-
Notifications
You must be signed in to change notification settings - Fork 1
/
drawLEdiff_scan.C
45 lines (36 loc) · 1.32 KB
/
drawLEdiff_scan.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
void drawLEdiff_scan(TString listFilename="analysis_results/filelist2.txt", TString picturesDir="pictures3")
{
// Read the table from the file
std::ifstream ifs;
ifs.open(listFilename.Data(), std::ifstream::in);
std::string line;
TString histoName("LeadingEdgeDiff_ID1_00/fhLeadingEdgeDiff_ID1_00_ID2_01");
TCanvas* canv = new TCanvas("canv", "canv", 1364, 796);
unsigned int lineCounter=0;
while (ifs >> line) {
TString curFilename;
curFilename.Form("analysis_results/%s", line.c_str());
TFile* curFile = new TFile(curFilename, "READ");
if (curFile->IsZombie()) {
cerr << "Error opening file " << curFilename.Data() << ". Aborting." << endl;
return;
}
TH1D* curHisto;
curHisto = (TH1D*)curFile->Get(histoName);
if (curHisto == NULL) {
cerr << "Histogram " << histoName << " not found in " << curFilename.Data() << ". Aborting." << endl;
return;
}
TString hTitle;
hTitle.Form("fhLeadingEdgeDiff_ID1_00_ID2_01 for threshold %d a.u.", lineCounter);
curHisto->Draw();
canv->SetTitle(hTitle);
gPad->SetGrid(1, 1);
TString outFilename;
outFilename.Form("%s/ID1_00_ID2_01_Threshold_%d.png", picturesDir.Data(), lineCounter);
canv->SaveAs(outFilename);
outFilename.Form("%s/ID1_00_ID2_01_Threshold_%d.eps", picturesDir.Data(), lineCounter);
canv->SaveAs(outFilename);
lineCounter++;
}
}