Go to the documentation of this file.
10 #include "FairLogger.h"
11 #include "FairRootManager.h"
12 #include "FairRunOnline.h"
14 #include "TClonesArray.h"
17 #include "THttpServer.h"
31 using std::setprecision;
37 : FairTask(
"CbmMcbm2018EventBuilder") {}
58 FairRootManager* ioman = FairRootManager::Instance();
66 fT0DigiVec = ioman->InitObjectAs<std::vector<CbmTofDigi>
const*>(
"T0Digi");
68 fT0DigiArr =
static_cast<TClonesArray*
>(ioman->GetObject(
"T0Digi"));
69 if (!
fT0DigiArr) { LOG(info) <<
"No T0 digi input."; }
73 LOG(info) <<
"No STS digi input.";
77 LOG(info) <<
"No MUCH digi input.";
81 LOG(info) <<
"No TRD digi input.";
85 LOG(info) <<
"No TOF digi input.";
89 LOG(info) <<
"No RICH digi input.";
93 LOG(info) <<
"No PSD digi input.";
97 fEvents =
new TClonesArray(
"CbmEvent", 100);
99 "CbmEvent",
"Cbm Event",
fEvents, IsOutputBranchPersistent(
"CbmEvent"));
101 if (!
fEvents) LOG(fatal) <<
"Output branch was not created";
107 "Time difference between two consecutive digis;time diff [ns];Counts",
112 "seed time of the events; Seed time [s]; Events",
118 "interval in seed time of consecutive events; Seed time [s]; Events",
123 new TH1F(
"hEventSize",
124 "nb of all digis in the event; Nb Digis []; Events []",
129 new TH2I(
"hNbDigiPerEvtTime",
130 "nb of all digis per event vs seed time of the events; Seed "
131 "time [s]; Nb Digis []; Events []",
140 new TH2I(
"hNbDigiPerEvtTimeT0",
141 "nb of T0 digis per event vs seed time of the events; Seed "
142 "time [s]; Nb Digis []; Events []",
150 new TH2I(
"hNbDigiPerEvtTimeSts",
151 "nb of STS digis per event vs seed time of the events; Seed "
152 "time [s]; Nb Digis []; Events []",
160 new TH2I(
"hNbDigiPerEvtTimeMuch",
161 "nb of MUCH digis per event vs seed time of the events; Seed "
162 "time [s]; Nb Digis []; Events []",
170 new TH2I(
"hNbDigiPerEvtTimeTrd",
171 "nb of TRD digis per event vs seed time of the events; Seed "
172 "time [s]; Nb Digis []; Events []",
180 new TH2I(
"hNbDigiPerEvtTimeTof",
181 "nb of TOF digis per event vs seed time of the events; Seed "
182 "time [s]; Nb Digis []; Events []",
190 new TH2I(
"hNbDigiPerEvtTimeRich",
191 "nb of RICH digis per event vs seed time of the events; Seed "
192 "time [s]; Nb Digis []; Events []",
200 new TH2I(
"hNbDigiPerEvtTimePsd",
201 "nb of PSD digis per event vs seed time of the events; Seed "
202 "time [s]; Nb Digis []; Events []",
220 LOG_IF(info,
fNrTs % 1000 == 0) <<
"Begin of TS " <<
fNrTs;
226 LOG(debug) <<
"Found " <<
fEventVector.size() <<
" events";
232 LOG(debug) <<
"Found " <<
fEventVector.size() <<
" triggered events";
256 LOG(debug) <<
"T0Digis: " << nrT0Digis;
257 LOG(debug) <<
"StsDigis: " << nrStsDigis;
258 LOG(debug) <<
"MuchDigis: " << nrMuchDigis;
259 LOG(debug) <<
"TrdDigis: " << nrTrdDigis;
260 LOG(debug) <<
"TofDigis: " << nrTofDigis;
261 LOG(debug) <<
"RichDigis: " << nrRichDigis;
262 LOG(debug) <<
"PsdDigis: " << nrPsdDigis;
268 if (nrMuchDigis > 0) {
280 for (
const auto& data :
fSorter) {
281 LOG(debug) <<
"Array, Entry(" << data.second.first <<
", "
282 << data.second.second <<
"): " << fixed << setprecision(15)
283 << data.first <<
" ns";
304 Double_t time = it->first;
306 Int_t entry = it->second.second;
327 AddDigiToSorter<CbmStsDigi>(system, ++entry);
332 AddDigiToSorter<CbmMuchDigi>(system, ++entry);
335 AddDigiToSorter<CbmMuchBeamTimeDigi>(system, ++entry);
340 AddDigiToSorter<CbmTrdDigi>(system, ++entry);
344 AddDigiToSorter<CbmTofDigi>(system, ++entry);
348 AddDigiToSorter<CbmRichDigi>(system, ++entry);
352 AddDigiToSorter<CbmPsdDigi>(system, ++entry);
356 AddDigiToSorter<CbmTofDigi>(system, ++entry);
382 Bool_t hasTrigger {kTRUE};
502 Double_t dPreEvtTime = -1.0;
505 if (0.0 <= dPreEvtTime) {
506 fhEventDt->Fill(evt->GetStartTime() - dPreEvtTime);
526 dPreEvtTime = evt->GetStartTime();
548 LOG(debug) <<
"Vector: " <<
event->ToString();
549 new ((*fEvents)[
fEvents->GetEntriesFast()])
CbmEvent(std::move(*event));
550 LOG(debug) <<
"TClonesArray: "
560 LOG(debug) <<
"Event " <<
counter <<
" has " <<
event->GetNofData()
604 LOG(debug) <<
"Entry: " << _entry;
618 if (
nullptr != pDigi) {
619 time = pDigi->GetTime();
620 fSorter.emplace(make_pair(time, make_pair(_system, _entry)));
627 if (
static_cast<UInt_t
>(_entry) <
fT0DigiVec->size()) {
629 fSorter.emplace(make_pair(time, make_pair(_system, _entry)));
633 if (_entry < fT0DigiArr->GetEntriesFast()) {
635 fSorter.emplace(make_pair(time, make_pair(_system, _entry)));
675 LOG(info) <<
"Total errors: " <<
fErrors;
Double_t fPrevTime
Timeslice Counter.
Int_t fTriggerMaxStsDigis
Double_t fFixedTimeWindow
TH2 * fhNbDigiPerEvtTimeTrd
histogram with the nb of MUCH digis per event vs seed time of the events
TH2 * fhNbDigiPerEvtTimeMuch
histogram with the nb of STS digis per event vs seed time of the events
Int_t fTriggerMinRichDigis
Bool_t IsDigiInEvent(Double_t)
InitStatus Init()
Initialisation.
virtual InitStatus Init()
TH1 * fhEventDt
histogram with the seed time of the events
void AddDigiToSorter(ECbmModuleId, Int_t)
CbmDigiManager * fDigiMan
const std::vector< CbmTofDigi > * fT0DigiVec
CbmMcbm2018EventBuilder()
Bool_t HasTrigger(CbmEvent *)
Int_t fTriggerMinTofDigis
void AddData(ECbmDataType type, UInt_t index)
@ kMvd
Micro-Vertex Detector.
static Int_t GetNofDigis(ECbmModuleId systemId)
void UseMuchBeamTimeDigi(Bool_t choice=kTRUE)
Use CbmMuchBeamTimeDigi instead of CbmMuchDigi for MUCH.
Bool_t fFillHistos
histogram with the nb of PSD digis per event vs seed time of the events
@ kTof
Time-of-flight Detector.
virtual void SetParContainers()
TH2 * fhNbDigiPerEvtTimeSts
histogram with the nb of T0 digis per event vs seed time of the events
TH2 * fhNbDigiPerEvtTimeT0
histogram with the nb of all digis per event vs seed time of the events
static Bool_t IsPresent(ECbmModuleId systemId)
Presence of a digi branch.
virtual void Exec(Option_t *)
static CbmDigiManager * Instance()
Static instance.
virtual InitStatus ReInit()
@ kHodo
Hodoscope (for test beam times)
Int_t fTriggerMaxTrdDigis
const Digi * Get(Int_t index) const
Get a digi object.
std::vector< std::pair< ECbmModuleId, Int_t > > fVect
for digi sorting
Int_t fNrTs
Error Counter.
Int_t fErrors
Event Counter.
Int_t fTriggerMinStsDigis
@ kRich
Ring-Imaging Cherenkov Detector.
TH2 * fhNbDigiPerEvtTimePsd
histogram with the nb of RICH digis per event vs seed time of the events
std::vector< CbmEvent * > fEventVector
pointer to the event which is currently build
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
TClonesArray * fEvents
input container of TO digis
Data class for expanded digital TOF information.
~CbmMcbm2018EventBuilder()
TH1 * fhEventSize
histogram with the interval in seed time of consecutive events
Int_t fTriggerMaxPsdDigis
@ kTrd
Transition Radiation Detector.
TH1 * fhEventTime
histogram with the time difference between two consecutive digis
TH2 * fhNbDigiPerEvtTimeRich
histogram with the nb of TOF digis per event vs seed time of the events
TH2 * fhNbDigiPerEvtTimeTof
histogram with the nb of TRD digis per event vs seed time of the events
TH1 * fDiffTime
vector with all created events
Int_t fTriggerMaxTofDigis
Int_t fTriggerMinPsdDigis
Class characterising one event by a collection of links (indices) to data objects,...
Int_t fTriggerMinTrdDigis
@ kMuch
Muon detection system.
EventBuilderAlgo fEventBuilderAlgo
Switch ON/OFF filling of histograms.
@ kPsd
Projectile spectator detector.
Bool_t fbUseBaseMuchDigi
Save previous time information.
std::multimap< Double_t, digituple > fSorter
array with pointers to input containers
Int_t fTriggerMaxMuchDigis
Int_t fTriggerMinMuchDigis
TClonesArray * fT0DigiArr
Int_t fTriggerMaxRichDigis
@ kSts
Silicon Tracking System.
std::string ToString(const T &value)
TH2 * fhNbDigiPerEvtTime
histogram with the nb of all digis in the event
void AddDigiToEvent(ECbmModuleId, Int_t)
void SetEndTime(Double_t endTime)