44 |
extern "C" int toftrk(); |
extern "C" int toftrk(); |
45 |
///extern "C" int toftrk(float); |
///extern "C" int toftrk(float); |
46 |
#define rdtofcal rdtofcal_ |
#define rdtofcal rdtofcal_ |
47 |
extern "C" int rdtofcal(char [], int *); |
//extern "C" int rdtofcal(char [], int *); |
48 |
|
extern "C" int rdtofcal(const char *, int *); |
49 |
|
|
50 |
using namespace std; |
using namespace std; |
51 |
|
|
184 |
}; |
}; |
185 |
// |
// |
186 |
tofdedx->ReadParAtt((glparam->PATH+glparam->NAME).Data()); |
tofdedx->ReadParAtt((glparam->PATH+glparam->NAME).Data()); |
187 |
|
printf(" Reading Attenuation file: %s \n",(glparam->PATH+glparam->NAME).Data()); |
188 |
|
|
189 |
// |
// |
190 |
error=glparam->Query_GL_PARAM(pam_event->GetRunInfo()->RUNHEADER_TIME,205,dbc); // parameters stored in DB in GL_PRAM table |
error=glparam->Query_GL_PARAM(pam_event->GetRunInfo()->RUNHEADER_TIME,205,dbc); // parameters stored in DB in GL_PRAM table |
191 |
if ( error<0 ) { |
if ( error<0 ) { |
193 |
}; |
}; |
194 |
// |
// |
195 |
tofdedx->ReadParPos((glparam->PATH+glparam->NAME).Data()); |
tofdedx->ReadParPos((glparam->PATH+glparam->NAME).Data()); |
196 |
|
printf(" Reading desaturation1 file: %s \n",(glparam->PATH+glparam->NAME).Data()); |
197 |
|
|
198 |
// |
// |
199 |
error=glparam->Query_GL_PARAM(pam_event->GetRunInfo()->RUNHEADER_TIME,206,dbc); // parameters stored in DB in GL_PRAM table |
error=glparam->Query_GL_PARAM(pam_event->GetRunInfo()->RUNHEADER_TIME,206,dbc); // parameters stored in DB in GL_PRAM table |
200 |
if ( error<0 ) { |
if ( error<0 ) { |
202 |
}; |
}; |
203 |
// |
// |
204 |
tofdedx->ReadParBBneg((glparam->PATH+glparam->NAME).Data()); |
tofdedx->ReadParBBneg((glparam->PATH+glparam->NAME).Data()); |
205 |
|
printf(" Reading BBneg file: %s \n",(glparam->PATH+glparam->NAME).Data()); |
206 |
|
|
207 |
// |
// |
208 |
error=glparam->Query_GL_PARAM(pam_event->GetRunInfo()->RUNHEADER_TIME,207,dbc); // parameters stored in DB in GL_PRAM table |
error=glparam->Query_GL_PARAM(pam_event->GetRunInfo()->RUNHEADER_TIME,207,dbc); // parameters stored in DB in GL_PRAM table |
209 |
if ( error<0 ) { |
if ( error<0 ) { |
211 |
}; |
}; |
212 |
// |
// |
213 |
tofdedx->ReadParBBpos((glparam->PATH+glparam->NAME).Data()); |
tofdedx->ReadParBBpos((glparam->PATH+glparam->NAME).Data()); |
214 |
|
printf(" Reading BBpos file: %s \n",(glparam->PATH+glparam->NAME).Data()); |
215 |
|
|
216 |
// |
// |
217 |
error=glparam->Query_GL_PARAM(pam_event->GetRunInfo()->RUNHEADER_TIME,208,dbc); // parameters stored in DB in GL_PRAM table |
error=glparam->Query_GL_PARAM(pam_event->GetRunInfo()->RUNHEADER_TIME,208,dbc); // parameters stored in DB in GL_PRAM table |
218 |
if ( error<0 ) { |
if ( error<0 ) { |
220 |
}; |
}; |
221 |
// |
// |
222 |
tofdedx->ReadParDesatBB((glparam->PATH+glparam->NAME).Data()); |
tofdedx->ReadParDesatBB((glparam->PATH+glparam->NAME).Data()); |
223 |
|
printf(" Reading desaturation2 file: %s \n",(glparam->PATH+glparam->NAME).Data()); |
224 |
|
|
225 |
tofdedx->CheckConnectors(pam_event->GetRunInfo()->RUNHEADER_TIME,glparam,dbc); |
tofdedx->CheckConnectors(pam_event->GetRunInfo()->RUNHEADER_TIME,glparam,dbc); |
226 |
|
|
227 |
|
|
|
|
|
228 |
error=glparam->Query_GL_PARAM(pam_event->GetRunInfo()->RUNHEADER_TIME,201,dbc); // parameters stored in DB in GL_PRAM table |
error=glparam->Query_GL_PARAM(pam_event->GetRunInfo()->RUNHEADER_TIME,201,dbc); // parameters stored in DB in GL_PRAM table |
229 |
if ( error<0 ) { |
if ( error<0 ) { |
230 |
return(1); |
return(1); |
234 |
// |
// |
235 |
if ( (UInt_t)glparam->TO_TIME != (UInt_t)4294967295UL ) defcal = false; |
if ( (UInt_t)glparam->TO_TIME != (UInt_t)4294967295UL ) defcal = false; |
236 |
// |
// |
237 |
Int_t nlen = (Int_t)(glparam->PATH+glparam->NAME).Length(); |
TString pippo=(glparam->PATH+glparam->NAME).Data(); |
238 |
rdtofcal((char *)(glparam->PATH+glparam->NAME).Data(),&nlen); |
//Int_t nlen = (Int_t)(glparam->PATH+glparam->NAME).Length(); |
239 |
|
//rdtofcal((char *)(glparam->PATH+glparam->NAME).Data(),&nlen); |
240 |
|
Int_t nlen = (Int_t)pippo.Length(); |
241 |
|
rdtofcal(pippo.Data(),&nlen); |
242 |
// |
// |
243 |
|
|
244 |
|
tofdedx->Clear(); |
245 |
|
|
246 |
}; |
}; |
247 |
// |
// |
248 |
|
|
252 |
//--- Define absolute time |
//--- Define absolute time |
253 |
UInt_t tabs=pam_event->GetOrbitalInfo()->absTime; |
UInt_t tabs=pam_event->GetOrbitalInfo()->absTime; |
254 |
|
|
255 |
if ( !(iev%1000) ) printf(" ATIME %u re %u \n",(Int_t)tabs,(UInt_t)iev); |
if ( !(iev%100000) ) printf(" ATIME %u re %u \n",(Int_t)tabs,(UInt_t)iev); |
256 |
|
|
257 |
//================================================================== |
//================================================================== |
258 |
Float_t dedx_corr_m[2000][48],dedx_corr[48]; |
Float_t dedx_corr_m[2000][48],dedx_corr[48]; |
274 |
printf(" READING NEW CALIBRATION FILE: %s \n",CALIBF.Data()); |
printf(" READING NEW CALIBRATION FILE: %s \n",CALIBF.Data()); |
275 |
|
|
276 |
ifstream fin(CALIBF.Data()); |
ifstream fin(CALIBF.Data()); |
277 |
|
//cout << "topolino" << endl; |
278 |
while (! fin.eof()) { |
while (! fin.eof()) { |
279 |
fin>>t1>>tm>>t2; |
fin>>t1>>tm>>t2; |
280 |
// cout<<jj<<" "<<tm<<endl; |
//cout<<jj<<" "<<tm<<endl; |
281 |
cout << setiosflags(ios::fixed) << setw(10) << setprecision(3) << tm << endl; |
//cout << setiosflags(ios::fixed) << setw(10) << setprecision(3) << tm << endl; |
282 |
mtime[jj]=tm; |
mtime[jj]=tm; |
283 |
for (ii=0; ii<48;ii++) { |
for (ii=0; ii<48;ii++) { |
284 |
fin>>j>>xmean1>>xwidth1; |
fin>>j>>xmean1>>xwidth1; |
288 |
// printf(" kk %i \n",jj); |
// printf(" kk %i \n",jj); |
289 |
} |
} |
290 |
// printf(" 1ical %i \n",ical); |
// printf(" 1ical %i \n",ical); |
291 |
|
//cout << "pippo" << endl; |
292 |
fin.close(); |
fin.close(); |
293 |
|
|
294 |
|
|
297 |
ical = ical+1; |
ical = ical+1; |
298 |
} |
} |
299 |
// ical = ical-1; |
// ical = ical-1; |
300 |
cout<<"abs time "<<tabs<<" limit low "<<mtime[ical]<<" limit up "<<mtime[ical+1]<<" ical "<<ical<<endl; |
//cout<<"abs time "<<tabs<<" limit low "<<mtime[ical]<<" limit up "<<mtime[ical+1]<<" ical "<<ical<<endl; |
301 |
} // if iev==0... |
} // if iev==0... |
302 |
|
|
303 |
//================================================================== |
//================================================================== |
315 |
ical = ical+1; |
ical = ical+1; |
316 |
} |
} |
317 |
// ical = ical-1; |
// ical = ical-1; |
318 |
cout<<"abs time "<<tabs<<" limit low "<<mtime[ical]<<" limit up "<<mtime[ical+1]<<" ical "<<ical<<endl; |
//cout<<"abs time "<<tabs<<" limit low "<<mtime[ical]<<" limit up "<<mtime[ical+1]<<" ical "<<ical<<endl; |
319 |
}; |
}; |
320 |
|
|
321 |
// printf(" 2ical %i \n",ical); |
// printf(" 2ical %i \n",ical); |
527 |
tof->GetPMTPaddle(pmt_id, Iplane, Ipaddle); |
tof->GetPMTPaddle(pmt_id, Iplane, Ipaddle); |
528 |
tof->GetPaddleGeometry(Iplane,Ipaddle,xleft,xright,yleft,yright); |
tof->GetPaddleGeometry(Iplane,Ipaddle,xleft,xright,yleft,yright); |
529 |
if ( tofdedx->GetdEdx_pmt(pmt_id)>-1. &&((xtof_temp[Iplane]>=xleft&&xtof_temp[Iplane]<=xright) || (ytof_temp[Iplane]>=yleft&&ytof_temp[Iplane]<=yright)) ){ //attenzione:qui va inserito un controllo sulla traccia tof o sulle variabili di posizione !!!! |
if ( tofdedx->GetdEdx_pmt(pmt_id)>-1. &&((xtof_temp[Iplane]>=xleft&&xtof_temp[Iplane]<=xright) || (ytof_temp[Iplane]>=yleft&&ytof_temp[Iplane]<=yright)) ){ //attenzione:qui va inserito un controllo sulla traccia tof o sulle variabili di posizione !!!! |
530 |
t_tof->dedx.AddAt((tofdedx->GetdEdx_pmt(pmt_id)*4./dedx_corr[pmt_id]),t_tof->npmtadc); |
//t_tof->dedx.AddAt((tofdedx->GetdEdx_pmt(pmt_id)*4./dedx_corr[pmt_id]),t_tof->npmtadc); |
531 |
|
//t_tof->dedx.AddAt((tofdedx->GetdEdx_pmt(pmt_id)*dedx_corr[pmt_id]/4.),t_tof->npmtadc);//annullo wolfrizzazione |
532 |
|
t_tof->dedx.AddAt((tofdedx->GetdEdx_pmt(pmt_id)),t_tof->npmtadc);//annullo wolfrizzazione |
533 |
t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc); |
t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc); |
534 |
t_tof->adcflag.AddAt(0,t_tof->npmtadc); // gf: Jan 09/07 |
t_tof->adcflag.AddAt(0,t_tof->npmtadc); // gf: Jan 09/07 |
535 |
t_tof->npmtadc++; |
t_tof->npmtadc++; |
650 |
tof->GetPMTPaddle(pmt_id, Iplane, Ipaddle); |
tof->GetPMTPaddle(pmt_id, Iplane, Ipaddle); |
651 |
IpaddleT=tof->GetPaddleIdOfTrack(t_tof->xtr_tof[Iplane],t_tof->ytr_tof[Iplane], Iplane,0.0); |
IpaddleT=tof->GetPaddleIdOfTrack(t_tof->xtr_tof[Iplane],t_tof->ytr_tof[Iplane], Iplane,0.0); |
652 |
if ( tofdedx->GetdEdx_pmt(pmt_id) > -1. && Ipaddle==IpaddleT ){ |
if ( tofdedx->GetdEdx_pmt(pmt_id) > -1. && Ipaddle==IpaddleT ){ |
653 |
t_tof->dedx.AddAt((tofdedx->GetdEdx_pmt(pmt_id)*4./dedx_corr[pmt_id]),t_tof->npmtadc); |
//t_tof->dedx.AddAt((tofdedx->GetdEdx_pmt(pmt_id)*4./dedx_corr[pmt_id]),t_tof->npmtadc); |
654 |
|
//t_tof->dedx.AddAt((tofdedx->GetdEdx_pmt(pmt_id)*dedx_corr[pmt_id]/4.),t_tof->npmtadc);//annullo wolfrizzazione |
655 |
|
t_tof->dedx.AddAt((tofdedx->GetdEdx_pmt(pmt_id)),t_tof->npmtadc);//annullo wolfrizzazione |
656 |
t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc); |
t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc); |
657 |
t_tof->adcflag.AddAt(0,t_tof->npmtadc); // gf: Jan 09/07 |
t_tof->adcflag.AddAt(0,t_tof->npmtadc); // gf: Jan 09/07 |
658 |
t_tof->npmtadc++; |
t_tof->npmtadc++; |