1#ifndef BMNTOF2RAW2DIGITNEW_H
2#define BMNTOF2RAW2DIGITNEW_H
6#define HPTIMEBIN 0.02344
7#define INVHPTIMEBIN 42.6666
9#define TOF2_MAX_STRIPS_IN_CHAMBER 32
10#define TOF2_MAX_CHANNELS_IN_SLOT 64
12#define TOF2_MAX_CHANNELS_IN_MODULE 64
13#define TOF2_MAX_CRATES 5
14#define TOF2_MAX_SLOTS_IN_CRATE 20
16#define TOF2_MAX_CHAMBERS 59
17#define TOF2_MAX_CHANNEL 4000
20#define TOF700_TDC_TYPE (0x53)
22#include "BmnADCDigit.h"
24#include "BmnSyncDigit.h"
25#include "BmnTDCDigit.h"
26#include "BmnTof2Digit.h"
28#include "TClonesArray.h"
31#include "TProfile2D.h"
38#include <unordered_map>
55 TString RunFile =
"empty",
57 UInt_t SlewingChamber = 0,
58 TString geomFile =
"TOF700_geometry_run7.txt");
64 void getEventInfo(
long long* ev,
long long* t1,
long long* t2);
78 for (
int c = 0; c < MaxPlane; c++)
85 if (c > 0 && c <= MaxPlane) {
86 if (wcut != Wcutc[c - 1]) {
94 if (c > 0 && c <= MaxPlane)
104 for (
int c = 0; c < MaxPlane; c++)
111 if (c > 0 && c <= MaxPlane) {
112 if (wm != Wmaxc[c - 1]) {
120 if (c > 0 && c <= MaxPlane)
128 if (wcut != Wcut || wm != Wmax) {
131 for (
int c = 0; c < MaxPlane; c++)
138 if (wt0m != WT0max) {
140 for (
int c = 0; c < MaxPlane; c++)
148 if (wt0m != WT0min) {
150 for (
int c = 0; c < MaxPlane; c++)
161 if (wt1 != WT0min || wt2 != WT0max) {
164 for (
int c = 0; c < MaxPlane; c++)
171 if (c > 0 && c <= MaxPlane)
172 if (leadmin != LeadMin[c - 1]) {
173 LeadMin[c - 1] = leadmin;
179 if (c > 0 && c <= MaxPlane)
180 return LeadMin[c - 1];
187 if (c > 0 && c <= MaxPlane)
188 if (leadmax != LeadMax[c - 1]) {
189 LeadMax[c - 1] = leadmax;
195 if (c > 0 && c <= MaxPlane)
196 return LeadMax[c - 1];
203 if (c > 0 && c <= MaxPlane)
204 if (leadmin != LeadMin[c - 1] || leadmax != LeadMax[c - 1]) {
205 LeadMin[c - 1] = leadmin;
206 LeadMax[c - 1] = leadmax;
211 void fillPreparation(TClonesArray* data, unordered_map<UInt_t, Long64_t>* ts, Double_t t0, Double_t t0width);
213 unordered_map<UInt_t, Long64_t>* ts,
216 TClonesArray* tof2digit);
217 void fillSlewingT0(TClonesArray* data, unordered_map<UInt_t, Long64_t>* ts, Double_t t0, Double_t t0width);
218 void fillSlewing(TClonesArray* data, unordered_map<UInt_t, Long64_t>* ts, Double_t t0, Double_t t0width);
219 void fillEqualization(TClonesArray* data, unordered_map<UInt_t, Long64_t>* ts, Double_t t0, Double_t t0width);
241 int get_strip_xyz(
int chamber,
int strip,
float* x,
float* y,
float* z);
243 int get_track_hits(
float* xyz,
float* cxyy,
int* nhits,
int* chamb,
int* strip);
245 float get_hit_x0(
int chamber,
int strip,
float diff);
246 void get_hit_xyz0(
int chamber,
int strip,
float diff,
float* x,
float* y,
float* z);
247 float get_hit_diff(
int chamber,
int strip,
float diff_corrected);
248 float get_hit_x(
int chamber,
int strip,
float diff_corrected);
249 void get_hit_xyz(
int chamber,
int strip,
float diff_corrected,
float* x,
float* y,
float* z);
250 float get_hit_xp(
int chamber,
int strip,
float diff);
251 void get_hit_xyzp(
int chamber,
int strip,
float diff,
float* x,
float* y,
float* z);
252 float get_hit_xng(
int chamber,
int strip,
float diff);
253 void get_hit_xyzng(
int chamber,
int strip,
float diff,
float* x,
float* y,
float* z);
254 float get_hit_xnl(
int chamber,
int strip,
float diff);
255 void get_hit_xyznl(
int chamber,
int strip,
float diff,
float* x,
float* y,
float* z);
263 Double_t*
GetINL() {
return &DNL_Table[0][0][0][0]; }
270 char filname_base[256];
271 char filname_base_results[256];
273 TString fPreparationFileName;
283 long long EVENT, TIME_SEC, TIME_NS;
299 int nslots, ncrates, nchambers;
303 double chtima[10][25][64];
310 int numcrate(
int id);
317 TH2F *poffsets, *poffsets1, *poffsets2;
325 TProfile* Toffsets[4];
326 TProfile* Toffsetsf[4];
350 float xoffs, xoffs2, yoffs, zoffs;
#define TOF2_MAX_STRIPS_IN_CHAMBER
#define TOF2_MAX_CHAMBERS
#define TOF2_MAX_SLOTS_IN_CRATE
#define TOF2_MAX_CHANNELS_IN_SLOT
void fillEvent(TClonesArray *data, unordered_map< UInt_t, Long64_t > *ts, Double_t t0, Double_t t0width, TClonesArray *tof2digit)
void getEventInfo(long long *ev, long long *t1, long long *t2)
float get_hit_diff(int chamber, int strip, float diff_corrected)
int readXYCalibrationNew(char *xcalibration, char *ycalibration)
int readXYCalibration(char *xcalibration, char *ycalibration)
int readGeom(const char *geomFile)
void get_hit_xyzp(int chamber, int strip, float diff, float *x, float *y, float *z)
virtual ~BmnTof2Raw2DigitNew()
void readSlewing(Bool_t update=false)
int get_strip_xyz(int chamber, int strip, float *x, float *y, float *z)
float get_hit_xp(int chamber, int strip, float diff)
void WritePreparationHists()
void BookSlewingResults()
int get_ch_tdc72vhl(unsigned int tdc, unsigned int ch)
void fillSlewing(TClonesArray *data, unordered_map< UInt_t, Long64_t > *ts, Double_t t0, Double_t t0width)
void SetLeadMin(int c, int leadmin)
float get_hit_diff0(int chamber, int strip, float diff)
void SetPreparationFileName(TString prep)
float get_hit_xnl(int chamber, int strip, float diff)
void get_hit_xyz0(int chamber, int strip, float diff, float *x, float *y, float *z)
int get_ch_tdc64vhle(unsigned int tdc, unsigned int ch)
int get_ch_tdc32vl(unsigned int tdc, unsigned int ch)
int readLRoffsets(char *LRoffsetsFile)
void WritePreparationHists0()
void SetWmaxc(int c, int wm)
void SetWcutc(int c, int wcut)
float get_hit_x(int chamber, int strip, float diff_corrected)
void get_hit_xyzng(int chamber, int strip, float diff, float *x, float *y, float *z)
void WriteSlewingResults()
void fillEqualization(TClonesArray *data, unordered_map< UInt_t, Long64_t > *ts, Double_t t0, Double_t t0width)
void SetW(int wcut, int wm)
float get_hit_x0(int chamber, int strip, float diff)
void get_hit_xyz(int chamber, int strip, float diff_corrected, float *x, float *y, float *z)
void fillSlewingT0(TClonesArray *data, unordered_map< UInt_t, Long64_t > *ts, Double_t t0, Double_t t0width)
void writeSlewingLimits()
void SetT0shift(float shift)
void fillPreparation(TClonesArray *data, unordered_map< UInt_t, Long64_t > *ts, Double_t t0, Double_t t0width)
void SetLeadMinMax(int c, int leadmin, int leadmax)
int get_chamber_z(int chamber, float *z)
void get_hit_xyznl(int chamber, int strip, float diff, float *x, float *y, float *z)
void SetWT0(int wt1, int wt2)
int get_track_hits(float *xyz, float *cxyy, int *nhits, int *chamb, int *strip)
void SetLeadMax(int c, int leadmax)
void SetSlewingReference(Int_t chamber, Int_t refrun, Int_t refchamber)
float get_hit_xng(int chamber, int strip, float diff)
Bmn_Tof2_map_element_new()