/[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.16 by pam-fi, Tue Jan 16 13:19:58 2007 UTC revision 1.17 by mocchiut, Tue Jan 16 15:26:55 2007 UTC
# Line 114  PamLevel2::PamLevel2(){ Line 114  PamLevel2::PamLevel2(){
114    
115      run_obj   = 0;//new GL_RUN();      run_obj   = 0;//new GL_RUN();
116      soft_obj   = 0;// Emiliano      soft_obj   = 0;// Emiliano
117            irun = -1;
118        runfirstentry = 0ULL;
119        runlastentry = 0ULL;
120    
121      for(Int_t i=0; i<8; i++ )tree_clone[i]=NULL;      for(Int_t i=0; i<8; i++ )tree_clone[i]=NULL;
122    
# Line 177  void PamLevel2::Clear(){ Line 179  void PamLevel2::Clear(){
179  //    cout << "void PamLevel2::Clear()"<<endl;  //    cout << "void PamLevel2::Clear()"<<endl;
180    
181  //  //
182    // This method is called once for every entry but RunInfo and SoftInfo do not change until the next run so we cannot clear them here unless we don't
183    // want to load them for each event even if they are the same...
184    //
185  //    if(run_obj)delete run_obj;  //    if(run_obj)delete run_obj;
186      if(run_obj) run_obj->Clear();  // Emiliano: Do not deallocate run_obj here, it will give segmentation fault! call clear instead  //    if(run_obj) run_obj->Clear();  // Emiliano: Do not deallocate run_obj here, it will give segmentation fault! call clear instead
187      if(soft_obj) soft_obj->Clear();  //    if(soft_obj) soft_obj->Clear();
188    
189      if(trk1_obj) trk1_obj->Clear();          if(trk1_obj) trk1_obj->Clear();    
190      if(trk2_obj) trk2_obj->Clear();      if(trk2_obj) trk2_obj->Clear();
# Line 1411  TTree *PamLevel2::GetRunTree(TFile *f){ Line 1416  TTree *PamLevel2::GetRunTree(TFile *f){
1416      return R;      return R;
1417            
1418  }  }
1419    /**
1420     * Update the runinfo informations (to be used to have Run infos event by event basis)
1421     * @param run Pointer to the chain/tree which contains run infos
1422     * @return true if a new run has been read, false if it is still the same run
1423     */
1424    Bool_t PamLevel2::UpdateRunInfo(TChain *run, ULong64_t iev){
1425      //
1426      // check if we have already called once GetEntry, if not call it
1427      //
1428      if ( run->GetEntries() <= 0 ) return(false);
1429      //
1430      Int_t oldrun = irun;
1431      if ( irun < 0 ){
1432        irun = 0;
1433        run->GetEntry(0);
1434        runfirstentry = 0ULL;
1435        runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS) - 1ULL;
1436      };
1437      while ( iev > (runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS-1)) && irun < run->GetEntries() ){
1438        //    printf(" iev %llu %u %llu \n",iev,this->GetRunInfo()->NEVENTS,(ULong64_t)(runfirstentry+(ULong64_t)(this->GetRunInfo()->NEVENTS)));
1439        irun++;
1440        run->GetEntry(irun);
1441        runfirstentry = runlastentry+1ULL;
1442        runlastentry += (ULong64_t)(this->GetRunInfo()->NEVENTS);
1443      };
1444      //
1445      if ( irun == oldrun || irun >= run->GetEntries() ) return(false);
1446      //
1447      //  printf(" iev %llu irun %i nevents %u 1st %llu last %llu \n",iev,irun,this->GetRunInfo()->NEVENTS,(ULong64_t)runfirstentry,(ULong64_t)runlastentry);
1448      //
1449      return(true);    
1450      //
1451    };
1452    /**
1453     * Update the runinfo informations (to be used to have Run infos event by event basis)
1454     * @param run Pointer to the chain/tree which contains run infos
1455     * @return true if a new run has been read, false if it is still the same run
1456     */
1457    Bool_t PamLevel2::UpdateRunInfo(TTree *run, ULong64_t iev){
1458      return(UpdateRunInfo((TChain*)run,iev));
1459    };
1460    
1461  //--------------------------------------  //--------------------------------------
1462  //  //
1463  //  //

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.23