BmnRoot
Loading...
Searching...
No Matches
BmnSlewingTOF700.h
Go to the documentation of this file.
1#ifndef BmnSlewingTOF700_H
2#define BmnSlewingTOF700_H 1
3
4#include <bitset>
5#include <cstdio>
6#include <cstdlib>
7#include <deque>
8#include <fstream>
9#include <iostream>
10#include <list>
11#include <map>
12#include <stdio.h>
13#include <stdlib.h>
14#include <vector>
15// ROOT
16#include "TClonesArray.h"
17#include "TFile.h"
18#include "TString.h"
19#include "TSystem.h"
20#include "TTimeStamp.h"
21#include "TTree.h"
22// BmnRoot
23#include "BmnADCDigit.h"
24#include "BmnCscRaw2Digit.h"
25#include "BmnDchRaw2Digit.h"
26#include "BmnECALRaw2Digit.h"
27#include "BmnEnums.h"
28#include "BmnEventHeader.h"
29#include "BmnGemRaw2Digit.h"
30#include "BmnGemStripDigit.h"
31#include "BmnHRBDigit.h"
32#include "BmnMwpcRaw2Digit.h"
33#include "BmnSiliconRaw2Digit.h"
34#include "BmnSyncDigit.h"
35#include "BmnTDCDigit.h"
36#include "BmnTQDCADCDigit.h"
37#include "BmnTof1Raw2Digit.h"
38#include "BmnTof2Raw2DigitNew.h"
39#include "BmnTrigRaw2Digit.h"
40#include "BmnZDCRaw2Digit.h"
41#include "DigiArrays.h"
42#include "RawTypes.h"
43
44const UInt_t kRUNNUMBERSYNC1 = 0x236E7552;
45const size_t kWORDSIZE1 = sizeof(UInt_t);
46
47/********************************************************/
48
49// wait limit for input data (ms)
50using namespace std;
51
53{
54 public:
55 BmnSlewingTOF700(TString file, ULong_t nEvents = 0, ULong_t period = 4);
57 virtual ~BmnSlewingTOF700();
58
60 Int_t GetUTCShift(TTimeStamp t);
61
65 void ResetDecoder(TString file);
69
72
73 void SetQue(deque<UInt_t>* v) { fDataQueue = v; }
74
75 deque<UInt_t>* GetQue() { return fDataQueue; }
76
77 void SetRunId(UInt_t v) { fRunId = v; }
78
79 void SetPeriodId(UInt_t v) { fPeriodId = v; }
80
81 map<UInt_t, Long64_t> GetTimeShifts() { return fTimeShifts; }
82
83 UInt_t GetRunId() const { return fRunId; }
84
85 UInt_t GetPeriodId() const { return fPeriodId; }
86
87 UInt_t GetNevents() const { return fNevents; }
88
89 UInt_t GetEventId() const { return fEventId; }
90
91 BmnTof2Raw2DigitNew* GetTof700Mapper() { return fTof700Mapper; }
92
93 void SetTrigPlaceMapping(TString map) { fTrigPlaceMapFileName = map; }
94
95 void SetTrigChannelMapping(TString file) { fTrigChannelMapFileName = file; }
96
97 void SetTof700Mapping(TString map) { fTof700MapFileName = map; }
98
99 TString GetRootFileName() { return fRootFileName; }
100
102 {
103 for (Int_t i = 0; i < 11; ++i) {
104 fDetectorSetup[i] = setup[i];
105 }
106
107 return kBMNSUCCESS;
108 }
109
110 void SetBmnSetup(BmnSetup v) { this->fBmnSetup = v; }
111
112 BmnSetup GetBmnSetup() const { return fBmnSetup; }
113
114 private:
115 const TTimeStamp TimeZero = TTimeStamp(time_t(0), 0);
116
117 // 9 bits correspond to detectors which we need to decode
118 Bool_t fDetectorSetup[11];
119
120 bool isRawRootInputFile;
121
122 Int_t GetRunIdFromFile(TString name);
123
124 TString GetSubNameAfterRunId(TString name, Int_t RunID);
125
126 UInt_t fRunId;
127 TTimeStamp fRunStartTime;
128 TTimeStamp fRunEndTime;
129 UInt_t fPeriodId;
130 UInt_t fEventId;
131 UInt_t fNevents;
132 // for event
133 Long64_t fTime_s;
134 Long64_t fTime_ns;
135 // for run
136 Long64_t fTimeStart_s;
137 Long64_t fTimeStart_ns;
138 Long64_t fTimeFinish_s;
139 Long64_t fTimeFinish_ns;
140
141 Long64_t fLengthRawFile;
142 Long64_t fCurentPositionRawFile;
143
144 TTree* fRawTree;
145 TTree* fDigiTree;
146 TString fRootFileName;
147 TString fRawFileName;
148 TString fTof700MapFileName;
149 TString fTof700GeomFileName;
150 TString fTrigPlaceMapFileName;
151 TString fTrigChannelMapFileName;
152
153 ifstream fTrigMapFile;
154 ifstream fTrigINLFile;
155
156 TFile* fRootFileIn;
157 TFile* fRootFileOut;
158 FILE* fRawFileIn;
159
160 // DAQ arrays
161 TClonesArray* sync;
162 TClonesArray* adc32; // gem
163 TClonesArray* adc128; // sts
164 TClonesArray* adc; // zdc & ecal
165 TClonesArray* hrb;
166 TClonesArray* tdc;
167 TClonesArray* tqdc_tdc;
168 TClonesArray* tqdc_adc;
169 TClonesArray* msc;
170 TClonesArray* eventHeaderDAQ;
171 // TClonesArray *runHeaderDAQ;
172 TClonesArray* pedestalAdc;
173
174 // header array
175 TClonesArray* eventHeader;
176
177 UInt_t data[10000000];
178 ULong_t fMaxEvent;
179
180 UInt_t fDat; // current 32-bits word
181 UInt_t syncCounter;
182 BmnTrigRaw2Digit* fTrigMapper;
183 BmnTof2Raw2DigitNew* fTof700Mapper;
184 BmnEventType fCurEventType;
185 BmnEventType fPrevEventType;
186 BmnSetup fBmnSetup;
187 UInt_t fT0Serial;
188 deque<UInt_t>* fDataQueue;
189
190 // Map to store pairs <Crate serial> - <crate time - T0 time>
191 map<UInt_t, Long64_t> fTimeShifts;
192 Double_t fT0Time; // ns
193 Double_t fT0Width; // ns
194
195 map<TTimeStamp, Int_t> leaps;
196 TTimeStamp utc_valid;
197 Int_t tai_utc_dif;
198
199 BmnStatus GetT0Info(Double_t& t0time, Double_t& t0width);
200 BmnStatus FillTimeShiftsMap();
201 BmnStatus FillTimeShiftsMapNoDB(UInt_t t0serial);
202};
203
204#endif
const size_t kWORDSIZE1
const UInt_t kRUNNUMBERSYNC1
__m128 v
Definition P4_F32vec4.h:1
int i
Definition P4_F32vec4.h:22
BmnStatus
Definition BmnEnums.h:24
@ kBMNSUCCESS
Definition BmnEnums.h:25
BmnSetup
Definition BmnEnums.h:89
BmnEventType
Definition BmnEnums.h:69
BmnStatus PreparationTOF700Init()
BmnTof2Raw2DigitNew * GetTof700Mapper()
UInt_t GetEventId() const
void ResetDecoder(TString file)
BmnStatus SlewingTOF700Init()
Int_t GetUTCShift(TTimeStamp t)
map< UInt_t, Long64_t > GetTimeShifts()
void SetTrigPlaceMapping(TString map)
BmnStatus DisposeDecoder()
BmnStatus InitMaps()
void SetTof700Mapping(TString map)
void SetQue(deque< UInt_t > *v)
TString GetRootFileName()
BmnSetup GetBmnSetup() const
void SetRunId(UInt_t v)
deque< UInt_t > * GetQue()
void SetPeriodId(UInt_t v)
BmnStatus PreparationTOF700()
BmnStatus SetDetectorSetup(Bool_t *setup)
UInt_t GetNevents() const
UInt_t GetRunId() const
BmnStatus InitDecoder()
void SetTrigChannelMapping(TString file)
void SetBmnSetup(BmnSetup v)
BmnStatus ClearArrays()
UInt_t GetPeriodId() const
Definition setup.py:1
STL namespace.