#include "Riostream.h"
#include "TVirtualMC.h"
#include "TVirtualMCStack.h"
#include "TDatabasePDG.h"
#include "TParticlePDG.h"
#include "TArrayI.h"
#include "TMCVerbose.h"
ClassImp(TMCVerbose)
TMCVerbose::TMCVerbose(Int_t level)
: TObject(),
fLevel(level),
fStepNumber(0)
{
}
TMCVerbose::TMCVerbose()
: TObject(),
fLevel(0),
fStepNumber(0)
{
}
TMCVerbose::~TMCVerbose()
{
}
void TMCVerbose::PrintBanner() const
{
cout << endl;
for (Int_t i=0; i<10; i++) cout << "**********";
cout << endl;
}
void TMCVerbose::PrintTrackInfo() const
{
cout << " Particle = ";
TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(gMC->TrackPid());
if (particle)
cout << particle->GetName() << " ";
else
cout << "unknown" << " ";
cout << " Track ID = " << gMC->GetStack()->GetCurrentTrackNumber() << " ";
cout << " Parent ID = " << gMC->GetStack()->GetCurrentParentTrackNumber();
}
void TMCVerbose::PrintStepHeader() const
{
cout << "Step# "
<< "X(cm) "
<< "Y(cm) "
<< "Z(cm) "
<< "KinE(MeV) "
<< "dE(MeV) "
<< "Step(cm) "
<< "TrackL(cm) "
<< "Volume "
<< "Process "
<< endl;
}
void TMCVerbose::InitMC()
{
if (fLevel>0)
cout << "--- Init MC " << endl;
}
void TMCVerbose::RunMC(Int_t nofEvents)
{
if (fLevel>0)
cout << "--- Run MC for " << nofEvents << " events" << endl;
}
void TMCVerbose::FinishRun()
{
if (fLevel>0)
cout << "--- Finish Run MC " << endl;
}
void TMCVerbose::ConstructGeometry()
{
if (fLevel>0)
cout << "--- Construct geometry " << endl;
}
void TMCVerbose::ConstructOpGeometry()
{
if (fLevel>0)
cout << "--- Construct geometry for optical processes" << endl;
}
void TMCVerbose::InitGeometry()
{
if (fLevel>0)
cout << "--- Init geometry " << endl;
}
void TMCVerbose::AddParticles()
{
if (fLevel>0)
cout << "--- Add particles " << endl;
}
void TMCVerbose::AddIons()
{
if (fLevel>0)
cout << "--- Add ions " << endl;
}
void TMCVerbose::GeneratePrimaries()
{
if (fLevel>0)
cout << "--- Generate primaries " << endl;
}
void TMCVerbose::BeginEvent()
{
if (fLevel>0)
cout << "--- Begin event " << endl;
}
void TMCVerbose::BeginPrimary()
{
if (fLevel>1)
cout << "--- Begin primary " << endl;
}
void TMCVerbose::PreTrack()
{
if (fLevel>2) {
PrintBanner();
PrintTrackInfo();
PrintBanner();
PrintStepHeader();
fStepNumber = 0;
return;
}
if (fLevel>1)
cout << "--- Pre track " << endl;
}
void TMCVerbose::Stepping()
{
if (fLevel>2) {
#if __GNUC__ >= 3
cout << std::fixed;
#endif
cout << "#" << setw(4) << fStepNumber++ << " ";
Double_t x, y, z;
gMC->TrackPosition(x, y, z);
cout << setw(8) << setprecision(3) << x << " "
<< setw(8) << setprecision(3) << y << " "
<< setw(8) << setprecision(3) << z << " ";
Double_t px, py, pz, etot;
gMC->TrackMomentum(px, py, pz, etot);
Double_t ekin = etot - gMC->TrackMass();
cout << setw(9) << setprecision(4) << ekin*1e03 << " ";
cout << setw(9) << setprecision(4) << gMC->Edep()*1e03 << " ";
cout << setw(8) << setprecision(3) << gMC->TrackStep() << " ";
cout << setw(8) << setprecision(3) << gMC->TrackLength() << " ";
if (gMC->CurrentVolName() != 0)
cout << setw(4) << gMC->CurrentVolName() << " ";
else
cout << setw(4) << "None" << " ";
TArrayI processes;
Int_t nofProcesses = gMC->StepProcesses(processes);
if (nofProcesses > 0)
cout << TMCProcessName[processes[nofProcesses-1]];
cout << endl;
}
}
void TMCVerbose::PostTrack()
{
if (fLevel==2)
cout << "--- Post track " << endl;
}
void TMCVerbose::FinishPrimary()
{
if (fLevel==2)
cout << "--- Finish primary " << endl;
}
void TMCVerbose::FinishEvent()
{
if (fLevel>0)
cout << "--- Finish event " << endl;
}
Last change: Wed Jun 25 08:48:04 2008
Last generated: 2008-06-25 08:48
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.