28 #include <TClonesArray.h>
30 #include <TGeoManager.h>
32 #include <TGeoVolume.h>
77 LOG(debug) <<
"PixelDigitize::Exec() EVENT " << fTNofEvents;
81 fNPoints = fPoints->GetEntriesFast();
82 fTNofPoints += fNPoints;
84 for (Int_t iPoint = 0; iPoint < fNPoints; iPoint++) {
87 Double_t posIn[3] = {currentPixelPoint->
GetX(), currentPixelPoint->
GetY(), currentPixelPoint->
GetZ()};
90 TString nodeName = Form(
"/cave/Pixel%d_%d", detId / 256, detId % 256);
92 gGeoManager->cd(nodeName.Data());
93 TGeoNode* curNode = gGeoManager->GetCurrentNode();
96 LOG(fatal) <<
"PixelDigitize::Exec() node \"" << nodeName.Data() <<
"\" unknown!";
100 curNode->MasterToLocal(posIn, locPosIn);
104 TGeoVolume* actVolume = gGeoManager->GetCurrentVolume();
105 TGeoBBox* actBox =
static_cast<TGeoBBox*
>(actVolume->GetShape());
108 locPosIn[0] += actBox->GetDX();
109 locPosIn[1] += actBox->GetDY();
111 LOG(debug) <<
"GLOB PNT " << detId <<
" POSITION: " << posIn[0] <<
" / " << posIn[1] <<
" / " << posIn[2];
112 LOG(debug) <<
"POINT ON " << detId <<
" POSITION: " << locPosIn[0] <<
" / " << locPosIn[1];
114 Int_t col =
static_cast<Int_t
>(locPosIn[0] / fPitchX);
116 Int_t row =
static_cast<Int_t
>(locPosIn[1] / fPitchY);
118 Int_t feCol = col / fFeCols;
120 Int_t feRow = row / fFeRows;
122 Int_t feId = 1 + feCol * fMaxFEperCol + feRow;
124 LOG(debug) <<
"COL = " << feCol <<
" FE + " << col <<
" ( " << ocol <<
" ) /// "
125 <<
"ROW = " << feRow <<
" FE + " << row <<
" ( " << orow <<
" ) /// "
126 <<
" /// PIXEL = " << feId;
128 ActivatePixel(iPoint, detId, feId, col, row, 1., 0.);
131 fTNofDigis += fNDigis;
134 void PixelDigitize::ActivatePixel(Int_t index,
142 Bool_t pixelAlreadyFired = kFALSE;
144 for (Int_t ipixel = 0; ipixel < fNDigis; ipixel++) {
145 tempPixel =
static_cast<PixelDigi*
>(fDigis->At(ipixel));
147 && tempPixel->
GetRow() == row) {
148 pixelAlreadyFired = kTRUE;
153 if (!pixelAlreadyFired) {
154 new ((*fDigis)[fNDigis])
PixelDigi(index, detId, feId, col, row, charge, timestamp);
159 void PixelDigitize::SetParContainers()
164 LOG(fatal) <<
"No analysis run";
169 LOG(fatal) <<
"No runtime database";
180 tempList->Add(fDigiPar);
187 LOG(info) <<
"********************************************** PixelDigitize::InitMQ()";
188 fDigiPar = (
PixelDigiPar*)tempList->FindObject(
"PixelDigiParameters");
196 LOG(info) <<
">> fFeCols = " << fFeCols;
197 LOG(info) <<
">> fFeRows = " << fFeRows;
198 LOG(info) <<
">> fMaxFEperCol = " << fMaxFEperCol;
199 LOG(info) <<
">> fPitchX = " << fPitchX;
200 LOG(info) <<
">> fPitchY = " << fPitchY;
202 fDigis =
new TClonesArray(
"PixelDigi", 10000);
212 fPoints = (TClonesArray*)inputList->FindObject(
"PixelPoint");
213 outputList->Add(fDigis);
224 LOG(fatal) <<
"No FairRootManager";
225 fPoints =
static_cast<TClonesArray*
>(ioman->
GetObject(
"PixelPoint"));
228 fDigis =
new TClonesArray(
"PixelDigi", 10000);
229 ioman->
Register(
"PixelDigis",
"Pixel", fDigis, kTRUE);
231 LOG(info) <<
"-I- " << fName.Data() <<
"::Init(). Initialization succesfull.";
239 LOG(info) <<
"PixelDigitize::SetParContainers() Pixel detector with pitch size " << fPitchX <<
"cm x" << fPitchY
247 void PixelDigitize::Reset()
249 fNPoints = fNDigis = 0;
254 void PixelDigitize::Finish()
259 LOG(info) <<
"-------------------- " << fName.Data() <<
" : Summary ------------------------";
260 LOG(info) <<
" Events: " << fTNofEvents;
261 LOG(info) <<
" MC Points: " << fTNofPoints <<
" ( "
262 <<
static_cast<Double_t
>(fTNofPoints) / (static_cast<Double_t>(fTNofEvents)) <<
" per event )";
263 LOG(info) <<
" Digis: " << fTNofDigis <<
" ( "
264 <<
static_cast<Double_t
>(fTNofDigis) / (static_cast<Double_t>(fTNofEvents)) <<
" per event )";
265 LOG(info) <<
"---------------------------------------------------------------------";
list of container factories
virtual void GetParList(TList *tempList)
void SetCharge(Double_t ch)
Double_t GetYPitch() const
static FairRun * Instance()
virtual void Exec(Option_t *opt)
static FairRootManager * Instance()
ClassImp(FairEventBuilder)
Digitization Parameter Class for Pixel detector.
TObject * GetObject(const char *BrName)
virtual void InitMQ(TList *tempList)
FairParSet * getContainer(const Text_t *)
FairRuntimeDb * GetRuntimeDb(void)
void Register(const char *name, const char *Foldername, TNamed *obj, Bool_t toFile)
virtual void ExecMQ(TList *inputList, TList *outputList)
Int_t GetDetectorID() const
Double_t GetXPitch() const
Int_t GetMaxFEperCol() const