22 #include <FairMQLogger.h>
23 #include <TClonesArray.h>
25 #include <TGeoManager.h>
27 #include <TGeoVolume.h>
54 void PixelFindHitsTask::Reset(TClonesArray* hits)
61 void PixelFindHitsTask::Finish()
65 LOG(info) <<
"-------------------- PixelFindHitsTask : Summary ------------------------";
66 LOG(info) <<
" Events: " << fTNofEvents;
67 LOG(info) <<
" Digis: " << fTNofDigis <<
" ("
68 <<
static_cast<Double_t
>(fTNofDigis) / (static_cast<Double_t>(fTNofEvents)) <<
" per event)";
69 LOG(info) <<
" Hits: " << fTNofHits <<
" ("
70 <<
static_cast<Double_t
>(fTNofHits) / (static_cast<Double_t>(fTNofEvents)) <<
" per event)";
71 LOG(info) <<
"---------------------------------------------------------------------";
82 LOG(info) <<
"PixelFindHitsTask::Init"
83 <<
" fFeCols=" << fFeCols <<
" fFeRows=" << fFeRows <<
" fMaxFEperCol=" << fMaxFEperCol
84 <<
" fPitchX=" << fPitchX <<
" fPitchY=" << fPitchX;
85 LOG(info) <<
"geopar->printParams()";
87 LOG(info) <<
"fGeoParSet->printParams()";
95 LOG(info) <<
"PixelFindHits::Exec(TCA) EVENT " << fTNofEvents;
98 LOG(debug) <<
"PixelFindHits::Exec() ok 0 ";
99 fNDigis = digis->GetEntriesFast();
100 LOG(debug) <<
"PixelFindHits::Exec() fNDigis = " << fNDigis;
101 fTNofDigis += fNDigis;
103 for (Int_t iDigi = 0; iDigi < fNDigis; iDigi++) {
107 TString nodeName = Form(
"/cave/Pixel%d_%d", detId / 256, detId % 256);
108 LOG(debug) <<
"PixelFindHits::Exec() ok 1 node name = " << nodeName.Data();
110 LOG(debug) <<
"PixelFindHits::Exec() ok 2 ";
111 TGeoNode* curNode = fGeoParSet->
GetGeometry()->GetCurrentNode();
112 LOG(debug) <<
"PixelFindHits::Exec() ok 3 ";
115 TGeoVolume* actVolume = fGeoParSet->
GetGeometry()->GetCurrentVolume();
116 TGeoBBox* actBox = (TGeoBBox*)(actVolume->GetShape());
118 Int_t feId = currentDigi->
GetFeID();
119 Int_t col = currentDigi->
GetCol();
120 Int_t row = currentDigi->
GetRow();
122 Double_t locPosCalc[3];
123 locPosCalc[0] = (((feId - 1) / fMaxFEperCol) * fFeCols + col + 0.5) * fPitchX;
124 locPosCalc[1] = (((feId - 1) % fMaxFEperCol) * fFeRows + row + 0.5) * fPitchY;
127 locPosCalc[0] -= actBox->GetDX();
128 locPosCalc[1] -= actBox->GetDY();
132 curNode->LocalToMaster(locPosCalc, globPos);
134 LOG(debug) <<
"HIT ON " << detId <<
" POSITION: " << locPosCalc[0] <<
" / " << locPosCalc[1];
135 LOG(debug) <<
"GLOB HIT " << detId <<
" POSITION: " << globPos[0] <<
" / " << globPos[1] <<
" / "
138 TVector3 pos(globPos[0], globPos[1], globPos[2]);
139 TVector3 posErr(fPitchX / TMath::Sqrt(12.), fPitchY / TMath::Sqrt(12.), actBox->GetDZ());
141 new ((*hits)[fNHits])
PixelHit(detId, currentDigi->
GetIndex(), pos, posErr);
154 LOG(info) <<
"PixelFindHits::Exec(TList) EVENT " << fTNofEvents;
156 TClonesArray* digis = (TClonesArray*)list->FindObject(
"PixelDigis");
158 LOG(error) <<
"OOOPS!!! no digis array";
163 LOG(debug) <<
"PixelFindHits::Exec() ok 0 ";
164 fNDigis = digis->GetEntriesFast();
165 LOG(debug) <<
"PixelFindHits::Exec() fNDigis = " << fNDigis;
166 fTNofDigis += fNDigis;
168 for (Int_t iDigi = 0; iDigi < fNDigis; iDigi++) {
172 TString nodeName = Form(
"/cave/Pixel%d_%d", detId / 256, detId % 256);
173 LOG(debug) <<
"PixelFindHits::Exec() ok 1 node name = " << nodeName.Data();
175 LOG(debug) <<
"PixelFindHits::Exec() ok 2 ";
176 TGeoNode* curNode = fGeoParSet->
GetGeometry()->GetCurrentNode();
177 LOG(debug) <<
"PixelFindHits::Exec() ok 3 ";
180 TGeoVolume* actVolume = fGeoParSet->
GetGeometry()->GetCurrentVolume();
181 TGeoBBox* actBox =
static_cast<TGeoBBox*
>(actVolume->GetShape());
183 Int_t feId = currentDigi->
GetFeID();
184 Int_t col = currentDigi->
GetCol();
185 Int_t row = currentDigi->
GetRow();
187 Double_t locPosCalc[3];
188 locPosCalc[0] = (((feId - 1) / fMaxFEperCol) * fFeCols + col + 0.5) * fPitchX;
189 locPosCalc[1] = (((feId - 1) % fMaxFEperCol) * fFeRows + row + 0.5) * fPitchY;
192 locPosCalc[0] -= actBox->GetDX();
193 locPosCalc[1] -= actBox->GetDY();
197 curNode->LocalToMaster(locPosCalc, globPos);
199 LOG(debug) <<
"HIT ON " << detId <<
" POSITION: " << locPosCalc[0] <<
" / " << locPosCalc[1];
200 LOG(debug) <<
"GLOB HIT " << detId <<
" POSITION: " << globPos[0] <<
" / " << globPos[1] <<
" / "
203 TVector3 pos(globPos[0], globPos[1], globPos[2]);
204 TVector3 posErr(fPitchX / TMath::Sqrt(12.), fPitchY / TMath::Sqrt(12.), actBox->GetDZ());
206 new ((*hits)[fNHits])
PixelHit(detId, currentDigi->
GetIndex(), pos, posErr);
TGeoManager * GetGeometry()
Double_t GetYPitch() const
void Init(PixelDigiPar *digipar, FairGeoParSet *geopar)
Digitization Parameter Class for Pixel detector.
void Exec(TClonesArray *digis, TClonesArray *hits)
virtual void printParams()
Double_t GetXPitch() const
virtual ~PixelFindHitsTask()
Int_t GetMaxFEperCol() const