16 #include <TGeoManager.h>
17 #include <TLorentzVector.h>
18 #include <TMCProcess.h>
19 #include <TRefArray.h>
21 #include <TVirtualMC.h>
33 , fFSFirstSecondary(-2)
34 , fFSNofSecondaries(0)
47 , fFSFirstSecondary(-2)
48 , fFSNofSecondaries(0)
54 : TVirtualMCStack(rhs)
56 , fDetList(rhs.fDetList)
58 , fVerbose(rhs.fVerbose)
68 TVirtualMCStack::operator=(rhs);
89 Fatal(
"CloneStack",
"Has to be overriden in multi-threading applications.");
102 TLorentzVector curPos;
103 TVirtualMC::GetMC()->TrackPosition(curPos);
104 LOG(debug) <<
"track is in " << curPos.X() <<
"," << curPos.Y() <<
"," << curPos.Z() <<
", moving to " << xx <<
","
106 TString curVolName(TVirtualMC::GetMC()->CurrentVolName());
107 TString targetVolName(gGeoManager->FindNode(xx, yy, zz)->GetVolume()->GetName());
108 if (curVolName.EqualTo(targetVolName)) {
109 LOG(fatal) <<
"FairStack::FastSimMoveParticleTo(" << xx <<
"," << yy <<
"," << zz <<
": " << curVolName <<
" = "
110 << targetVolName <<
") crashes the simulation.";
112 LOG(debug) <<
"gMC says track is in \"" << curVolName <<
"\" moving particle to \"" << targetVolName <<
"\".";
117 Int_t pdg = TVirtualMC::GetMC()->TrackPid();
121 TMCProcess proc = kPPrimary;
124 Double_t weight = 0.;
126 PushTrack(tobedone, parent, pdg, px, py, pz, en, xx, yy, zz, tt, polx, poly, polz, proc, ntr, weight, status, -1);
128 Int_t trackID = TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();
134 LOG(debug) <<
"FairStack::FastSimMoveParticleTo() created track number " << ntr <<
" to replace track number "
137 if (strcmp(TVirtualMC::GetMC()->GetName(),
"TGeant3TGeo") == 0) {
138 TVirtualMC::GetMC()->StopTrack();
144 if (TVirtualMC::GetMC()->IsTrackStop())
145 LOG(fatal) <<
"FairStack::FastSimStopParticle() tries to stop particle that was probably moved!";
147 TVirtualMC::GetMC()->StopTrack();
170 PushTrack(tobedone, parentID, pdgCode, px, py, pz, en, xx, yy, zz, tt, polx, poly, polz, proc, ntr, weight, is, -1);
virtual FairGenericStack * CloneStack() const
std::map< Int_t, Int_t >::iterator fFSTrackIter
virtual void FastSimPushSecondary(Int_t parentID, Int_t pdgCode, Double_t xx, Double_t yy, Double_t zz, Double_t tt, Double_t px, Double_t py, Double_t pz, Double_t en, Double_t polx, Double_t poly, Double_t polz, TMCProcess proc, Double_t weight, Int_t is)
FairGenericStack & operator=(const FairGenericStack &)
void SetDetArrayList(TRefArray *detArray)
ClassImp(FairEventBuilder)
virtual void PushTrack(Int_t toBeDone, Int_t parentID, Int_t pdgCode, Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz, TMCProcess proc, Int_t &ntr, Double_t weight, Int_t is, Int_t secondparentID)=0
virtual TClonesArray * GetListOfParticles()
virtual ~FairGenericStack()
std::map< Int_t, Int_t > fFSTrackMap
virtual void FastSimStopParticle()
virtual void FastSimMoveParticleTo(Double_t xx, Double_t yy, Double_t zz, Double_t tt, Double_t px, Double_t py, Double_t pz, Double_t en)