20 |
int ret = (int)(f+0.5); |
int ret = (int)(f+0.5); |
21 |
float ret1 = 0; |
float ret1 = 0; |
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 |
/** |
/** |
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; |
159 |
tr2->Delete(); |
tr2->Delete(); |
160 |
}; |
}; |
161 |
/** |
/** |
162 |
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
* Method to fill the tracker calibration-parameter struct from default calibration |
163 |
*/ |
*/ |
164 |
void cTrkCalib::FillTCalibFrom(TString path){ |
void cTrkCalib::FillTCalibFrom(TString path){ |
165 |
|
|
169 |
|
|
170 |
}; |
}; |
171 |
|
|
172 |
|
/** |
173 |
|
* 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){ |
176 |
|
|
177 |
|
TrkCalib *calib = new TrkCalib(); |
178 |
|
|
179 |
|
for(Int_t i=0; i<2; i++){ |
180 |
|
TTree *tr=0; |
181 |
|
if(i==0){ |
182 |
|
//------------------------- |
183 |
|
//read calibration packet 1 |
184 |
|
//------------------------- |
185 |
|
tr = (TTree*)f0->Get("CalibTrk1"); |
186 |
|
tr->SetBranchAddress("CalibTrk1",calib->GetPointerTo()); |
187 |
|
tr->GetEntry(ev_reg1); |
188 |
|
} |
189 |
|
if(i==1){ |
190 |
|
//------------------------- |
191 |
|
//read calibration packet 2 |
192 |
|
//------------------------- |
193 |
|
tr = (TTree*)f0->Get("CalibTrk2"); |
194 |
|
tr->SetBranchAddress("CalibTrk2",calib->GetPointerTo()); |
195 |
|
tr->GetEntry(ev_reg2); |
196 |
|
} |
197 |
|
for(Int_t ipkt=0; ipkt<NPLANE; ipkt++){ |
198 |
|
for(Int_t ivk=0; ivk<NVK; ivk++){ |
199 |
|
Int_t view = calib->GetView(ipkt); |
200 |
|
Float_t sigm = calib->GetMean("SIG-BAD",ipkt,ivk+1); |
201 |
|
Float_t sigmin = 0.; |
202 |
|
if(view%2)sigmin = 6.5; |
203 |
|
else sigmin = 2.5; |
204 |
|
Int_t mask = 1; |
205 |
|
if( sigm<sigmin )mask = 0; |
206 |
|
|
207 |
|
mask_vk_run[ivk][view-1] = mask; |
208 |
|
|
209 |
|
// if(mask==0)cout<< " VIEW "<<view<<" VK "<<ivk+1<<" -- <SIG> "<<sigm<<" ---> MASKED!"<<endl; |
210 |
|
} |
211 |
|
} |
212 |
|
if(tr)tr->Delete(); |
213 |
|
} |
214 |
|
|
215 |
|
if(calib)calib->Delete(); |
216 |
|
|
217 |
|
}; |