CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018Source.h
Go to the documentation of this file.
1/* Copyright (C) 2018-2020 Facility for Antiproton and Ion Research in Europe, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau [committer], Florian Uhlig */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmMcbm2018Source -----
8// ----- Created 19.01.2018 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#ifndef CBMMCBM2018SOURCE_H
13#define CBMMCBM2018SOURCE_H
14
15#include "CbmDefs.h"
16
17#include "MicrosliceDescriptor.hpp"
18#include "Timeslice.hpp"
19#include "TimesliceSource.hpp"
20
21#include "FairSource.h"
22
23#include "TList.h"
24#include "TObjString.h"
25#include "TStopwatch.h"
26#include "TString.h"
27
28#include <map>
29#include <memory>
30#include <unordered_set>
31
32class CbmMcbmUnpack;
33
34class TH1I;
35class TProfile;
36class TClonesArray;
37
38class CbmMcbm2018Source : public FairSource {
39public:
41
42 CbmMcbm2018Source(const CbmMcbm2018Source& source) = delete;
44
45 virtual ~CbmMcbm2018Source();
46
47 Bool_t Init();
48 Int_t ReadEvent(UInt_t);
49
50 Source_Type GetSourceType() { return kONLINE; }
51
52 virtual void SetParUnpackers();
53
54 virtual Bool_t InitUnpackers();
55
56 virtual Bool_t ReInitUnpackers();
57
58 virtual Bool_t SpecifyRunId() { return true; };
59
60 void Close();
61 void Reset();
62
63 void SetFileName(TString name)
64 {
65 fFileName = name;
66 fInputFileList.Add(new TObjString(name));
67 }
68 void SetInputDir(TString name) { fDirName = name; }
69 void SetHostName(TString name) { fHost = name; }
70
71 void AddUnpacker(CbmMcbmUnpack* unpacker, Int_t flibId, ECbmModuleId /*detId*/)
72 {
73 fUnpackers.insert(std::pair<Int_t, CbmMcbmUnpack*>(flibId, unpacker));
74 }
75
76 void AddFile(const char* name) { fInputFileList.Add(new TObjString(name)); }
77
78 UInt_t GetTsCount() { return fTSCounter; }
80
81 void SetDataReductionMuch(UInt_t uTsReduction = 15) { fuTsReduction = uTsReduction; }
82
83 void UnpackSingleSpill(Int_t iSpillIdx, UInt_t uSpillStart = 1)
84 {
85 fiUnpSpillIdxStart = iSpillIdx;
86 fiUnpSpillIdxStop = iSpillIdx;
87 fuFlagSpillStart = uSpillStart;
88 }
89
90 void UnpackSelectSpills(Int_t iSpillIdxStart, Int_t iSpillIdxStop, UInt_t uSpillStart = 1)
91 {
92 fiUnpSpillIdxStart = iSpillIdxStart;
93 fiUnpSpillIdxStop = iSpillIdxStop;
94 fuFlagSpillStart = uSpillStart;
95 }
96
97 void LoadTsListSpillBreakBegin(std::vector<ULong64_t> vTsBeg)
98 {
99 fvuSpillBreakBegTs.assign(vTsBeg.begin(), vTsBeg.end());
100 }
101 void LoadTsListSpillBreakEnd(std::vector<ULong64_t> vTsEnd)
102 {
103 fvuSpillBreakEndTs.assign(vTsEnd.begin(), vTsEnd.end());
104 }
105 void LoadTsListSpillBreakMiddle(std::vector<ULong64_t> vTsMid)
106 {
107 fvuSpillBreakMidTs.assign(vTsMid.begin(), vTsMid.end());
108 }
109
110 void SetSubscriberHwm(UInt_t val = 1) { fuSubscriberHwm = val; }
111
112 void SetWriteOutputFlag(Bool_t bFlagIn) { fbWriteOutput = bFlagIn; }
113
114private:
115 TString fFileName;
116 TString fDirName;
118 TString fHost;
119
120 std::multimap<Int_t, CbmMcbmUnpack*>
122 std::unordered_set<CbmMcbmUnpack*>
124
125 UInt_t fTSNumber;
127 ULong64_t fTSLength = 0; // used for the creation of the TimesliceMetaData
128 ULong64_t fTSOverlappLength = 0; // used for the creation of the TimesliceMetaData
129 TStopwatch fTimer;
130
134
136
138 Int_t fiUnpSpillIdxStop = -1;
139 UInt_t fuFlagSpillStart = 0;
140 UInt_t fuSpillBegTs = 0;
141 UInt_t fuSpillEndTs = 0;
142
143 std::vector<ULong64_t> fvuSpillBreakBegTs = {};
144 std::vector<ULong64_t> fvuSpillBreakEndTs = {};
145 std::vector<ULong64_t> fvuSpillBreakMidTs = {};
146
147 std::unique_ptr<fles::TimesliceSource> fSource;
148
150
151 Bool_t CheckTimeslice(const fles::Timeslice& ts);
152 void PrintMicroSliceDescriptor(const fles::MicrosliceDescriptor& mdsc);
153
154 Int_t FillBuffer();
155
159
160 ClassDef(CbmMcbm2018Source, 2)
161};
162
163
164#endif
ECbmModuleId
Definition CbmDefs.h:39
TClonesArray * fTimeSliceMetaDataArray
If ON the output TClonesArray of meta-data is written to disk.
void PrintMicroSliceDescriptor(const fles::MicrosliceDescriptor &mdsc)
std::vector< ULong64_t > fvuSpillBreakMidTs
void SetHostName(TString name)
virtual void SetParUnpackers()
virtual Bool_t InitUnpackers()
void AddFile(const char *name)
void LoadTsListSpillBreakBegin(std::vector< ULong64_t > vTsBeg)
Source_Type GetSourceType()
std::unique_ptr< fles::TimesliceSource > fSource
std::vector< ULong64_t > fvuSpillBreakEndTs
void SetFileName(TString name)
void SetSubscriberHwm(UInt_t val=1)
virtual Bool_t ReInitUnpackers()
void UnpackSingleSpill(Int_t iSpillIdx, UInt_t uSpillStart=1)
UInt_t fTSNumber
List of all unpackers for which at least one matching container was found.
CbmMcbm2018Source(const CbmMcbm2018Source &source)=delete
void UnpackSelectSpills(Int_t iSpillIdxStart, Int_t iSpillIdxStop, UInt_t uSpillStart=1)
CbmMcbm2018Source & operator=(const CbmMcbm2018Source &)=delete
Int_t fiUnpSpillIdxStop
>= 0 means unpack only from this spill
void SetDataReductionMuch(UInt_t uTsReduction=15)
void SetInputDir(TString name)
UInt_t fuSpillBegTs
0 = Break begin, 1 = Break middle, 2 = Break end
TList fInputFileList
List of input files.
void AddUnpacker(CbmMcbmUnpack *unpacker, Int_t flibId, ECbmModuleId)
void LoadTsListSpillBreakMiddle(std::vector< ULong64_t > vTsMid)
void LoadTsListSpillBreakEnd(std::vector< ULong64_t > vTsEnd)
std::multimap< Int_t, CbmMcbmUnpack * > fUnpackers
std::unordered_set< CbmMcbmUnpack * > fUnpackersToRun
List pairs of system ID and unpacker pointer (unpacker can appear multiple times)
Bool_t CheckTimeslice(const fles::Timeslice &ts)
void SetWriteOutputFlag(Bool_t bFlagIn)
Bool_t fbWriteOutput
Output ClonesArray.
UInt_t fuFlagSpillStart
>= 0 means unpack only up to this spill (included)
std::vector< ULong64_t > fvuSpillBreakBegTs
virtual Bool_t SpecifyRunId()