// @(#)root/mc:$Name: $:$Id: TMCVerbose.cxx,v 1.3 2003/03/01 22:36:38 brun Exp $
// Author: Ivana Hrivnacova, 27/03/2002
//
// Class TMCVerbose
// ----------------
// Class for printing detailed info from MC application.
#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)
{
// Standard constructor
// ---
}
//_____________________________________________________________________________
TMCVerbose::TMCVerbose()
: TObject(),
fLevel(0),
fStepNumber(0)
{
// Default constructor
// ---
}
//_____________________________________________________________________________
TMCVerbose::~TMCVerbose()
{
// Destructor
// ---
}
//
// private methods
//
//_____________________________________________________________________________
void TMCVerbose::PrintBanner() const
{
// Prints banner for track information
// ---
cout << endl;
for (Int_t i=0; i<10; i++) cout << "**********";
cout << endl;
}
//_____________________________________________________________________________
void TMCVerbose::PrintTrackInfo() const
{
// Prints track information
// ---
// Particle
//
cout << " Particle = ";
TParticlePDG* particle
= TDatabasePDG::Instance()->GetParticle(gMC->TrackPid());
if (particle)
cout << particle->GetName() << " ";
else
cout << "unknown" << " ";
// Track ID
//
cout << " Track ID = " << gMC->GetStack()->CurrentTrack() << " ";
// Parent ID
//
cout << " Parent ID = " << gMC->GetStack()->CurrentTrackParent();
}
//_____________________________________________________________________________
void TMCVerbose::PrintStepHeader() const
{
// Prints the header for stepping information
// ---
cout << "Step# "
<< "X(cm) "
<< "Y(cm) "
<< "Z(cm) "
<< "KinE(MeV) "
<< "dE(MeV) "
<< "Step(cm) "
<< "TrackL(cm) "
<< "Volume "
<< "Process "
<< endl;
}
//
// public methods
//
//_____________________________________________________________________________
void TMCVerbose::InitMC()
{
// Initialize MC info.
// ---
if (fLevel>0)
cout << "--- Init MC " << endl;
}
//_____________________________________________________________________________
void TMCVerbose::RunMC(Int_t nofEvents)
{
// MC run info.
// ---
if (fLevel>0)
cout << "--- Run MC for " << nofEvents << " events" << endl;
}
//_____________________________________________________________________________
void TMCVerbose::FinishRun()
{
// Finish MC run info.
// ---
if (fLevel>0)
cout << "--- Finish Run MC " << endl;
}
//_____________________________________________________________________________
void TMCVerbose::ConstructGeometry()
{
// Construct geometry info
// ---
if (fLevel>0)
cout << "--- Construct geometry " << endl;
}
//_____________________________________________________________________________
void TMCVerbose::InitGeometry()
{
// Initialize geometry info
// ---
if (fLevel>0)
cout << "--- Init geometry " << endl;
}
//_____________________________________________________________________________
void TMCVerbose::GeneratePrimaries()
{
// Generate primaries info
// ---
if (fLevel>0)
cout << "--- Generate primaries " << endl;
}
//_____________________________________________________________________________
void TMCVerbose::BeginEvent()
{
// Begin event info
// ---
if (fLevel>0)
cout << "--- Begin event " << endl;
}
//_____________________________________________________________________________
void TMCVerbose::BeginPrimary()
{
// Begin of a primary track info
// ---
if (fLevel>1)
cout << "--- Begin primary " << endl;
}
//_____________________________________________________________________________
void TMCVerbose::PreTrack()
{
// Begin of each track info
// ---
if (fLevel>2) {
PrintBanner();
PrintTrackInfo();
PrintBanner();
PrintStepHeader();
fStepNumber = 0;
return;
}
if (fLevel>1)
cout << "--- Pre track " << endl;
}
//_____________________________________________________________________________
void TMCVerbose::Stepping()
{
// Stepping info
// ---
if (fLevel>2) {
#if __GNUC__ >= 3
cout << std::fixed;
#endif
// Step number
//
cout << "#" << setw(4) << fStepNumber++ << " ";
// Position
//
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 << " ";
// Kinetic energy
//
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 << " ";
// Energy deposit
//
cout << setw(9) << setprecision(4) << gMC->Edep()*1e03 << " ";
// Step length
//
cout << setw(8) << setprecision(3) << gMC->TrackStep() << " ";
// Track length
//
cout << setw(8) << setprecision(3) << gMC->TrackLength() << " ";
// Volume
//
cout << setw(4) << gMC->CurrentVolName() << " ";
// Process
//
TArrayI processes;
Int_t nofProcesses = gMC->StepProcesses(processes);
if (nofProcesses > 0)
cout << TMCProcessName[processes[nofProcesses-1]];
cout << endl;
}
}
//_____________________________________________________________________________
void TMCVerbose::PostTrack()
{
// Finish of each track info
// ---
if (fLevel==2)
cout << "--- Post track " << endl;
}
//_____________________________________________________________________________
void TMCVerbose::FinishPrimary()
{
// Finish of a primary track info
// ---
if (fLevel==2)
cout << "--- Finish primary " << endl;
}
//_____________________________________________________________________________
void TMCVerbose::FinishEvent()
{
// Finish of an event info
// ---
if (fLevel>0)
cout << "--- Finish event " << endl;
}
ROOT page - Class index - Top of the page
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.