--- PamelaLevel2/src/PamLevel2.cpp 2008/12/12 14:11:50 1.72 +++ PamelaLevel2/src/PamLevel2.cpp 2009/03/25 14:42:36 1.80 @@ -397,17 +397,17 @@ * If no options are specified, the default is assumed. Default is: * +TRK2+CAL2+CAL1+TOF+TRG+ND+AC+S4+ORB */ -PamLevel2::PamLevel2(TString ddir,TString list,TString detlist){ +PamLevel2::PamLevel2(TString ddir,TString llist,TString detlist){ Initialize(); - TList* listf = GetListOfLevel2Files(ddir,list); - GetPamTree(listf,detlist); - GetRunTree(listf); + TList* listf = GetListOfLevel2Files(ddir,llist); + if(listf)GetPamTree(listf,detlist); + if(listf)GetRunTree(listf); }; -PamLevel2::PamLevel2(TString ddir,TList *list,TString detlist){ +PamLevel2::PamLevel2(TString ddir,TList *llist,TString detlist){ Initialize(); - GetPamTree(list,detlist); - GetRunTree(list); + GetPamTree(llist,detlist); + GetRunTree(llist); }; /** * Constructor @@ -416,9 +416,9 @@ * Default trees/branches are loaded. Default is: * +TRK2+CAL2+CAL1+TOF+TRG+ND+AC+S4+ORB */ -PamLevel2::PamLevel2(TString ddir,TString list){ +PamLevel2::PamLevel2(TString ddir,TString llist){ Initialize(); - TList* listf = GetListOfLevel2Files(ddir,list); + TList* listf = GetListOfLevel2Files(ddir,llist); GetPamTree(listf,""); GetRunTree(listf); }; @@ -740,11 +740,11 @@ if(trig_obj && trig_obj->unpackError != 0) goodev = false; if(s4_obj && s4_obj->unpackError != 0) goodev = false; if(nd_obj && nd_obj->unpackError != 0) goodev = false; - if(ac_obj && (ac_obj->unpackError != 0 || ((ac_obj->status[0]>>3)&1) || ((ac_obj->status[0]>>3)&1)) ) goodev = false; + if(ac_obj && (ac_obj->unpackError != 0 || ((ac_obj->status[0]>>2)&1) || ((ac_obj->status[1]>>2)&1)) ) goodev = false; // if(orb_obj) } else { if(nd_obj && nd_obj->unpackError != 0) goodev = false; - if(ac_obj && (ac_obj->unpackError != 0 || ((ac_obj->status[0]>>3)&1) || ((ac_obj->status[0]>>3)&1)) ) goodev = false; + if(ac_obj && (ac_obj->unpackError != 0 || ((ac_obj->status[0]>>2)&1) || ((ac_obj->status[1]>>2)&1)) ) goodev = false; }; return(goodev); }; @@ -1867,9 +1867,7 @@ TList* PamLevel2::GetListOfLevel2Files(TString ddir, TString flisttxt = ""){ TString wdir = gSystem->WorkingDirectory(); - - // if(ddir=="")ddir = wdir; -// TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(ddir),ddir); + if ( ddir != ""){ cout << "Level2 data directory : "<< ddir << endl; } else { @@ -1878,21 +1876,21 @@ TList *contents = new TList; // create output list contents->SetOwner(); -// char *fullpath; -// const char *fullpath; - - // if no input file list is given: + // -------------------------------------- + // case 1 : input file/file-list provided + // -------------------------------------- if ( flisttxt != "" ){ -// if( !gSystem->IsFileInIncludePath(flisttxt,&fullpath) ){ -// if( !(fullpath = gSystem->FindFile("./",flisttxt)) ){ -// cout <<"File "<ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); + TString dir = gSystem->DirName(flisttxt); +// cout << " List directory "<ConcatFileName(wdir.Data(),gSystem->BaseName(flisttxt)); +// flisttxt = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); if( !gSystem->ChangeDirectory(ddir) ){ cout << "Cannot change directory : "< ERROR opening the file "<ChangeDirectory(wdir); // back to the working directory return 0; } int line=0; + // ........................... + // loop over file-list records + // ........................... while (1) { TString file; in >> file; if (!in.good()) break; line++; -// cout <<"(1) " << file << endl; + cout <<"(*) " << file << endl; if(file.IsNull()){ cout << "-- list interrupted at line "<IsFileInIncludePath(file,&fullpath) ){ -// if( (fullpath = gSystem->FindFile(ddir,file)) ){ + // + // take only root files + // if( file.EndsWith(".root") ){ TString filedir; + cout << ddir << endl; if (ddir != ""){ filedir = ddir; // take the input dir } else { gSystem->ChangeDirectory(wdir); // back to the working directory filedir = gSystem->DirName(file); // this will take the path if exist in the list otherwise it will return automatically the working dir }; + filedir.Append("/"); char *fullpath = gSystem->ConcatFileName(gSystem->DirName(filedir),gSystem->BaseName(file)); contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list + cout << fullpath << endl; delete fullpath; } // }else{ @@ -1939,12 +1943,18 @@ // }; }; in.close(); + // -------------------------------------- + // a single root file given as input + // -------------------------------------- } else { if(flisttxt.Contains("#"))flisttxt = flisttxt(0,flisttxt.First("#")); char *fullpath = gSystem->ConcatFileName(gSystem->DirName(flisttxt),gSystem->BaseName(flisttxt)); contents->Add(new TSystemFile(fullpath,gSystem->DirName(fullpath)));// add file to the list delete fullpath; }; + // --------------------------------------------------------------------------------- + // case 2 : no input file/file-list provided --> read all files insede the directory + // --------------------------------------------------------------------------------- }else{ cout << "No input file list given."<BaseName(ddir),ddir); TList *temp = datadir->GetListOfFiles(); + if(!temp)return 0; // temp->Print(); // cout << "*************************************" << endl; @@ -2637,7 +2648,7 @@ if( !GetOrbitalInfo() )cout << "** WARNING ** missing OrbitalInfo ---> run info might be not correctly updated "<IsConnected()) )SetDBConnection(); //Emiliano - gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0,"ID",dbc); //Emiliano + gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0,"ID",dbc,false); //Emiliano // the "false" means not to use level0 file (not necessary here) if ( dbc ) dbc->Close();// Emiliano }; // --------------------------------------------------------------- @@ -2724,15 +2735,17 @@ totdltime[1]-=GetTrigLevel2()->dltime[1];//dead-time } totdltime[2]--; //event counter - cout << endl; - cout << "n.events : "<GetTreeNumber()]; if ( gltsync ) delete gltsync; // Emiliano if(!dbc || (dbc && !dbc->IsConnected()) )SetDBConnection(); //Emiliano - gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0,"ID",dbc); // Emiliano + gltsync = new GL_TIMESYNC(GetRunInfo()->ID_ROOT_L0,"ID",dbc,false); // Emiliano if ( dbc ) dbc->Close(); // Emiliano if(gltsync->DBobt(GetRunInfo()->RUNHEADER_OBT)>gltsync->DBobt(GetRunInfo()->RUNTRAILER_OBT) ){ // Emiliano cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<=RUNTRAILER_OBT " <GetListOfKeys(); + if(!lk)return; TIter next(lk); TKey *key =0; @@ -3445,7 +3459,7 @@ if(GP){ Int_t nevt = ((TTree*)f->Get("h20"))->GetEntries(); if( nev && nevt!=nev){ - cout << "File: "<< f->GetName() <<" discarded ---- OrbitalInfo tree has "<GetName() <<" discarded ---- h20 tree has "<Branch("OrbitalInfo","OrbitalInfo", GetPointerTo("OrbitalInfo")); cout << "OrbitalInfo : branch OrbitalInfo"<Branch("GPamela","GPamela", GetPointerTo("GPamela"),32000,1);//split cout << "OrbitalInfo : branch OrbitalInfo"<GetEntry(ii) ){ - cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading pam tree"<