<!DOCTYPE HTML PUBLIC "-// IETF/DTD HTML 2.0// EN">
<html>
<!--                                             -->
<!-- Author: ROOT team (rootdev@hpsalo.cern.ch)  -->
<!--                                             -->
<!--   Date: Tue Apr  6 15:50:12 1999            -->
<!--                                             -->
<head>
<title>MCPartPrint - source file</title>
<link rev=made href="mailto:rootdev@root.cern.ch">
<meta name="rating" content="General">
<meta name="objecttype" content="Manual">
<meta name="keywords" content="software development, oo, object oriented, unix, x11, motif, windows nt, c++, html, rene brun, fons rademakers">
<meta name="description" content="ROOT - An Object Oriented Framework For Large Scale Data Analysis.">
</head>
<body BGCOLOR="#ffffff" LINK="#0000ff" VLINK="#551a8b" ALINK="#ff0000" TEXT="#000000">
<a name="TopOfPage"></a>
<pre>
<b>// $Header: <a href=".././MCPartPrint.html">MCPartPrint</a>.cxx $</b>

#include "<a href="../MCPartPrint.h">MCPartPrint.h</a>"
#include "math.h"

<b>//______________________________________________________________________</b>
<b>// <a href=".././MCPartPrint.html">MCPartPrint</a></b>
<b>//</b>
<b>//  A very simple "processing" module.  It really has no processing to</b>
<b>//  do, but does write out MC particle information when spew is requested.</b>

ClassImp(<a href=".././MCPartPrint.html">MCPartPrint</a>)

<a name="MCPartPrint:MCPartPrint"> </a><a href=".././MCPartPrint.html#MCPartPrint:MCPartPrint">MCPartPrint::MCPartPrint</a>() {
<b>  // Constructor</b>
};

<a name="MCPartPrint:doit"> </a><a href="../ListOfTypes.html#void">void</a>  <a href=".././MCPartPrint.html#MCPartPrint:doit">MCPartPrint::doit</a>(<a href="http://root.cern.ch/root/html/Event.html">Event</a>* event) {
<b>  // No real processing for this module.</b>

  <a href=".././MCPartPrint.html#MCPartPrint:m_event">m_event</a> = event;
}


<b>//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</b>
<a href="../ListOfTypes.html#void">void</a> 
<a name="MCPartPrint:spew"> </a><a href=".././MCPartPrint.html#MCPartPrint:spew">MCPartPrint::spew</a>(FILE* ofile)const
{
<b>  // Write out the MC particle information (ascii)</b>

  fprintf(ofile,"MCPrint n %i n", 
	  <a href=".././MCPartPrint.html#MCPartPrint:m_event">m_event</a>-&gt;<a href="http://root.cern.ch/root/html/Event.html#Event:MCparticles">MCparticles</a>()-&gt;GetEntries());
  <a href="http://root.cern.ch/root/html/TIter.html">TIter</a> next(<a href=".././MCPartPrint.html#MCPartPrint:m_event">m_event</a>-&gt;<a href="http://root.cern.ch/root/html/Event.html#Event:MCparticles">MCparticles</a>());
  <a href="http://root.cern.ch/root/html/McPart.html">McPart</a>* mc;
  while(mc = (<a href="http://root.cern.ch/root/html/McPart.html">McPart</a>*)next() ) {

    <a href="../ListOfTypes.html#Float_t">Float_t</a>* mom;
    <a href="../ListOfTypes.html#Float_t">Float_t</a>* pos;
    <a href="../ListOfTypes.html#Float_t">Float_t</a>* calMom;
    <a href="../ListOfTypes.html#Float_t">Float_t</a>* calPos;
    mom = mc-&gt;GetMomentum();
    pos = mc-&gt;GetPosition();
    calMom = mc-&gt;GetCalMom();
    calPos = mc-&gt;GetCalPos();
    
    fprintf(ofile,
	    "%i %i %i %i %f Point(%f,%f,%f) ( %f,%f,%f)%f (%f,%f,%f) (%f,%f,%f) n",
	    (<a href="../ListOfTypes.html#int">int</a>)(mc),
	    (<a href="../ListOfTypes.html#int">int</a>)(mc-&gt;GetParnt()),
	    mc-&gt;GetType(),
	    mc-&gt;GetStatus(),
	    mc-&gt;GetCharge(),
	    pos[0],
	    pos[1],
	    pos[2],
	    mom[0],
	    mom[1],
	    mom[2],
	    mom[3],
	    calPos[0],
	    calPos[1],
	    calPos[2],
	    calMom[0],
	    calMom[1],
	    calMom[2]);
  }
  fprintf(ofile,"endn");
}

</pre>

<!--SIGNATURE-->
<br>
<address>
<hr>
<center>
<a href="http://root.cern.ch/root/Welcome.html">ROOT page</a> - <a href="../ClassIndex.html">Class index</a> - <a href="#TopOfPage">Top of the page</a><br>
</center>
<hr>This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to <a href="mailto:rootdev@root.cern.ch">ROOT support</a>, or contact <a href="mailto:rootdev@root.cern.ch">the developers</a> with any questions or problems regarding ROOT.
</address>
</body>
</html>
