28 #include <TClonesArray.h>
30 #include <TGeoManager.h>
32 #include <TGeoVolume.h>
63 LOG(info) <<
"Created PixelAltFindHits.";
81 LOG(debug) <<
"PixelAltFindHits::Exec() EVENT " << fTNofEvents;
85 fNDigis = fDigis->GetEntriesFast();
86 fTNofDigis += fNDigis;
88 for (Int_t iDigi = 0; iDigi < fNDigis; iDigi++) {
93 Double_t posX, posY, posZ;
94 Double_t errX, errY, errZ;
95 Int_t hitIndex = FindHit(detId,
107 TVector3 pos(posX, posY, posZ);
108 TVector3 posErr(errX, errY, errZ);
110 if (hitIndex == -666)
113 new ((*fHits)[fNHits])
PixelHit(detId, hitIndex, pos, posErr);
122 Int_t PixelAltFindHits::FindHit(Int_t detId,
134 TString nodeName = Form(
"/cave/Pixel%d_%d", detId / 256, detId % 256);
136 gGeoManager->cd(nodeName.Data());
137 TGeoNode* curNode = gGeoManager->GetCurrentNode();
138 TGeoVolume* actVolume = gGeoManager->GetCurrentVolume();
139 TGeoBBox* actBox =
static_cast<TGeoBBox*
>(actVolume->GetShape());
141 Double_t locPosCalc[3];
142 locPosCalc[0] = (((feId - 1) / fMaxFEperCol) * fFeCols + col + 0.5) * fPitchX;
143 locPosCalc[1] = (((feId - 1) % fMaxFEperCol) * fFeRows + row + 0.5) * fPitchY;
146 locPosCalc[0] -= actBox->GetDX();
147 locPosCalc[1] -= actBox->GetDY();
151 curNode->LocalToMaster(locPosCalc, globPos);
153 LOG(debug) <<
"HIT ON " << detId <<
" POSITION: " << locPosCalc[0] <<
" / " << locPosCalc[1];
154 LOG(debug) <<
"GLOB HIT " << detId <<
" POSITION: " << globPos[0] <<
" / " << globPos[1] <<
" / " << globPos[2];
159 errX = fPitchX / TMath::Sqrt(12.);
160 errY = fPitchY / TMath::Sqrt(12.);
161 errZ = actBox->GetDZ();
167 void PixelAltFindHits::SetParContainers()
172 LOG(fatal) <<
"No analysis run";
176 LOG(fatal) <<
"No runtime database";
185 tempList->Add(fDigiPar);
192 LOG(info) <<
"********************************************** PixelAltFindHits::InitMQ()";
193 fDigiPar = (
PixelDigiPar*)tempList->FindObject(
"PixelDigiParameters");
201 LOG(info) <<
">> fFeCols = " << fFeCols;
202 LOG(info) <<
">> fFeRows = " << fFeRows;
203 LOG(info) <<
">> fMaxFEperCol = " << fMaxFEperCol;
204 LOG(info) <<
">> fPitchX = " << fPitchX;
205 LOG(info) <<
">> fPitchY = " << fPitchY;
207 fHits =
new TClonesArray(
"PixelHit", 10000);
218 fDigis = (TClonesArray*)inputList->FindObject(
"PixelDigis");
219 outputList->Add(fHits);
229 for (
int idigi = 0; idigi < nofDigis; idigi++) {
230 FindHit(digiPalVector[idigi].fDetectorID,
231 digiPalVector[idigi].fFeID,
232 digiPalVector[idigi].fCol,
233 digiPalVector[idigi].fRow,
235 hitPalVector[idigi].posX,
236 hitPalVector[idigi].posY,
237 hitPalVector[idigi].posZ,
238 hitPalVector[idigi].dposX,
239 hitPalVector[idigi].dposY,
240 hitPalVector[idigi].dposZ);
253 LOG(fatal) <<
"No FairRootManager";
254 fDigis =
static_cast<TClonesArray*
>(ioman->
GetObject(
"PixelDigis"));
257 LOG(warn) <<
"PixelAltFindHits::Init() No input PixelDigis array!";
260 fHits =
new TClonesArray(
"PixelHit", 10000);
261 ioman->
Register(
"PixelHits",
"Pixel", fHits, kTRUE);
263 LOG(info) <<
"-I- " << fName.Data() <<
"::Init(). Initialization succesfull.";
271 LOG(info) <<
"PixelAltFindHits::SetParContainers() Pixel detector with pitch size " << fPitchX <<
"cm x" << fPitchY
279 void PixelAltFindHits::Reset()
281 fNDigis = fNHits = 0;
286 void PixelAltFindHits::Finish()
291 LOG(info) <<
"-------------------- " << fName.Data() <<
" : Summary ------------------------";
292 LOG(info) <<
" Events: " << fTNofEvents;
293 LOG(info) <<
" Digis: " << fTNofDigis <<
" ("
294 <<
static_cast<Double_t
>(fTNofDigis) / (static_cast<Double_t>(fTNofEvents)) <<
" per event)";
295 LOG(info) <<
" Hits: " << fTNofHits <<
" ("
296 <<
static_cast<Double_t
>(fTNofHits) / (static_cast<Double_t>(fTNofEvents)) <<
" per event)";
297 LOG(info) <<
"---------------------------------------------------------------------";
list of container factories
Double_t GetYPitch() const
virtual void Exec(Option_t *opt)
static FairRun * Instance()
virtual void ExecMQ(TList *inputList, TList *outputList)
static FairRootManager * Instance()
ClassImp(FairEventBuilder)
virtual void GetParList(TList *tempList)
Digitization Parameter Class for Pixel detector.
TObject * GetObject(const char *BrName)
FairParSet * getContainer(const Text_t *)
virtual ~PixelAltFindHits()
FairRuntimeDb * GetRuntimeDb(void)
void Register(const char *name, const char *Foldername, TNamed *obj, Bool_t toFile)
Double_t GetXPitch() const
virtual void InitMQ(TList *tempList)
Int_t GetMaxFEperCol() const