/[PAMELA software]/PamelaLevel2/src/PamLevel2.cpp
ViewVC logotype

Diff of /PamelaLevel2/src/PamLevel2.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.95 by pam-ts, Wed Oct 15 08:51:51 2014 UTC revision 1.112 by pam-fi, Mon Nov 2 09:59:54 2015 UTC
# Line 315  PamTrack::PamTrack(TrkTrack* t, CaloTrkV Line 315  PamTrack::PamTrack(TrkTrack* t, CaloTrkV
315    
316  //   candeleteobj = 0;  //   candeleteobj = 0;
317    
318    //  cout << t<<"--"<<c<<"--"<<o<<"--"<<r<<"--"<< endl;
319    
320    if (t){    if (t){
321        trk_track = new TrkTrack(*t);        trk_track = new TrkTrack(*t);
322        trk_ext_track = new ExtTrack(*t);//NB!! ha dimensione 6 invece che 8        trk_ext_track = new ExtTrack(*t);//NB!! ha dimensione 6 invece che 8
323      }else{
324          trk_track = new TrkTrack();
325          trk_ext_track = new ExtTrack();
326          
327    }    }
328    
329    if (c)    if (c)
330      calo_track = new CaloTrkVar(*c);      calo_track = new CaloTrkVar(*c);
331      else
332        calo_track = new CaloTrkVar();
333      
334    if (o)    if (o)
335      tof_track = new ToFTrkVar(*o);      tof_track = new ToFTrkVar(*o);
336      else
337        tof_track = new ToFTrkVar();
338    
339    if (r)    if (r)
340      orb_track = new OrbitalInfoTrkVar(*r);      orb_track = new OrbitalInfoTrkVar(*r);
341      else
342        orb_track = new OrbitalInfoTrkVar();
343    
344    //  cout << trk_track<<"--"<< calo_track <<"--"<<tof_track<<"--"<<orb_track<<"--"<< endl;
345    
346    candeleteobj = 1;    candeleteobj = 1;
347    
348  }  }
# Line 335  PamTrack::PamTrack(TrkTrack* t, CaloTrkV Line 352  PamTrack::PamTrack(TrkTrack* t, CaloTrkV
352   */   */
353  PamTrack::PamTrack(ExtTrack* t, CaloTrkVar* c, ToFTrkVar* o, OrbitalInfoTrkVar *r) {  PamTrack::PamTrack(ExtTrack* t, CaloTrkVar* c, ToFTrkVar* o, OrbitalInfoTrkVar *r) {
354    
355        
356    
357    trk_ext_track = 0;    trk_ext_track = 0;
358    trk_track = 0;    trk_track = 0;
359    calo_track = 0;    calo_track = 0;
# Line 354  PamTrack::PamTrack(ExtTrack* t, CaloTrkV Line 373  PamTrack::PamTrack(ExtTrack* t, CaloTrkV
373    
374  //   candeleteobj = 0;  //   candeleteobj = 0;
375    
376    //  cout << t<<"--"<<c<<"--"<<o<<"--"<<r<<"--"<< endl;
377    
378    
379    if (t){    if (t){
380  ////      trk_track = new TrkTrack(*t);//in this case TrkTrack object remains null  ////      trk_track = new TrkTrack(*t);//in this case TrkTrack object remains null
381        trk_ext_track = new ExtTrack(*t);        trk_ext_track = new ExtTrack(*t);
382      }else{
383          trk_ext_track = new ExtTrack();
384    }    }
385    if (c)    if (c)
386      calo_track = new CaloTrkVar(*c);      calo_track = new CaloTrkVar(*c);
387      else
388          calo_track = new CaloTrkVar();
389    
390    if (o)    if (o)
391      tof_track = new ToFTrkVar(*o);      tof_track = new ToFTrkVar(*o);
392      else
393        tof_track = new ToFTrkVar();
394    
395    if (r)    if (r)
396      orb_track = new OrbitalInfoTrkVar(*r);      orb_track = new OrbitalInfoTrkVar(*r);
397      else
398        orb_track = new OrbitalInfoTrkVar();
399    
400    //  cout << trk_track<<"--"<< calo_track <<"--"<<tof_track<<"--"<<orb_track<<"--"<< endl;
401    
402    candeleteobj = 1;    candeleteobj = 1;
403    pscore = 0;    pscore = 0;
404    iscore = 0;    iscore = 0;
405    
406  }  }
407  ;  ;
408    
409  PamTrack::PamTrack(const PamTrack& track) {  PamTrack::PamTrack(const PamTrack& track) {
410    
411    TrkTrack *t = track.trk_track;    TrkTrack *t = track.trk_track;
412      ExtTrack *e = track.trk_ext_track;
413    CaloTrkVar *c = track.calo_track;    CaloTrkVar *c = track.calo_track;
414    ToFTrkVar *o = track.tof_track;    ToFTrkVar *o = track.tof_track;
415    OrbitalInfoTrkVar *r = track.orb_track;    OrbitalInfoTrkVar *r = track.orb_track;
416    
417    trk_track = 0;    trk_ext_track = 0;
418    calo_track = 0;    trk_track     = 0;
419    tof_track = 0;    calo_track    = 0;
420    orb_track = 0;    tof_track     = 0;
421      orb_track     = 0;
422      if(e)
423          trk_ext_track = new ExtTrack(*e);
424    if (t)    if (t)
425      trk_track = new TrkTrack(*t);      trk_track = new TrkTrack(*t);
426    if (c)    if (c)
# Line 390  PamTrack::PamTrack(const PamTrack& track Line 429  PamTrack::PamTrack(const PamTrack& track
429      tof_track = new ToFTrkVar(*o);      tof_track = new ToFTrkVar(*o);
430    if (r)    if (r)
431      orb_track = new OrbitalInfoTrkVar(*r);      orb_track = new OrbitalInfoTrkVar(*r);
432    
433    candeleteobj = 1;    candeleteobj = 1;
434    pscore = 0;    pscore = 0;
435    iscore = 0;    iscore = 0;
436    
437  }  }
 void PamTrack::Clear() {  
438    
439    //    cout << "PamTrack::Clear() "<<candeleteobj<<endl;  void PamTrack::Copy( PamTrack& track) const {
440    
441        track.trk_track = trk_track;
442        track.trk_ext_track = trk_ext_track;
443        track.calo_track = calo_track;
444        track.tof_track = tof_track;
445        track.orb_track = orb_track;
446        
447        track.candeleteobj = candeleteobj;
448        track.pscore = pscore;
449        track.iscore = iscore;
450        
451    }
452    
453    
454    
455    void PamTrack::Clear(Option_t *option) {
456    
457    //    cout << "PamTrack::Clear( "<<option<<" ) "<<candeleteobj<<endl;
458    if (candeleteobj) {    if (candeleteobj) {
459                
460      if (trk_ext_track)      if (trk_ext_track)
461        trk_ext_track->ExtTrack::Clear();        trk_ext_track->ExtTrack::Clear(option);
462      if (trk_track)      if (trk_track)
463        trk_track->TrkTrack::Clear();        trk_track->TrkTrack::Clear();
464      if (calo_track)      if (calo_track)
# Line 426  void PamTrack::Delete() { Line 483  void PamTrack::Delete() {
483    //    cout << "PamTrack::Delete() "<<candeleteobj<<endl;    //    cout << "PamTrack::Delete() "<<candeleteobj<<endl;
484    if (candeleteobj) {    if (candeleteobj) {
485      if (trk_ext_track) {      if (trk_ext_track) {
486        trk_ext_track->ExtTrack::Clear();  //      trk_ext_track->ExtTrack::Clear("C");//Clear is called for all the array elements
487            trk_ext_track->ExtTrack::Clear("C+C");//Clear is called for all the array elements passing option 'C'
488        delete trk_ext_track;        delete trk_ext_track;
489      }      }
490      if (trk_track) {      if (trk_track) {
# Line 561  void PamLevel2::Initialize() { Line 619  void PamLevel2::Initialize() {
619    
620    run_obj = 0;//new GL_RUN();    run_obj = 0;//new GL_RUN();
621    soft_obj = 0;// Emiliano    soft_obj = 0;// Emiliano
622      proc_obj = 0;// Emiliano
623    irun = -1LL;    irun = -1LL;
624    irunt = -1LL;    irunt = -1LL;
625    totrunentry = 0LL;    totrunentry = 0LL;
# Line 571  void PamLevel2::Initialize() { Line 630  void PamLevel2::Initialize() {
630    gltsync = 0; // Emiliano    gltsync = 0; // Emiliano
631    fUpdateRunInfo = true; // Emiliano    fUpdateRunInfo = true; // Emiliano
632    fUseDBinRunInfo = true; // Emiliano    fUseDBinRunInfo = true; // Emiliano
633      fDiscarded = false; //EM
634    isSync = false; // by default assume that the level2 file(s) is(are) not sinchronized between L0/DB and L2, that is we miss some packets in L2 due to nested/DV-skipped events    isSync = false; // by default assume that the level2 file(s) is(are) not sinchronized between L0/DB and L2, that is we miss some packets in L2 due to nested/DV-skipped events
635    il0entry = 0LL;    il0entry = 0LL;
636    //  hasL0EE = true;    //  hasL0EE = true;
# Line 586  void PamLevel2::Initialize() { Line 646  void PamLevel2::Initialize() {
646    
647    run_tree = NULL;    run_tree = NULL;
648    run_tree_clone = NULL;    run_tree_clone = NULL;
649    
650      proc_tree = NULL;
651      proc_tree_clone = NULL;
652    
653    sel_tree = NULL;    sel_tree = NULL;
654    sel_tree_clone = NULL;    sel_tree_clone = NULL;
655    
# Line 617  void PamLevel2::Initialize() { Line 681  void PamLevel2::Initialize() {
681    if (strcmp(pamdbpsw, ""))    if (strcmp(pamdbpsw, ""))
682      psw = pamdbpsw;      psw = pamdbpsw;
683    
684      customString = "";
685    
686    //    sorted_tracks = 0;//new TRefArray();    //    sorted_tracks = 0;//new TRefArray();
687    
688    CAL0 = false;    CAL0 = false;
# Line 633  void PamLevel2::Initialize() { Line 699  void PamLevel2::Initialize() {
699    ND = true;    ND = true;
700    AC = true;    AC = true;
701    ORB = true;    ORB = true;
702      PROC = true;
703    GP = false;    GP = false;
704    
705    EXT = false;    EXT = false;
706    NUC = false;    NUC = false;
707    trkAlg = "";//default tracking algorythm    trkAlg = "STD";//default tracking algorythm
708    
709    RUN = true;    RUN = true;
710    
# Line 675  void PamLevel2::Delete() { Line 742  void PamLevel2::Delete() {
742      delete run_obj;      delete run_obj;
743    if (soft_obj)    if (soft_obj)
744      delete soft_obj; //Emiliano      delete soft_obj; //Emiliano
745      if (proc_obj)
746        delete proc_obj; //Emiliano
747    
748    //    cout << "void PamLevel2::Clear()"<<endl;    //    cout << "void PamLevel2::Clear()"<<endl;
749    if (h0_obj)    if (h0_obj)
# Line 875  void PamLevel2::Clear() { Line 944  void PamLevel2::Clear() {
944      orb2_obj->Clear();      orb2_obj->Clear();
945    if (gp_obj)    if (gp_obj)
946      gp_obj->Clear();      gp_obj->Clear();
947      if (proc_obj)
948        proc_obj->Clear();
949    
950    //    if(sorted_tracks)sorted_tracks->Clear();    //    if(sorted_tracks)sorted_tracks->Clear();
951    //    sorted_tracks.Clear();    //    sorted_tracks.Clear();
# Line 955  void PamLevel2::Reset() { Line 1026  void PamLevel2::Reset() {
1026    if (sel_tree)    if (sel_tree)
1027      sel_tree->Delete();;      sel_tree->Delete();;
1028    sel_tree = NULL;    sel_tree = NULL;
1029    
1030      if (proc_tree)
1031        proc_tree->Delete();
1032      proc_tree = NULL;
1033    //    //
1034    // Close file    // Close file
1035    //    //
# Line 978  void PamLevel2::Reset() { Line 1053  void PamLevel2::Reset() {
1053    ac_obj = 0;    ac_obj = 0;
1054    orb2_obj = 0;    orb2_obj = 0;
1055    gp_obj = 0;    gp_obj = 0;
1056      proc_obj = 0;
1057    
1058    trk_ext_obj     = 0;    trk_ext_obj     = 0;
1059    trk_ext_nuc_obj = 0;    trk_ext_nuc_obj = 0;
# Line 1009  void PamLevel2::Reset() { Line 1085  void PamLevel2::Reset() {
1085    //    //
1086    run_obj = 0;//new GL_RUN();    run_obj = 0;//new GL_RUN();
1087    soft_obj = 0;// Emiliano    soft_obj = 0;// Emiliano
1088      proc_obj = 0;// Emiliano
1089    irun = -1;    irun = -1;
1090    irunt = -1;    irunt = -1;
1091    totrunentry = 0LL;    totrunentry = 0LL;
# Line 1183  void *PamLevel2::GetPointerTo(const char Line 1260  void *PamLevel2::GetPointerTo(const char
1260    if (!objname.CompareTo("SoftInfo"))    if (!objname.CompareTo("SoftInfo"))
1261      return &soft_obj; // Emiliano      return &soft_obj; // Emiliano
1262    
1263      if (!objname.CompareTo("ProcInfo")){
1264        if (!proc_obj)
1265          proc_obj = new ProcInfo();    
1266        return &proc_obj; // Emiliano
1267      }
1268    
1269    return NULL;    return NULL;
1270  }  }
1271  ;  ;
# Line 1200  CaloTrkVar *PamLevel2::GetCaloStoredTrac Line 1283  CaloTrkVar *PamLevel2::GetCaloStoredTrac
1283      return 0;      return 0;
1284    
1285    if (calo2_obj->CaloLevel2::ntrk() == 0) {    if (calo2_obj->CaloLevel2::ntrk() == 0) {
1286      cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo " << seqno        if( seqno >=0 ){
1287          << " but no Calorimeter tracks are stored" << endl;            cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo " << seqno;
1288      return NULL;            cout << " but no Calorimeter tracks are stored" << endl;
1289          }
1290          return NULL;
1291    };    };
1292    
1293    CaloTrkVar *c = 0;    CaloTrkVar *c = 0;
# Line 1215  CaloTrkVar *PamLevel2::GetCaloStoredTrac Line 1300  CaloTrkVar *PamLevel2::GetCaloStoredTrac
1300    
1301    if (!c || seqno != c->trkseqno) {    if (!c || seqno != c->trkseqno) {
1302      c = 0;      c = 0;
1303      if (seqno != -1)      if (seqno != -1 && seqno>=0)
1304        cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo " << seqno        cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo " << seqno
1305            << " does not match Calorimeter stored tracks" << endl;            << " does not match Calorimeter stored tracks" << endl;
1306    };    };
# Line 1334  OrbitalInfoTrkVar *PamLevel2::GetOrbital Line 1419  OrbitalInfoTrkVar *PamLevel2::GetOrbital
1419  //  //
1420  //  //
1421  //--------------------------------------  //--------------------------------------
1422  /**  // /**
1423   * Give the pamela track associated to a tracker track, retrieving related calorimeter, orbitalinfo and tof track information.  //  * Give the pamela track associated to a tracker track, retrieving related calorimeter, orbitalinfo and tof track information.
1424   */  //  */
1425  PamTrack* PamLevel2::GetPamTrackAlong(TrkTrack* t) {  // PamTrack* PamLevel2::GetPamTrackAlong(TrkTrack* t) {
1426    
1427    cout << "PamLevel2::GetPamTrackAlong(TrkTrack* t) **obsolete** " << endl;  //   cout << "PamLevel2::GetPamTrackAlong(TrkTrack* t) **obsolete** " << endl;
1428    cout << "(if you use it, remember to delete the PamTrack object)" << endl;  //   cout << "(if you use it, remember to delete the PamTrack object)" << endl;
1429    
1430    CaloTrkVar *c = 0;  //   CaloTrkVar *c = 0;
1431    ToFTrkVar *o = 0;  //   ToFTrkVar *o = 0;
1432    OrbitalInfoTrkVar *r = 0;  //   OrbitalInfoTrkVar *r = 0;
1433    
1434    //   if (CAL2)
1435    //     c = GetCaloStoredTrack(t->GetSeqNo());
1436    //   if (TOF)
1437    //     o = GetToFStoredTrack(t->GetSeqNo());
1438    //   if (ORB)
1439    //     r = GetOrbitalInfoStoredTrack(t->GetSeqNo());
1440    
1441    if (CAL2)  //   //    if(t && c && o)track = new PamTrack(t,c,o);
1442      c = GetCaloStoredTrack(t->GetSeqNo());  //   PamTrack *track = new PamTrack(t, c, o, r);
   if (TOF)  
     o = GetToFStoredTrack(t->GetSeqNo());  
   if (ORB)  
     r = GetOrbitalInfoStoredTrack(t->GetSeqNo());  
1443    
1444    //    if(t && c && o)track = new PamTrack(t,c,o);  //   return track;
   PamTrack *track = new PamTrack(t, c, o, r);  
1445    
1446    return track;  // }
1447    // ;
 }  
 ;  
1448  //--------------------------------------  //--------------------------------------
1449  //  //
1450  //  //
1451  //--------------------------------------  //--------------------------------------
1452  /**  // /**
1453   * Retrieves the it-th stored track.  //  * Retrieves the it-th stored track.
1454   * It override TrkLevel2::GetTrack(int it).  //  * It override TrkLevel2::GetTrack(int it).
1455   * @param itrk Track number, ranging from 0 to GetNTracks().  //  * @param itrk Track number, ranging from 0 to GetNTracks().
1456   */  //  */
1457    
1458    // PamTrack* PamLevel2::GetStoredTrack(Int_t itrk) {
1459    
1460    //   cout << "PamLevel2::GetStoredTrack(Int_t itrk) **to-be-updated** " << endl;
1461    //   cout
1462    //       << "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)"
1463    //       << endl;
1464    //   cout << "(if you use it, remember to delete the PamTrack object)" << endl;
1465    //   PamTrack *track = 0;
1466    
1467  PamTrack* PamLevel2::GetStoredTrack(Int_t itrk) {  //   if (itrk >= 0 && itrk < trk2_obj->TrkLevel2::ntrk()) {
1468    
1469    cout << "PamLevel2::GetStoredTrack(Int_t itrk) **to-be-updated** " << endl;  //     TrkTrack *t = trk2_obj->TrkLevel2::GetStoredTrack(itrk);
1470    cout  //     track = GetPamTrackAlong(t);
       << "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;  
   cout << "(if you use it, remember to delete the PamTrack object)" << endl;  
   PamTrack *track = 0;  
1471    
1472    if (itrk >= 0 && itrk < trk2_obj->TrkLevel2::ntrk()) {  //   }
1473    //   else {
1474      TrkTrack *t = trk2_obj->TrkLevel2::GetStoredTrack(itrk);  //     cout << "PamLevel2::GetStoredTrack(int) : tracker track SeqNo " << itrk << " does not exist (GetNTracks() = "
1475      track = GetPamTrackAlong(t);  //         << trk2_obj->TrkLevel2::GetNTracks() << ")" << endl;
1476    //   };
   }  
   else {  
     cout << "PamLevel2::GetStoredTrack(int) : tracker track SeqNo " << itrk << " does not exist (GetNTracks() = "  
         << trk2_obj->TrkLevel2::GetNTracks() << ")" << endl;  
   };  
1477    
1478    return track;  //   return track;
1479    
1480  }  // }
1481  //--------------------------------------  //--------------------------------------
1482  //  //
1483    
# Line 1446  void PamLevel2::SortTracks() { Line 1531  void PamLevel2::SortTracks() {
1531    Int_t ObjectNumber = TProcessID::GetObjectCount();    Int_t ObjectNumber = TProcessID::GetObjectCount();
1532    
1533    // create TCloneArrays to store tracks and its images    // create TCloneArrays to store tracks and its images
1534    if (!tsorted)  //   if (!tsorted)
1535      tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks());  //     tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
1536    tsorted->Delete();  //   tsorted->Clear("C+C");//Delete();
1537    TClonesArray &ttsorted = *tsorted;  //   if (!timage)
1538    //     timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
1539    //   timage->Clear("C+C");//Delete();
1540    
1541      if(tsorted)delete tsorted;
1542      if(timage) delete timage;
1543      tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
1544      timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
1545    
1546    if (!timage)  
1547      timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks());    TClonesArray &ttsorted = *tsorted;
   timage->Delete();  
1548    TClonesArray &ttimage = *timage;    TClonesArray &ttimage = *timage;
1549    
1550    
# Line 1895  void PamLevel2::SortTracks() { Line 1986  void PamLevel2::SortTracks() {
1986      //  cout<<"o "<<cp<<endl;      //  cout<<"o "<<cp<<endl;
1987      //  cout<<"o "<<op<<endl;      //  cout<<"o "<<op<<endl;
1988    
1989    //     cout <<"old p:"<< tp<<"--"<<cp<<"--"<<op<<"--"<<rp<<"--"<< endl;
1990    //     cout <<"old i:"<< ti<<"--"<<ci<<"--"<<oi<<"--"<<ri<<"--"<< endl;
1991    
1992      new (ttsorted[i]) PamTrack(tp, cp, op, rp);      new (ttsorted[i]) PamTrack(tp, cp, op, rp);
1993      new (ttimage[i]) PamTrack(ti, ci, oi, ri);      new (ttimage[i]) PamTrack(ti, ci, oi, ri);
1994    
# Line 1922  void PamLevel2::SortTracks() { Line 2016  void PamLevel2::SortTracks() {
2016    issorted = true;    issorted = true;
2017    lastsorted = GetReadEntry();    lastsorted = GetReadEntry();
2018    
2019    //  cout <<" SortTracks() -- end"<<endl;
2020    
2021  }  }
2022  ;  ;
2023  //  //
# Line 1989  void PamLevel2::SortTracksNew() { Line 2085  void PamLevel2::SortTracksNew() {
2085    //-----------------------------------------------------------    //-----------------------------------------------------------
2086    // create/reset TCloneArrays to store tracks and their images    // create/reset TCloneArrays to store tracks and their images
2087    //-----------------------------------------------------------    //-----------------------------------------------------------
2088    
2089    //  cout << " PamLevel2::SortTracksNew() --- Clear TClonesArray objects"<<endl;
2090        
2091    // main tracks from standard alg    // main tracks from standard alg
2092    if (!tsorted)  //   if (!tsorted)
2093        tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks());  //       tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
2094    tsorted->Delete();  //   tsorted->Clear("C+C");//Delete();
2095    // track images from standard alg  //   // track images from standard alg
2096    if (!timage)  //   if (!timage)
2097        timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks());  //       timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
2098    timage->Delete();  //   timage->Clear("C+C");//Delete();
2099    // tracks from extended algorythm  //   // tracks from extended algorythm
2100    if(EXT && !text)  //   if(EXT && !text)
2101        text = new TClonesArray("PamTrack",trk_ext_obj->GetEntries());  //       text = new TClonesArray("PamTrack",trk_ext_obj->GetEntries());
2102    if(text)text->Delete();  //   if(text)text->Clear("C+C");//Delete();
2103    
2104      if(tsorted)delete tsorted;
2105      if(timage) delete timage;
2106      if(text)   delete text;
2107      tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
2108      timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
2109      text = new TClonesArray("PamTrack",trk_ext_obj->GetEntries());
2110    
2111    //-----------------------------------------------------------    //-----------------------------------------------------------
2112    // create/reset TCloneArrays to store tracks and their images    // create/reset TCloneArrays to store tracks and their images
2113    //-----------------------------------------------------------    //-----------------------------------------------------------
2114    if(NUC){    if(NUC){
2115    
2116          
2117          if(tsorted_nuc)delete tsorted_nuc;
2118          if(timage_nuc) delete timage_nuc;
2119          if(text_nuc)   delete text_nuc;
2120          tsorted_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks());
2121          timage_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks());
2122          text_nuc = new TClonesArray("PamTrack",trk_ext_nuc_obj->GetEntries());
2123    
2124    // main tracks from standard alg    // main tracks from standard alg
2125        if (!tsorted_nuc)  //       if (!tsorted_nuc)
2126            tsorted_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks());  //        tsorted_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks());
2127        tsorted_nuc->Delete();  //       tsorted_nuc->Clear("C+C");//Delete();
2128        // track images from standard alg  //       // track images from standard alg
2129        if (!timage_nuc)  //       if (!timage_nuc)
2130            timage_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks());  //        timage_nuc = new TClonesArray("PamTrack", trk2_nuc_obj->GetNTracks());
2131        timage_nuc->Delete();  //       timage_nuc->Clear("C+C");//Delete();
2132        // tracks from extended algorythm  //       // tracks from extended algorythm
2133        if(EXT && !text_nuc)  //       if(EXT && !text_nuc)
2134            text_nuc = new TClonesArray("PamTrack",trk_ext_nuc_obj->GetEntries());  //        text_nuc = new TClonesArray("PamTrack",trk_ext_nuc_obj->GetEntries());
2135        if(text_nuc)text_nuc->Delete();  //       if(text_nuc)text_nuc->Clear("C+C");//Delete();
2136    
2137    }    }
2138    //--------------------------------------------------    //--------------------------------------------------
2139    // retrieve sorting method    // retrieve sorting method
# Line 2066  void PamLevel2::SortTracksNew() { Line 2181  void PamLevel2::SortTracksNew() {
2181    
2182        if(doit == 0){        if(doit == 0){
2183    
2184            trk2  = trk2_obj;            trk2  = (TRK2 ? trk2_obj: NULL);;
2185            calo2 = calo2_obj;            calo2 = (CAL2 ? calo2_obj: NULL);;
2186            tof2  = tof2_obj;            tof2  = (TOF  ?tof2_obj: NULL);;
2187            orb2  = orb2_obj;            orb2  = (ORB ? orb2_obj: NULL);;
         
           trkext = trk_ext_obj;  
           caloext = calo_ext_obj;  
           tofext = tof_ext_obj;  
           orbext = orb_ext_obj;  
       
         
         
2188                
2189              trkext = (TRK2 ? trk_ext_obj: NULL);;
2190              caloext = (CAL2 ? calo_ext_obj: NULL);;
2191              tofext = (TOF  ?tof_ext_obj: NULL);;
2192              orbext = (ORB ? orb_ext_obj: NULL);;
2193    
2194        }else if (doit == 1){        }else if (doit == 1){
2195    
2196            if(!NUC)break;            if(!NUC)break;
2197    
2198                
2199            trk2  = trk2_nuc_obj;            trk2  = (TRK2 ?trk2_nuc_obj: NULL);;
2200            calo2 = calo2_nuc_obj;            calo2 = (CAL2 ? calo2_nuc_obj: NULL);;
2201            tof2  = tof2_nuc_obj;            tof2  = (TOF  ?tof2_nuc_obj: NULL);;
2202            orb2  = orb2_nuc_obj;            orb2  = (ORB ? orb2_nuc_obj: NULL);;
2203                
2204            trkext = trk_ext_nuc_obj;            trkext = (TRK2 ?trk_ext_nuc_obj: NULL);;
2205            caloext = calo_ext_nuc_obj;            caloext = (CAL2 ? calo_ext_nuc_obj: NULL);;
2206            tofext = tof_ext_nuc_obj;            tofext = (TOF  ?tof_ext_nuc_obj: NULL);;
2207            orbext = orb_ext_nuc_obj;            orbext = (ORB ? orb_ext_nuc_obj: NULL);;
2208                
2209                
2210                
# Line 2126  void PamLevel2::SortTracksNew() { Line 2237  void PamLevel2::SortTracksNew() {
2237            OrbitalInfoTrkVar *rs = 0;            OrbitalInfoTrkVar *rs = 0;
2238    
2239            // get tracker tracks            // get tracker tracks
2240            TrkTrack *tp = trk2->GetTrack(i); //tracker            TrkTrack *tp          = (TRK2 ? trk2->GetTrack(i): NULL); //tracker
2241            CaloTrkVar *cp = calo2->GetCaloStoredTrack(tp->GetSeqNo());            CaloTrkVar *cp        = (CAL2 ? calo2->GetCaloStoredTrack(tp->GetSeqNo()) : NULL);
2242            ToFTrkVar *op = tof2->GetToFStoredTrack(tp->GetSeqNo());            ToFTrkVar *op         = (TOF  ? tof2->GetToFStoredTrack(tp->GetSeqNo())   : NULL);
2243            OrbitalInfoTrkVar *rp = orb2->GetOrbitalInfoStoredTrack(tp->GetSeqNo());            OrbitalInfoTrkVar *rp = (ORB ? orb2->GetOrbitalInfoStoredTrack(tp->GetSeqNo()) : NULL);
2244    
2245    //        cout << "ORB="<<ORB<<" rp="<<rp<<endl;
2246    
2247            TrkTrack *ti = 0; //tracker (image)            TrkTrack *ti = 0; //tracker (image)
2248            CaloTrkVar *ci = 0;            CaloTrkVar *ci = 0;
# Line 2145  void PamLevel2::SortTracksNew() { Line 2258  void PamLevel2::SortTracksNew() {
2258    
2259            if (tp->HasImage()) {            if (tp->HasImage()) {
2260    
2261                ti = trk2->GetTrackImage(i); //tracker (image)                ti = (TRK2 ? trk2->GetTrackImage(i) : NULL); //tracker (image)
2262                ci = calo2->GetCaloStoredTrack(ti->GetSeqNo());                ci = (CAL2 ? calo2->GetCaloStoredTrack(ti->GetSeqNo()): NULL);
2263                oi = tof2->GetToFStoredTrack(ti->GetSeqNo());                oi = (TOF  ? tof2->GetToFStoredTrack(ti->GetSeqNo()): NULL);
2264                ri = orb2->GetOrbitalInfoStoredTrack(ti->GetSeqNo());                ri = (ORB ? orb2->GetOrbitalInfoStoredTrack(ti->GetSeqNo()): NULL);
2265    
2266                //            cout << "its image "<<i << " "<<hex<< ti <<dec<< endl;                //            cout << "its image "<<i << " "<<hex<< ti <<dec<< endl;
2267    
# Line 2516  void PamLevel2::SortTracksNew() { Line 2629  void PamLevel2::SortTracksNew() {
2629            //    cout<<"o "<<cp<<endl;            //    cout<<"o "<<cp<<endl;
2630            //    cout<<"o "<<op<<endl;            //    cout<<"o "<<op<<endl;
2631    
2632    //        cout <<"p:"<< tp<<"--"<<cp<<"--"<<op<<"--"<<rp<<"--"<< endl;
2633    //        cout <<"i:"<< ti<<"--"<<ci<<"--"<<oi<<"--"<<ri<<"--"<< endl;
2634    
2635    
2636    
2637            new (ttsorted[i]) PamTrack(tp, cp, op, rp);            new (ttsorted[i]) PamTrack(tp, cp, op, rp);
2638            new (ttimage[i]) PamTrack(ti, ci, oi, ri);            new (ttimage[i]) PamTrack(ti, ci, oi, ri);
2639    
# Line 2539  void PamLevel2::SortTracksNew() { Line 2657  void PamLevel2::SortTracksNew() {
2657  //   }  //   }
2658    
2659    
2660  //       cout << "text "<<doit<<endl;        //      cout << "text "<<orbext<<endl;
2661    
2662    
2663        //--------------------------------------------------        //--------------------------------------------------
# Line 2548  void PamLevel2::SortTracksNew() { Line 2666  void PamLevel2::SortTracksNew() {
2666        if(EXT){        if(EXT){
2667            for(int it=0; it<trkext->GetEntries(); it++){            for(int it=0; it<trkext->GetEntries(); it++){
2668                                
2669                new (ttext[it]) PamTrack((ExtTrack*)(*trkext)[it], (CaloTrkVar*)(*caloext)[it], (ToFTrkVar*)(*tofext)[it], (OrbitalInfoTrkVar*)(*orbext)[it]);  //            if(
2670    //                it < caloext->GetEntries() &&
2671    //                it < tofext->GetEntries() &&
2672    //                it < orbext->GetEntries() &&
2673    //                true){
2674                  
2675                  ExtTrack *t = (trkext ?(ExtTrack*)(*trkext)[it]:NULL );
2676                  CaloTrkVar *c =(caloext ?(CaloTrkVar*)(*caloext)[it]:NULL );
2677                  ToFTrkVar *o = (tofext ?(ToFTrkVar*)(*tofext)[it]:NULL );
2678                  OrbitalInfoTrkVar *r =(orbext ?(OrbitalInfoTrkVar*)(*orbext)[it]:NULL );
2679    //            cout <<"ext:"<< t<<"--"<<c<<"--"<<o<<"--"<<r<<"--"<< endl;
2680                                
2681                  new (ttext[it]) PamTrack(t, c, o, r);
2682    //            }else{
2683    //                cout << " PamLevel2::SortTracksNew() --> ORRORE E RACCAPRICCIO!!!"<<endl;
2684    //                cout << " trk  ext-tracks = "<<trkext->GetEntries()<<endl;
2685    //                cout << " calo ext-tracks = "<<caloext->GetEntries()<<endl;
2686    //                cout << " tof  ext-tracks = "<<tofext->GetEntries()<<endl;
2687    //                cout << " orb  ext-tracks = "<<orbext->GetEntries()<<endl;
2688    //            }
2689            }            }
2690        }        }
2691                
2692    //  cout <<" SortTracksNew() -- end"<<endl;
2693    
2694    
2695    };    };
# Line 2580  void PamLevel2::SortTracksNew() { Line 2717  void PamLevel2::SortTracksNew() {
2717  /**  /**
2718   * This method overrides TrkLevel2::GetTracks(), where sorting is done by decreasing number of fit points and increasing chi^2.   * This method overrides TrkLevel2::GetTracks(), where sorting is done by decreasing number of fit points and increasing chi^2.
2719   * PamLevel2::GetTracks() keeps the same track order given by TrkLevel2::GetTracks(), but checks image selection by using calorimeter and ToF tracking information.   * PamLevel2::GetTracks() keeps the same track order given by TrkLevel2::GetTracks(), but checks image selection by using calorimeter and ToF tracking information.
2720   /*   */
2721    
2722  // TRefArray *PamLevel2::GetTracks(){  // TRefArray *PamLevel2::GetTracks(){
2723    
# Line 2598  void PamLevel2::SortTracksNew() { Line 2735  void PamLevel2::SortTracksNew() {
2735  //  //
2736  //  //
2737  //--------------------------------------  //--------------------------------------
2738    
2739  /**  /**
2740   * Retrieves the it-th Pamela "physical" track.   * Retrieves the it-th Pamela "physical" track.
2741   * It override TrkLevel2::GetTrack(int it).   * It override TrkLevel2::GetTrack(int it).
2742   * @param it Track number, ranging from 0 to GetNTracks().   * @param it Track number, ranging from 0 to GetNTracks().
2743   */   */
2744  PamTrack *PamLevel2::GetTrack(int it) {  PamTrack *PamLevel2::GetTrackOld(int it) {
2745    
2746    PamTrack *track = NULL;    PamTrack *track = NULL;
2747    
# Line 2612  PamTrack *PamLevel2::GetTrack(int it) { Line 2750  PamTrack *PamLevel2::GetTrack(int it) {
2750    //  *-*-*-*-*-*-*-*-*-*-*-*-*    //  *-*-*-*-*-*-*-*-*-*-*-*-*
2751    if (!tsorted)    if (!tsorted)
2752      return track;      return track;
2753    if (!tsorted->GetEntries())  //   if (!tsorted->GetEntries())
2754    //     return track;
2755      if (tsorted->GetEntries()==0)
2756      return track;      return track;
2757    
2758    
2759    if (it >= 0 && it < trk2_obj->TrkLevel2::GetNTracks()) {    if (
2760      track = (PamTrack*)((*tsorted)[it]);        tsorted &&
2761          it >= 0 &&
2762          it < trk2_obj->TrkLevel2::GetNTracks() &&
2763          it < tsorted->GetEntries() &&
2764          true) {
2765          track = (PamTrack*)((*tsorted)[it]);
2766    }    }
2767    else {    else {
2768      cout << "PamLevel2::GetTrack(int) : tracker track SeqNo " << it << " does not exist (GetNTracks() = "      cout << "PamLevel2::GetTrackOld(int) : tracker track SeqNo " << it << " does not exist (GetNTracks() = "
2769          << trk2_obj->TrkLevel2::GetNTracks() << ")" << endl;          << trk2_obj->TrkLevel2::GetNTracks() << ")" << endl;
2770    };    };
2771    
# Line 2636  PamTrack *PamLevel2::GetTrack(int it) { Line 2781  PamTrack *PamLevel2::GetTrack(int it) {
2781   * @param it Track number, ranging from 0 to GetNTracks().   * @param it Track number, ranging from 0 to GetNTracks().
2782   * @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation.   * @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation.
2783   */   */
2784  PamTrack *PamLevel2::GetTrack(int it, char* alg) {  PamTrack *PamLevel2::GetTrack(int it, const char* alg) {
2785    
2786      TString s(alg);      TString s(alg);
2787      if(!s.CompareTo("") ||!s.CompareTo("STD") )return GetTrack(it); //old algorythm      if(!s.CompareTo("") ||!s.CompareTo("STD") )return GetTrackOld(it); //old algorythm
2788    
2789    
2790      SortTracksNew();      SortTracksNew();
# Line 2687  PamTrack *PamLevel2::GetTrack(int it, ch Line 2832  PamTrack *PamLevel2::GetTrack(int it, ch
2832      };      };
2833            
2834            
2835        cout << "PamTrack *PamLevel2::GetTrack("<<it<<","<<alg<<") -- wrong track number or unrecognised algorithm"<<endl;
2836            
2837      return NULL;      return NULL;
2838    
# Line 2702  TClonesArray *PamLevel2::GetTracks() { Line 2848  TClonesArray *PamLevel2::GetTracks() {
2848    
2849  }  }
2850  ;  ;
2851  Int_t  PamLevel2::GetNTracks(char* alg) {  Int_t  PamLevel2::GetNTracks(const char* alg) {
2852    
2853    
2854  //    cout << " trk_nuc_obj->GetEntries() "<<trk_nuc_obj->GetEntries()<<" trk2_nuc_obj->GetNTracks() "<<trk2_nuc_obj->GetNTracks()<<endl;  //    cout << " trk_nuc_obj->GetEntries() "<<trk_nuc_obj->GetEntries()<<" trk2_nuc_obj->GetNTracks() "<<trk2_nuc_obj->GetNTracks()<<endl;
# Line 2723  Int_t  PamLevel2::GetNTracks(char* alg) Line 2869  Int_t  PamLevel2::GetNTracks(char* alg)
2869      if(s.Contains("NUC", TString::kIgnoreCase) && NUC )      if(s.Contains("NUC", TString::kIgnoreCase) && NUC )
2870          return trk2_nuc_obj->TrkLevel2::GetNTracks();          return trk2_nuc_obj->TrkLevel2::GetNTracks();
2871            
2872        cout << "Int_t  PamLevel2::GetNTracks("<<alg<<") -- unrecognised algorithm"<<endl;
2873    
2874      return 0;      return 0;
2875    
2876  }  }
# Line 2736  Int_t  PamLevel2::GetNTracks(char* alg) Line 2884  Int_t  PamLevel2::GetNTracks(char* alg)
2884   * Retrieves (if present) the image of the it-th Pamela "physical" track, sorted by the method PamLevel2::SortTracks().   * Retrieves (if present) the image of the it-th Pamela "physical" track, sorted by the method PamLevel2::SortTracks().
2885   * @param it Track number, ranging from 0 to GetNTracks().   * @param it Track number, ranging from 0 to GetNTracks().
2886   */   */
2887  PamTrack *PamLevel2::GetTrackImage(int it) {  PamTrack *PamLevel2::GetTrackImageOld(int it) {
2888    
2889    //  *-*-*-*-*-*-*-*-*-*-*-*-*    //  *-*-*-*-*-*-*-*-*-*-*-*-*
2890    SortTracks();    SortTracks();
# Line 2760  PamTrack *PamLevel2::GetTrackImage(int i Line 2908  PamTrack *PamLevel2::GetTrackImage(int i
2908      };      };
2909    }    }
2910    else {    else {
2911      cout << "PamLevel2::GetTrackImage(int) : Tracker track SeqNo " << it << " does not exist (GetNTracks() = "      cout << "PamLevel2::GetTrackImageOld(int) : Tracker track SeqNo " << it << " does not exist (GetNTracks() = "
2912          << trk2_obj->TrkLevel2::GetNTracks() << ")" << endl;          << trk2_obj->TrkLevel2::GetNTracks() << ")" << endl;
2913    };    };
2914    
# Line 2771  PamTrack *PamLevel2::GetTrackImage(int i Line 2919  PamTrack *PamLevel2::GetTrackImage(int i
2919   * @param it Track number, ranging from 0 to GetNTracks().   * @param it Track number, ranging from 0 to GetNTracks().
2920   * @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation.   * @param alg Algorythm, see SetTrakingAlgorythm(char *alg) for explanation.
2921   */   */
2922  PamTrack *PamLevel2::GetTrackImage(int it, char* alg) {  PamTrack *PamLevel2::GetTrackImage(int it, const char* alg) {
2923    
2924      TString s(alg);      TString s(alg);
2925      if(!s.CompareTo("") || !s.CompareTo("STD"))return GetTrack(it); //old algorythm      if(!s.CompareTo("") || !s.CompareTo("STD"))return GetTrackImageOld(it); //old algorythm
2926    
2927    
2928      SortTracksNew();      SortTracksNew();
# Line 2792  PamTrack *PamLevel2::GetTrackImage(int i Line 2940  PamTrack *PamLevel2::GetTrackImage(int i
2940                  PamTrack *temp = (PamTrack*) t[it];                  PamTrack *temp = (PamTrack*) t[it];
2941                  if (temp->GetTrkTrack()->HasImage()) {                  if (temp->GetTrkTrack()->HasImage()) {
2942                      return (PamTrack*)((*timage_nuc)[it]);                 //ok return the track                      return (PamTrack*)((*timage_nuc)[it]);                 //ok return the track
2943                    }else{
2944                        return NULL;
2945                  }                  }
2946                                    
2947              }              }
# Line 2805  PamTrack *PamLevel2::GetTrackImage(int i Line 2955  PamTrack *PamLevel2::GetTrackImage(int i
2955                  PamTrack *temp = (PamTrack*) t[it];                  PamTrack *temp = (PamTrack*) t[it];
2956                  if (temp->GetTrkTrack()->HasImage()) {                                if (temp->GetTrkTrack()->HasImage()) {              
2957                      return (PamTrack*)((*timage)[it]);                 //ok return the track                      return (PamTrack*)((*timage)[it]);                 //ok return the track
2958                    }else{
2959                        return NULL;
2960                  }                  }
2961              }              }
2962          }          }
2963    
2964      }      }
2965    
2966    //    cout << "PamTrack *PamLevel2::GetTrackImage("<<it<<","<<alg<<") -- wrong track number or unrecognised algorithm"<<endl;
2967                
2968      return NULL;      return NULL;
2969    
# Line 3269  TChain *PamLevel2::GetPamTree(TList *fl, Line 3423  TChain *PamLevel2::GetPamTree(TList *fl,
3423    TChain *G = 0;    TChain *G = 0;
3424    
3425    TChain *L = 0;    TChain *L = 0;
3426      TChain *P = 0;
3427    
3428    if (TRK2 || TRK1 || TRKh)    if (TRK2 || TRK1 || TRKh)
3429      T = new TChain("Tracker");      T = new TChain("Tracker");
# Line 3288  TChain *PamLevel2::GetPamTree(TList *fl, Line 3443  TChain *PamLevel2::GetPamTree(TList *fl,
3443      B = new TChain("OrbitalInfo");      B = new TChain("OrbitalInfo");
3444    if (GP)    if (GP)
3445      G = new TChain("h20");      G = new TChain("h20");
3446      if (PROC)
3447        P = new TChain("ProcessingInfo");
3448    L = new TChain("SelectionList");    L = new TChain("SelectionList");
3449    
3450    // loop over files and create chains    // loop over files and create chains
# Line 3315  TChain *PamLevel2::GetPamTree(TList *fl, Line 3472  TChain *PamLevel2::GetPamTree(TList *fl,
3472          B->Add(name);          B->Add(name);
3473        if (GP)        if (GP)
3474          G->Add(name);          G->Add(name);
3475          if (P)
3476            P->Add(name);
3477        if (SELLI == 1)        if (SELLI == 1)
3478          L->Add(name);          L->Add(name);
3479       };       };
# Line 3440  TChain *PamLevel2::GetPamTree(TList *fl, Line 3599  TChain *PamLevel2::GetPamTree(TList *fl,
3599        L->Delete();        L->Delete();
3600    };    };
3601    
3602      //ProcessingInfo EM
3603      if ( P && P->GetEntries() ){
3604        cout << "----------------------------------------------------" << endl;
3605        cout << ">>> Found ProcessingInfo <<<" << endl;
3606        //  L->SetBranchAddress("RunEntry",&irun);
3607        P->SetBranchAddress("ProcInfo", &proc_obj);//NEWNEW
3608        proc_tree = P;
3609      } else {
3610        //    proc_tree = new TChain("ProcessingInfo","Log of data processing");
3611        //    proc_tree->Branch("ProcInfo", "ProcInfo", &proc_obj);
3612        cout << "----------------------------------------------------" << endl;
3613        cout << ">>> ProcessingInfo not found, PROC set to false and continue (not 10RED files?)<<<" << endl;
3614        PROC = false;
3615      }
3616    //  --------------------------------------------    //  --------------------------------------------
3617    //  return the pamela chain with all the friends    //  return the pamela chain with all the friends
3618    //  --------------------------------------------    //  --------------------------------------------
3619    
3620    pam_tree = Trout;    pam_tree = Trout;
   
