18 #include "FairLogger.h"
19 #include "FairModule.h"
20 #include "FairRootManager.h"
23 #include "TClonesArray.h"
24 #include "TStopwatch.h"
40 , fShowDebugHistos(kFALSE)
41 , fNoiseSensors(kFALSE)
43 , fInputPoints(nullptr)
54 , fDeltaBufferSize(-1)
57 , fInputBranchName(
"")
61 , fPileupManager(nullptr)
62 , fDeltaManager(nullptr) {}
71 , fShowDebugHistos(kFALSE)
72 , fNoiseSensors(kFALSE)
74 , fInputPoints(nullptr)
85 , fDeltaBufferSize(-1)
88 , fInputBranchName(
"MvdPoint")
92 , fPileupManager(nullptr)
93 , fDeltaManager(nullptr) {}
120 LOG(debug) <<
"//----------------------------------------//";
121 LOG(debug) << fName <<
": Send Input";
123 LOG(debug) << fName <<
": Execute DigitizerPlugin Nr. " <<
fDigiPluginNr;
125 LOG(debug) << fName <<
": End Chain";
131 Int_t nEntries =
fTmpDigi->GetEntriesFast();
132 for (Int_t index = 0; index < nEntries; index++) {
172 LOG(debug) << fName <<
": Sent " << nDigis <<
" digis to DAQ";
179 LOG(debug) <<
"//----------------------------------------//";
187 LOG(info) <<
"+ " << setw(15) << GetName() <<
": Event " << setw(6) << right
190 <<
", digis: " << nDigis <<
". Exec time " << setprecision(6)
191 <<
fTimer.RealTime() <<
" s.";
197 cout <<
"-I- " << GetName() <<
": Initialisation..." << endl;
199 cout <<
"---------------------------------------------" << endl;
200 cout <<
"-I- Initialising " << GetName() <<
" ...." << endl;
203 FairRootManager* ioman = FairRootManager::Instance();
205 cout <<
"-E- " << GetName() <<
"::Init: No FairRootManager!" << endl;
210 fInputPoints = (TClonesArray*) ioman->GetObject(
"MvdPoint");
213 LOG(error) <<
"No MvdPoint branch found. There was no MVD in the "
214 "simulation. Switch this task off";
221 fMcPileUp =
new TClonesArray(
"CbmMvdPoint", 10000);
222 ioman->Register(
"MvdPileUpMC",
223 "Mvd MC Points after Pile Up",
225 IsOutputBranchPersistent(
"MvdPileUpMC"));
232 cout <<
"-E- " << GetName() <<
"::Init: Pileup events needed, but no "
233 <<
" background file name given! " << endl;
239 cout <<
"-E- " << GetName()
240 <<
": The size of your BG-File is insufficient to perform the "
243 cout <<
" You need at least events > 2* fNPileup." << endl;
244 cout <<
" Detected: fPileUp = " <<
fNPileup <<
", events in file "
246 Fatal(GetName(),
"The size of your BG-File is insufficient");
254 cout <<
"-E- " << GetName() <<
"::Init: Pileup events needed, but no "
255 <<
" background file name given! " << endl;
261 cout <<
"-E- " << GetName()
262 <<
": The size of your Delta-File is insufficient to perform the "
265 cout <<
" You need at least events > 2* fNDeltaElect." << endl;
268 Fatal(GetName(),
"The size of your Delta-File is insufficient");
282 cout << GetName() <<
" initialised with parameters: " << endl;
284 cout <<
"---------------------------------------------" << endl;
330 cout.setf(ios_base::fixed, ios_base::floatfield);
331 cout <<
"============================================================"
333 cout <<
"============== Parameters MvdDigitizer ====================="
335 cout <<
"============================================================"
337 cout <<
"=============== End Task ==================================="
361 vector<Int_t> freeEvents(nBuffer);
362 for (Int_t
i = 0;
i < nBuffer;
i++)
366 for (Int_t iBg = 0; iBg <
fNPileup; iBg++) {
369 Int_t index = gRandom->Integer(freeEvents.size());
371 Int_t iEvent = freeEvents[index];
373 freeEvents.erase(freeEvents.begin() + index);
376 for (Int_t iPoint = 0; iPoint <
points->GetEntriesFast(); iPoint++) {
378 point->SetTrackID(-2);
396 vector<Int_t> freeDeltaEvents(nDeltaBuffer);
397 for (Int_t
i = 0;
i < nDeltaBuffer;
i++)
398 freeDeltaEvents[
i] =
i;
404 Int_t indexD = gRandom->Integer(freeDeltaEvents.size());
405 Int_t iEventD = freeDeltaEvents[indexD];
407 freeDeltaEvents.erase(freeDeltaEvents.begin() + indexD);
410 for (Int_t iPoint = 0; iPoint < pointsD->GetEntriesFast(); iPoint++) {
412 point->SetTrackID(-3);
428 LOG(debug) <<
"+ " << GetName() <<
"::BuildEvent: original " << nOrig
429 <<
", pileup " << nPile <<
", delta " << nElec <<
", total "
430 << nOrig + nPile + nElec <<
" MvdPoints";