/* $Id$ */
+// This class is extracted from the AliRun class
+// and contains all the MC-related functionality
+// The number of dependencies has to be reduced...
+// Author: F.Carminati
+// Federico.Carminati@cern.ch
+
+#include <RVersion.h>
#include <TBrowser.h>
#include <TStopwatch.h>
#include <TSystem.h>
fSum2Energy(0),
fTrRmax(1.e10),
fTrZmax(1.e10),
+ fDebug(0),
fImedia(0),
fTransParName("\0"),
fMCQA(0),
fTrackReferences(0)
{
+ //default constructor
}
//_______________________________________________________________________
fSum2Energy(0),
fTrRmax(1.e10),
fTrZmax(1.e10),
+ fDebug(0),
fImedia(new TArrayI(1000)),
fTransParName("\0"),
fMCQA(0),
fHitLists(new TList()),
fTrackReferences(new TClonesArray("AliTrackReference", 100))
{
-
+ //constructor
// Set transport parameters
SetTransPar();
fSum2Energy(0),
fTrRmax(1.e10),
fTrZmax(1.e10),
+ fDebug(0),
fImedia(0),
fTransParName("\0"),
fMCQA(0),
//_______________________________________________________________________
AliMC::~AliMC()
{
+ //destructor
delete fGenerator;
delete fImedia;
delete fMCQA;
}
//_______________________________________________________________________
-void AliMC::Copy(AliMC &) const
+void AliMC::Copy(TObject &) const
{
+ //dummy Copy function
Fatal("Copy","Not implemented!\n");
}
}
//_______________________________________________________________________
-void AliMC::GeneratePrimaries()
+void AliMC::GeneratePrimaries()
{
//
// Generate primary particles and fill them in the stack.
fGenerator->FinishRun();
//Output energy summary tables
- if (GetDebug()) Info("FinishRun"," EnergySummary()");
- EnergySummary();
+ if (GetDebug()) {
+ Info("FinishRun"," EnergySummary()");
+ EnergySummary();
+ }
}
//_______________________________________________________________________
void AliMC::PreTrack()
{
+ // Actions before the track's transport
TObjArray &dets = *gAlice->Modules();
AliModule *module;
Int_t copy;
//Update energy deposition tables
AddEnergyDeposit(gMC->CurrentVolID(copy),gMC->Edep());
+ //
+ // write tracke reference for track which is dissapearing - MI
+ if (gMC->IsTrackDisappeared()) {
+ if (gMC->Etot()>0.05) AddTrackReference(GetCurrentTrackNumber());
+ }
//Call the appropriate stepping routine;
AliModule *det = dynamic_cast<AliModule*>(gAlice->Modules()->At(id));
if (GetDebug()) Info("BeginEvent"," %s->SetTreeAddress()",detector->GetName());
detector->SetTreeAddress();
}
+ // make branch for AliRun track References
+ TTree * treeTR = runloader->TreeTR();
+ if (treeTR){
+ // make branch for central track references
+ if (!fTrackReferences) fTrackReferences = new TClonesArray("AliTrackReference",0);
+ TBranch *branch;
+ branch = treeTR->Branch("AliRun",&fTrackReferences);
+ branch->SetAddress(&fTrackReferences);
+ }
+ //
}
//_______________________________________________________________________
//_______________________________________________________________________
void AliMC::PostTrack()
{
+ // Posts tracks for each module
TObjArray &dets = *gAlice->Modules();
AliModule *module;
// static Int_t count=0;
// const Int_t times=10;
// This primary is finished, purify stack
+#if ROOT_VERSION_CODE > 262152
+ if (!(gMC->SecondariesAreOrdered()))
+ runloader->Stack()->ReorderKine();
+#endif
runloader->Stack()->PurifyKine();
TIter next(gAlice->Modules());
//_______________________________________________________________________
void AliMC::Field(const Double_t* x, Double_t* b) const
{
+ // Calculates field "b" at point "x"
gAlice->Field(x,b);
}
//_______________________________________________________________________
void AliMC::Init()
{
+ // MC initialization
//=================Create Materials and geometry
gMC->Init();
- gMC->DefineParticles(); //Create standard MC particles
-
//Read the cuts for all materials
ReadTransPar();
//Build the special IMEDIA table
//_______________________________________________________________________
TParticle* AliMC::Particle(Int_t i) const
{
+ // Returns the i-th particle from the stack taking into account
+ // the remaping done by PurifyKine
AliRunLoader * runloader = gAlice->GetRunLoader();
if (runloader)
if (runloader->Stack())
//_______________________________________________________________________
void AliMC::PushTrack(Int_t done, Int_t parent, Int_t pdg, Float_t *pmom,
Float_t *vpos, Float_t *polar, Float_t tof,
- TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is)
+ TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is) const
{
// Delegate to stack
//
Double_t px, Double_t py, Double_t pz, Double_t e,
Double_t vx, Double_t vy, Double_t vz, Double_t tof,
Double_t polx, Double_t poly, Double_t polz,
- TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is)
+ TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is) const
{
// Delegate to stack
//
}
//_______________________________________________________________________
-void AliMC::SetHighWaterMark(const Int_t nt)
+void AliMC::SetHighWaterMark(Int_t nt) const
{
//
// Set high water mark for last track in event
}
//_______________________________________________________________________
-void AliMC::KeepTrack(const Int_t track)
+void AliMC::KeepTrack(Int_t track) const
{
//
// Delegate to stack
}
//_______________________________________________________________________
-void AliMC::FlagTrack(Int_t track)
+void AliMC::FlagTrack(Int_t track) const
{
// Delegate to stack
//
}
//_______________________________________________________________________
-void AliMC::SetCurrentTrack(Int_t track)
+void AliMC::SetCurrentTrack(Int_t track) const
{
//
// Set current track number