/[PAMELA software]/DarthVader/TrackerLevel2/src/TrkParams.cpp
ViewVC logotype

Annotation of /DarthVader/TrackerLevel2/src/TrkParams.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Thu Mar 15 12:17:10 2007 UTC (17 years, 9 months ago) by pam-fi
Branch: MAIN
Changes since 1.1: +6 -4 lines
workaround to retrieve clusters + other minor adjustments

1 pam-fi 1.1 /**
2     * \file TrkParams.cpp
3     * \author Elena Vannuccini
4     */
5    
6     #include <TrkParams.h>
7     #include <iostream>
8     using namespace std;
9    
10    
11     // -------------------------
12     // CALIBRATION (PED,SIG,BAD)
13     // -------------------------
14     GL_TRK_CALIB TrkParams::calib = GL_TRK_CALIB();
15     TString TrkParams::calibpatht = "";
16     TString TrkParams::calibpathf = "";
17     Bool_t TrkParams::calib104 = 0;
18     Bool_t TrkParams::calibload = false;
19     UInt_t TrkParams::trkparamtype[] = {1,2,3,4,5,6,7};
20     GL_PARAM TrkParams::gl[] = {GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM()};
21     TString TrkParams::glpath[] = {"","","","","","",""};
22     Bool_t TrkParams::glload[] = {false,false,false,false,false,false,false};
23    
24     TrkParams::TrkParams(){
25    
26     cout<<"TrkParams::TrkParams()"<<endl;
27    
28     }
29     float aint(float f){
30     int ret = (int)f;
31     float ret1 = 0;
32     ret1=(float)ret;
33     return ret1;
34     }
35    
36     float anint(float f){
37     int ret = (int)(f+0.5);
38     float ret1 = 0;
39     ret1=(float)ret;
40     return ret1;
41     }
42     /**
43     * Static method to set the calibration to be loaded.
44    
45     * It retrieves the calibration associated to a given run, from
46     * a given DB. It fills the F77 common.
47     * @param glrun Pointer to a GL_RUN row
48     * @param dbc Pointer to a DB connection
49     */
50     Bool_t TrkParams::SetCalib( GL_RUN *glrun, TSQLServer* dbc ){
51    
52     GL_TRK_CALIB q2;
53     GL_ROOT q3;
54     GL_PARAM q4;
55    
56     if( q2.Query_GL_TRK_CALIB(glrun->RUNHEADER_TIME,dbc) )return false;
57     if(q2.EV_ROOT_CALIBTRK1 != q2.EV_ROOT_CALIBTRK2)
58     printf("WARNING!! ---> EV_ROOT_CALIBTRK1=%d it's different from EV_ROOT_CALIBTRK2=%d \n\n",q2.EV_ROOT_CALIBTRK1,q2.EV_ROOT_CALIBTRK2);
59     if( q3.Query_GL_ROOT(q2.ID_ROOT_L0,dbc) )return false;
60    
61     calib = q2;
62     calibpathf = q3.PATH + q3.NAME;
63     calib104 = (glrun->TRK_CALIB_USED==104);
64     calibload = kFALSE;
65     if(calib104){
66     if (q4.Query_GL_PARAM(glrun->RUNHEADER_TIME,7,dbc) )return false;
67     calibpatht = q4.PATH + q4.NAME;
68     }
69    
70    
71     // return TrkParams::LoadCalib();
72     return true;
73     };
74    
75     /**
76     * Method to fill the tracker calibration-parameter struct from on-line calibrations
77     */
78     void TrkParams::FillACalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){
79    
80     cTrkCalib *ca = &pedsigbad_;
81    
82     TTree *tr1 = (TTree*)f0->Get("CalibTrk1");
83     TTree *tr2 = (TTree*)f0->Get("CalibTrk2");
84    
85     CalibTrk1Event *calibdata1 = 0;
86     CalibTrk2Event *calibdata2 = 0;
87     tr1->SetBranchAddress("CalibTrk1",&calibdata1);
88     tr2->SetBranchAddress("CalibTrk2",&calibdata2);
89     tr1->GetEntry(ev_reg1);
90     tr2->GetEntry(ev_reg2);
91     Int_t dspn1(0),dspn2(0);
92    
93     for(Int_t i=0;i<6;i++){
94     dspn1=calibdata1->DSPnumber[i]-1;
95     dspn2=calibdata2->DSPnumber[i]-1;
96     /* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */
97     for(Int_t ii=0;ii<3072;ii++){
98     Int_t j=(ii/128);
99     Int_t jj=ii-j*128;
100     ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii];
101     ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii];
102     ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]);
103     ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]);
104     ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii];
105     ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii];
106     ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]);
107     ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]);
108     // cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl;
109     // cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl;
110     // cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl;
111     // cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl;
112    
113     //
114     // invert the bad
115     //
116     if(calibdata1->DSPbad_par[i][ii]==0)
117     ca->bad[jj][j][dspn1]=1;
118     else if(calibdata1->DSPbad_par[i][ii]==1)
119     ca->bad[jj][j][dspn1]=0;
120     if(calibdata2->DSPbad_par[i][ii]==0)
121     ca->bad[jj][j][dspn2]=1;
122     else if(calibdata2->DSPbad_par[i][ii]==1)
123     ca->bad[jj][j][dspn2]=0;
124     };
125     };
126    
127     tr1->Delete();
128     tr2->Delete();
129     };
130     /**
131     * Method to fill the tracker calibration-parameter struct from on-line calibrations
132     */
133     void TrkParams::FillFCalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){
134    
135     cTrkCalib *ca = &pedsigbad_;
136    
137     TTree *tr1 = (TTree*)f0->Get("CalibTrk1");
138     TTree *tr2 = (TTree*)f0->Get("CalibTrk2");
139    
140     CalibTrk1Event *calibdata1 = 0;
141     CalibTrk2Event *calibdata2 = 0;
142     tr1->SetBranchAddress("CalibTrk1",&calibdata1);
143     tr2->SetBranchAddress("CalibTrk2",&calibdata2);
144     tr1->GetEntry(ev_reg1);
145     tr2->GetEntry(ev_reg2);
146     Int_t dspn1(0),dspn2(0);
147    
148     for(Int_t i=0;i<6;i++){
149     dspn1=calibdata1->DSPnumber[i]-1;
150     dspn2=calibdata2->DSPnumber[i]-1;
151     /* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */
152     for(Int_t ii=0;ii<3072;ii++){
153     Int_t j=(ii/128);
154     Int_t jj=ii-j*128;
155     ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii];
156     ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii];
157     ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii];
158     ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii];
159     // cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl;
160     // cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl;
161     // cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl;
162     // cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl;
163    
164     //
165     // invert the bad
166     //
167     if(calibdata1->DSPbad_par[i][ii]==0)
168     ca->bad[jj][j][dspn1]=1;
169     else if(calibdata1->DSPbad_par[i][ii]==1)
170     ca->bad[jj][j][dspn1]=0;
171     if(calibdata2->DSPbad_par[i][ii]==0)
172     ca->bad[jj][j][dspn2]=1;
173     else if(calibdata2->DSPbad_par[i][ii]==1)
174     ca->bad[jj][j][dspn2]=0;
175     };
176     };
177    
178     tr1->Delete();
179     tr2->Delete();
180     };
181     /**
182     * Method to fill the tracker calibration-parameter struct from on-line calibrations
183     */
184     void TrkParams::FillTCalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){
185    
186     cTrkCalib *ca = &pedsigbad_;
187    
188     TTree *tr1 = (TTree*)f0->Get("CalibTrk1");
189     TTree *tr2 = (TTree*)f0->Get("CalibTrk2");
190    
191     CalibTrk1Event *calibdata1 = 0;
192     CalibTrk2Event *calibdata2 = 0;
193     tr1->SetBranchAddress("CalibTrk1",&calibdata1);
194     tr2->SetBranchAddress("CalibTrk2",&calibdata2);
195     tr1->GetEntry(ev_reg1);
196     tr2->GetEntry(ev_reg2);
197     Int_t dspn1(0),dspn2(0);
198    
199     for(Int_t i=0;i<6;i++){
200     dspn1=calibdata1->DSPnumber[i]-1;
201     dspn2=calibdata2->DSPnumber[i]-1;
202     /* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */
203     for(Int_t ii=0;ii<3072;ii++){
204     Int_t j=(ii/128);
205     Int_t jj=ii-j*128;
206     ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]);
207     ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]);
208     ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]);
209     ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]);
210     };
211     };
212    
213     tr1->Delete();
214     tr2->Delete();
215     };
216     /**
217     * Method to fill the tracker calibration-parameter struct from default calibration
218     */
219     void TrkParams::FillTCalibFrom(TString path){
220    
221     path_.FillWith(path);
222     fillpedsigfromdefault_();
223     if(path_.error) throw -216;
224    
225     };
226     /**
227     * Method to fill the tracker VA1-mask struct from calibration
228     */
229     void TrkParams::FillMask(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){
230    
231     cTrkMask *ma = &mask_;
232    
233     TrkCalib *calib = new TrkCalib();
234    
235     for(Int_t i=0; i<2; i++){
236     TTree *tr=0;
237     if(i==0){
238     //-------------------------
239     //read calibration packet 1
240     //-------------------------
241     tr = (TTree*)f0->Get("CalibTrk1");
242     tr->SetBranchAddress("CalibTrk1",calib->GetPointerTo());
243     tr->GetEntry(ev_reg1);
244     }
245     if(i==1){
246     //-------------------------
247     //read calibration packet 2
248     //-------------------------
249     tr = (TTree*)f0->Get("CalibTrk2");
250     tr->SetBranchAddress("CalibTrk2",calib->GetPointerTo());
251     tr->GetEntry(ev_reg2);
252     }
253     for(Int_t ipkt=0; ipkt<NPLANE; ipkt++){
254     for(Int_t ivk=0; ivk<NVK; ivk++){
255     Int_t view = calib->GetView(ipkt);
256     Float_t sigm = calib->GetMean("SIG-BAD",ipkt,ivk+1);
257     Float_t sigmin = 0.;
258     if(view%2)sigmin = 6.5;
259     else sigmin = 2.5;
260     Int_t mask = 1;
261     if( sigm<sigmin )mask = 0;
262    
263     ma->mask_vk_run[ivk][view-1] = mask;
264    
265     // if(mask==0)cout<< " VIEW "<<view<<" VK "<<ivk+1<<" -- <SIG> "<<sigm<<" ---> MASKED!"<<endl;
266     }
267     }
268     if(tr)tr->Delete();
269     }
270    
271     if(calib)calib->Delete();
272    
273     };
274    
275     /**
276     * Static method to load calibration.
277     * Calibration is loaded ONLY IF TrkParams::CalibLoaded()==kTRUE, which appens the
278     * first time the method is called (but it does not work becouse I didn't set any
279     * default calibration for the moment) or after the method TrkParams::SetCalib(***) is called.
280     */
281     Bool_t TrkParams::LoadCalib( ){
282    
283     if( TrkParams::CalibIsLoaded() )return false;
284    
285     // cTrkCalib *ca = new cTrkCalib; //&pedsigbad_;
286    
287     // extern cTrkCalib pedsigbad_;
288     // extern cTrkMask mask_;
289    
290     cout << "--------------------------------------"<<endl;
291     cout << "Retrieve calibration (PED-SIG-BAD) ..."<<endl;
292     // =============================================================
293     // retrieve calibration file needed to reduce data
294     // =============================================================
295     // if run OBT is > last calibration "expiration date"
296     // - search for new calibration packet
297     // - load calibration parameters (full + truncated)
298     cout << "Full pedestals for cluster finding:";
299     cout << " >> Loading from LEVEL0 file: "<< calibpathf << endl;
300     FileStat_t t;
301     if( gSystem->GetPathInfo(calibpathf.Data(),t) )return false;
302    
303     TFile *f0_c = new TFile(calibpathf);
304     if ( !f0_c ) return false;
305     cout << " calibration entries "<< calib.EV_ROOT_CALIBTRK1 << " " << calib.EV_ROOT_CALIBTRK2;
306     cout << " (from time "<< calib.FROM_TIME <<" to time "<< calib.TO_TIME <<")"<<endl;
307     // ca->FillACalibFrom(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2);
308     TrkParams::FillACalibFrom(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2);
309     TrkParams::FillMask(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2);
310     // mask_.Set(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2);
311 pam-fi 1.2 // for(int i=0; i<12; i++) cout << " DSP "<< i << " "<< pedsigbad_.pedestal[64][12][i] << endl;
312 pam-fi 1.1
313     // };
314     // =============================================================
315     // retrieve calibration file needed to uncompress data
316     // =============================================================
317     // if the run was compressed using default calib
318     // load truncated pedestals from default
319     // otherwise reload them from on-line calibration
320     cout << "Truncated pedestals for uncompression:";
321     if( calib104 ){
322    
323     cout << " >> Loading default calibration: "<< calibpatht << endl;
324     // ca->FillTCalibFrom(calibpatht);
325     TrkParams::FillTCalibFrom(calibpatht);
326    
327     }else{
328    
329     if ( !f0_c ) return false;
330     cout << ">> Loading on-line calibration " << endl;
331     // ca->FillTCalibFrom(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2);
332     TrkParams::FillTCalibFrom(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2);
333     };
334 pam-fi 1.2 for(int i=0; i<12; i++) cout << " DSP "<< i << " "<< pedsigbad_.pedestal_t[64][12][i] << endl;
335 pam-fi 1.1 f0_c->Close();
336     // delete f0_c;
337     cout << "--------------------------------------"<<endl;
338    
339     calibload = kTRUE;
340     return true;
341     };
342    
343     Int_t TrkParams::GetIndex( UInt_t type ){
344     Int_t index = -1;
345     for (Int_t i=0; i< NTYPES; i++)if( type == trkparamtype[i] )index=i;
346     return index;
347     };
348    
349     /**
350     * Set tracker parameters proper for a run querying the DB.
351     * @param glrun Input run info
352     * @param dbc Database
353     * @param type Parameter type
354     * @return FALSE if parameter set fails.
355     * If glrun==NULL the last parameter entry from GL_PARAM table is set.
356     * If dbc==NULL, try to open a connection taking DB-connection
357     * parameters from PAMELA environment variables.
358     */
359     Bool_t TrkParams::Set( GL_RUN* glrun , TSQLServer* dbc , UInt_t type){
360    
361     // if( !dbc )return false;
362    
363    
364     if( !dbc || (dbc && !dbc->IsConnected()) ){
365    
366     cout <<" Missing DB connection -- check PAMELA environment variables "<<endl;
367     TString host = "mysql://localhost/pamelaprod";
368     TString user = "anonymous";
369     TString psw = "";
370     const char *pamdbhost=gSystem->Getenv("PAM_DBHOST");
371     const char *pamdbuser=gSystem->Getenv("PAM_DBUSER");
372     const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW");
373     if ( !pamdbhost ) pamdbhost = "";
374     if ( !pamdbuser ) pamdbuser = "";
375     if ( !pamdbpsw ) pamdbpsw = "";
376     if ( strcmp(pamdbhost,"") ) host = pamdbhost;
377     if ( strcmp(pamdbuser,"") ) user = pamdbuser;
378     if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw;
379     cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
380     cout<<"Connecting to DB"<<endl;
381     cout<<"HOST "<<host<<endl;
382     cout<<"USER "<<user<<endl;
383     cout<<"PSW "<<psw<<endl;
384     dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
385     if( !dbc )return false;
386     if( !dbc->IsConnected() )return false;
387     cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
388    
389     }
390    
391     UInt_t index = TrkParams::GetIndex( type );
392     if(index < 0)return false;
393    
394     UInt_t runheadtime = numeric_limits<UInt_t>::max();
395     if(glrun)runheadtime = glrun->RUNHEADER_TIME;
396     else cout <<"Missing run info -- taking last entry "<<endl;
397    
398     GL_PARAM q4;
399     if( q4.Query_GL_PARAM(runheadtime,type,dbc) )return false;
400    
401     gl[index] = q4;
402     glpath[index] = q4.PATH+q4.NAME;
403     glload[index] = false;
404 pam-fi 1.2 cout << "<< set TrkParams type "<<type<<" >> (from DB) "<<endl;
405 pam-fi 1.1 return true;
406     // return TrkParams::Load(type);
407    
408     };
409     /**
410 pam-fi 1.2 * Set tracker parameters proper for the run, from input.
411 pam-fi 1.1 * @param path Path to parameters directory
412     * @param type Parameter type
413     * @return FALSE if parameter set fails.
414     */
415     Bool_t TrkParams::Set( TString path , UInt_t type){
416    
417     UInt_t index = TrkParams::GetIndex( type );
418     if(index < 0)return false;
419    
420     gl[index].TYPE= type;
421     glpath[index] = path;
422 pam-fi 1.2 cout << "<< set TrkParams type "<<type<<" >> (from input) "<<endl;
423 pam-fi 1.1 glload[index] = false;
424    
425     // return TrkParams::Load(type);
426     return true;
427    
428     };
429    
430     /**
431     * Set and load tracker parameters.
432     * @param type Parameter type
433     * If no path as been yet specified, it set a default path.
434     * @return FALSE if parameter set fails.
435     */
436     Bool_t TrkParams::Set(UInt_t type){
437    
438     UInt_t index = TrkParams::GetIndex( type );
439     if(index < 0)return false;
440    
441     gl[index].TYPE= type;
442     glload[index] = false;
443    
444     // -----------------------------------------
445     // check if enviroment variables are defined
446     // -----------------------------------------
447     glpath[index] = gSystem->Getenv("PAM_CALIB");
448    
449     if( !glpath[index].IsNull() ){
450    
451     switch(type){
452     case 1:
453     glpath[index].Append("/trk-param/field_param-0/");
454     break;
455     case 2:
456     glpath[index].Append("/trk-param/mip_param-0/");
457     break;
458     case 3:
459     glpath[index].Append("/trk-param/charge_param-1/");
460     break;
461     case 4:
462     glpath[index].Append("/trk-param/eta_param-0/");
463     break;
464     case 5:
465     glpath[index].Append("/trk-param/align_param-0/");
466     break;
467     case 6:
468     glpath[index].Append("/trk-param/mask_param-1/");
469     break;
470     case 7:
471     glpath[index].Append("/trk-param/default_calib/");
472     break;
473     }
474    
475     }else{
476     cout << " TrkParams::Set( UInt_t type) ==> No PAMELA environment variables defined "<<endl;
477     return false;
478    
479     }
480    
481 pam-fi 1.2 cout << "<< set TrkParams type "<<type<<" (from env var PAM_CALIB) >>"<<endl;
482 pam-fi 1.1 // return TrkParams::Load(type);
483     return true;
484    
485     };
486     /**
487     * Set tracker parameters.
488     * If no path as been yet specified, try to read from DB
489     * otherwise it set a default path.
490     * @return FALSE if parameter set fails.
491     */
492     Bool_t TrkParams::Set( ){
493    
494     Bool_t connected = false;
495    
496     cout <<" Missing DB connection -- check PAMELA environment variables "<<endl;
497     TString host = "mysql://localhost/pamelaprod";
498     TString user = "anonymous";
499     TString psw = "";
500     const char *pamdbhost=gSystem->Getenv("PAM_DBHOST");
501     const char *pamdbuser=gSystem->Getenv("PAM_DBUSER");
502     const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW");
503     if ( !pamdbhost ) pamdbhost = "";
504     if ( !pamdbuser ) pamdbuser = "";
505     if ( !pamdbpsw ) pamdbpsw = "";
506     if ( strcmp(pamdbhost,"") ) host = pamdbhost;
507     if ( strcmp(pamdbuser,"") ) user = pamdbuser;
508     if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw;
509     cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
510     cout<<"Connecting to DB"<<endl;
511     cout<<"HOST "<<host<<endl;
512     cout<<"USER "<<user<<endl;
513     cout<<"PSW "<<psw<<endl;
514     TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
515     if( dbc || dbc->IsConnected() )connected = true;
516     else cout << " >> FAILED!!!"<<endl;
517     cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
518    
519     if(connected){
520     if ( !TrkParams::Set(0,dbc) )return false;
521     dbc->Close();
522     }else for(Int_t i=0; i<NTYPES; i++)if ( !TrkParams::Set(trkparamtype[i])) return false;
523     }
524    
525     /**
526     * Load tracker parameter, if not already loaded.
527     * @param type Parameter type
528     * ( Any call to TrkParams::Set(...) forces reloading )
529     */
530     Bool_t TrkParams::Load(UInt_t type){
531    
532     Int_t index = TrkParams::GetIndex( type );
533     if( index<0 )return false;
534     if( glload[index] )return true;
535    
536     if( glpath[index].IsNull() )TrkParams::Set(type);
537    
538     switch( type ){
539     //------------------------------------------
540     case 1:
541     cout <<type<<" -- Loading magnetic field "<<glpath[index]<<endl;
542     strcpy(path_.path,glpath[index].Data());
543     path_.pathlen = glpath[index].Length();
544     path_.error = 0;
545     readb_();
546     if(path_.error) return false;
547     glload[index]=true;
548     break;
549     //------------------------------------------
550     case 2:
551     cout <<type<<" -- Loading ADC-to-MIP conversion parameters "<<glpath[index]<<endl;
552     strcpy(path_.path,glpath[index].Data());
553     path_.pathlen = glpath[index].Length();
554     path_.error = 0;
555     readmipparam_();
556     if(path_.error) return false;
557     glload[index]=true;
558     break;
559     //------------------------------------------
560     case 3:
561     cout <<type<<" -- Loading charge-correlation parameters "<<glpath[index]<<endl;
562     strcpy(path_.path,glpath[index].Data());
563     path_.pathlen = glpath[index].Length();
564     path_.error = 0;
565     readchargeparam_();
566     if(path_.error) return false;
567     glload[index]=true;
568     break;
569     //------------------------------------------
570     case 4:
571     cout <<type<<" -- Loading p.f.a. parameters "<<glpath[index]<<endl;
572     strcpy(path_.path,glpath[index].Data());
573     path_.pathlen = glpath[index].Length();
574     path_.error = 0;
575     readetaparam_();
576     if(path_.error) return false;
577     glload[index]=true;
578     break;
579     //------------------------------------------
580     case 5:
581     cout <<type<<" -- Loading alignment parameters "<<glpath[index]<<endl;
582     strcpy(path_.path,glpath[index].Data());
583     path_.pathlen = glpath[index].Length();
584     path_.error = 0;
585     readalignparam_();
586     if(path_.error) return false;
587     glload[index]=true;
588     break;
589     //------------------------------------------
590     case 6:
591     cout <<type<<" -- Loading VK-mask parameters "<<glpath[index]<<endl;
592     strcpy(path_.path,glpath[index].Data());
593     path_.pathlen = glpath[index].Length();
594     path_.error = 0;
595     readvkmask_();
596     if(path_.error) return false;
597     glload[index]=true;
598     break;
599     //------------------------------------------
600     case 7:
601     cout <<type<<" -- Loading default calibration "<<glpath[index]<<endl;
602     strcpy(path_.path,glpath[index].Data());
603     path_.pathlen = glpath[index].Length();
604     path_.error = 0;
605     // fillpedsigfromdefault_();
606     cout << ">> not implemented <<"<<endl;
607     if(path_.error) return false;
608     glload[index]=true;
609     break;
610     default:
611     cout << " Bool_t TrkParams::Load(UInt_t type) -- type "<< type << "not yet implemented"<<endl;
612     return false;
613     };
614    
615     return true;
616     }
617    
618     Bool_t TrkParams::Load( ){
619     for(Int_t i=0 ; i<NTYPES; i++)if(!glload[i] && trkparamtype[i]>0 )if( !TrkParams::Load(trkparamtype[i]) )return false;
620     return true;
621     };
622     Bool_t TrkParams::IsLoaded( ){
623     for(Int_t i=0 ; i<NTYPES; i++)if(!glload[i] && trkparamtype[i]>0 )return false;
624     return true;
625     };
626    
627     ClassImp(TrkParams);

  ViewVC Help
Powered by ViewVC 1.1.23