CbmRoot
Loading...
Searching...
No Matches
CbmDaq.h
Go to the documentation of this file.
1/* Copyright (C) 2012-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer] */
4
12#ifndef CBMDAQ_H
13#define CBMDAQ_H 1
14
15#include "CbmDefs.h" // for ECbmModuleId
16#include "CbmMCEventList.h" // for CbmMCEventList
17
18#include <FairTask.h> // for FairTask, InitStatus
19
20#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
21#include <RtypesCore.h> // for Int_t, Double_t, Bool_t, kFALSE, ULong64_t
22#include <TStopwatch.h> // for TStopwatch
23
24#include <map> // for map
25#include <string> // for string
26#include <utility> // for pair
27class CbmDigi;
28class CbmDigitizeBase;
29class CbmTimeSlice;
30class TClonesArray;
31
32
44class CbmDaq : public FairTask {
45
46 public:
57 CbmDaq(Bool_t eventMode = kFALSE);
58
59
63 CbmDaq(Double_t tsLength);
64
65
67 ~CbmDaq();
68
69
71 virtual void Exec(Option_t* opt);
72
73
75 virtual InitStatus Init();
76
77
95 void SetLatency(Double_t time);
96
101 void SetDigitizer(ECbmModuleId system, CbmDigitizeBase* digitizer);
102
103
107 void SetTimeSliceLength(Double_t length) { fTimeSliceLength = length; }
108
109
115 void StoreAllTimeSlices(Bool_t choice = kTRUE) { fStoreEmptySlices = choice; }
116
117
118 private:
121 Double_t fLatency = 5000.;
124
126 Int_t fNofDigis;
130 Double_t fTimeDigiFirst;
131 Double_t fTimeDigiLast;
133 Double_t fTimeSliceLast;
134
135 TStopwatch fTimer;
136 std::map<ECbmModuleId, TClonesArray*> fDigis;
137 std::map<ECbmModuleId, CbmDigitizeBase*> fDigitizers;
141
142
144 std::map<Int_t, std::pair<Int_t, Int_t>> fEventRange;
145
146
150 Bool_t CheckOutput() const;
151
152
157 void CloseTimeSlice();
158
159
165 Int_t CopyEventList();
166
167
171 void FillData(CbmDigi* digi);
172 //TODO: Obsolete, remove
173
174
180 ULong64_t FillTimeSlice(Bool_t timeLimit, Double_t fillTime = -1.);
181
182
186 ULong64_t GetBufferSize() const;
187
188
192 std::string GetBufferStatus(Bool_t verbose = kFALSE) const;
193
194
198 Double_t GetBufferTimeFirst() const;
199
200
204 Double_t GetBufferTimeLast() const;
205
206
210 Bool_t IsDaqBufferEmpty() const;
211
212
216 void PrintCurrentEventRange() const;
217
218
220 void StartNextTimeSlice();
221
222
224 virtual void Finish();
225
226
228 CbmDaq(const CbmDaq&) = delete;
229 CbmDaq& operator=(const CbmDaq&) = delete;
230
232};
233
234#endif /* CBMDAQ_H */
ECbmModuleId
Definition CbmDefs.h:39
CBM task class for filling digis into time slices.
Definition CbmDaq.h:44
Int_t fNofTimeSlices
Number of time slices.
Definition CbmDaq.h:128
Int_t fNofEvents
Number of processed events.
Definition CbmDaq.h:125
Bool_t IsDaqBufferEmpty() const
Check for empty DAQ buffers.
Definition CbmDaq.cxx:442
TStopwatch fTimer
Definition CbmDaq.h:135
Double_t fLatency
Maximal time disorder of input data [ns].
Definition CbmDaq.h:121
std::map< ECbmModuleId, TClonesArray * > fDigis
Stop watch.
Definition CbmDaq.h:136
Double_t fTimeDigiFirst
Time of first digi.
Definition CbmDaq.h:130
Int_t fNofDigisIgnored
Number of ignored digis.
Definition CbmDaq.h:127
CbmDaq(const CbmDaq &)=delete
CbmDaq(Bool_t eventMode=kFALSE)
Constructor.
Definition CbmDaq.cxx:46
Bool_t CheckOutput() const
Check the output arrays for being time-sorted.
Definition CbmDaq.cxx:107
Int_t fNofTimeSlicesEmpty
Number of empty time slices.
Definition CbmDaq.h:129
void StartNextTimeSlice()
Start a new time slice in the output tree.
Definition CbmDaq.cxx:490
void FillData(CbmDigi *digi)
Copy data (digi) from the DaqBuffer into the output array.
Double_t fTimeSliceLength
Time-slice length [ns].
Definition CbmDaq.h:120
Int_t CopyEventList()
Definition CbmDaq.cxx:160
Double_t fTimeDigiLast
Time of last digi.
Definition CbmDaq.h:131
Bool_t fIsEventByEvent
Flag for event-by-event mode.
Definition CbmDaq.h:119
Int_t fNofDigis
Total number of processed digis.
Definition CbmDaq.h:126
CbmDaq & operator=(const CbmDaq &)=delete
void SetLatency(Double_t time)
Set the DAQ buffer latency.
Definition CbmDaq.cxx:512
Double_t fTimeSliceFirst
Start time of first time slice.
Definition CbmDaq.h:132
CbmTimeSlice * fTimeSlice
Array of registered digitizers.
Definition CbmDaq.h:138
~CbmDaq()
Destructor
Definition CbmDaq.cxx:102
std::string GetBufferStatus(Bool_t verbose=kFALSE) const
Debug output of DAQ buffer status @value String with status of DAQ buffers.
Definition CbmDaq.cxx:346
std::map< Int_t, std::pair< Int_t, Int_t > > fEventRange
MC events for current time slice.
Definition CbmDaq.h:144
void StoreAllTimeSlices(Bool_t choice=kTRUE)
Store all time-slices.
Definition CbmDaq.h:115
CbmMCEventList * fEventsCurrent
MC event list (all)
Definition CbmDaq.h:140
Double_t GetBufferTimeFirst() const
Time of first datum in DAQ buffers @value Minimum time stamp in all DAQ buffers.
Definition CbmDaq.cxx:366
void SetTimeSliceLength(Double_t length)
Set the time-slice length.
Definition CbmDaq.h:107
virtual InitStatus Init()
Initialisation.
Definition CbmDaq.cxx:398
virtual void Exec(Option_t *opt)
Task execution.
Definition CbmDaq.cxx:179
ULong64_t GetBufferSize() const
Size of DAQ buffers @value Sum of number of data in all DAQ buffers.
Definition CbmDaq.cxx:335
Bool_t fStoreEmptySlices
Flag to store also empty time slices.
Definition CbmDaq.h:122
void PrintCurrentEventRange() const
Definition CbmDaq.cxx:457
Double_t fTimeEventPrevious
Time of previous event [ns].
Definition CbmDaq.h:123
Double_t GetBufferTimeLast() const
Time of last datum in DAQ buffers @value Maximum time stamp in all DAQ buffers.
Definition CbmDaq.cxx:382
void CloseTimeSlice()
Definition CbmDaq.cxx:118
ULong64_t FillTimeSlice(Bool_t timeLimit, Double_t fillTime=-1.)
Definition CbmDaq.cxx:235
ClassDef(CbmDaq, 4)
Double_t fTimeSliceLast
Stop time of last time slice.
Definition CbmDaq.h:133
void SetDigitizer(ECbmModuleId system, CbmDigitizeBase *digitizer)
Set the digitizer for a given system.
Definition CbmDaq.cxx:481
virtual void Finish()
Definition CbmDaq.cxx:271
CbmMCEventList fEventList
Current time slice.
Definition CbmDaq.h:139
std::map< ECbmModuleId, CbmDigitizeBase * > fDigitizers
Output arrays (digis)
Definition CbmDaq.h:137
Abstract base class for CBM digitisation tasks.
Container class for MC events with number, file and start time.
Bookkeeping of time-slice content.