3621    return Trout;    return Trout;
3622  }  }
3623    
# Line 3767  void PamLevel2::SetBranchAddress(TChain Line 3939  void PamLevel2::SetBranchAddress(TChain
3939   * "NUCEXT" --> as "EXT", but for nuclei   * "NUCEXT" --> as "EXT", but for nuclei
3940   * "NUCEXTF" --> as "EXTF", but for nuclei   * "NUCEXTF" --> as "EXTF", but for nuclei
3941   */   */
3942  void PamLevel2::SetTrakingAlgorythm(char *alg){  // void PamLevel2::SetTrackingAlgorythm(const char *alg){
3943    
3944    
3945      TString s(alg);  //     TString s(alg);
3946      if(s.Contains("NUC", TString::kIgnoreCase) && !NUC)  //     if(s.Contains("NUC", TString::kIgnoreCase) && !NUC)
3947          cout << "Warning! NUC algorythm requested, but branches are missing"<<endl;  //      cout << "Warning! NUC algorythm requested, but branches are missing"<<endl;
3948      if(s.Contains("EXT", TString::kIgnoreCase) && !EXT)  //     if(s.Contains("EXT", TString::kIgnoreCase) && !EXT)
3949          cout << "Warning! EXT algorythm requested, but branches are missing"<<endl;;  //      cout << "Warning! EXT algorythm requested, but branches are missing"<<endl;;
3950                            
3951      trkAlg = alg;  //     trkAlg = alg;
3952    
3953  };  // };
3954  char* PamLevel2::GetTrakingAlgorythm(){  // const char* PamLevel2::GetTrackingAlgorythm(){
3955    
3956    
3957      cout<<endl<<" Implemented tracking algorythm: ";  //     cout<<endl<<" Implemented tracking algorythm: ";
3958      cout<<endl<<"  \"\" or \"STD\"  --> take the output of the standard tracking algorythm";  //     cout<<endl<<"  \"\" or \"STD\"  --> take the output of the standard tracking algorythm";
3959      cout<<endl<<"  \"NUC\"      --> take the output of the standard tracking algorythm for nuclei cluster selection";  //     cout<<endl<<"  \"NUC\"      --> take the output of the standard tracking algorythm for nuclei cluster selection";
3960      cout<<endl<<"  \"EXT\"      --> in case the standard tracking algorythm has not found any track,";  //     cout<<endl<<"  \"EXT\"      --> in case the standard tracking algorythm has not found any track,";
3961      cout<<endl<<"                 take the output of the extended one";  //     cout<<endl<<"                 take the output of the extended one";
3962      cout<<endl<<"  \"EXTF\"     --> force the extended tracking algorythm";  //     cout<<endl<<"  \"EXTF\"     --> force the extended tracking algorythm";
3963      cout<<endl<<"  \"NUCEXT\"   --> as \"EXT\", but for nuclei ";  //     cout<<endl<<"  \"NUCEXT\"   --> as \"EXT\", but for nuclei ";
3964      cout<<endl<<"  \"NUCEXTF\"  --> as \"EXTF\", but for nuclei";  //     cout<<endl<<"  \"NUCEXTF\"  --> as \"EXTF\", but for nuclei";
3965    
3966      cout<<endl;  //     cout<<endl;
3967      cout<<" <<Currently set algorythm>> "<<trkAlg<<endl;  //     cout<<" <<Currently set algorythm>> "<<trkAlg<<endl;
3968      cout<<endl;  //     cout<<endl;
3969    
3970      return trkAlg;  //     return trkAlg;
3971  };  // };
3972    
3973    
3974    
# Line 3955  Bool_t PamLevel2::UpdateRunInfo(Long64_t Line 4127  Bool_t PamLevel2::UpdateRunInfo(Long64_t
4127      isFragment = false;      isFragment = false;
4128      run_tree->GetEntry(irun);      run_tree->GetEntry(irun);
4129      if (!GetOrbitalInfo())      if (!GetOrbitalInfo())
4130        cout << "** WARNING ** missing OrbitalInfo ---> run info might be not correctly updated " << endl;          cout << "PamLevel2::UpdateRunInfo(Long64_t "<<iev<<") ** WARNING ** missing OrbitalInfo    ORB="<<ORB << endl;
4131      if ( fUseDBinRunInfo ){      if ( fUseDBinRunInfo ){
4132        if (gltsync)        if (gltsync)
4133          delete gltsync; //Emiliano          delete gltsync; //Emiliano
# Line 4537  void PamLevel2::GetWhichTrees(TFile* f) Line 4709  void PamLevel2::GetWhichTrees(TFile* f)
4709    //    cout << "Checking file: "<<f->GetName()<<endl;    //    cout << "Checking file: "<<f->GetName()<<endl;
4710    if (!f || f->IsZombie()) {    if (!f || f->IsZombie()) {
4711      cout << "File: " << f->GetName() << " Non valid root file" << endl;      cout << "File: " << f->GetName() << " Non valid root file" << endl;
4712        fDiscarded = true;
4713      return;      return;
4714    }    }
4715    
# Line 4743  Bool_t PamLevel2::CheckLevel2File(TStrin Line 4916  Bool_t PamLevel2::CheckLevel2File(TStrin
4916    TFile *f = new TFile(name.Data());    TFile *f = new TFile(name.Data());
4917    if (!f || f->IsZombie()) {    if (!f || f->IsZombie()) {
4918      cout << "File: " << f->GetName() << " discarded ---- Non valid root file" << endl;      cout << "File: " << f->GetName() << " discarded ---- Non valid root file" << endl;
4919        fDiscarded = true;
4920      return false;      return false;
4921    }    }
4922    //    cout << "Get list of keys: "<<f<<endl;    //    cout << "Get list of keys: "<<f<<endl;
# Line 4781  Bool_t PamLevel2::CheckLevel2File(TStrin Line 4955  Bool_t PamLevel2::CheckLevel2File(TStrin
4955          if (nev && nevt != nev) {          if (nev && nevt != nev) {
4956            cout << "File: " << f->GetName() << " discarded ---- SelectionList tree has " << nevt            cout << "File: " << f->GetName() << " discarded ---- SelectionList tree has " << nevt
4957                << " events instead of " << nev << endl;                << " events instead of " << nev << endl;
4958              fDiscarded = true;
4959            return false;            return false;
4960          }          }
4961          nev = nevt;          nev = nevt;
# Line 4795  Bool_t PamLevel2::CheckLevel2File(TStrin Line 4970  Bool_t PamLevel2::CheckLevel2File(TStrin
4970          if (nev && nevt != nev) {          if (nev && nevt != nev) {
4971            cout << "File: " << f->GetName() << " discarded ---- Trigger tree has " << nevt << " events instead of "            cout << "File: " << f->GetName() << " discarded ---- Trigger tree has " << nevt << " events instead of "
4972                << nev << endl;                << nev << endl;
4973              fDiscarded = true;
4974            return false;            return false;
4975          }          }
4976          nev = nevt;          nev = nevt;
# Line 4808  Bool_t PamLevel2::CheckLevel2File(TStrin Line 4984  Bool_t PamLevel2::CheckLevel2File(TStrin
4984          if (nev && nevt != nev) {          if (nev && nevt != nev) {
4985            cout << "File: " << f->GetName() << " discarded ---- ToF tree has " << nevt << " events instead of " << nev            cout << "File: " << f->GetName() << " discarded ---- ToF tree has " << nevt << " events instead of " << nev
4986                << endl;                << endl;
4987              fDiscarded = true;
4988            return false;            return false;
4989          }          }
4990          nev = nevt;          nev = nevt;
# Line 4821  Bool_t PamLevel2::CheckLevel2File(TStrin Line 4998  Bool_t PamLevel2::CheckLevel2File(TStrin
4998          if (nev && nevt != nev) {          if (nev && nevt != nev) {
4999            cout << "File: " << f->GetName() << " discarded ---- S4 tree has " << nevt << " events instead of " << nev            cout << "File: " << f->GetName() << " discarded ---- S4 tree has " << nevt << " events instead of " << nev
5000                << endl;                << endl;
5001              fDiscarded = true;
5002            return false;            return false;
5003          }          }
5004          nev = nevt;          nev = nevt;
# Line 4835  Bool_t PamLevel2::CheckLevel2File(TStrin Line 5013  Bool_t PamLevel2::CheckLevel2File(TStrin
5013          if (nev && nevt != nev) {          if (nev && nevt != nev) {
5014            cout << "File: " << f->GetName() << " discarded ---- NeutronD tree has " << nevt << " events instead of "            cout << "File: " << f->GetName() << " discarded ---- NeutronD tree has " << nevt << " events instead of "
5015                << nev << endl;                << nev << endl;
5016              fDiscarded = true;
5017            return false;            return false;
5018          }          }
5019          nev = nevt;          nev = nevt;
# Line 4848  Bool_t PamLevel2::CheckLevel2File(TStrin Line 5027  Bool_t PamLevel2::CheckLevel2File(TStrin
5027          if (nev && nevt != nev) {          if (nev && nevt != nev) {
5028            cout << "File: " << f->GetName() << " discarded ---- Anticounter tree has " << nevt << " events instead of "            cout << "File: " << f->GetName() << " discarded ---- Anticounter tree has " << nevt << " events instead of "
5029                << nev << endl;                << nev << endl;
5030              fDiscarded = true;
5031            return false;            return false;
5032          }          }
5033          nev = nevt;          nev = nevt;
# Line 4861  Bool_t PamLevel2::CheckLevel2File(TStrin Line 5041  Bool_t PamLevel2::CheckLevel2File(TStrin
5041          if (nev && nevt != nev) {          if (nev && nevt != nev) {
5042            cout << "File: " << f->GetName() << " discarded ---- OrbitalInfo tree has " << nevt << " events instead of "            cout << "File: " << f->GetName() << " discarded ---- OrbitalInfo tree has " << nevt << " events instead of "
5043                << nev << endl;                << nev << endl;
5044              fDiscarded = true;
5045            return false;            return false;
5046          }          }
5047          nev = nevt;          nev = nevt;
# Line 4874  Bool_t PamLevel2::CheckLevel2File(TStrin Line 5055  Bool_t PamLevel2::CheckLevel2File(TStrin
5055          if (nev && nevt != nev) {          if (nev && nevt != nev) {
5056            cout << "File: " << f->GetName() << " discarded ---- Tracker tree has " << nevt << " events instead of "            cout << "File: " << f->GetName() << " discarded ---- Tracker tree has " << nevt << " events instead of "
5057                << nev << endl;                << nev << endl;
5058              fDiscarded = true;
5059            return false;            return false;
5060          }          }
5061          nev = nevt;          nev = nevt;
# Line 4897  Bool_t PamLevel2::CheckLevel2File(TStrin Line 5079  Bool_t PamLevel2::CheckLevel2File(TStrin
5079          if (nev && nevt != nev) {          if (nev && nevt != nev) {
5080            cout << "File: " << f->GetName() << " discarded ---- Calorimeter tree has " << nevt << " events instead of "            cout << "File: " << f->GetName() << " discarded ---- Calorimeter tree has " << nevt << " events instead of "
5081                << nev << endl;                << nev << endl;
5082              fDiscarded = true;
5083            return false;            return false;
5084          }          }
5085          nev = nevt;          nev = nevt;
# Line 4919  Bool_t PamLevel2::CheckLevel2File(TStrin Line 5102  Bool_t PamLevel2::CheckLevel2File(TStrin
5102          if (nev && nevt != nev) {          if (nev && nevt != nev) {
5103            cout << "File: " << f->GetName() << " discarded ---- h20 tree has " << nevt << " events instead of " << nev            cout << "File: " << f->GetName() << " discarded ---- h20 tree has " << nevt << " events instead of " << nev
5104                << endl;                << endl;
5105              fDiscarded = true;
5106            return false;            return false;
5107          }          }
5108          nev = nevt;          nev = nevt;
# Line 4931  Bool_t PamLevel2::CheckLevel2File(TStrin Line 5115  Bool_t PamLevel2::CheckLevel2File(TStrin
5115      SELLI = (Int_t) SELLI__ok;      SELLI = (Int_t) SELLI__ok;
5116    if (SELLI == 0 && SELLI__ok) {    if (SELLI == 0 && SELLI__ok) {
5117      cout << "File: " << f->GetName() << " discarded ---- found SelectionList (it is not a full-event file)" << endl;      cout << "File: " << f->GetName() << " discarded ---- found SelectionList (it is not a full-event file)" << endl;
5118        fDiscarded = true;
5119      return false;      return false;
5120    }    }
5121    if (SELLI == 1 && !SELLI__ok) {    if (SELLI == 1 && !SELLI__ok) {
5122      cout << "File: " << f->GetName() << " discarded ---- SelectionList missing" << endl;      cout << "File: " << f->GetName() << " discarded ---- SelectionList missing" << endl;
5123        fDiscarded = true;
5124      return false;      return false;
5125    }    }
5126    
# Line 4973  Bool_t PamLevel2::CheckLevel2File(TStrin Line 5159  Bool_t PamLevel2::CheckLevel2File(TStrin
5159    
5160    if (CAL1 && !CAL1__ok) {    if (CAL1 && !CAL1__ok) {
5161      cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel1 branch" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel1 branch" << endl;
5162        fDiscarded = true;
5163      return false;      return false;
5164    };    };
5165    if (CAL2 && !CAL2__ok) {    if (CAL2 && !CAL2__ok) {
5166      cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel2 branch" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing CaloLevel2 branch" << endl;
5167        fDiscarded = true;
5168      return false;      return false;
5169    };    };
5170    if (TRK2 && !TRK2__ok) {    if (TRK2 && !TRK2__ok) {
5171      cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel2 branch" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel2 branch" << endl;
5172        fDiscarded = true;
5173      return false;      return false;
5174    };    };
5175    if (TRK1 && !TRK1__ok) {    if (TRK1 && !TRK1__ok) {
5176      cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel1 branch" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing TrkLevel1 branch" << endl;
5177        fDiscarded = true;
5178      return false;      return false;
5179    };    };
5180    if (TRKh && !TRKh__ok) {    if (TRKh && !TRKh__ok) {
5181      cout << "File: " << f->GetName() << " discarded ---- Missing TrkHough branch" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing TrkHough branch" << endl;
5182        fDiscarded = true;
5183      return false;      return false;
5184    };    };
5185    if (ORB && !ORB__ok) {    if (ORB && !ORB__ok) {
5186      cout << "File: " << f->GetName() << " discarded ---- Missing ORB tree" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing ORB tree" << endl;
5187        fDiscarded = true;
5188      return false;      return false;
5189    };    };
5190    if (AC && !AC__ok) {    if (AC && !AC__ok) {
5191      cout << "File: " << f->GetName() << " discarded ---- Missing AC tree" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing AC tree" << endl;
5192        fDiscarded = true;
5193      return false;      return false;
5194    };    };
5195    if (S4 && !S4__ok) {    if (S4 && !S4__ok) {
5196      cout << "File: " << f->GetName() << " discarded ---- Missing S4 tree" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing S4 tree" << endl;
5197        fDiscarded = true;
5198      return false;      return false;
5199    };    };
5200    if (TOF && !TOF__ok) {    if (TOF && !TOF__ok) {
5201      cout << "File: " << f->GetName() << " discarded ---- Missing ToF tree" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing ToF tree" << endl;
5202        fDiscarded = true;
5203      return false;      return false;
5204    };    };
5205    
5206    if (ND && !ND__ok) {    if (ND && !ND__ok) {
5207      cout << "File: " << f->GetName() << " discarded ---- Missing ND tree" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing ND tree" << endl;
5208        fDiscarded = true;
5209      return false;      return false;
5210    };    };
5211    if (TRG && !TRG__ok) {    if (TRG && !TRG__ok) {
5212      cout << "File: " << f->GetName() << " discarded ---- Missing Trigger tree" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing Trigger tree" << endl;
5213        fDiscarded = true;
5214      return false;      return false;
5215    };    };
5216    if (GP && !GP__ok) {    if (GP && !GP__ok) {
5217      cout << "File: " << f->GetName() << " discarded ---- Missing h20 tree" << endl;      cout << "File: " << f->GetName() << " discarded ---- Missing h20 tree" << endl;
5218        fDiscarded = true;
5219      return false;      return false;
5220    };    };
5221    
# Line 5117  void PamLevel2::CreateCloneTrees(TFile * Line 5315  void PamLevel2::CreateCloneTrees(TFile *
5315      //  cout << i<< "\t | "<<GetRunInfo()->ID<<"\t "<<GetRunInfo()->NEVENTS<< "\t "<<GetRunInfo()->RUNHEADER_TIME<<" <---> "<<GetRunInfo()->RUNTRAILER_TIME<<endl;      //  cout << i<< "\t | "<<GetRunInfo()->ID<<"\t "<<GetRunInfo()->NEVENTS<< "\t "<<GetRunInfo()->RUNHEADER_TIME<<" <---> "<<GetRunInfo()->RUNTRAILER_TIME<<endl;
5316      run_tree_clone->Fill();      run_tree_clone->Fill();
5317    }    }
5318    cout << "----------------------------------------------------" << endl;    //
5319      // replicate processinginfo tree
5320      //
5321      if ( PROC ){ // EMEMEM
5322        proc_tree_clone = new TTree("ProcessingInfo","Log of data processing");
5323        proc_tree_clone->Branch("ProcInfo", "ProcInfo", GetPointerTo("ProcInfo"));
5324        cout << "ProcessingInfo: branch ProcessingInfo" << endl;  
5325        // ------------------
5326        // replicate processinginfo tree
5327        // ------------------
5328        //    cout << "----------------------------------------------------"<<endl;
5329        //    cout << "irun\t | RUN\t NEVENTS\t absolute time"<<endl;
5330        for (Int_t i = 0; i < proc_tree->GetEntries(); i++) {
5331          proc_tree->GetEntry(i);
5332          //      cout << i<< "\t | "<<endl;
5333          proc_tree_clone->Fill();
5334        }
5335        if ( SELLI != 2 ){      
5336          proc_obj->runID = 0;
5337          TTimeStamp *dt = new TTimeStamp();
5338          proc_obj->date = dt->AsString();
5339          delete dt;
5340          proc_obj->commandLine = Form("PamelaLevel2 was called: CAL2 %i CAL1 %i CAL0 %i TRK2 %i TRK1 %i TRKh %i TRK0 %i TOF %i TOF0 %i TRG %i \n                                            S4 %i ND %i AC %i ORB %i GP %i EXT %i NUC %i RUN %i ISGP %i SELLI %i \n Custom string   = %s",CAL2,CAL1,CAL0,TRK2,TRK1,TRKh,TRK0,TOF,TOF0,TRG,S4,ND,AC,ORB,GP,EXT,NUC,RUN,ISGP,SELLI,customString.Data());
5341          proc_obj->outputFilename = ofile->GetName();
5342          proc_obj->localDir = gSystem->WorkingDirectory();
5343          proc_obj->uname = gSystem->GetFromPipe("uname -a");
5344          if (!dbc || (dbc && !dbc->IsConnected())) SetDBConnection();
5345          proc_obj->DB = Form("mysql://%s/%s",dbc->GetHost(),dbc->GetDB());
5346          dbc->Close();
5347          proc_tree_clone->Fill();
5348        }
5349        cout << "----------------------------------------------------" << endl;
5350      }
5351    // ------------------------------------    // ------------------------------------
5352    // add branch with dead and live times    // add branch with dead and live times
5353    // ------------------------------------    // ------------------------------------
# Line 5309  TTree* PamLevel2::GetCloneTree(TString n Line 5538  TTree* PamLevel2::GetCloneTree(TString n
5538      if (!name.CompareTo(na))      if (!name.CompareTo(na))
5539        return sel_tree_clone;        return sel_tree_clone;
5540    }    }
5541      if (proc_tree_clone && PROC) {
5542        TString na = proc_tree_clone->GetName();
5543        if (!name.CompareTo(na))
5544          return proc_tree_clone;
5545      }
5546    return NULL;    return NULL;
5547    
5548  }  }
# Line 5328  void PamLevel2::WriteCloneTrees() { Line 5562  void PamLevel2::WriteCloneTrees() {
5562    for (Int_t i = 0; i < NCLONES; i++) {    for (Int_t i = 0; i < NCLONES; i++) {
5563      if (pam_tree_clone[i]) {      if (pam_tree_clone[i]) {
5564        cout << pam_tree_clone[i]->GetName() << endl;        cout << pam_tree_clone[i]->GetName() << endl;
5565        pam_tree_clone[i]->Write();        pam_tree_clone[i]->Write(pam_tree_clone[i]->GetName(),TObject::kOverwrite);
5566      };      };
5567    }    }
5568      
5569      if ( PROC ){//EMEMEMEM
5570        proc_tree_clone->Write("ProcessingInfo",TObject::kOverwrite);
5571      }
5572    cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl;    cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl;
5573    
5574  }  }

Legend:
Removed from v.1.95  
changed lines
  Added in v.1.112

  ViewVC Help
Powered by ViewVC 1.1.23