--- calo/flight/FUTILITIES/macros/FCaloCALIBSCAN.cxx 2006/03/22 15:07:47 1.1.1.1 +++ calo/flight/FUTILITIES/macros/FCaloCALIBSCAN.cxx 2008/09/22 20:18:44 1.2 @@ -106,7 +106,7 @@ // If the file doesn't exist create it // hfl1 = new TFile(file5.str().c_str(),"UPDATE","Calorimeter calib data"); - calo = new CalorimeterCalibScan(); + // calo = new CalorimeterCalibScan(); // trl1 = (TTree*)hfl1->Get("CaloCALIBdata"); trl1->SetBranchAddress("Event", &calo); @@ -119,7 +119,7 @@ // hfl1 = new TFile(file5.str().c_str(),"RECREATE","Calorimeter calib data"); // - calo = new CalorimeterCalibScan(); + // calo = new CalorimeterCalibScan(); // trl1 = new TTree("CaloCALIBdata","PAMELA calorimeter calibration data"); trl1->Branch("Event","CalorimeterCalibScan",&calo); @@ -150,8 +150,8 @@ Int_t l = 0; Int_t m = 0; Int_t ss = 0; - TTree *tr; - TFile *File; + TTree *tr = 0; + TFile *File = 0; // while ( e < nfile ){ if ( flist != "" ){ @@ -180,26 +180,36 @@ nome = filename; printf("\n Processing file number %i: %s \n\n",e+1,nome); // - const string fil = (const char *)filename; - Int_t posiz = fil.find("dw_"); - if ( posiz == -1 ) posiz = fil.find("DW_"); - if ( posiz == -1 ) return(-1); - TString year; - stringcopy(year,filename,posiz+3,posiz+5); - const char *ye = year; - TString month; - stringcopy(month,filename,posiz+5,posiz+7); - const char *mo = month; - TString day; - stringcopy(day,filename,posiz+7,posiz+9); - const char *da = day; - TString fno; - stringcopy(fno,filename,posiz+10,posiz+13); - const char *fn = fno; - stringstream unino; - unino.str(""); - unino << ye << mo; - unino << da << fn; + const string fil = (const char *)(gSystem->BaseName(filename)); + Int_t posiz = 0; +// Int_t posiz = fil.find("dw_"); +// if ( posiz == -1 ) posiz = fil.find("DW_"); +// if ( posiz == -1 ) return(-1); + TString filenam2=(TString)(gSystem->BaseName(filename)); + TString year; + stringcopy(year,filenam2,posiz,posiz+5); + const char *ye = year; + TString month; + stringcopy(month,filenam2,posiz+7,posiz+9); + const char *mo = month; + TString day; + stringcopy(day,filenam2,posiz+11,posiz+13); + const char *da = day; +// TString fno; +// stringcopy(fno,filename,posiz+10,posiz+13); +// const char *fn = fno; + stringstream unino; + unino.str(""); + unino << ye << mo; + unino << da; +// unino << da << fn; + // + // stringstream unino; + // unino.str(""); + // unino << (e+1); + // unino << ye; + // + // printf("unino is %s \n",unino.str().c_str()); // // upgrade data... // @@ -208,17 +218,19 @@ goto jumpfile; }; File = new TFile(filename.Data()); - tr = new TTree; + // tr = new TTree; tr = (TTree*)File->Get("CalibCalPed"); tr->SetBranchAddress("Header", &ceh); tr->SetBranchAddress("CalibCalPed", &ce); ncalibs = tr->GetEntries(); if ( ncalibs == 0 ) goto oltre; - calo = new CalorimeterCalibScan(); + //calo = new CalorimeterCalibScan(); s = -1; l = 0; m = 0; + calo->Clear(); for (Int_t ci = 0; ci < ncalibs ; ci++){ + // calo = new CalorimeterCalibScan(); tr->GetEntry(ci); // s++; @@ -266,15 +278,20 @@ // if ( s == 3 ){ trl1->Fill(); - calo = new CalorimeterCalibScan(); + calo->Clear(); + // calo = new CalorimeterCalibScan(); }; - // }; + // + //if ( calo ) delete calo; + // fileup++; // goto oltre; jumpfile: printf(" File not processed! \n "); oltre: + if ( File ) File->Close(); + // if ( tr ) delete tr; e++; }; hfl1->Write();