284 |
trk_track = 0; |
trk_track = 0; |
285 |
calo_track = 0; |
calo_track = 0; |
286 |
tof_track = 0; |
tof_track = 0; |
287 |
|
orb_track = 0; |
288 |
candeleteobj = 0; |
candeleteobj = 0; |
289 |
pscore = 0; |
pscore = 0; |
290 |
iscore = 0; |
iscore = 0; |
296 |
/** |
/** |
297 |
* Constructor |
* Constructor |
298 |
*/ |
*/ |
299 |
PamTrack::PamTrack(TrkTrack* t, CaloTrkVar* c, ToFTrkVar* o){ |
PamTrack::PamTrack(TrkTrack* t, CaloTrkVar* c, ToFTrkVar* o, OrbitalInfoTrkVar *r){ |
300 |
|
|
301 |
trk_track = 0; |
trk_track = 0; |
302 |
calo_track = 0; |
calo_track = 0; |
303 |
tof_track = 0; |
tof_track = 0; |
304 |
|
orb_track = 0; |
305 |
// if(t)trk_track = new TrkTrack(*t); |
// if(t)trk_track = new TrkTrack(*t); |
306 |
// if(c)calo_track = new CaloTrkVar(*c); |
// if(c)calo_track = new CaloTrkVar(*c); |
307 |
// if(o)tof_track = new ToFTrkVar(*o); |
// if(o)tof_track = new ToFTrkVar(*o); |
308 |
if(t)trk_track = t; |
if(t)trk_track = t; |
309 |
if(c)calo_track = c; |
if(c)calo_track = c; |
310 |
if(o)tof_track = o; |
if(o)tof_track = o; |
311 |
|
if(r)orb_track = r; |
312 |
candeleteobj = 0; |
candeleteobj = 0; |
313 |
|
|
314 |
}; |
}; |
317 |
TrkTrack *t = track.trk_track; |
TrkTrack *t = track.trk_track; |
318 |
CaloTrkVar *c = track.calo_track; |
CaloTrkVar *c = track.calo_track; |
319 |
ToFTrkVar *o = track.tof_track; |
ToFTrkVar *o = track.tof_track; |
320 |
|
OrbitalInfoTrkVar *r = track.orb_track; |
321 |
|
|
322 |
trk_track = 0; |
trk_track = 0; |
323 |
calo_track = 0; |
calo_track = 0; |
324 |
tof_track = 0; |
tof_track = 0; |
325 |
|
orb_track = 0; |
326 |
if(t)trk_track = new TrkTrack(*t); |
if(t)trk_track = new TrkTrack(*t); |
327 |
if(c)calo_track = new CaloTrkVar(*c); |
if(c)calo_track = new CaloTrkVar(*c); |
328 |
if(o)tof_track = new ToFTrkVar(*o); |
if(o)tof_track = new ToFTrkVar(*o); |
329 |
|
if(r)orb_track = new OrbitalInfoTrkVar(*r); |
330 |
candeleteobj = 1; |
candeleteobj = 1; |
331 |
|
|
332 |
} |
} |
337 |
if(trk_track) trk_track->TrkTrack::Clear(); |
if(trk_track) trk_track->TrkTrack::Clear(); |
338 |
if(calo_track) calo_track->CaloTrkVar::Clear();//??? |
if(calo_track) calo_track->CaloTrkVar::Clear();//??? |
339 |
if(tof_track) tof_track->ToFTrkVar::Clear();//??? |
if(tof_track) tof_track->ToFTrkVar::Clear();//??? |
340 |
|
if(orb_track) orb_track->OrbitalInfoTrkVar::Clear();//??? |
341 |
}else{ |
}else{ |
342 |
trk_track = 0; |
trk_track = 0; |
343 |
calo_track = 0; |
calo_track = 0; |
344 |
tof_track = 0; |
tof_track = 0; |
345 |
|
orb_track = 0; |
346 |
} |
} |
347 |
pscore = 0; |
pscore = 0; |
348 |
iscore = 0; |
iscore = 0; |
363 |
tof_track->ToFTrkVar::Clear();//??? |
tof_track->ToFTrkVar::Clear();//??? |
364 |
delete tof_track; |
delete tof_track; |
365 |
} |
} |
366 |
|
if(orb_track){ |
367 |
|
orb_track->OrbitalInfoTrkVar::Clear();//??? |
368 |
|
delete orb_track; |
369 |
|
} |
370 |
}else{ |
}else{ |
371 |
Clear(); |
Clear(); |
372 |
} |
} |
722 |
|
|
723 |
Bool_t PamLevel2::IsGood(){ |
Bool_t PamLevel2::IsGood(){ |
724 |
Bool_t goodev=true; |
Bool_t goodev=true; |
725 |
// if(trk2_obj && trk2_obj->UnpackError() != 0 ) goodev = false; |
if(trk2_obj && trk2_obj->UnpackError() != 0 ) goodev = false; |
726 |
if(calo2_obj && calo2_obj->good != 1) goodev = false; |
if(calo2_obj && calo2_obj->good != 1) goodev = false; |
727 |
if(tof_obj && tof_obj->unpackError != 0) goodev = false; |
if(tof_obj && tof_obj->unpackError != 0) goodev = false; |
728 |
if(trig_obj && trig_obj->unpackError != 0) goodev = false; |
if(trig_obj && trig_obj->unpackError != 0) goodev = false; |
756 |
return &trk2_obj; |
return &trk2_obj; |
757 |
}; |
}; |
758 |
if(!objname.CompareTo("TrkHough")) { |
if(!objname.CompareTo("TrkHough")) { |
759 |
if(!trkh_obj) trkh_obj = new TrkHough(); |
if(!trkh_obj) { |
760 |
|
trkh_obj = new TrkHough(); |
761 |
|
trkh_obj->Set(); |
762 |
|
} |
763 |
return &trkh_obj; |
return &trkh_obj; |
764 |
}; |
}; |
765 |
if(!objname.CompareTo("CaloLevel1")) { |
if(!objname.CompareTo("CaloLevel1")) { |
881 |
// |
// |
882 |
//-------------------------------------- |
//-------------------------------------- |
883 |
/** |
/** |
884 |
* Give the pamela track associated to a tracker track, retrieving related calorimeter and tof track information. |
* Retrieves the OrbitalInfo track matching the seqno-th tracker stored track. |
885 |
|
* (If seqno = -1 retrieves the tracker-independent tof related track) |
886 |
|
*/ |
887 |
|
OrbitalInfoTrkVar *PamLevel2::GetOrbitalInfoStoredTrack(int seqno){ |
888 |
|
|
889 |
|
if( !orb_obj )return 0; |
890 |
|
|
891 |
|
if( orb_obj->OrbitalInfo::ntrk()==0 ){ |
892 |
|
cout << "PamLevel2::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo "<< seqno <<" but no OrbitalInfo tracks are stored"<<endl; |
893 |
|
return NULL; |
894 |
|
}; |
895 |
|
|
896 |
|
OrbitalInfoTrkVar *c = 0; |
897 |
|
Int_t it_tof=0; |
898 |
|
|
899 |
|
do{ |
900 |
|
c = orb_obj->OrbitalInfo::GetOrbitalInfoTrkVar(it_tof); |
901 |
|
it_tof++; |
902 |
|
} while( c && seqno != c->trkseqno && it_tof < orb_obj->OrbitalInfo::ntrk()); |
903 |
|
|
904 |
|
if(!c || seqno != c->trkseqno){ |
905 |
|
c = 0; |
906 |
|
if(seqno!=-1)cout << "PamLevel2::GetOrbitalInfoStoredTrack(int) : requested tracker SeqNo "<< seqno <<" does not match OrbitalInfo stored tracks"<<endl; |
907 |
|
}; |
908 |
|
return c; |
909 |
|
|
910 |
|
}; |
911 |
|
|
912 |
|
//-------------------------------------- |
913 |
|
// |
914 |
|
// |
915 |
|
//-------------------------------------- |
916 |
|
/** |
917 |
|
* Give the pamela track associated to a tracker track, retrieving related calorimeter, orbitalinfo and tof track information. |
918 |
*/ |
*/ |
919 |
PamTrack* PamLevel2::GetPamTrackAlong(TrkTrack* t){ |
PamTrack* PamLevel2::GetPamTrackAlong(TrkTrack* t){ |
920 |
|
|
923 |
|
|
924 |
CaloTrkVar *c = 0; |
CaloTrkVar *c = 0; |
925 |
ToFTrkVar *o = 0; |
ToFTrkVar *o = 0; |
926 |
|
OrbitalInfoTrkVar *r = 0; |
927 |
|
|
928 |
if(CAL2) c = GetCaloStoredTrack(t->GetSeqNo()); |
if(CAL2) c = GetCaloStoredTrack(t->GetSeqNo()); |
929 |
if(TOF) o = GetToFStoredTrack(t->GetSeqNo()); |
if(TOF) o = GetToFStoredTrack(t->GetSeqNo()); |
930 |
|
if(ORB) r = GetOrbitalInfoStoredTrack(t->GetSeqNo()); |
931 |
|
|
932 |
// if(t && c && o)track = new PamTrack(t,c,o); |
// if(t && c && o)track = new PamTrack(t,c,o); |
933 |
PamTrack *track = new PamTrack(t,c,o); |
PamTrack *track = new PamTrack(t,c,o,r); |
934 |
|
|
935 |
return track; |
return track; |
936 |
|
|
948 |
PamTrack* PamLevel2::GetStoredTrack(Int_t itrk){ |
PamTrack* PamLevel2::GetStoredTrack(Int_t itrk){ |
949 |
|
|
950 |
cout <<"PamLevel2::GetStoredTrack(Int_t itrk) **to-be-updated** "<<endl; |
cout <<"PamLevel2::GetStoredTrack(Int_t itrk) **to-be-updated** "<<endl; |
951 |
cout <<"for the moment, better use separately the methods: TrkLevel2::GetStoredTrack(seqno) CaloLevel2::GetCaloTrkVar(Int_t notrack) ToFLevel2::GetToFTrkVar(Int_t notrack)"<<endl; |
cout <<"for the moment, better use separately the methods: TrkLevel2::GetStoredTrack(seqno) CaloLevel2::GetCaloTrkVar(Int_t notrack) ToFLevel2::GetToFTrkVar(Int_t notrack) OrbitalInfo::GetOrbitalInfoTrkVar(Int_t notrack)"<<endl; |
952 |
cout <<"(if you use it, remember to delete the PamTrack object)"<<endl; |
cout <<"(if you use it, remember to delete the PamTrack object)"<<endl; |
953 |
PamTrack *track = 0; |
PamTrack *track = 0; |
954 |
|
|
1060 |
TrkTrack *ts = 0; |
TrkTrack *ts = 0; |
1061 |
CaloTrkVar *cs = 0; |
CaloTrkVar *cs = 0; |
1062 |
ToFTrkVar *os = 0; |
ToFTrkVar *os = 0; |
1063 |
|
OrbitalInfoTrkVar *rs = 0; |
1064 |
|
|
1065 |
// get tracker tracks |
// get tracker tracks |
1066 |
TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker |
TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker |
1067 |
CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); |
CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); |
1068 |
ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); |
ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); |
1069 |
|
OrbitalInfoTrkVar *rp = GetOrbitalInfoStoredTrack(tp->GetSeqNo()); |
1070 |
|
|
1071 |
TrkTrack *ti = 0; //tracker (image) |
TrkTrack *ti = 0; //tracker (image) |
1072 |
CaloTrkVar *ci = 0; |
CaloTrkVar *ci = 0; |
1073 |
ToFTrkVar *oi = 0; |
ToFTrkVar *oi = 0; |
1074 |
|
OrbitalInfoTrkVar *ri = 0; |
1075 |
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
1076 |
// if track has an image, check image selection |
// if track has an image, check image selection |
1077 |
|
|
1085 |
ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) |
ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) |
1086 |
ci = GetCaloStoredTrack(ti->GetSeqNo()); |
ci = GetCaloStoredTrack(ti->GetSeqNo()); |
1087 |
oi = GetToFStoredTrack(ti->GetSeqNo()); |
oi = GetToFStoredTrack(ti->GetSeqNo()); |
1088 |
|
ri = GetOrbitalInfoStoredTrack(ti->GetSeqNo()); |
1089 |
|
|
1090 |
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
1091 |
|
|
1427 |
ts = ti;//its image!! |
ts = ti;//its image!! |
1428 |
cs = ci; |
cs = ci; |
1429 |
os = oi; |
os = oi; |
1430 |
|
rs = ri; |
1431 |
Int_t totis = toti_score; |
Int_t totis = toti_score; |
1432 |
|
|
1433 |
ti = tp;//its image!! |
ti = tp;//its image!! |
1434 |
ci = cp; |
ci = cp; |
1435 |
oi = op; |
oi = op; |
1436 |
|
ri = rp; |
1437 |
|
|
1438 |
tp = ts;//its image!! |
tp = ts;//its image!! |
1439 |
cp = cs; |
cp = cs; |
1440 |
op = os; |
op = os; |
1441 |
|
rp = rs; |
1442 |
|
|
1443 |
toti_score = totp_score; |
toti_score = totp_score; |
1444 |
totp_score = totis; |
totp_score = totis; |
1468 |
// cout<<"o "<<cp<<endl; |
// cout<<"o "<<cp<<endl; |
1469 |
// cout<<"o "<<op<<endl; |
// cout<<"o "<<op<<endl; |
1470 |
|
|
1471 |
new(ttsorted[i]) PamTrack(tp,cp,op); |
new(ttsorted[i]) PamTrack(tp,cp,op,rp); |
1472 |
new(ttimage[i]) PamTrack(ti,ci,oi); |
new(ttimage[i]) PamTrack(ti,ci,oi,ri); |
1473 |
|
|
1474 |
((PamTrack*)(ttsorted[i]))->SetPScore(totp_score); |
((PamTrack*)(ttsorted[i]))->SetPScore(totp_score); |
1475 |
((PamTrack*)(ttsorted[i]))->SetIScore(toti_score); |
((PamTrack*)(ttsorted[i]))->SetIScore(toti_score); |
2740 |
// -------------------------------------- |
// -------------------------------------- |
2741 |
// ---> exit with TRUE |
// ---> exit with TRUE |
2742 |
// -------------------------------------- |
// -------------------------------------- |
2743 |
cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
if(DBG)cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
2744 |
|
// ---------------------------------------------------- |
2745 |
|
// update the tracker parameters |
2746 |
|
// (non ho trovato nessun altro modo sicuro di farlo...) |
2747 |
|
// ---------------------------------------------------- |
2748 |
|
if(!dbc || (dbc && !dbc->IsConnected()) )SetDBConnection(); |
2749 |
|
TrkParams::Set(GetRunInfo() ,dbc); |
2750 |
|
if(dbc)dbc->Close(); |
2751 |
|
|
2752 |
// ---------------------------------------------------- |
// ---------------------------------------------------- |
2753 |
// then check if the run has a fragment |
// then check if the run has a fragment |
2754 |
// in this case we have to switch to the next fragment |
// in this case we have to switch to the next fragment |
2757 |
if( |
if( |
2758 |
GetRunInfo()->ID_RUN_FRAG != 0 && |
GetRunInfo()->ID_RUN_FRAG != 0 && |
2759 |
// GetRunInfo()->ID_RUN_FRAG != GetRunInfo()->ID && |
// GetRunInfo()->ID_RUN_FRAG != GetRunInfo()->ID && |
2760 |
|
DBG && |
2761 |
true ){ |
true ){ |
2762 |
cout << "* fragment *"<<endl; |
cout << "* fragment *"<<endl; |
2763 |
} |
} |
2803 |
cout << " obt "<<obt; |
cout << " obt "<<obt; |
2804 |
cout <<" >> "<<GetRunInfo()->RUNHEADER_OBT<<" "<<GetRunInfo()->RUNTRAILER_OBT; |
cout <<" >> "<<GetRunInfo()->RUNHEADER_OBT<<" "<<GetRunInfo()->RUNTRAILER_OBT; |
2805 |
cout << " *** JUMP RUN *** irun "<<irun; |
cout << " *** JUMP RUN *** irun "<<irun; |
|
// if(!SECONDO_GIRO)cout << " (don't worry)"; |
|
|
// else cout << " (start worring...)"; |
|
2806 |
cout << endl; |
cout << endl; |
2807 |
} |
} |
2808 |
// irun++; |
// irun++; |
2834 |
cout << " obt "<<obt; |
cout << " obt "<<obt; |
2835 |
cout <<" >> "<<GetRunInfo()->RUNHEADER_OBT<<" "<<GetRunInfo()->RUNTRAILER_OBT; |
cout <<" >> "<<GetRunInfo()->RUNHEADER_OBT<<" "<<GetRunInfo()->RUNTRAILER_OBT; |
2836 |
} |
} |
2837 |
cout << endl; |
if(DBG)cout << endl; |
2838 |
cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" (run-entry "<<irun<<")"<<endl; |
if(DBG)cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" (run-entry "<<irun<<")"<<endl; |
2839 |
|
// ---------------------------------------------------- |
2840 |
|
// update the tracker parameters |
2841 |
|
// (non ho trovato nessun altro modo sicuro di farlo...) |
2842 |
|
// ---------------------------------------------------- |
2843 |
|
if(!dbc || (dbc && !dbc->IsConnected()) )SetDBConnection(); |
2844 |
|
TrkParams::Set(GetRunInfo() ,dbc); |
2845 |
|
if(dbc)dbc->Close(); |
2846 |
// cout << endl; |
// cout << endl; |
2847 |
prevshift = 0; |
prevshift = 0; |
2848 |
return true; |
return true; |
3914 |
// } |
// } |
3915 |
|
|
3916 |
if ( TRK0 ){ |
if ( TRK0 ){ |
3917 |
TrkParams::Load(6); |
// TrkParams::Load(6); |
3918 |
if( !TrkParams::IsLoaded(6) ){ |
// if( !TrkParams::IsLoaded(6) ){ |
3919 |
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- VK-mask not loaded"<<endl; |
// cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- VK-mask not loaded"<<endl; |
3920 |
}; |
// }; |
3921 |
if(!dbc || (dbc && !dbc->IsConnected()))SetDBConnection(); |
// if(!dbc || (dbc && !dbc->IsConnected()))SetDBConnection(); |
3922 |
TrkParams::SetCalib(run_obj,dbc); |
TrkParams::SetCalib(run_obj,dbc); |
3923 |
TrkParams::LoadCalib( ); |
TrkParams::LoadCalib( ); |
3924 |
if( !TrkParams::CalibIsLoaded() ){ |
if( !TrkParams::CalibIsLoaded() ){ |
3925 |
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- Calibration not loaded"<<endl; |
cout << " TTree* PamLevel2::GetYodaTree( ) -- WARNING -- Calibration not loaded"<<endl; |
3926 |
}; |
}; |
3927 |
dbc->Close(); // EMILIANO, do not leave open connections, open only when needed |
// if(dbc)dbc->Close(); // EMILIANO, do not leave open connections, open only when needed |
3928 |
} |
} |
3929 |
|
|
3930 |
|
|
3993 |
do{ |
do{ |
3994 |
if(shift>0){ |
if(shift>0){ |
3995 |
cout << " PKTNUM L2 --- "<< pktn << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
cout << " PKTNUM L2 --- "<< pktn << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
3996 |
cout << " RUN: ID "<< GetRunInfo()->ID << " ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<" ID_RUN_FRAG "<<GetRunInfo()->ID_RUN_FRAG << " EV_FROM "<<GetRunInfo()->EV_FROM <<endl; |
if(DBG)cout << " RUN: ID "<< GetRunInfo()->ID << " ID_ROOT_L0 "<<run_obj->ID_ROOT_L0<<" ID_RUN_FRAG "<<GetRunInfo()->ID_RUN_FRAG << " EV_FROM "<<GetRunInfo()->EV_FROM <<endl; |
3997 |
cout << " L2 <--> L0 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" prevshift "<<prevshift<<" )"<<endl; |
if(DBG)cout << " L2 <--> L0 mismatch ( irun "<<irun<<" irunentry "<<irunentry<<" shift "<<shift<<" prevshift "<<prevshift<<" )"<<endl; |
3998 |
} |
} |
3999 |
answer = l0_tree->GetEntry(quellagiusta+(Long64_t)shift+(Long64_t)prevshift); |
answer = l0_tree->GetEntry(quellagiusta+(Long64_t)shift+(Long64_t)prevshift); |
4000 |
shift++; |
shift++; |
4042 |
*/ |
*/ |
4043 |
Bool_t PamLevel2::SetDBConnection(){ |
Bool_t PamLevel2::SetDBConnection(){ |
4044 |
|
|
4045 |
|
// cout << "PamLevel2::SetDBConnection()" << endl; |
4046 |
if(DBG){ |
if(DBG){ |
4047 |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
4048 |
cout<<"Connecting to DB"<<endl; |
cout<<"Connecting to DB"<<endl; |