BmnRoot
Loading...
Searching...
No Matches
BmnZDCRaw2Digit.h
Go to the documentation of this file.
1#ifndef BMNZDCRAW2DIGIT_H
2#define BMNZDCRAW2DIGIT_H
3
4#include "TString.h"
5#include "TClonesArray.h"
6#include "TMinuit.h"
7#include "TH1F.h"
8#include "TProfile.h"
9#include "BmnTDCDigit.h"
10#include "BmnADCDigit.h"
11#include "BmnSyncDigit.h"
12#include <iostream>
13#include "Riostream.h"
14#include "BmnZDCDigit.h"
15#include <cstdlib>
16#include <UniRun.h>
17
18#define MAX_EVENTS 10000
19#define MAX_CHANNELS 112
20#define MAX_LOG_CHANNELS 16
21
22static int use_log_function;
23
25public:
27 void set(unsigned long v1,unsigned char v2,unsigned char v3,unsigned char v4,unsigned char v5,unsigned char v6,unsigned char v7, float v8, float v9){
28 id=v1; chan=v2; adc_chan=v3; size=v4; ix=v5; iy=v6; used=v7; x=v8; y=v9;
29 };
30 unsigned long id;
31 unsigned char chan;
32 unsigned char adc_chan;
33 unsigned char size;
34 unsigned char ix;
35 unsigned char iy;
36 unsigned char used;
37 float x;
38 float y;
39};
40
42{
43 public:
44 BmnZDCRaw2Digit(Int_t period, Int_t run, TString mappingFile, TString calibrationFile = "", TString MaxPositionFile = "");
46
47 virtual ~BmnZDCRaw2Digit();
48
49 void print();
50
51 void setParStep(Float_t p) { pstep = p;};
52 Float_t getParStep() { return pstep;};
53
54 void setParStart(Float_t p) { pstart = p;};
55 Float_t getParStart() { return pstart;};
56
57 void setThreshold(Float_t t) { thres = t;};
58 Float_t getThreshold() { return thres;};
59
60 void setEnergy(Float_t e) { shower_energy = e;};
61 Float_t getEnergy() { return shower_energy;};
62
63 void setError(Float_t s) { sigma_amp = s;};
64 Float_t getError() { return sigma_amp;};
65
66 void setNorm(Float_t n) { shower_norm = n;};
67 Float_t getNorm() { return shower_norm;};
68
69 void setType(Int_t t) { wave2amp_flag = t;};
70 Int_t getType() { return wave2amp_flag;};
71
72 void setMinSamples(Int_t m) { min_samples = m;};
73 Int_t getMinSamples() { return min_samples;};
74
75 void setPedSamples(Int_t p) { ped_samples = p;};
76 Int_t getPedSamples() { return ped_samples;};
77
78 void setUseMeanXY(Int_t u) { use_meanxy = u;};
79 Int_t getUseMeanXY() { return use_meanxy;};
80
81 void setLogFunction(Int_t u) { use_log_function = u;};
82 Int_t getUseLogFunction() { return use_log_function;};
83
84 void fillEvent(TClonesArray *data, TClonesArray *zdcdigit);
85
86 void fillAmplitudes(TClonesArray *data);
87
88 int fillCalibrateCluster(TClonesArray *data, Float_t x, Float_t y, Float_t e, Int_t clsize);
89
90 int fillCalibrateNumbers(TClonesArray *data, Float_t x, Float_t y, Float_t e, Int_t ncells, Int_t *numbers);
91
92 int fillCalibrateAll(TClonesArray *data, Float_t x, Float_t y, Float_t e);
93
94 void fillSampleProfiles(TClonesArray *data, Float_t x, Float_t y, Float_t e, Int_t clsize);
95
96 void fillSampleProfilesAll(TClonesArray *data, Float_t x, Float_t y, Float_t e);
97
98 void calibrate();
99
100 void drawzdc(int nohist = 0);
101
102 void drawprof();
103
104 void drawtest();
105
106 float getAmp(int zch) { if (zch < MAX_CHANNELS) return zdc_amp[zch]; else return -1.;};
107
108 float getLogAmp(int lch) { if (lch < MAX_LOG_CHANNELS) return log_amp[lch]; else return -1.;};
109
110 int getLogId(int lch) { if (lch < MAX_LOG_CHANNELS) return test_id[lch]; else return -1;};
111
112 int getLogChan(int lch) { if (lch < MAX_LOG_CHANNELS) return test_chan[lch]; else return -1;};
113
114// void fcn(Int_t& npar, Double_t *gin, Double_t& f, Double_t *par, Int_t iflag);
115
116private:
117 int digiPar[6];
118// char filname_base[256];
119 int maxchan;
120 Bmn_ZDC_map_element zdc_map_element[256];
121 float cell_size[10];
122 int n_rec;
123 float thres;
124 int wave2amp_flag;
125 int MaxPos_min, MaxPos_max;
126 int min_samples;
127 int ped_samples;
128 int use_meanxy;
129 float sigma_amp;
130 float shower_energy;
131 float shower_norm;
132 float x_beam, y_beam;
133 float x_min, y_min;
134 float x_max, y_max;
135 float pstart, pstep;
136 int ncells;
137// int use_log_function;
138// static int nevents;
139
140// static float amp_array[MAX_EVENTS][MAX_CHANNELS];
141// static float profile_amp[MAX_EVENTS][MAX_CHANNELS];
142// static float profile_err[MAX_EVENTS][MAX_CHANNELS];
143 float zdc_amp[MAX_CHANNELS];
144 float log_amp[MAX_LOG_CHANNELS];
145 int number[MAX_CHANNELS];
146 int index[MAX_CHANNELS];
147 int channel0[MAX_CHANNELS];
148 int channel1[MAX_CHANNELS];
149 float cal[MAX_CHANNELS];
150 float cale[MAX_CHANNELS];
151 float cal_out[MAX_CHANNELS];
152 float cale_out[MAX_CHANNELS];
153
154 void cellWeight(int ievent);
155// static void fcn1(Int_t& npar, Double_t *gin, Double_t& f, Double_t *par, Int_t iflag);
156 double ch(double x, double r);
157 double sh(double x, double r);
158 double PP1(double x, double h);
159 double PP2(double x, double h);
160 double shower(double x, double h);
161 float wave2amp(UChar_t ns, UShort_t *s, Float_t *p, Float_t *sigMin, Float_t *sigMax, Float_t *sigPed, Float_t *sigInt);
162 float testwave2amp(UChar_t ns, UShort_t *s, Float_t *p);
163 Int_t periodId;
164 Int_t runId;
165 int n_test;
166 int test_chan[MAX_LOG_CHANNELS];
167 UInt_t test_id[MAX_LOG_CHANNELS];
168 int is_test[256];
169 TH1F *htest[MAX_LOG_CHANNELS];
170 TProfile *TestProf[MAX_LOG_CHANNELS];
171 TH1F *hsum_sim;
172 TH1F *hsum_raw;
173 TH1F *hsum;
174 TH1F *hxmean, *hymean;
175 TProfile *SampleProf[MAX_CHANNELS];
176
177 ClassDef(BmnZDCRaw2Digit, 3);
178};
179#endif /* BMNZDCRAW2DIGIT_H */
180
181
__m128 m
Definition P4_F32vec4.h:27
int fillCalibrateCluster(TClonesArray *data, Float_t x, Float_t y, Float_t e, Int_t clsize)
void setEnergy(Float_t e)
Float_t getParStart()
void setThreshold(Float_t t)
void setPedSamples(Int_t p)
void setParStart(Float_t p)
void fillEvent(TClonesArray *data, TClonesArray *zdcdigit)
Float_t getThreshold()
float getLogAmp(int lch)
void drawzdc(int nohist=0)
void setError(Float_t s)
int getLogChan(int lch)
void fillSampleProfilesAll(TClonesArray *data, Float_t x, Float_t y, Float_t e)
int fillCalibrateAll(TClonesArray *data, Float_t x, Float_t y, Float_t e)
void setMinSamples(Int_t m)
float getAmp(int zch)
void setNorm(Float_t n)
void setParStep(Float_t p)
int fillCalibrateNumbers(TClonesArray *data, Float_t x, Float_t y, Float_t e, Int_t ncells, Int_t *numbers)
void setUseMeanXY(Int_t u)
Int_t getUseLogFunction()
int getLogId(int lch)
void fillSampleProfiles(TClonesArray *data, Float_t x, Float_t y, Float_t e, Int_t clsize)
void fillAmplitudes(TClonesArray *data)
void setType(Int_t t)
void setLogFunction(Int_t u)
void set(unsigned long v1, unsigned char v2, unsigned char v3, unsigned char v4, unsigned char v5, unsigned char v6, unsigned char v7, float v8, float v9)
unsigned char adc_chan
#define MAX_LOG_CHANNELS
#define MAX_CHANNELS
-clang-format