9 #include <FairLogger.h>
10 #include <FairRootManager.h>
11 #include <FairRunAna.h>
12 #include <FairRuntimeDb.h>
17 #include <TClonesArray.h>
18 #include <TGenericClassInfo.h>
28 : FairTask(
"TrdSPADIC", 1)
29 , fSpadicResponse(nullptr)
35 , fAdcBit(fmaxdEdx / pow(2, fBitResolution))
40 , fModuleInfo(nullptr)
41 , fGeoHandler(nullptr)
42 , fMinimumChargeTH(1.0e-06) {}
54 FairRootManager* ioman = FairRootManager::Instance();
56 fDigis = (TClonesArray*) ioman->GetObject(
"TrdDigi");
57 if (
fDigis ==
nullptr) LOG(fatal) <<
"CbmTrdSPADIC::Init No TrdDigi array";
85 std::pair<Int_t, Int_t /*CbmTrdDigi**/> b) {
86 return (a.first < b.first);
91 "SpadicResponseFunction",
92 "SpadicResponseFunction",
112 for (Int_t iBin = 0; iBin <
fnBins; iBin++) {
118 for (Int_t k = 1; k <= spadicPulse->GetNbinsX(); k++) {
119 if (spadicPulse->GetBinContent(k) >
fmaxdEdx)
120 spadicPulse->SetBinContent(k,
fmaxdEdx);
122 spadicPulse->SetBinContent(
137 if (amplitude <= 0.0)
return;
139 new TH1D(
"deltaPulse",
144 event->SetBinContent(1, 0);
145 for (Int_t k =
fPeakBin; k <=
event->GetNbinsX(); k++) {
146 event->SetBinContent(k, amplitude *
exp(-0.65 * (k -
fPeakBin)));
148 spadicPulse->Reset();
156 for (Int_t k = 1; k <=
event->GetNbinsX(); k++) {
158 for (Int_t
i = 1;
i <=
event->GetNbinsX();
i++) {
162 x =
event->GetBinContent(k -
i);
165 spadicPulse->SetBinContent(k,
y);
170 / spadicPulse->GetBinContent(
171 spadicPulse->GetMaximumBin()) );
179 LOG(info) <<
"================CbmTrdSPADIC===============";
180 LOG(info) <<
"CbmTrdSPADIC::Exec : fPulseShape: " << (Bool_t)
fPulseShape;
181 LOG(info) <<
"CbmTrdSPADIC::Exec : fBitResolution: " <<
fBitResolution;
182 LOG(info) <<
"CbmTrdSPADIC::Exec : fShaperOrder: " <<
fShaperOrder;
183 LOG(info) <<
"CbmTrdSPADIC::Exec : fShapingTime: " <<
fShapingTime <<
" µs";
184 LOG(info) <<
"CbmTrdSPADIC::Exec : fmaxdEdx: " <<
fmaxdEdx <<
" GeV";
185 LOG(info) <<
"CbmTrdSPADIC::Exec : fAdcBit: " <<
fAdcBit
187 LOG(info) <<
"CbmTrdSPADIC::Exec : fSelectionMask:";
188 for (Int_t iBin = 0; iBin <
fnBins; iBin++) {
190 if ((1 + iBin) % 5 == 0 && iBin > 0 && (1 + iBin) <
fnBins) {
195 Bool_t debug =
false;
196 std::map<Int_t, std::map<Int_t, Int_t>>
197 moduleDigiNotTriggerMap;
198 std::map<Int_t, std::list<std::pair<Int_t, Int_t>>>
199 moduleDigiTriggerMap;
200 Int_t nDigis =
fDigis->GetEntries();
203 new TH1D(
"spadicPulse",
208 TCanvas* c =
nullptr;
209 if (debug) c =
new TCanvas(
"c",
"c", 800, 600);
210 for (Int_t iDigi = 0; iDigi < nDigis; iDigi++) {
221 printf(
"digi %3i digiAddress %i layer %i and modId %i Sec%i Row:%i "
243 moduleDigiTriggerMap[moduleAddress].push_back(
244 std::make_pair(combiId, iDigi));
246 moduleDigiNotTriggerMap[moduleAddress][combiId] = iDigi;
250 for (std::map<Int_t, std::list<std::pair<Int_t, Int_t>>>::iterator iModule =
251 moduleDigiTriggerMap.begin();
252 iModule != moduleDigiTriggerMap.end();
255 Int_t moduleAddress = (*iModule).first;
256 for (std::list<std::pair<Int_t, Int_t>>::iterator iDigi =
257 (*iModule).second.begin();
258 iDigi != (*iModule).second.end();
260 Int_t combiId = (*iDigi).first;
261 Int_t digiId = (*iDigi).second;
265 Float_t pulse[
fnBins] = {0.0};
266 for (Int_t k = 1; k <= spadicPulse->GetNbinsX(); k++) {
267 pulse[k - 1] = spadicPulse->GetBinContent(k);
273 spadicPulse->GetYaxis()->SetRangeUser(0 - 0.01 *
fmaxdEdx,
275 spadicPulse->DrawCopy();
280 if (moduleDigiNotTriggerMap[moduleAddress].find(combiId - 1)
281 != moduleDigiNotTriggerMap[moduleAddress].end()) {
283 moduleDigiNotTriggerMap[moduleAddress][combiId - 1]);
286 Float_t pulse[
fnBins] = {0.0};
287 for (Int_t k = 1; k <= spadicPulse->GetNbinsX(); k++) {
288 pulse[k - 1] = spadicPulse->GetBinContent(k);
293 spadicPulse->SetLineColor(kRed);
294 spadicPulse->GetYaxis()->SetRangeUser(0 - 0.01 *
fmaxdEdx,
296 spadicPulse->DrawCopy(
"same");
304 if (moduleDigiNotTriggerMap[moduleAddress].find(combiId + 1)
305 != moduleDigiNotTriggerMap[moduleAddress].end()) {
307 moduleDigiNotTriggerMap[moduleAddress][combiId + 1]);
310 Float_t pulse[
fnBins] = {0.0};
311 for (Int_t k = 1; k <= spadicPulse->GetNbinsX(); k++) {
312 pulse[k - 1] = spadicPulse->GetBinContent(k);
317 spadicPulse->SetLineColor(kGreen);
318 spadicPulse->GetYaxis()->SetRangeUser(0 - 0.01 *
fmaxdEdx,
320 spadicPulse->DrawCopy(
"same");
329 if (debug) c->Update();