1 #include "ERNDDigitizer.h" 4 #include "TGeoMatrix.h" 8 #include "FairRootManager.h" 10 #include "FairRuntimeDb.h" 11 #include "FairLogger.h" 17 #include "ERDetectorList.h" 18 #include "ERNDPoint.h" 20 Int_t ERNDDigitizer::fEvent = 0;
23 : FairTask(
"ER ND Digi producing scheme")
42 : FairTask(
"ER ND Digi producing scheme ", verbose)
66 void ERNDDigitizer::SetParContainers()
69 FairRun* run = FairRun::Instance();
70 if ( ! run ) Fatal(
"SetParContainers",
"No analysis run");
72 FairRuntimeDb* rtdb = run->GetRuntimeDb();
73 if ( ! rtdb ) Fatal(
"SetParContainers",
"No runtime database");
81 FairRootManager* ioman = FairRootManager::Instance();
82 if ( ! ioman ) Fatal(
"Init",
"No FairRootManager");
84 fNDPoints = (TClonesArray*) ioman->GetObject(
"NDPoint");
86 Fatal(
"Init",
"Can`t find collection NDPoint!");
89 fNDDigis =
new TClonesArray(
"ERNDDigi",10);
91 ioman->Register(
"NDDigi",
"ND digi", fNDDigis, kTRUE);
93 fSetup = ERNDSetup::Instance();
103 LOG(DEBUG2) <<
"ERNDDigitizer event: " << fEvent++ << FairLogger::endl;
107 std::map<Int_t, std::vector<Int_t>> pointsByCrystall;
108 for (Int_t iPoint = 0; iPoint < fNDPoints->GetEntriesFast(); iPoint++){
110 pointsByCrystall[point->StilbenNr()].push_back(iPoint);
114 for (
const auto &itCrystall : pointsByCrystall){
116 Float_t time = std::numeric_limits<float>::max();
120 for (
const auto iPoint : itCrystall.second){
122 edep += point->GetEnergyLoss();
123 ly += point->LightYield();
124 if (point->GetTime() < time){
125 time = point->GetTime();
129 Float_t edepSigma = sqrt(pow(fEdepErrorA,2) + pow(fEdepErrorB*TMath::Sqrt(edep/1000.),2) + pow(fEdepErrorC*edep,2));
130 edep = gRandom->Gaus(edep, edepSigma);
138 Float_t lySigma = sqrt(pow(fLYErrorA,2) + pow(fLYErrorB*TMath::Sqrt(ly/1000.),2) + pow(fLYErrorC*ly,2));
139 ly = gRandom->Gaus(ly, lySigma);
141 Float_t timeSigma = TMath::Sqrt(fTimeErrorA/ly);
142 time = gRandom->Gaus(time, timeSigma);
144 Float_t neutronProb = NeutronProbability(edep,ly);
146 AddDigi(itCrystall.first,edep, ly, time, neutronProb);
148 LOG(DEBUG) <<
"Digis count: " << fNDDigis->GetEntriesFast() << FairLogger::endl;
168 ERNDDigi* ERNDDigitizer::AddDigi(Int_t stilbenNb, Float_t edep, Float_t ly,
169 Float_t time,Float_t neutronProb)
171 ERNDDigi *Digi =
new((*fNDDigis)[fNDDigis->GetEntriesFast()])
172 ERNDDigi(stilbenNb, edep, ly, time, neutronProb);
176 Float_t ERNDDigitizer::NeutronProbability(Float_t edep, Float_t ly){
178 Float_t quench = ly/edep;
179 if ((ly > fLYThreshold) && (quench < fQuenchThreshold)){
182 if ((ly < fLYThreshold) && (quench < fQuenchThreshold)){
183 neutronProb = fProbabilityB+(1-fProbabilityB)*(ly/fLYThreshold);
185 if ((ly > fLYThreshold) && (quench > fQuenchThreshold)){
188 if ((ly < fLYThreshold) && (quench > fQuenchThreshold)){
189 neutronProb = fProbabilityC*(1-ly/fLYThreshold);
virtual void Exec(Option_t *opt)
virtual InitStatus Init()