4 |
* \date |
* \date |
5 |
*/ |
*/ |
6 |
#include <TrkStruct.h> |
#include <TrkStruct.h> |
7 |
|
//#include <TrkCalib.h> |
8 |
|
|
9 |
using namespace pamela; |
using namespace pamela; |
10 |
using namespace std; |
using namespace std; |
22 |
ret1=(float)ret; |
ret1=(float)ret; |
23 |
return ret1; |
return ret1; |
24 |
} |
} |
25 |
/** |
// /** |
26 |
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
// * Method to fill the tracker calibration-parameter struct from on-line calibrations |
27 |
*/ |
// */ |
28 |
void cTrkCalib::FillACalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
// void cTrkCalib::FillACalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
29 |
|
|
30 |
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
// TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
31 |
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
// TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
32 |
|
|
33 |
CalibTrk1Event *calibdata1 = 0; |
// CalibTrk1Event *calibdata1 = 0; |
34 |
CalibTrk2Event *calibdata2 = 0; |
// CalibTrk2Event *calibdata2 = 0; |
35 |
tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
// tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
36 |
tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
// tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
37 |
tr1->GetEntry(ev_reg1); |
// tr1->GetEntry(ev_reg1); |
38 |
tr2->GetEntry(ev_reg2); |
// tr2->GetEntry(ev_reg2); |
39 |
Int_t dspn1(0),dspn2(0); |
// Int_t dspn1(0),dspn2(0); |
40 |
|
|
41 |
for(Int_t i=0;i<6;i++){ |
// for(Int_t i=0;i<6;i++){ |
42 |
dspn1=calibdata1->DSPnumber[i]-1; |
// dspn1=calibdata1->DSPnumber[i]-1; |
43 |
dspn2=calibdata2->DSPnumber[i]-1; |
// dspn2=calibdata2->DSPnumber[i]-1; |
44 |
/* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */ |
// /* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */ |
45 |
for(Int_t ii=0;ii<3072;ii++){ |
// for(Int_t ii=0;ii<3072;ii++){ |
46 |
Int_t j=(ii/128); |
// Int_t j=(ii/128); |
47 |
Int_t jj=ii-j*128; |
// Int_t jj=ii-j*128; |
48 |
pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii]; |
// pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii]; |
49 |
pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii]; |
// pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii]; |
50 |
pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]); |
// pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]); |
51 |
pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]); |
// pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]); |
52 |
sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii]; |
// sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii]; |
53 |
sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii]; |
// sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii]; |
54 |
sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]); |
// sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]); |
55 |
sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]); |
// sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]); |
56 |
// cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
// // cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
57 |
// cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
// // cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
58 |
// cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
// // cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
59 |
// cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
// // cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
60 |
|
|
61 |
// |
// // |
62 |
// invert the bad |
// // invert the bad |
63 |
// |
// // |
64 |
if(calibdata1->DSPbad_par[i][ii]==0) |
// if(calibdata1->DSPbad_par[i][ii]==0) |
65 |
bad[jj][j][dspn1]=1; |
// bad[jj][j][dspn1]=1; |
66 |
else if(calibdata1->DSPbad_par[i][ii]==1) |
// else if(calibdata1->DSPbad_par[i][ii]==1) |
67 |
bad[jj][j][dspn1]=0; |
// bad[jj][j][dspn1]=0; |
68 |
if(calibdata2->DSPbad_par[i][ii]==0) |
// if(calibdata2->DSPbad_par[i][ii]==0) |
69 |
bad[jj][j][dspn2]=1; |
// bad[jj][j][dspn2]=1; |
70 |
else if(calibdata2->DSPbad_par[i][ii]==1) |
// else if(calibdata2->DSPbad_par[i][ii]==1) |
71 |
bad[jj][j][dspn2]=0; |
// bad[jj][j][dspn2]=0; |
72 |
}; |
// }; |
73 |
}; |
// }; |
74 |
|
|
75 |
tr1->Delete(); |
// tr1->Delete(); |
76 |
tr2->Delete(); |
// tr2->Delete(); |
77 |
}; |
// }; |
78 |
|
|
79 |
/** |
// /** |
80 |
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
// * Method to fill the tracker calibration-parameter struct from on-line calibrations |
81 |
*/ |
// */ |
82 |
void cTrkCalib::FillFCalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
// void cTrkCalib::FillFCalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
83 |
|
|
84 |
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
// TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
85 |
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
// TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
86 |
|
|
87 |
CalibTrk1Event *calibdata1 = 0; |
// CalibTrk1Event *calibdata1 = 0; |
88 |
CalibTrk2Event *calibdata2 = 0; |
// CalibTrk2Event *calibdata2 = 0; |
89 |
tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
// tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
90 |
tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
// tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
91 |
tr1->GetEntry(ev_reg1); |
// tr1->GetEntry(ev_reg1); |
92 |
tr2->GetEntry(ev_reg2); |
// tr2->GetEntry(ev_reg2); |
93 |
Int_t dspn1(0),dspn2(0); |
// Int_t dspn1(0),dspn2(0); |
94 |
|
|
95 |
for(Int_t i=0;i<6;i++){ |
// for(Int_t i=0;i<6;i++){ |
96 |
dspn1=calibdata1->DSPnumber[i]-1; |
// dspn1=calibdata1->DSPnumber[i]-1; |
97 |
dspn2=calibdata2->DSPnumber[i]-1; |
// dspn2=calibdata2->DSPnumber[i]-1; |
98 |
/* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */ |
// /* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */ |
99 |
for(Int_t ii=0;ii<3072;ii++){ |
// for(Int_t ii=0;ii<3072;ii++){ |
100 |
Int_t j=(ii/128); |
// Int_t j=(ii/128); |
101 |
Int_t jj=ii-j*128; |
// Int_t jj=ii-j*128; |
102 |
pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii]; |
// pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii]; |
103 |
pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii]; |
// pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii]; |
104 |
sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii]; |
// sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii]; |
105 |
sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii]; |
// sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii]; |
106 |
// cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
// // cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
107 |
// cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
// // cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
108 |
// cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
// // cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
109 |
// cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
// // cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
110 |
|
|
111 |
// |
// // |
112 |
// invert the bad |
// // invert the bad |
113 |
// |
// // |
114 |
if(calibdata1->DSPbad_par[i][ii]==0) |
// if(calibdata1->DSPbad_par[i][ii]==0) |
115 |
bad[jj][j][dspn1]=1; |
// bad[jj][j][dspn1]=1; |
116 |
else if(calibdata1->DSPbad_par[i][ii]==1) |
// else if(calibdata1->DSPbad_par[i][ii]==1) |
117 |
bad[jj][j][dspn1]=0; |
// bad[jj][j][dspn1]=0; |
118 |
if(calibdata2->DSPbad_par[i][ii]==0) |
// if(calibdata2->DSPbad_par[i][ii]==0) |
119 |
bad[jj][j][dspn2]=1; |
// bad[jj][j][dspn2]=1; |
120 |
else if(calibdata2->DSPbad_par[i][ii]==1) |
// else if(calibdata2->DSPbad_par[i][ii]==1) |
121 |
bad[jj][j][dspn2]=0; |
// bad[jj][j][dspn2]=0; |
122 |
}; |
// }; |
123 |
}; |
// }; |
124 |
|
|
125 |
tr1->Delete(); |
// tr1->Delete(); |
126 |
tr2->Delete(); |
// tr2->Delete(); |
127 |
}; |
// }; |
128 |
/** |
// /** |
129 |
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
// * Method to fill the tracker calibration-parameter struct from on-line calibrations |
130 |
*/ |
// */ |
131 |
void cTrkCalib::FillTCalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
// void cTrkCalib::FillTCalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
132 |
|
|
133 |
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
// TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
134 |
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
// TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
135 |
|
|
136 |
CalibTrk1Event *calibdata1 = 0; |
// CalibTrk1Event *calibdata1 = 0; |
137 |
CalibTrk2Event *calibdata2 = 0; |
// CalibTrk2Event *calibdata2 = 0; |
138 |
tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
// tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
139 |
tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
// tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
140 |
tr1->GetEntry(ev_reg1); |
// tr1->GetEntry(ev_reg1); |
141 |
tr2->GetEntry(ev_reg2); |
// tr2->GetEntry(ev_reg2); |
142 |
Int_t dspn1(0),dspn2(0); |
// Int_t dspn1(0),dspn2(0); |
143 |
|
|
144 |
for(Int_t i=0;i<6;i++){ |
// for(Int_t i=0;i<6;i++){ |
145 |
dspn1=calibdata1->DSPnumber[i]-1; |
// dspn1=calibdata1->DSPnumber[i]-1; |
146 |
dspn2=calibdata2->DSPnumber[i]-1; |
// dspn2=calibdata2->DSPnumber[i]-1; |
147 |
/* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */ |
// /* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */ |
148 |
for(Int_t ii=0;ii<3072;ii++){ |
// for(Int_t ii=0;ii<3072;ii++){ |
149 |
Int_t j=(ii/128); |
// Int_t j=(ii/128); |
150 |
Int_t jj=ii-j*128; |
// Int_t jj=ii-j*128; |
151 |
pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]); |
// pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]); |
152 |
pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]); |
// pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]); |
153 |
sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]); |
// sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]); |
154 |
sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]); |
// sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]); |
155 |
}; |
// }; |
156 |
}; |
// }; |
157 |
|
|
158 |
tr1->Delete(); |
// tr1->Delete(); |
159 |
tr2->Delete(); |
// tr2->Delete(); |
160 |
}; |
// }; |
161 |
/** |
// /** |
162 |
* Method to fill the tracker calibration-parameter struct from default calibration |
// * Method to fill the tracker calibration-parameter struct from default calibration |
163 |
*/ |
// */ |
164 |
void cTrkCalib::FillTCalibFrom(TString path){ |
// void cTrkCalib::FillTCalibFrom(TString path){ |
165 |
|
|
166 |
path_.FillWith(path); |
// path_.FillWith(path); |
167 |
fillpedsigfromdefault_(); |
// fillpedsigfromdefault_(); |
168 |
if(path_.error) throw -216; |
// if(path_.error) throw -216; |
169 |
|
|
170 |
}; |
// }; |
171 |
|
|
172 |
/** |
/** |
173 |
* Method to fill the tracker VA1-mask struct from calibration |
* Method to fill the tracker VA1-mask struct from calibration |
174 |
*/ |
*/ |
175 |
void cTrkMask::Set(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
// void cTrkMask::Set(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
176 |
|
|
177 |
TrkCalib *calib = new TrkCalib(); |
// TrkCalib *calib = new TrkCalib(); |
178 |
|
|
179 |
for(Int_t i=0; i<2; i++){ |
// for(Int_t i=0; i<2; i++){ |
180 |
TTree *tr=0; |
// TTree *tr=0; |
181 |
if(i==0){ |
// if(i==0){ |
182 |
//------------------------- |
// //------------------------- |
183 |
//read calibration packet 1 |
// //read calibration packet 1 |
184 |
//------------------------- |
// //------------------------- |
185 |
tr = (TTree*)f0->Get("CalibTrk1"); |
// tr = (TTree*)f0->Get("CalibTrk1"); |
186 |
tr->SetBranchAddress("CalibTrk1",calib->GetPointerTo()); |
// tr->SetBranchAddress("CalibTrk1",calib->GetPointerTo()); |
187 |
tr->GetEntry(ev_reg1); |
// tr->GetEntry(ev_reg1); |
188 |
} |
// } |
189 |
if(i==1){ |
// if(i==1){ |
190 |
//------------------------- |
// //------------------------- |
191 |
//read calibration packet 2 |
// //read calibration packet 2 |
192 |
//------------------------- |
// //------------------------- |
193 |
tr = (TTree*)f0->Get("CalibTrk2"); |
// tr = (TTree*)f0->Get("CalibTrk2"); |
194 |
tr->SetBranchAddress("CalibTrk2",calib->GetPointerTo()); |
// tr->SetBranchAddress("CalibTrk2",calib->GetPointerTo()); |
195 |
tr->GetEntry(ev_reg2); |
// tr->GetEntry(ev_reg2); |
196 |
} |
// } |
197 |
for(Int_t ipkt=0; ipkt<NPLANE; ipkt++){ |
// for(Int_t ipkt=0; ipkt<NPLANE; ipkt++){ |
198 |
for(Int_t ivk=0; ivk<NVK; ivk++){ |
// for(Int_t ivk=0; ivk<NVK; ivk++){ |
199 |
Int_t view = calib->GetView(ipkt); |
// Int_t view = calib->GetView(ipkt); |
200 |
Float_t sigm = calib->GetMean("SIG-BAD",ipkt,ivk+1); |
// Float_t sigm = calib->GetMean("SIG-BAD",ipkt,ivk+1); |
201 |
Float_t sigmin = 0.; |
// Float_t sigmin = 0.; |
202 |
if(view%2)sigmin = 6.5; |
// if(view%2)sigmin = 6.5; |
203 |
else sigmin = 2.5; |
// else sigmin = 2.5; |
204 |
Int_t mask = 1; |
// Int_t mask = 1; |
205 |
if( sigm<sigmin )mask = 0; |
// if( sigm<sigmin )mask = 0; |
206 |
|
|
207 |
mask_vk_run[ivk][view-1] = mask; |
// mask_vk_run[ivk][view-1] = mask; |
208 |
|
|
209 |
// if(mask==0)cout<< " VIEW "<<view<<" VK "<<ivk+1<<" -- <SIG> "<<sigm<<" ---> MASKED!"<<endl; |
// // if(mask==0)cout<< " VIEW "<<view<<" VK "<<ivk+1<<" -- <SIG> "<<sigm<<" ---> MASKED!"<<endl; |
210 |
} |
// } |
211 |
} |
// } |
212 |
if(tr)tr->Delete(); |
// if(tr)tr->Delete(); |
213 |
} |
// } |
214 |
|
|
215 |
|
// if(calib)calib->Delete(); |
216 |
|
|
217 |
if(calib)calib->Delete(); |
// }; |
218 |
|
|
|
}; |
|