1 #include "ERGadastDigitizer.h" 7 #include "FairRuntimeDb.h" 8 #include "FairEventHeader.h" 10 #include "ERGadastCsIPoint.h" 11 #include "ERGadastLaBrPoint.h" 17 : FairTask(
"ER Gadast Digitization scheme"),
29 fCsIElossThreshold(0.),
30 fLaBrElossThreshold(0.)
37 : FairTask(
"ER Gadast Digitization scheme ", verbose),
49 fCsIElossThreshold(0.),
50 fLaBrElossThreshold(0.)
63 void ERGadastDigitizer::SetParContainers()
66 FairRun* run = FairRun::Instance();
67 if ( ! run ) Fatal(
"SetParContainers",
"No analysis run");
69 FairRuntimeDb* rtdb = run->GetRuntimeDb();
70 if ( ! rtdb ) Fatal(
"SetParContainers",
"No runtime database");
73 (rtdb->getContainer(
"ERGadastDigiPar"));
75 std::cout <<
"ERGadastDigitizer::SetParContainers() "<< std::endl;
76 std::cout <<
"ERGadastDigiPar initialized! "<< std::endl;
85 FairRootManager* ioman = FairRootManager::Instance();
86 if ( ! ioman ) Fatal(
"Init",
"No FairRootManager");
88 fGadastCsIPoints = (TClonesArray*) ioman->GetObject(
"GadastCsIPoint");
89 fGadastLaBrPoints = (TClonesArray*) ioman->GetObject(
"GadastLaBrPoint");
92 fGadastCsIDigi =
new TClonesArray(
"ERGadastCsIDigi",1000);
93 fGadastLaBrDigi =
new TClonesArray(
"ERGadastLaBrDigi",1000);
94 ioman->Register(
"GadastCsIDigi",
"Digital response in Gadast CsI", fGadastCsIDigi, kTRUE);
95 ioman->Register(
"GadastLaBrDigi",
"Digital response in Gadast LaBr", fGadastLaBrDigi, kTRUE);
97 fSetup = ERGadastSetup::Instance();
99 std::cerr <<
"Problems with ERGadastSetup initialization!" << std::endl;
113 map<Int_t, map<Int_t, map <Int_t, vector<Int_t> > > > pointsCsI;
114 for (Int_t iPoint = 0; iPoint < fGadastCsIPoints->GetEntriesFast(); iPoint++){
116 pointsCsI[point->GetWall()][point->GetBlock()][point->GetCell()].push_back(iPoint);
120 map<Int_t, vector<Int_t> > pointsLaBr;
121 for (Int_t iPoint = 0; iPoint < fGadastLaBrPoints->GetEntriesFast(); iPoint++){
123 pointsLaBr[point->GetCell()].push_back(iPoint);
126 for (
const auto &itWall : pointsCsI){
127 for (
const auto &itBlock : itWall.second){
128 for (
const auto &itCell : itBlock.second){
130 Float_t time = std::numeric_limits<float>::max();
131 for (
const auto iPoint : itCell.second){
133 edep += point->GetEnergyLoss();
134 if (point->GetTime() < time)
135 time = point->GetTime();
137 Float_t edepSigma = sqrt(pow(fCsIEdepErrorA,2) + pow(fCsIEdepErrorB*TMath::Sqrt(edep),2) + pow(fCsIEdepErrorC*edep,2));
138 edep = gRandom->Gaus(fCsILC*edep, edepSigma);
139 if (edep < fCsIElossThreshold)
141 Float_t timeSigma = TMath::Sqrt(fCsITimeErrorA/edep);
142 time = gRandom->Gaus(time, timeSigma);
144 AddCsIDigi(edep,itWall.first,itBlock.first,itCell.first);
149 for (
const auto &itCell : pointsLaBr){
151 Float_t time = std::numeric_limits<float>::max();
152 for (
const auto iPoint : itCell.second){
154 edep += point->GetEnergyLoss();
155 if (point->GetTime() < time)
156 time = point->GetTime();
158 Float_t edepSigma = sqrt(pow(fLaBrEdepErrorA,2) + pow(fLaBrEdepErrorB*TMath::Sqrt(edep),2) + pow(fLaBrEdepErrorC*edep,2));
159 edep = gRandom->Gaus(fLaBrLC*edep, edepSigma);
160 if (edep < fLaBrElossThreshold)
162 Float_t timeSigma = TMath::Sqrt(fLaBrTimeErrorA/edep);
163 time = gRandom->Gaus(time, timeSigma);
165 AddLaBrDigi(edep,itCell.first);
173 if (fGadastCsIDigi) {
174 fGadastCsIDigi->Delete();
176 if (fGadastLaBrDigi) {
177 fGadastLaBrDigi->Delete();
185 std::cout <<
"========== Finish of ERGadastDigitizer =================="<< std::endl;
190 ERGadastCsIDigi* ERGadastDigitizer::AddCsIDigi(Float_t Edep,Int_t wall,Int_t block, Int_t cell)
192 ERGadastCsIDigi *digi =
new((*fGadastCsIDigi)[fGadastCsIDigi->GetEntriesFast()])
193 ERGadastCsIDigi(fGadastCsIDigi->GetEntriesFast(), Edep, wall, block, cell);
199 ERGadastLaBrDigi *digi =
new((*fGadastLaBrDigi)[fGadastLaBrDigi->GetEntriesFast()])
virtual void Exec(Option_t *opt)
The data class for storing pieces of charged tracks in sensitive volumes in CsI crystall.
virtual InitStatus Init()
ERGadastDigiPar * fDigiPar