CbmRoot
CbmOffsetDigiTime.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 // ----- -----
3 // ----- CbmOffsetDigiTime -----
4 // ----- Created 13.02.2020 by P.-A. Loizeau -----
5 // ----- -----
6 // -----------------------------------------------------------------------------
7 
8 #ifndef CBMOFFSETDIGITIME_H
9 #define CBMOFFSETDIGITIME_H
10 
12 
14 #include "FairTask.h"
15 
17 #include "TClonesArray.h"
18 
20 #include <map>
21 #include <set>
22 #include <vector>
23 
24 template<class TDigi>
25 class CbmOffsetDigiTime : public FairTask {
26 public:
27  CbmOffsetDigiTime(TString sDigiBranchName,
28  TString sDigiCalBranchName = "",
29  TString sDigiCalBranchDescr = "");
30 
33 
35 
36 
38  virtual InitStatus Init();
39 
41  virtual InitStatus ReInit();
42 
43 
45  virtual void Exec(Option_t*);
46 
48  virtual void SetParContainers();
49 
51  virtual void Finish();
52 
54  void SetWriteOutputFlag(Bool_t bFlagIn) { fbWriteOutput = bFlagIn; }
55  void AddOffsetPoint(UInt_t uIndexTS, Double_t dOffset) {
56  fmOffsets[uIndexTS] = dOffset;
57  }
58  void AddAddressToOffset(UInt_t uDigiAddress) {
59  fsAddrToOffset.insert(uDigiAddress);
60  }
61 
62 private:
64  Bool_t fbWriteOutput =
65  kTRUE;
66 
68  uint64_t fulTsCounter = 0;
69 
71  std::vector<TDigi> const* fvDigiIn =
72  nullptr;
73  std::vector<TDigi>* fvDigiOut =
74  nullptr;
75 
77  TClonesArray* fArrayDigiIn =
78  nullptr;
79  TClonesArray* fArrayDigiOut =
80  nullptr;
81 
82 
84  std::map<UInt_t, Double_t> fmOffsets =
85  {};
86  Double_t fdCurrentOffset = 0.0;
87  std::map<UInt_t, Double_t>::iterator fmitNextOffset = fmOffsets.end();
88 
90  std::set<UInt_t> fsAddrToOffset =
91  {};
92 
94  TString fsDigiBranchName = "";
95  TString fsDigiBranchNameCal = "";
96  TString fsDigiBranchDescrCal = "";
97 
99 };
100 
102 #include "CbmOffsetDigiTime.tmpl"
103 
104 #endif // CBMOFFSETDIGITIME_H
CbmOffsetDigiTime::SetParContainers
virtual void SetParContainers()
CbmOffsetDigiTime::fmOffsets
std::map< UInt_t, Double_t > fmOffsets
Output array of Digis, propagated to framework for output.
Definition: CbmOffsetDigiTime.h:84
CbmOffsetDigiTime::fsDigiBranchNameCal
TString fsDigiBranchNameCal
Definition: CbmOffsetDigiTime.h:95
CbmOffsetDigiTime::fdCurrentOffset
Double_t fdCurrentOffset
Index is the first TS where the offset is valid.
Definition: CbmOffsetDigiTime.h:86
CbmOffsetDigiTime::fbWriteOutput
Bool_t fbWriteOutput
Control flags.
Definition: CbmOffsetDigiTime.h:64
CbmOffsetDigiTime::~CbmOffsetDigiTime
~CbmOffsetDigiTime()
CbmOffsetDigiTime::fArrayDigiIn
TClonesArray * fArrayDigiIn
Output vector of Digis, propagated to framework for output.
Definition: CbmOffsetDigiTime.h:77
CbmOffsetDigiTime::fmitNextOffset
std::map< UInt_t, Double_t >::iterator fmitNextOffset
Current offset in [ns].
Definition: CbmOffsetDigiTime.h:87
CbmOffsetDigiTime::operator=
CbmOffsetDigiTime operator=(const CbmOffsetDigiTime &)=delete
CbmOffsetDigiTime::Exec
virtual void Exec(Option_t *)
CbmOffsetDigiTime
CbmRoot (+externals) headers.
Definition: CbmOffsetDigiTime.h:25
CbmOffsetDigiTime::Init
virtual InitStatus Init()
CbmOffsetDigiTime::SetWriteOutputFlag
void SetWriteOutputFlag(Bool_t bFlagIn)
Task settings.
Definition: CbmOffsetDigiTime.h:54
CbmOffsetDigiTime::Finish
virtual void Finish()
CbmOffsetDigiTime::CbmOffsetDigiTime
CbmOffsetDigiTime(TString sDigiBranchName, TString sDigiCalBranchName="", TString sDigiCalBranchDescr="")
CbmOffsetDigiTime::fsDigiBranchName
TString fsDigiBranchName
Addresses for which the digi time is offset, if empty applied to all.
Definition: CbmOffsetDigiTime.h:94
CbmOffsetDigiTime::AddAddressToOffset
void AddAddressToOffset(UInt_t uDigiAddress)
Definition: CbmOffsetDigiTime.h:58
CbmOffsetDigiTime::fsDigiBranchDescrCal
TString fsDigiBranchDescrCal
Definition: CbmOffsetDigiTime.h:96
CbmOffsetDigiTime::fvDigiOut
std::vector< TDigi > * fvDigiOut
Input vector of Digis, recovered from framework for input.
Definition: CbmOffsetDigiTime.h:73
CbmOffsetDigiTime::CbmOffsetDigiTime
CbmOffsetDigiTime(const CbmOffsetDigiTime &)=delete
CbmOffsetDigiTime::fsAddrToOffset
std::set< UInt_t > fsAddrToOffset
List of addresses to which the offset should be applied.
Definition: CbmOffsetDigiTime.h:90
CbmOffsetDigiTime::fArrayDigiOut
TClonesArray * fArrayDigiOut
Input array of Digis, recovered from framework for input.
Definition: CbmOffsetDigiTime.h:79
CbmOffsetDigiTime::ClassDef
ClassDef(CbmOffsetDigiTime, 0)
CbmOffsetDigiTime::ReInit
virtual InitStatus ReInit()
CbmOffsetDigiTime::fvDigiIn
std::vector< TDigi > const * fvDigiIn
TS counter, not same as TS index!
Definition: CbmOffsetDigiTime.h:71
CbmOffsetDigiTime::AddOffsetPoint
void AddOffsetPoint(UInt_t uIndexTS, Double_t dOffset)
Definition: CbmOffsetDigiTime.h:55
CbmOffsetDigiTime::fulTsCounter
uint64_t fulTsCounter
If ON the output vector of digi is written to disk by FairRoot, otherwise just made available for hig...
Definition: CbmOffsetDigiTime.h:68