/[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.105 by mocchiut, Fri Oct 17 16:22:26 2014 UTC revision 1.110 by pam-fi, Tue Mar 24 09:15:01 2015 UTC
# Line 371  PamTrack::PamTrack(ExtTrack* t, CaloTrkV Line 371  PamTrack::PamTrack(ExtTrack* t, CaloTrkV
371    
372  }  }
373  ;  ;
374    
375  PamTrack::PamTrack(const PamTrack& track) {  PamTrack::PamTrack(const PamTrack& track) {
376    
377    TrkTrack *t = track.trk_track;    TrkTrack *t = track.trk_track;
# Line 400  PamTrack::PamTrack(const PamTrack& track Line 401  PamTrack::PamTrack(const PamTrack& track
401    iscore = 0;    iscore = 0;
402    
403  }  }
404    
405    void PamTrack::Copy( PamTrack& track) const {
406    
407        track.trk_track = trk_track;
408        track.trk_ext_track = trk_ext_track;
409        track.calo_track = calo_track;
410        track.tof_track = tof_track;
411        track.orb_track = orb_track;
412        
413        track.candeleteobj = candeleteobj;
414        track.pscore = pscore;
415        track.iscore = iscore;
416        
417    }
418    
419    
420    
421  void PamTrack::Clear(Option_t *option) {  void PamTrack::Clear(Option_t *option) {
422    
423  //    cout << "PamTrack::Clear( "<<option<<" ) "<<candeleteobj<<endl;  //    cout << "PamTrack::Clear( "<<option<<" ) "<<candeleteobj<<endl;
# Line 431  void PamTrack::Delete() { Line 449  void PamTrack::Delete() {
449    //    cout << "PamTrack::Delete() "<<candeleteobj<<endl;    //    cout << "PamTrack::Delete() "<<candeleteobj<<endl;
450    if (candeleteobj) {    if (candeleteobj) {
451      if (trk_ext_track) {      if (trk_ext_track) {
452        trk_ext_track->ExtTrack::Clear("C");  //      trk_ext_track->ExtTrack::Clear("C");//Clear is called for all the array elements
453            trk_ext_track->ExtTrack::Clear("C+C");//Clear is called for all the array elements passing option 'C'
454        delete trk_ext_track;        delete trk_ext_track;
455      }      }
456      if (trk_track) {      if (trk_track) {
# Line 628  void PamLevel2::Initialize() { Line 647  void PamLevel2::Initialize() {
647    if (strcmp(pamdbpsw, ""))    if (strcmp(pamdbpsw, ""))
648      psw = pamdbpsw;      psw = pamdbpsw;
649    
650      customString = "";
651    
652    //    sorted_tracks = 0;//new TRefArray();    //    sorted_tracks = 0;//new TRefArray();
653    
654    CAL0 = false;    CAL0 = false;
# Line 1228  CaloTrkVar *PamLevel2::GetCaloStoredTrac Line 1249  CaloTrkVar *PamLevel2::GetCaloStoredTrac
1249      return 0;      return 0;
1250    
1251    if (calo2_obj->CaloLevel2::ntrk() == 0) {    if (calo2_obj->CaloLevel2::ntrk() == 0) {
1252      cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo " << seqno        if( seqno >=0 ){
1253          << " but no Calorimeter tracks are stored" << endl;            cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo " << seqno;
1254      return NULL;            cout << " but no Calorimeter tracks are stored" << endl;
1255          }
1256          return NULL;
1257    };    };
1258    
1259    CaloTrkVar *c = 0;    CaloTrkVar *c = 0;
# Line 1243  CaloTrkVar *PamLevel2::GetCaloStoredTrac Line 1266  CaloTrkVar *PamLevel2::GetCaloStoredTrac
1266    
1267    if (!c || seqno != c->trkseqno) {    if (!c || seqno != c->trkseqno) {
1268      c = 0;      c = 0;
1269      if (seqno != -1)      if (seqno != -1 && seqno>=0)
1270        cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo " << seqno        cout << "PamLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo " << seqno
1271            << " does not match Calorimeter stored tracks" << endl;            << " does not match Calorimeter stored tracks" << endl;
1272    };    };
# Line 1362  OrbitalInfoTrkVar *PamLevel2::GetOrbital Line 1385  OrbitalInfoTrkVar *PamLevel2::GetOrbital
1385  //  //
1386  //  //
1387  //--------------------------------------  //--------------------------------------
1388  /**  // /**
1389   * 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.
1390   */  //  */
1391  PamTrack* PamLevel2::GetPamTrackAlong(TrkTrack* t) {  // PamTrack* PamLevel2::GetPamTrackAlong(TrkTrack* t) {
1392    
1393    cout << "PamLevel2::GetPamTrackAlong(TrkTrack* t) **obsolete** " << endl;  //   cout << "PamLevel2::GetPamTrackAlong(TrkTrack* t) **obsolete** " << endl;
1394    cout << "(if you use it, remember to delete the PamTrack object)" << endl;  //   cout << "(if you use it, remember to delete the PamTrack object)" << endl;
1395    
1396    CaloTrkVar *c = 0;  //   CaloTrkVar *c = 0;
1397    ToFTrkVar *o = 0;  //   ToFTrkVar *o = 0;
1398    OrbitalInfoTrkVar *r = 0;  //   OrbitalInfoTrkVar *r = 0;
1399    
1400    if (CAL2)  //   if (CAL2)
1401      c = GetCaloStoredTrack(t->GetSeqNo());  //     c = GetCaloStoredTrack(t->GetSeqNo());
1402    if (TOF)  //   if (TOF)
1403      o = GetToFStoredTrack(t->GetSeqNo());  //     o = GetToFStoredTrack(t->GetSeqNo());
1404    if (ORB)  //   if (ORB)
1405      r = GetOrbitalInfoStoredTrack(t->GetSeqNo());  //     r = GetOrbitalInfoStoredTrack(t->GetSeqNo());
1406    
1407    //    if(t && c && o)track = new PamTrack(t,c,o);  //   //    if(t && c && o)track = new PamTrack(t,c,o);
1408    PamTrack *track = new PamTrack(t, c, o, r);  //   PamTrack *track = new PamTrack(t, c, o, r);
1409    
1410    return track;  //   return track;
1411    
1412  }  // }
1413  ;  // ;
1414  //--------------------------------------  //--------------------------------------
1415  //  //
1416  //  //
1417  //--------------------------------------  //--------------------------------------
1418  /**  // /**
1419   * Retrieves the it-th stored track.  //  * Retrieves the it-th stored track.
1420   * It override TrkLevel2::GetTrack(int it).  //  * It override TrkLevel2::GetTrack(int it).
1421   * @param itrk Track number, ranging from 0 to GetNTracks().  //  * @param itrk Track number, ranging from 0 to GetNTracks().
1422   */  //  */
1423    
1424  PamTrack* PamLevel2::GetStoredTrack(Int_t itrk) {  // PamTrack* PamLevel2::GetStoredTrack(Int_t itrk) {
1425    
1426    //   cout << "PamLevel2::GetStoredTrack(Int_t itrk) **to-be-updated** " << endl;
1427    //   cout
1428    //       << "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)"
1429    //       << endl;
1430    //   cout << "(if you use it, remember to delete the PamTrack object)" << endl;
1431    //   PamTrack *track = 0;
1432    
1433    cout << "PamLevel2::GetStoredTrack(Int_t itrk) **to-be-updated** " << endl;  //   if (itrk >= 0 && itrk < trk2_obj->TrkLevel2::ntrk()) {
   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;  
   cout << "(if you use it, remember to delete the PamTrack object)" << endl;  
   PamTrack *track = 0;  
1434    
1435    if (itrk >= 0 && itrk < trk2_obj->TrkLevel2::ntrk()) {  //     TrkTrack *t = trk2_obj->TrkLevel2::GetStoredTrack(itrk);
1436    //     track = GetPamTrackAlong(t);
1437    
1438      TrkTrack *t = trk2_obj->TrkLevel2::GetStoredTrack(itrk);  //   }
1439      track = GetPamTrackAlong(t);  //   else {
1440    //     cout << "PamLevel2::GetStoredTrack(int) : tracker track SeqNo " << itrk << " does not exist (GetNTracks() = "
1441    }  //         << trk2_obj->TrkLevel2::GetNTracks() << ")" << endl;
1442    else {  //   };
     cout << "PamLevel2::GetStoredTrack(int) : tracker track SeqNo " << itrk << " does not exist (GetNTracks() = "  
         << trk2_obj->TrkLevel2::GetNTracks() << ")" << endl;  
   };  
1443    
1444    return track;  //   return track;
1445    
1446  }  // }
1447  //--------------------------------------  //--------------------------------------
1448  //  //
1449    
# Line 1474  void PamLevel2::SortTracks() { Line 1497  void PamLevel2::SortTracks() {
1497    Int_t ObjectNumber = TProcessID::GetObjectCount();    Int_t ObjectNumber = TProcessID::GetObjectCount();
1498    
1499    // create TCloneArrays to store tracks and its images    // create TCloneArrays to store tracks and its images
1500    if (!tsorted)  //   if (!tsorted)
1501      tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks());  //     tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
1502    tsorted->Clear("C+C");//Delete();  //   tsorted->Clear("C+C");//Delete();
1503    TClonesArray &ttsorted = *tsorted;  //   if (!timage)
1504    //     timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
1505    //   timage->Clear("C+C");//Delete();
1506    
1507    if (!timage)    if(tsorted)delete tsorted;
1508      timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks());    if(timage) delete timage;
1509    timage->Clear("C+C");//Delete();    tsorted = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
1510      timage = new TClonesArray("PamTrack", trk2_obj->GetNTracks());
1511    
1512    
1513      TClonesArray &ttsorted = *tsorted;
1514    TClonesArray &ttimage = *timage;    TClonesArray &ttimage = *timage;
1515    
1516    
# Line 2660  PamTrack *PamLevel2::GetTrackOld(int it) Line 2689  PamTrack *PamLevel2::GetTrackOld(int it)
2689    //  *-*-*-*-*-*-*-*-*-*-*-*-*    //  *-*-*-*-*-*-*-*-*-*-*-*-*
2690    if (!tsorted)    if (!tsorted)
2691      return track;      return track;
2692    if (!tsorted->GetEntries())  //   if (!tsorted->GetEntries())
2693    //     return track;
2694      if (tsorted->GetEntries()==0)
2695      return track;      return track;
2696    
2697    
2698    if (it >= 0 && it < trk2_obj->TrkLevel2::GetNTracks()) {    if (
2699      track = (PamTrack*)((*tsorted)[it]);        tsorted &&
2700          it >= 0 &&
2701          it < trk2_obj->TrkLevel2::GetNTracks() &&
2702          it < tsorted->GetEntries() &&
2703          true) {
2704          track = (PamTrack*)((*tsorted)[it]);
2705    }    }
2706    else {    else {
2707      cout << "PamLevel2::GetTrackOld(int) : tracker track SeqNo " << it << " does not exist (GetNTracks() = "      cout << "PamLevel2::GetTrackOld(int) : tracker track SeqNo " << it << " does not exist (GetNTracks() = "
# Line 2866  PamTrack *PamLevel2::GetTrackImage(int i Line 2902  PamTrack *PamLevel2::GetTrackImage(int i
2902    
2903      }      }
2904    
2905      cout << "PamTrack *PamLevel2::GetTrackImage("<<it<<","<<alg<<") -- wrong track number or unrecognised algorithm"<<endl;  //    cout << "PamTrack *PamLevel2::GetTrackImage("<<it<<","<<alg<<") -- wrong track number or unrecognised algorithm"<<endl;
2906                
2907      return NULL;      return NULL;
2908    
# Line 3509  TChain *PamLevel2::GetPamTree(TList *fl, Line 3545  TChain *PamLevel2::GetPamTree(TList *fl,
3545      //  L->SetBranchAddress("RunEntry",&irun);      //  L->SetBranchAddress("RunEntry",&irun);
3546      P->SetBranchAddress("ProcInfo", &proc_obj);//NEWNEW      P->SetBranchAddress("ProcInfo", &proc_obj);//NEWNEW
3547      proc_tree = P;      proc_tree = P;
3548      } else {
3549        //    proc_tree = new TChain("ProcessingInfo","Log of data processing");
3550        //    proc_tree->Branch("ProcInfo", "ProcInfo", &proc_obj);
3551        cout << "----------------------------------------------------" << endl;
3552        cout << ">>> ProcessingInfo not found, PROC set to false and continue (not 10RED files?)<<<" << endl;
3553        PROC = false;
3554    }    }
3555    //  --------------------------------------------    //  --------------------------------------------
3556    //  return the pamela chain with all the friends    //  return the pamela chain with all the friends
# Line 5215  void PamLevel2::CreateCloneTrees(TFile * Line 5257  void PamLevel2::CreateCloneTrees(TFile *
5257    //    //
5258    // replicate processinginfo tree    // replicate processinginfo tree
5259    //    //
5260    if ( PROC && false ){ // EMEMEM    if ( PROC ){ // EMEMEM
5261      proc_tree_clone = new TTree("ProcessingInfo","Log of data processing");      proc_tree_clone = new TTree("ProcessingInfo","Log of data processing");
5262      proc_tree_clone->Branch("ProcInfo", "ProcInfo", GetPointerTo("ProcInfo"));      proc_tree_clone->Branch("ProcInfo", "ProcInfo", GetPointerTo("ProcInfo"));
5263      cout << "ProcessingInfo: branch ProcessingInfo" << endl;        cout << "ProcessingInfo: branch ProcessingInfo" << endl;  
# Line 5226  void PamLevel2::CreateCloneTrees(TFile * Line 5268  void PamLevel2::CreateCloneTrees(TFile *
5268      //    cout << "irun\t | RUN\t NEVENTS\t absolute time"<<endl;      //    cout << "irun\t | RUN\t NEVENTS\t absolute time"<<endl;
5269      for (Int_t i = 0; i < proc_tree->GetEntries(); i++) {      for (Int_t i = 0; i < proc_tree->GetEntries(); i++) {
5270        proc_tree->GetEntry(i);        proc_tree->GetEntry(i);
5271        cout << i<< "\t | "<<endl;        //      cout << i<< "\t | "<<endl;
5272        proc_tree_clone->Fill();        proc_tree_clone->Fill();
5273      }      }
5274      if ( SELLI != 2 || true ){            if ( SELLI != 2 ){      
       cout << "|| "<<endl;  
5275        proc_obj->runID = 0;        proc_obj->runID = 0;
       cout << "|||d "<<endl;  
5276        TTimeStamp *dt = new TTimeStamp();        TTimeStamp *dt = new TTimeStamp();
5277        proc_obj->date = dt->AsString();        proc_obj->date = dt->AsString();
5278        delete dt;        delete dt;
5279        cout << "|||f "<<endl;        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());
5280        proc_obj->commandLine = Form("PamelaLevel2 was called");        proc_obj->outputFilename = ofile->GetName();
       cout << "|||g "<<endl;  
       proc_obj->outputFilename = "";  
       cout << "|||h "<<endl;  
5281        proc_obj->localDir = gSystem->WorkingDirectory();        proc_obj->localDir = gSystem->WorkingDirectory();
       cout << "|||j "<<endl;  
5282        proc_obj->uname = gSystem->GetFromPipe("uname -a");        proc_obj->uname = gSystem->GetFromPipe("uname -a");
5283        cout << "|||s "<<endl;        if (!dbc || (dbc && !dbc->IsConnected())) SetDBConnection();
5284        proc_obj->DB = Form("mysql://%s/%s",dbc->GetHost(),dbc->GetDB());        proc_obj->DB = Form("mysql://%s/%s",dbc->GetHost(),dbc->GetDB());
5285        cout << "||| "<<endl;        dbc->Close();
5286        proc_tree_clone->Fill();        proc_tree_clone->Fill();
5287      }      }
5288      cout << "----------------------------------------------------" << endl;      cout << "----------------------------------------------------" << endl;
# Line 5469  void PamLevel2::WriteCloneTrees() { Line 5505  void PamLevel2::WriteCloneTrees() {
5505      };      };
5506    }    }
5507        
5508    if ( PROC && false ){//EMEMEMEM    if ( PROC ){//EMEMEMEM
5509      proc_tree_clone->Write("ProcessingInfo",TObject::kOverwrite);      proc_tree_clone->Write("ProcessingInfo",TObject::kOverwrite);
5510    }    }
5511    cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl;    cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" << endl;

Legend:
Removed from v.1.105  
changed lines
  Added in v.1.110

  ViewVC Help
Powered by ViewVC 1.1.23