CbmRoot
CbmMcbm2018Source.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 // ----- -----
3 // ----- CbmMcbm2018Source -----
4 // ----- Created 19.01.2018 by P.-A. Loizeau -----
5 // ----- -----
6 // -----------------------------------------------------------------------------
7 
8 #ifndef CBMMCBM2018SOURCE_H
9 #define CBMMCBM2018SOURCE_H
10 
11 #include "MicrosliceDescriptor.hpp"
12 #include "Timeslice.hpp"
13 #include "TimesliceSource.hpp"
14 
15 #include "FairSource.h"
16 
17 #include "TList.h"
18 #include "TObjString.h"
19 #include "TStopwatch.h"
20 #include "TString.h"
21 
22 #include <map>
23 #include <memory>
24 #include <unordered_set>
25 
26 #include "CbmDefs.h"
27 
28 class CbmMcbmUnpack;
29 
30 class TH1I;
31 class TProfile;
32 class TClonesArray;
33 
34 class CbmMcbm2018Source : public FairSource {
35 public:
37 
38  CbmMcbm2018Source(const CbmMcbm2018Source& source) = delete;
40 
41  virtual ~CbmMcbm2018Source();
42 
43  Bool_t Init();
44  Int_t ReadEvent(UInt_t);
45 
46  Source_Type GetSourceType() { return kONLINE; }
47 
48  virtual void SetParUnpackers();
49 
50  virtual Bool_t InitUnpackers();
51 
52  virtual Bool_t ReInitUnpackers();
53 
54  void Close();
55  void Reset();
56 
57  void SetFileName(TString name) {
58  fFileName = name;
59  fInputFileList.Add(new TObjString(name));
60  }
61  void SetInputDir(TString name) { fDirName = name; }
62  void SetHostName(TString name) { fHost = name; }
63 
64  void
65  AddUnpacker(CbmMcbmUnpack* unpacker, Int_t flibId, ECbmModuleId /*detId*/) {
66  fUnpackers.insert(std::pair<Int_t, CbmMcbmUnpack*>(flibId, unpacker));
67  }
68 
69  void AddFile(const char* name) { fInputFileList.Add(new TObjString(name)); }
70 
71  UInt_t GetTsCount() { return fTSCounter; }
73 
74  void SetDataReductionMuch(UInt_t uTsReduction = 15) {
75  fuTsReduction = uTsReduction;
76  }
77 
78  void SetSubscriberHwm(UInt_t val = 1) { fuSubscriberHwm = val; }
79 
80  void SetWriteOutputFlag(Bool_t bFlagIn) { fbWriteOutput = bFlagIn; }
81 
82 private:
83  TString fFileName;
84  TString fDirName;
86  TString fHost;
87 
88  std::multimap<Int_t, CbmMcbmUnpack*>
90  std::unordered_set<CbmMcbmUnpack*>
92 
93  UInt_t fTSNumber;
94  UInt_t fTSCounter;
95  TStopwatch fTimer;
96 
98  TProfile* fHistoMissedTSEvo;
100 
102 
103  std::unique_ptr<fles::TimesliceSource> fSource;
104 
106 
107  Bool_t CheckTimeslice(const fles::Timeslice& ts);
108  void PrintMicroSliceDescriptor(const fles::MicrosliceDescriptor& mdsc);
109 
110  Int_t FillBuffer();
111 
113  Bool_t
115  TClonesArray* fTimeSliceMetaDataArray;
116 
117  ClassDef(CbmMcbm2018Source, 2)
118 };
119 
120 
121 #endif
CbmMcbm2018Source::Reset
void Reset()
Definition: CbmMcbm2018Source.cxx:199
CbmMcbm2018Source::fHost
TString fHost
Definition: CbmMcbm2018Source.h:86
CbmMcbm2018Source::fHistoMissedTS
TH1I * fHistoMissedTS
Definition: CbmMcbm2018Source.h:97
CbmMcbm2018Source::fTSCounter
UInt_t fTSCounter
Definition: CbmMcbm2018Source.h:94
CbmMcbm2018Source::SetHostName
void SetHostName(TString name)
Definition: CbmMcbm2018Source.h:62
CbmMcbm2018Source::operator=
CbmMcbm2018Source operator=(const CbmMcbm2018Source &)=delete
CbmMcbm2018Source::GetSourceType
Source_Type GetSourceType()
Definition: CbmMcbm2018Source.h:46
CbmMcbm2018Source::SetSubscriberHwm
void SetSubscriberHwm(UInt_t val=1)
Definition: CbmMcbm2018Source.h:78
CbmMcbm2018Source::Close
void Close()
Definition: CbmMcbm2018Source.cxx:187
ECbmModuleId
ECbmModuleId
Definition: CbmDefs.h:33
CbmMcbm2018Source::AddUnpacker
void AddUnpacker(CbmMcbmUnpack *unpacker, Int_t flibId, ECbmModuleId)
Definition: CbmMcbm2018Source.h:65
CbmMcbm2018Source::fDirName
TString fDirName
Definition: CbmMcbm2018Source.h:84
CbmMcbm2018Source::AddFile
void AddFile(const char *name)
Definition: CbmMcbm2018Source.h:69
CbmMcbm2018Source::ReInitUnpackers
virtual Bool_t ReInitUnpackers()
Definition: CbmMcbm2018Source.cxx:141
CbmMcbm2018Source::fSource
std::unique_ptr< fles::TimesliceSource > fSource
Definition: CbmMcbm2018Source.h:103
CbmMcbm2018Source::SetDataReductionMuch
void SetDataReductionMuch(UInt_t uTsReduction=15)
Definition: CbmMcbm2018Source.h:74
CbmMcbm2018Source::SetParUnpackers
virtual void SetParUnpackers()
Definition: CbmMcbm2018Source.cxx:123
CbmMcbm2018Source::fHistoMissedTSEvo
TProfile * fHistoMissedTSEvo
Definition: CbmMcbm2018Source.h:98
CbmMcbm2018Source::SetFileName
void SetFileName(TString name)
Definition: CbmMcbm2018Source.h:57
CbmMcbm2018Source::FillBuffer
Int_t FillBuffer()
Definition: CbmMcbm2018Source.cxx:206
CbmMcbm2018Source::SetWriteOutputFlag
void SetWriteOutputFlag(Bool_t bFlagIn)
Definition: CbmMcbm2018Source.h:80
CbmMcbm2018Source::~CbmMcbm2018Source
virtual ~CbmMcbm2018Source()
Definition: CbmMcbm2018Source.cxx:52
CbmMcbm2018Source::Init
Bool_t Init()
Definition: CbmMcbm2018Source.cxx:54
CbmMcbm2018Source::CbmMcbm2018Source
CbmMcbm2018Source(const CbmMcbm2018Source &source)=delete
CbmMcbm2018Source::GetTsCount
UInt_t GetTsCount()
Definition: CbmMcbm2018Source.h:71
CbmMcbm2018Source::fuSubscriberHwm
UInt_t fuSubscriberHwm
Definition: CbmMcbm2018Source.h:105
CbmMcbm2018Source::GetNofTSSinceLastTS
UInt_t GetNofTSSinceLastTS()
Definition: CbmMcbm2018Source.h:72
CbmMcbm2018Source::fFileName
TString fFileName
Definition: CbmMcbm2018Source.h:83
CbmMcbm2018Source::ReadEvent
Int_t ReadEvent(UInt_t)
Definition: CbmMcbm2018Source.cxx:151
CbmMcbm2018Source::CheckTimeslice
Bool_t CheckTimeslice(const fles::Timeslice &ts)
Definition: CbmMcbm2018Source.cxx:177
CbmMcbm2018Source
Definition: CbmMcbm2018Source.h:34
CbmMcbm2018Source::fuTsReduction
UInt_t fuTsReduction
Definition: CbmMcbm2018Source.h:101
CbmMcbm2018Source::fTSNumber
UInt_t fTSNumber
List of all unpackers for which at least one matching container was found.
Definition: CbmMcbm2018Source.h:93
CbmMcbm2018Source::fTimeSliceMetaDataArray
TClonesArray * fTimeSliceMetaDataArray
If ON the output TClonesArray of meta-data is written to disk.
Definition: CbmMcbm2018Source.h:115
CbmMcbm2018Source::InitUnpackers
virtual Bool_t InitUnpackers()
Definition: CbmMcbm2018Source.cxx:131
CbmMcbm2018Source::fNofTSSinceLastTS
Int_t fNofTSSinceLastTS
Definition: CbmMcbm2018Source.h:99
CbmMcbm2018Source::fInputFileList
TList fInputFileList
List of input files.
Definition: CbmMcbm2018Source.h:85
CbmMcbm2018Source::fUnpackersToRun
std::unordered_set< CbmMcbmUnpack * > fUnpackersToRun
List pairs of system ID and unpacker pointer (unpacker can appear multiple times)
Definition: CbmMcbm2018Source.h:91
CbmMcbm2018Source::fbWriteOutput
Bool_t fbWriteOutput
Output ClonesArray.
Definition: CbmMcbm2018Source.h:114
CbmMcbmUnpack
Definition: CbmMcbmUnpack.h:15
CbmMcbm2018Source::SetInputDir
void SetInputDir(TString name)
Definition: CbmMcbm2018Source.h:61
CbmMcbm2018Source::PrintMicroSliceDescriptor
void PrintMicroSliceDescriptor(const fles::MicrosliceDescriptor &mdsc)
Definition: CbmMcbm2018Source.cxx:159
CbmMcbm2018Source::CbmMcbm2018Source
CbmMcbm2018Source()
Definition: CbmMcbm2018Source.cxx:32
CbmMcbm2018Source::fTimer
TStopwatch fTimer
Definition: CbmMcbm2018Source.h:95
CbmMcbm2018Source::fUnpackers
std::multimap< Int_t, CbmMcbmUnpack * > fUnpackers
Definition: CbmMcbm2018Source.h:89
CbmDefs.h