#include #include #include #include #include #include #include "CPmix.C" #include TChain *t ; using namespace std ; Int_t AddFilesToChain( char* buf , Int_t Run ) { char* RootFileName = new char[100]; Int_t fstRun(1),lstRun(6), step(1) ; string sbuf (buf) ; if( Run != 0 ) { fstRun = Run ; lstRun = Run; } for( Int_t iRun = fstRun ; iRun <= lstRun ; iRun++ ) { Int_t aRun = abs(iRun) ; for( Int_t j = 1 ; j <1000 ; j++ ) { Int_t a = sprintf( RootFileName ,"../RootFiles/%s_run%d%s%d%s", buf, aRun,"_",j,".root" ) ; TFile f( RootFileName,"READ" ) ; if( f.IsZombie() ) { cout << RootFileName << " does not exist " << endl ; break ; } f.Close() ; cout << " Add file " << RootFileName << endl ; t->Add( RootFileName ) ; } } if( t->GetEntries() == 0 ) { return 0 ; } else { return 1 ; } } void AnaCP( char* Str , Int_t Run, int nevmax ) { gDirectory->DeleteAll() ; if( t != 0 ) delete t ; t = new TChain( "CPmix" ) ; // Add file(s) to chain Int_t Ok = AddFilesToChain( Str , Run ) ; if( Ok == 0 ) { printf( " Cannot Open Chain for Set %s \n", Str ) ; return ; } // TTree* t = CPmix ; cout << " Load Tree " ; int s = t->GetEntries() ; cout << " entries " << s ; if( s>nevmax ) s=nevmax ; cout << " process " << s << " events " << endl ; CPmix* d = new CPmix(t) ; d->Loop( s, 20, "test.hist" ); // delete d ; return ; }