18 #include "MyProjDetectorList.h"
19 #include "MyProjStack.h"
24 #include <TClonesArray.h>
26 #include <TGeoCompositeShape.h>
27 #include <TGeoManager.h>
28 #include <TGeoMaterial.h>
29 #include <TGeoMedium.h>
31 #include <TVirtualMC.h>
45 , fNewDetectorPointCollection(new TClonesArray(
"NewDetectorPoint"))
57 , fNewDetectorPointCollection(new TClonesArray(
"NewDetectorPoint"))
69 , fNewDetectorPointCollection(new TClonesArray(
"NewDetectorPoint"))
74 if (fNewDetectorPointCollection) {
75 fNewDetectorPointCollection->Delete();
76 delete fNewDetectorPointCollection;
87 DefineSensitiveVolumes();
99 if (TVirtualMC::GetMC()->IsTrackEntering()) {
101 fTime = TVirtualMC::GetMC()->TrackTime() * 1.0e09;
102 fLength = TVirtualMC::GetMC()->TrackLength();
103 TVirtualMC::GetMC()->TrackPosition(fPos);
104 TVirtualMC::GetMC()->TrackMomentum(fMom);
108 fELoss += TVirtualMC::GetMC()->Edep();
111 if (TVirtualMC::GetMC()->IsTrackExiting() || TVirtualMC::GetMC()->IsTrackStop()
112 || TVirtualMC::GetMC()->IsTrackDisappeared()) {
113 fTrackID = TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();
120 TVector3(fPos.X(), fPos.Y(), fPos.Z()),
121 TVector3(fMom.Px(), fMom.Py(), fMom.Pz()),
137 LOG(info) <<
"NewDetector: " << fNewDetectorPointCollection->GetEntriesFast() <<
" points registered in this event";
139 fNewDetectorPointCollection->Clear();
161 return fNewDetectorPointCollection;
171 TGeoVolume* top = gGeoManager->GetTopVolume();
172 TGeoMedium* Si = gGeoManager->GetMedium(
"Si");
173 TGeoMedium* Carbon = gGeoManager->GetMedium(
"C");
176 TGeoMaterial* matSi =
new TGeoMaterial(
"Si", 28.0855, 14, 2.33);
177 Si =
new TGeoMedium(
"Si", 2, matSi);
180 TGeoMaterial* matCarbon =
new TGeoMaterial(
"C", 12.011, 6.0, 2.265);
181 Carbon =
new TGeoMedium(
"C", 3, matCarbon);
184 TGeoVolume* det1 = gGeoManager->MakeTubs(
"Det1", Si, 5, 80, 0.1, 0, 360);
186 r1.SetAngles(0, 0, 0);
187 TGeoTranslation t1(0, 0, 0);
188 TGeoCombiTrans c1(t1, r1);
189 TGeoHMatrix* h1 =
new TGeoHMatrix(c1);
190 top->AddNode(det1, 1, h1);
191 det1->SetLineColor(kGreen);
194 TGeoVolume* passive1 = gGeoManager->MakeTubs(
"Pass1", Si, 5, 120, 10, 0, 360);
196 rp1.SetAngles(0, 0, 0);
197 TGeoTranslation tp1(0, 0, 20);
198 TGeoCombiTrans cp1(tp1, rp1);
199 TGeoHMatrix* hp1 =
new TGeoHMatrix(cp1);
200 top->AddNode(passive1, 1, hp1);
201 passive1->SetLineColor(kRed);
203 TGeoVolume* det2 = gGeoManager->MakeTubs(
"Det2", Si, 5, 150, 0.1, 0, 360);
205 r2.SetAngles(0, 0, 0);
206 TGeoTranslation t2(0, 0, 70);
207 TGeoCombiTrans c2(t2, r2);
208 TGeoHMatrix* h2 =
new TGeoHMatrix(c2);
209 top->AddNode(det2, 1, h2);
210 det2->SetLineColor(kGreen);
213 TGeoVolume* det3 = gGeoManager->MakeTubs(
"Det3", Si, 5, 150, 0.1, 0, 360);
215 r3.SetAngles(0, 0, 0);
216 TGeoTranslation t3(0, 0, 150);
217 TGeoCombiTrans c3(t3, r3);
218 TGeoHMatrix* h3 =
new TGeoHMatrix(c3);
219 top->AddNode(det3, 1, h3);
220 det3->SetLineColor(kGreen);
232 TClonesArray& clref = *fNewDetectorPointCollection;
233 Int_t size = clref.GetEntriesFast();
234 return new (clref[size])
NewDetectorPoint(trackID, detID, pos, mom, time, length, eLoss);
239 void NewDetector::DefineSensitiveVolumes()
241 TObjArray* volumes = gGeoManager->GetListOfVolumes();
244 while ((volume = static_cast<TGeoVolume*>(next()))) {
246 LOG(debug2) <<
"Sensitive Volume " << volume->GetName();
254 if (name.find(
"Det") != std::string::npos) {
void AddSensitiveVolume(TGeoVolume *v)
virtual void see Tutorial4 for examples LOG(warn)<< "This function is deprecated. Use FairAlignmentHandler instead
list of container factories
static FairRun * Instance()
virtual FairModule * CloneModule() const
static FairRootManager * Instance()
ClassImp(FairEventBuilder)
virtual Bool_t ProcessHits(FairVolume *v=0)
virtual void EndOfEvent()
FairParSet * getContainer(const Text_t *)
virtual void Initialize()
virtual void Initialize()
FairMQExParamsParOne * par
FairRuntimeDb * GetRuntimeDb(void)
void Register(const char *name, const char *Foldername, TNamed *obj, Bool_t toFile)
virtual Bool_t IsSensitive(const std::string &name)
virtual TClonesArray * GetCollection(Int_t iColl) const
void AddPoint(DetectorId iDet)
NewDetectorPoint * AddHit(Int_t trackID, Int_t detID, TVector3 pos, TVector3 mom, Double_t time, Double_t length, Double_t eLoss)
void RegisterAny(const char *name, T *&obj, Bool_t toFile)