11 #include "TGeoManager.h"
13 #include "FairRootManager.h"
22 #include "FairRunAna.h"
23 #include "FairRuntimeDb.h"
24 #include "FairGeoVector.h"
25 #include "FairGeoNode.h"
26 #include "FairGeoVolume.h"
34 #include "FairBaseParSet.h"
35 #include "FairGeoTransform.h"
100 cout <<
" ---------- INITIALIZATION ------------" << endl;
104 FairRootManager* ioman = FairRootManager::Instance();
106 cout <<
"-E- PndDrcTimeDigiTask::Init: "
107 <<
"RootManager not instantiated!" << endl;
116 if(
fVerbose>1) Info(
"SetParContainers",
"done.");
119 fMCArray = (TClonesArray*) ioman->GetObject(
"MCTrack");
121 cout <<
"-W- PndDrcRecoLookupMap::Init: "
122 <<
"No MCTrack array!" << endl;
129 cout <<
"-W- PndDrcTimeDigiTask::Init: "
130 <<
"No DrcBarPoint array!" << endl;
135 fPDPointArray = (TClonesArray*) ioman->GetObject(
"DrcPDPoint");
137 cout <<
"-W- PndDrcAna::Init: "
138 <<
"No DrcPDPoint array!" << endl;
142 ioman->Register(
"DrcDigiNormal",
"Drc",
fDrcDigiArray, kFALSE);
149 cout <<
"-I- PndDrcTimeDigiTask: Intialization successfull" << endl;
168 cout <<
" Number of Photon MC Points in Photon Detector Plane : "<<
fPDPointArray->GetEntries()<<endl;
172 if (
fVerbose == 0) cout<<
"-I- PndDrcTimeDigiTask: PD points "<<
fPDPointArray->GetEntriesFast() <<endl;
177 Int_t trID=
fPpt->GetTrackID();
222 TVector3 PptPosition;
223 fPpt->Position(PptPosition);
228 TVector3 posLshifted = posL + sensorDim;
231 Int_t Ncol = (Int_t)TMath::Floor(posLshifted.X()/
fPixelStep);
232 Int_t Nrow = (Int_t)TMath::Floor(posLshifted.Y()/
fPixelStep);
233 Int_t NpixelLocal = Ncol + Nrow *
fNpix;
238 Int_t sensorId = mcpId * 100 + NpixelLocal;
244 fEventTime = FairRootManager::Instance()->GetEventTime();
284 point.SetXYZ(posLshifted.X(),posLshifted.Y(),0.);
289 distance = (point-
corner).Mag();
291 if(Ncol-1 >= 0 && Nrow+1 < fNpix){
300 distance = (point-
corner).Mag();
302 if(Ncol-1 >= 0 && Nrow-1 >= 0){
310 distance = (point-
corner).Mag();
312 if(Ncol+1 < fNpix && Nrow-1 >= 0){
320 distance = (point-
corner).Mag();
322 if(Ncol+1 < fNpix && Nrow+1 < fNpix){
339 Digi->SetTimeStamp(signalTime);
357 Digi->SetLink(FairLink(
"PndDrcPDPoint", k));
362 if(
fabs(
fTimeMap.find(sensorId)->second-signalTime)<5.0){
367 digi->SetTimeStamp(signalTime);
394 hit.SetXYZ(xx,yy,0.);
396 if(startPhi < 0.){startPhi = 360. + hit.Phi()*180./
fpi;}
399 if(startPhi >= 0. && startPhi < 90.){
402 if(startPhi >= 90. && startPhi < 270.){
405 if(startPhi >= 270. && startPhi < 360.){
417 if(print){std::cout<<
"n = "<<n<<
", NN = "<<*NN<<
", x0 = "<<x0<<
", a = "<<a<<std::endl;}
419 if(x0 < 0.){x1 = x0 - (n+1)*a;}
420 if(print){std::cout<<
"xy = "<< x1<<std::endl;}
422 if((m/2. - TMath::Floor(m/2.)) == 0.) {
423 if(print){std::cout<<
"odd==0"<<std::endl;}
424 if(x0 >= 0. && x1 + xEn <= a){xK = x1 + xEn;}
425 if(x0 >= 0. && x1 + xEn > a){xK = 2*a - x1 - xEn; n = 1. +
n;}
426 if(x0 < 0. && x1 + xEn >= 0.){xK = a - (x1 + xEn); n = -1. -
n;}
427 if(x0 < 0. && x1 + xEn < 0.) {xK = a + x1 + xEn; n = -
n;}
428 if(print){std::cout<<
"xK = "<< xK<<
", n = "<<n<<std::endl;}
432 if((m/2. - TMath::Floor(m/2.)) != 0.) {
433 if(print){std::cout<<
"even!=0"<<std::endl;}
434 if(x0 >= 0. && x1 + xEn <= a){xK = a - (x1 + xEn);}
435 if(x0 >= 0. && x1 + xEn > a){xK = x1 + xEn -
a; n = 1. +
n;}
436 if(x0 < 0. && x1 + xEn >= 0.){xK = x1 + xEn; n = -1. -
n;}
437 if(x0 < 0. && x1 + xEn < 0.) {xK = - (x1 + xEn); n = -
n;}
438 if(print){std::cout<<
"xK = "<< xK<<
", n = "<<n<<std::endl;}
451 TClonesArray& clrefPD = *
fDigis;
452 Int_t size = clrefPD.GetEntriesFast();
453 return new(clrefPD[size])
PndDrcDigi(index, iDetectorId, iDetectorId, charge, time, csflag, 0.);
470 cout <<
"ERROR: photocathode type not specified" << endl;
494 (par0*x*x/(x*x-par1*par1))+
495 (par2*x*x/(x*x-par3*par3))+
496 (par4*x*x/(x*x-par5*par5)));
502 return 1. - pow(4.*3.14159*
cos(y)*par0*
FuncD1(x)/x,2);
508 TGeoVolume* actVolume =
gGeoManager->GetCurrentVolume();
509 TGeoBBox* actBox = (TGeoBBox*)(actVolume->GetShape());
510 TVector3 result(actBox->GetDX(),actBox->GetDY(),actBox->GetDZ());
552 Double_t EvtTime = FairRootManager::Instance()->GetEventTime();
553 time += EvtTime + gRandom->Gaus(0,sigt);
569 cout <<
"-I- PndDrcTimeDigiTask: Finish" << endl;
friend F32vec4 cos(const F32vec4 &a)
virtual void Exec(Option_t *option)
friend F32vec4 exp(const F32vec4 &a)
void SetTimeAtBar(Double_t TimeAtBar)
friend F32vec4 sqrt(const F32vec4 &a)
std::map< Int_t, Int_t > fPixelMap
static T Sqrt(const T &x)
Int_t GetDetectorID() const
std::map< Int_t, Double_t > fTimeMap
virtual void SetParContainers()
void SetEventNo(Double_t EventNo)
Double_t fPackingFraction
TVector3 GetMomentum() const
PndDrcDigiWriteoutBuffer * fDrcTimeDigiArray
TClonesArray * fBarPointArray
void Smear(Double_t &time, Double_t sigt)
PndGeoDrc * fGeo
Basic geometry data of barrel DRC.
TGeoManager * gGeoManager
TString GetPath(Int_t shortID)
for a given shortID the path is returned
TClonesArray * fDrcDigiArray
Double_t FindPhiRot(Double_t, Double_t)
Double_t FindOutPoint(Double_t, Double_t, Double_t, Double_t *, Bool_t)
Int_t GetBarPointID() const
void SetBarID(Int_t BarID)
virtual ~PndDrcTimeDigiTask()
PndDrcDigi * AddDrcDigi(Int_t index, Int_t iDetectorId, Double_t charge, Double_t TimeStamp, Int_t csflag)
void SetBoxID(Int_t BoxID)
PndDrcBarPoint * fBarPoint
void SetMotherID(Int_t MrID)
void SetTrackMom(TVector3 TrackMom)
void SetTrackID(Int_t TrackID)
friend F32vec4 fabs(const F32vec4 &a)
TVector3 GetSensorDimensions(Int_t sensorID)
virtual InitStatus Init()
void SetEvtTim(Double_t EvtTim)
static PndGeoHandling * Instance()
TVector3 MasterToLocalShortId(const TVector3 &master, const Int_t &shortId)
void SetTrackIniVertex(TVector3 TrackIniVertex)
TClonesArray * fPDPointArray
Double_t fDetEfficiency[800]
Double_t FuncD3(Double_t x, Double_t y)
Double_t FuncD1(Double_t x)
TVector3 GetStartVertex() const
void ActivatePixel(Int_t DetectorId, Int_t sensorId, Double_t signalTime, Int_t k, Int_t csflag)
Int_t GetMotherID() const
void SetPdgCode(Int_t Pdg)
Double_t fTimeGranularity
void SetEventTim(Double_t EventTim)
Double_t GetStartTime() const
void SetMotherIDPho(Int_t MrIDPho)