15 #include "FairRootManager.h"
16 #include "FairDetector.h"
18 #include "FairRuntimeDb.h"
19 #include "FairEventHeader.h"
23 #include "TClonesArray.h"
24 #include "TGeoManager.h"
25 #include "TGeoVolume.h"
27 #include "TGeoMatrix.h"
59 cout <<
"-I- PndRichHitProducer::Init: "
60 <<
"INITIALIZATION *********************" << endl;
67 cout <<
"-I- PndRichHitProducer::Init: "
70 cout <<
"-I- PndRichHitProducer::Init: ";
72 cout <<
"Photodetector noise is switched on! " << endl;
74 cout <<
"Photodetector noise is switched off! " << endl;
77 FairRootManager* ioman = FairRootManager::Instance();
79 cout <<
"-E- PndRichHitProducer::Init: "
80 <<
"RootManager not instantiated!" << endl;
85 fPDPointArray = (TClonesArray*) ioman->GetObject(
"RichPDPoint");
87 cout <<
"-W- PndRichHitProducer::Init: "
88 <<
"No RichPDPoint array!" << endl;
94 cout <<
"-W- PndRichHitProducer::Init: "
95 <<
"No RichBarPoint array!" << endl;
104 fHitArray =
new TClonesArray(
"PndRichHit");
105 ioman->Register(
"RichHit",
"PndRich",
fHitArray,kTRUE);
108 cout <<
"-I- PndRichHitProducer::Init: "
109 <<
"Hit Position smearing: " <<
fPosResolution <<
" [cm]" << endl;
111 cout <<
"-I- PndRichHitProducer: Intialization successfull" << endl;
153 fEventTime = FairRootManager::Instance()->GetEventTime();
176 for (Int_t iPoint=0; iPoint<nPoints; iPoint++) {
178 point->Momentum(mom);
180 point->Position(pos);
184 Double_t t = gRandom->Gaus(point->GetTime(),0.5);
209 Double_t fnoise = 1e3*1e-9*kcell*kcell;
211 Int_t nn = gRandom->Poisson(iXmax*iYmax*fnoise*dt);
212 std::cout <<
"nn = " << nn <<
" " << iXmax <<
" " << iYmax <<
" " << kcell << std::endl;
213 for (Int_t
i=0;
i<nn;
i++)
215 Int_t gind = gRandom->Integer(iXmax*iYmax);
216 Int_t ix = gind%iXmax;
217 Int_t iy = gind/iXmax;
235 TVector3 dpos(0., 0., 0.);
239 for (Int_t iBarPoint=0; iBarPoint<nBarPoints; iBarPoint++) {
248 pnt.
theta = mom.Theta();
253 thetaC = gRandom->Gaus( hit->
GetThetaC(), errThetaC );
254 AddHit(detID, sensorId, pos, dpos, thetaC, errThetaC, iBarPoint);
264 std::vector<Double_t> tn;
271 t += gRandom->Exp(1e9/fn-td);
276 if (ts<tstop) tn.push_back(ts);
284 TVector3&
pos, TVector3& dpos,
287 else AddPDHit(detID,sensorId,pos,dpos,index,time);
292 TVector3&
pos, TVector3& dpos,
294 Double_t EventTime = FairRootManager::Instance()->GetEventTime();
298 PndRichDigi *hitnew =
new PndRichDigi(index,detID, sensorId, pos, dpos, time+EventTime, timeThreshold, EventTime+time);
300 hitnew->ResetLinks();
301 FairEventHeader* evtHeader = (FairEventHeader*)FairRootManager::Instance()->GetObject(
"EventHeader.");
302 hitnew->AddLink(FairLink(evtHeader->GetInputFileId(), evtHeader->GetMCEntryNumber(),
"RichPDPoint", index));
303 hitnew->AddLink(FairLink(-1, FairRootManager::Instance()->GetEntryNr(),
"EventHeader.", -1));
305 if (point) hitnew->AddLinks(*(point->GetPointerToLinks()));
313 TVector3&
pos, TVector3& dpos,
319 Int_t size = clref.GetEntriesFast();
320 return new(clref[size])
PndRichPDHit(index, detID, sensorId, pos, dpos, time, timeThreshold);
327 TVector3&
pos, TVector3& dpos,
332 Int_t size = clref.GetEntriesFast();
333 return new(clref[size])
PndRichHit(detID, sensorId, pos, dpos, thetaC, errThetaC, index);
virtual InitStatus Init()
friend F32vec4 sqrt(const F32vec4 &a)
TVector3 PositionDiscretization(TVector3 pos, bool cell=true)
void SetPersistency(Bool_t val=kTRUE)
UInt_t sensorsPerDevice()
virtual void Exec(Option_t *opt)
PndRichDigi * AddDigi(Int_t detID, Int_t sensorId, TVector3 &pos, TVector3 &dpos, Int_t index, Double_t time)
void AddXPDHit(Int_t detID, Int_t sensorId, TVector3 &pos, TVector3 &dpos, Int_t index, Double_t time)
std::vector< Double_t > PhDetNoise()
PndRichHit * AddHit(Int_t detID, Int_t sensorId, TVector3 &pos, TVector3 &dpos, Double_t thetaC, Double_t errThetaC, Int_t index)
TClonesArray * fPDHitArray
PndRichPDHit * AddPDHit(Int_t detID, Int_t sensorId, TVector3 &pos, TVector3 &dpos, Int_t index, Double_t time)
Double_t GetThetaC() const
PndRichHitWriteoutBuffer * fDataBuffer
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Double_t fPreviousEventTime
TClonesArray * fPDPointArray
Double_t Sigma(dbpoint pnt)
PndPidEmcAssociatorTask * ts
PndRichResolution * fRichResolution
Double_t Efficiency(dbpoint pnt)
TClonesArray * fBarPointArray
TVector3 PixelPosition(UInt_t ix, UInt_t iy)