17 #include <TClonesArray.h>
18 #include <TGeoManager.h>
19 #include <TGeoVolume.h>
21 #include <TObjArray.h>
24 #include <TVectorDfwd.h>
26 #include <TVirtualMC.h>
27 #include <TVirtualMCStack.h>
43 : fPointCollection(new TClonesArray(
"FairRadMapPoint"))
47 , fPosIn(TLorentzVector(0, 0, 0, 0))
48 , fPosOut(TLorentzVector(0, 0, 0, 0))
49 , fMomIn(TLorentzVector(0, 0, 0, 0))
50 , fMomOut(TLorentzVector(0, 0, 0, 0))
67 if (
nullptr == fgInstance) {
77 fPointCollection->Delete();
78 delete fPointCollection;
86 cout <<
"RadMapMan initialized" << endl;
90 Int_t volumeiterator = 0, lastvolume = 0;
92 TObjArray* volumelist;
94 const char* volumename;
95 fMassMap =
new TMap(lastvolume + 1, 0);
97 volumelist = gGeoManager->GetListOfVolumes();
99 lastvolume = volumelist->GetLast();
103 cout <<
"RadMapMan: calculating the masses for " << lastvolume <<
" volumes in this simulation" << endl;
105 while (volumeiterator <= lastvolume) {
106 volumename = volumelist->At(volumeiterator)->GetName();
107 myvolume = gGeoManager->GetVolume(volumename);
108 vmass = myvolume->WeightA();
109 TVectorD* vomass =
new TVectorD(1, 1, vmass,
"END");
111 fMassMap->Add(myvolume, vomass);
113 cout << myvolume->GetName() <<
" has " << vmass <<
" kg" << endl;
122 fPointCollection->Delete();
123 cout <<
" FairRadMapManager::Reset() ------------------------------------------------\n" << endl;
129 if (TVirtualMC::GetMC()->IsTrackEntering()) {
138 fVolumeID = TVirtualMC::GetMC()->CurrentVolID(copyNo);
139 fTime = TVirtualMC::GetMC()->TrackTime() * 1.0e09;
140 fLength = TVirtualMC::GetMC()->TrackLength();
141 TVirtualMC::GetMC()->TrackPosition(fPosIn);
142 TVirtualMC::GetMC()->TrackMomentum(fMomIn);
144 TVirtualMC::GetMC()->CurrentMaterial(fA, fZmat, fDensity, fRadl, fAbsl);
148 TGeoVolume* actVolume = gGeoManager->GetVolume(fVolumeID);
150 TVectorD* ActMass =
static_cast<TVectorD*
>(fMassMap->GetValue(actVolume));
152 fActMass = ActMass->Min();
157 fELoss += TVirtualMC::GetMC()->Edep();
158 fStep += TVirtualMC::GetMC()->TrackStep();
160 fPdg = TVirtualMC::GetMC()->TrackPid();
165 if (fPdg < 10000 && fStep > 0 && fActMass > 0) {
167 fDose = fELoss * 1.602e-10 / (fActMass);
178 if (TVirtualMC::GetMC()->IsTrackExiting() || TVirtualMC::GetMC()->IsTrackStop()
179 || TVirtualMC::GetMC()->IsTrackDisappeared()) {
182 fTrackID = TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();
184 Int_t fVolID = TVirtualMC::GetMC()->CurrentVolID(copyNo);
185 TVirtualMC::GetMC()->TrackPosition(fPosOut);
186 TVirtualMC::GetMC()->TrackMomentum(fMomOut);
188 TClonesArray& clref = *fPointCollection;
189 Int_t tsize = clref.GetEntriesFast();
194 TVector3(fPosIn.X(), fPosIn.Y(), fPosIn.Z()),
195 TVector3(fMomIn.X(), fMomIn.Y(), fMomIn.Z()),
199 TVector3(fPosOut.X(), fPosOut.Y(), fPosOut.Z()),
200 TVector3(fMomOut.X(), fMomOut.Y(), fMomOut.Z()),
static FairRadMapManager * Instance()
static FairRootManager * Instance()
ClassImp(FairEventBuilder)
void Register(const char *name, const char *Foldername, TNamed *obj, Bool_t toFile)
void AddPoint(Int_t &ModuleId)
virtual ~FairRadMapManager()