1 #include "ERmuSiHitProducer.h" 6 #include "TGeoMatrix.h" 8 #include "FairRootManager.h" 9 #include "FairRunAna.h" 10 #include "FairRuntimeDb.h" 13 #include "ERDetectorList.h" 14 #include "ERmuSiPoint.h" 16 Int_t ERmuSiHitProducer::fEvent = 0;
19 : FairTask(
"ER muSi hit producing scheme")
28 : FairTask(
"ER muSi hit producing scheme ", verbose)
42 void ERmuSiHitProducer::SetParContainers()
45 FairRunAna* run = FairRunAna::Instance();
46 if ( ! run ) Fatal(
"SetParContainers",
"No analysis run");
48 FairRuntimeDb* rtdb = run->GetRuntimeDb();
49 if ( ! rtdb ) Fatal(
"SetParContainers",
"No runtime database");
57 FairRootManager* ioman = FairRootManager::Instance();
58 if ( ! ioman ) Fatal(
"Init",
"No FairRootManager");
60 fmuSiPoints = (TClonesArray*) ioman->GetObject(
"muSiPoint");
64 fmuSiHits =
new TClonesArray(
"ERmuSiHit",1000);
66 ioman->Register(
"muSiHit",
"muSi hits", fmuSiHits, kTRUE);
75 std::cout << std::endl;
76 std::cout <<
"####### EVENT " << fEvent++ <<
" #####" << std::endl;
77 std::cout << std::endl;
78 std::cout <<
"ERmuSiHitProducer: "<< std::endl;
81 std::vector<ERmuSiPoint*> PointsByStation[3];
82 for (Int_t iPoint = 0; iPoint <
fmuSiPoints->GetEntriesFast(); iPoint++){
84 PointsByStation[point->Station()].push_back(point);
87 TVector3 dpos = TVector3(0.01, 0.01, 0.01);
89 for (Int_t iStation =0; iStation < 3; iStation++){
90 for (std::vector<ERmuSiPoint*>::iterator it1 = PointsByStation[iStation].begin(); it1 != PointsByStation[iStation].end(); ++ it1){
93 pos =
new TVector3((point1->GetXIn()+point1->GetXOut())/2.,
94 (point1->GetYIn()+point1->GetYOut())/2.,
95 (point1->GetZIn()+point1->GetZOut())/2.);
96 ERmuSiHit* hit = AddHit(kMUSI, *pos, dpos,point1->Index(), point1->Station());
99 for (std::vector<ERmuSiPoint*>::iterator it2 = PointsByStation[iStation].begin(); it2 != PointsByStation[iStation].end(); ++ it2){
106 Double_t masterPos[3], localPos[3];
107 masterPos[0] = (point1->GetXIn()+point1->GetXOut())/2.;
108 masterPos[1] = (point2->GetYIn()+point2->GetYOut())/2.;
109 masterPos[2] = (point1->GetZIn()+point1->GetZOut())/2.;
111 TGeoRotation *Rotation =
new TGeoRotation();
112 Rotation->RotateX(0.);
113 Rotation->RotateY(0.);
114 Rotation->RotateZ(30.);
115 Rotation->MasterToLocal(masterPos, localPos);
117 pos =
new TVector3(localPos[0],localPos[1],localPos[2]);
120 pos =
new TVector3((point1->GetXIn()+point1->GetXOut())/2.,
121 (point2->GetYIn()+point2->GetYOut())/2.,
122 (point1->GetZIn()+point1->GetZOut())/2.);
125 hit = AddHit(kMUSI, *pos, dpos,-1,point1->Station());
130 std::cout <<
"Hits count: " << fmuSiHits->GetEntriesFast() << std::endl;
151 ERmuSiHit* ERmuSiHitProducer::AddHit(Int_t detID, TVector3& pos, TVector3& dpos, Int_t index, Int_t station)
153 ERmuSiHit *hit =
new((*fmuSiHits)[fmuSiHits->GetEntriesFast()])
154 ERmuSiHit(fmuSiHits->GetEntriesFast(),detID, pos, dpos, index, station);
virtual InitStatus Init()
virtual void Exec(Option_t *opt)
TClonesArray * fmuSiPoints