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