6 #include "FairRootManager.h" 7 #include "TClonesArray.h" 9 #include "TVirtualMC.h" 15 FairDetector(
"ERmuSi", kTRUE),
16 fERmuSiPoints(new TClonesArray(
"ERmuSiPoint"))
19 flGeoPar =
new TList();
20 flGeoPar->SetName( GetName());
28 : FairDetector(name, active,verbose),
29 fERmuSiPoints(new TClonesArray(
"ERmuSiPoint"))
32 flGeoPar =
new TList();
33 flGeoPar->SetName( GetName());
39 fERmuSiPoints->Delete();
46 FairDetector::Initialize();
53 static Int_t mot0TrackID;
55 static TLorentzVector posIn, posOut;
56 static TLorentzVector momIn, momOut;
57 static Double32_t time;
58 static Double32_t length;
59 static Double32_t eLoss;
62 if ( gMC->IsTrackEntering() ) {
64 eventID = gMC->CurrentEvent();
65 gMC->TrackPosition(posIn);
66 gMC->TrackMomentum(momIn);
67 trackID = gMC->GetStack()->GetCurrentTrackNumber();
68 time = gMC->TrackTime() * 1.0e09;
69 length = gMC->TrackLength();
70 mot0TrackID = gMC->GetStack()->GetCurrentTrack()->GetMother(0);
71 mass = gMC->ParticleMass(gMC->TrackPid());
72 Int_t curVolId = gMC->CurrentVolID(station);
77 if (gMC->IsTrackExiting() ||
79 gMC->IsTrackDisappeared())
81 gMC->TrackPosition(posOut);
82 gMC->TrackMomentum(momOut);
85 AddPoint( eventID, trackID, mot0TrackID, mass,
86 TVector3(posIn.X(), posIn.Y(), posIn.Z()),
87 TVector3(posOut.X(), posOut.Y(), posOut.Z()),
88 TVector3(momIn.Px(), momIn.Py(), momIn.Pz()),
89 TVector3(momOut.Px(), momOut.Py(), momOut.Pz()),
90 time, length, eLoss, station);
103 if (fVerboseLevel > 1) {
112 FairRootManager* ioman = FairRootManager::Instance();
114 Fatal(
"Init",
"IO manager is not set");
115 ioman->Register(
"muSiPoint",
"ERmuSi", fERmuSiPoints, kTRUE);
122 return fERmuSiPoints;
145 fERmuSiPoints->Clear();
152 Int_t nEntries = cl1->GetEntriesFast();
153 std::cout <<
"decector: " << nEntries <<
" entries to add" << std::endl;
154 TClonesArray& clref = *cl2;
156 for (Int_t i=0; i<nEntries; i++) {
158 Int_t index = oldpoint->GetTrackID() + offset;
159 oldpoint->SetTrackID(index);
160 new (clref[cl2->GetEntriesFast()])
ERmuSiPoint(*oldpoint);
162 std::cout <<
"decector: " << cl2->GetEntriesFast() <<
" merged entries" << std::endl;
172 TVector3 posOut, TVector3 momIn,
173 TVector3 momOut, Double_t time,
174 Double_t length, Double_t eLoss, Int_t station) {
175 TClonesArray& clref = *fERmuSiPoints;
176 Int_t size = clref.GetEntriesFast();
177 return new(clref[size])
ERmuSiPoint(size, eventID, trackID, mot0trackID, mass,
178 posIn, posOut, momIn, momOut, time, length, eLoss, station);
186 TString fileName = GetGeometryFileName();
187 if(fileName.EndsWith(
".root")) {
188 std::cout <<
"Constructing ERmuSi geometry from ROOT file " << fileName.Data() << std::endl;
189 ConstructRootGeometry();
191 LOG(FATAL) <<
"Geometry file name is not set" << std::endl;
200 TString volName = name;
201 if(volName.Contains(
"station")) {
virtual void BeginEvent()
virtual void Initialize()
virtual void ConstructGeometry()
Int_t fVersion
The point collection.
virtual void CopyClones(TClonesArray *cl1, TClonesArray *cl2, Int_t offset)
virtual void EndOfEvent()
virtual void Print(Option_t *option="") const
virtual Bool_t ProcessHits(FairVolume *vol=0)
virtual Bool_t CheckIfSensitive(std::string name)
virtual TClonesArray * GetCollection(Int_t iColl) const
ERmuSiPoint * AddPoint(Int_t eventID, Int_t trackID, Int_t mot0trackID, Double_t mass, TVector3 posIn, TVector3 pos_out, TVector3 momIn, TVector3 momOut, Double_t time, Double_t length, Double_t eLoss, Int_t station)
geometry version