| 106 |
// If the file doesn't exist create it |
// If the file doesn't exist create it |
| 107 |
// |
// |
| 108 |
hfl1 = new TFile(file5.str().c_str(),"UPDATE","Calorimeter calib data"); |
hfl1 = new TFile(file5.str().c_str(),"UPDATE","Calorimeter calib data"); |
| 109 |
calo = new CalorimeterCalibScan(); |
// calo = new CalorimeterCalibScan(); |
| 110 |
// |
// |
| 111 |
trl1 = (TTree*)hfl1->Get("CaloCALIBdata"); |
trl1 = (TTree*)hfl1->Get("CaloCALIBdata"); |
| 112 |
trl1->SetBranchAddress("Event", &calo); |
trl1->SetBranchAddress("Event", &calo); |
| 119 |
// |
// |
| 120 |
hfl1 = new TFile(file5.str().c_str(),"RECREATE","Calorimeter calib data"); |
hfl1 = new TFile(file5.str().c_str(),"RECREATE","Calorimeter calib data"); |
| 121 |
// |
// |
| 122 |
calo = new CalorimeterCalibScan(); |
// calo = new CalorimeterCalibScan(); |
| 123 |
// |
// |
| 124 |
trl1 = new TTree("CaloCALIBdata","PAMELA calorimeter calibration data"); |
trl1 = new TTree("CaloCALIBdata","PAMELA calorimeter calibration data"); |
| 125 |
trl1->Branch("Event","CalorimeterCalibScan",&calo); |
trl1->Branch("Event","CalorimeterCalibScan",&calo); |
| 150 |
Int_t l = 0; |
Int_t l = 0; |
| 151 |
Int_t m = 0; |
Int_t m = 0; |
| 152 |
Int_t ss = 0; |
Int_t ss = 0; |
| 153 |
TTree *tr; |
TTree *tr = 0; |
| 154 |
TFile *File; |
TFile *File = 0; |
| 155 |
// |
// |
| 156 |
while ( e < nfile ){ |
while ( e < nfile ){ |
| 157 |
if ( flist != "" ){ |
if ( flist != "" ){ |
| 180 |
nome = filename; |
nome = filename; |
| 181 |
printf("\n Processing file number %i: %s \n\n",e+1,nome); |
printf("\n Processing file number %i: %s \n\n",e+1,nome); |
| 182 |
// |
// |
| 183 |
const string fil = (const char *)filename; |
const string fil = (const char *)(gSystem->BaseName(filename)); |
| 184 |
Int_t posiz = fil.find("dw_"); |
Int_t posiz = 0; |
| 185 |
if ( posiz == -1 ) posiz = fil.find("DW_"); |
// Int_t posiz = fil.find("dw_"); |
| 186 |
if ( posiz == -1 ) return(-1); |
// if ( posiz == -1 ) posiz = fil.find("DW_"); |
| 187 |
TString year; |
// if ( posiz == -1 ) return(-1); |
| 188 |
stringcopy(year,filename,posiz+3,posiz+5); |
TString filenam2=(TString)(gSystem->BaseName(filename)); |
| 189 |
const char *ye = year; |
TString year; |
| 190 |
TString month; |
stringcopy(year,filenam2,posiz,posiz+5); |
| 191 |
stringcopy(month,filename,posiz+5,posiz+7); |
const char *ye = year; |
| 192 |
const char *mo = month; |
TString month; |
| 193 |
TString day; |
stringcopy(month,filenam2,posiz+7,posiz+9); |
| 194 |
stringcopy(day,filename,posiz+7,posiz+9); |
const char *mo = month; |
| 195 |
const char *da = day; |
TString day; |
| 196 |
TString fno; |
stringcopy(day,filenam2,posiz+11,posiz+13); |
| 197 |
stringcopy(fno,filename,posiz+10,posiz+13); |
const char *da = day; |
| 198 |
const char *fn = fno; |
// TString fno; |
| 199 |
stringstream unino; |
// stringcopy(fno,filename,posiz+10,posiz+13); |
| 200 |
unino.str(""); |
// const char *fn = fno; |
| 201 |
unino << ye << mo; |
stringstream unino; |
| 202 |
unino << da << fn; |
unino.str(""); |
| 203 |
|
unino << ye << mo; |
| 204 |
|
unino << da; |
| 205 |
|
// unino << da << fn; |
| 206 |
|
// |
| 207 |
|
// stringstream unino; |
| 208 |
|
// unino.str(""); |
| 209 |
|
// unino << (e+1); |
| 210 |
|
// unino << ye; |
| 211 |
|
// |
| 212 |
|
// printf("unino is %s \n",unino.str().c_str()); |
| 213 |
// |
// |
| 214 |
// upgrade data... |
// upgrade data... |
| 215 |
// |
// |
| 218 |
goto jumpfile; |
goto jumpfile; |
| 219 |
}; |
}; |
| 220 |
File = new TFile(filename.Data()); |
File = new TFile(filename.Data()); |
| 221 |
tr = new TTree; |
// tr = new TTree; |
| 222 |
tr = (TTree*)File->Get("CalibCalPed"); |
tr = (TTree*)File->Get("CalibCalPed"); |
| 223 |
tr->SetBranchAddress("Header", &ceh); |
tr->SetBranchAddress("Header", &ceh); |
| 224 |
tr->SetBranchAddress("CalibCalPed", &ce); |
tr->SetBranchAddress("CalibCalPed", &ce); |
| 225 |
ncalibs = tr->GetEntries(); |
ncalibs = tr->GetEntries(); |
| 226 |
if ( ncalibs == 0 ) goto oltre; |
if ( ncalibs == 0 ) goto oltre; |
| 227 |
calo = new CalorimeterCalibScan(); |
//calo = new CalorimeterCalibScan(); |
| 228 |
s = -1; |
s = -1; |
| 229 |
l = 0; |
l = 0; |
| 230 |
m = 0; |
m = 0; |
| 231 |
|
calo->Clear(); |
| 232 |
for (Int_t ci = 0; ci < ncalibs ; ci++){ |
for (Int_t ci = 0; ci < ncalibs ; ci++){ |
| 233 |
|
// calo = new CalorimeterCalibScan(); |
| 234 |
tr->GetEntry(ci); |
tr->GetEntry(ci); |
| 235 |
// |
// |
| 236 |
s++; |
s++; |
| 278 |
// |
// |
| 279 |
if ( s == 3 ){ |
if ( s == 3 ){ |
| 280 |
trl1->Fill(); |
trl1->Fill(); |
| 281 |
calo = new CalorimeterCalibScan(); |
calo->Clear(); |
| 282 |
|
// calo = new CalorimeterCalibScan(); |
| 283 |
}; |
}; |
|
// |
|
| 284 |
}; |
}; |
| 285 |
|
// |
| 286 |
|
//if ( calo ) delete calo; |
| 287 |
|
// |
| 288 |
fileup++; |
fileup++; |
| 289 |
// |
// |
| 290 |
goto oltre; |
goto oltre; |
| 291 |
jumpfile: printf(" File not processed! \n "); |
jumpfile: printf(" File not processed! \n "); |
| 292 |
oltre: |
oltre: |
| 293 |
|
if ( File ) File->Close(); |
| 294 |
|
// if ( tr ) delete tr; |
| 295 |
e++; |
e++; |
| 296 |
}; |
}; |
| 297 |
hfl1->Write(); |
hfl1->Write(); |