11 |
|
dumpToPDF(string inName, string fitName){ |
12 |
|
TFile *fin = TFile::Open(inName.c_str(), "read"); assert(fin); |
13 |
|
|
14 |
– |
|
14 |
|
string outName = inName; |
15 |
|
outName.replace(outName.find(".root"), 5, ".pdf"); |
16 |
|
|
26 |
|
printf("nplots: %i, nfits: %i\n", nplots, nfits); |
27 |
|
if(nplots != nfits){ |
28 |
|
cout<<" PDF output will be wrong since different number of triggers in fit and current run"<<endl; |
29 |
< |
abort(); |
29 |
> |
if (nplots > nfits) { |
30 |
> |
cout<<"Quitting"<<endl; |
31 |
> |
abort(); |
32 |
> |
} |
33 |
|
} |
34 |
|
TList* plots = fin->GetListOfKeys(); |
35 |
|
TList* fits = fFit->GetListOfKeys(); |
36 |
+ |
int offset = 0; //Assumes nfits >= nplots |
37 |
+ |
std::string inPlotName = ""; |
38 |
+ |
std::string inFitName = ""; |
39 |
|
for(int i=0; i<nplots; ++i){ |
40 |
+ |
|
41 |
|
TKey* plot = (TKey*) plots->At(i); |
42 |
< |
TKey* fit = (TKey*) fits->At(i);//assume they're in the same order for now |
42 |
> |
TKey* fit = (TKey*) fits->At(i+offset);//assume they're in the same order for now |
43 |
|
|
44 |
|
if(!fin->GetKey(plot->GetName())){ |
45 |
|
cout<<"Didn't find "<<plot<<". Removing."<<endl; |
49 |
|
cout<<"Didn't find "<<fit<<". Removing."<<endl; |
50 |
|
abort(); |
51 |
|
} |
52 |
+ |
inPlotName = plot->GetName(); |
53 |
+ |
inFitName = fit->GetName(); |
54 |
+ |
inFitName.erase(inFitName.length()-17,inFitName.length());//Removes "rate_vs_delivered" from string |
55 |
+ |
|
56 |
+ |
//std::cout << inPlotName << " " << inFitName << std::endl; |
57 |
+ |
while ((std::string::npos != inPlotName.find(inFitName)) == 0) { //While plot and fit names don't match |
58 |
+ |
offset += 1; |
59 |
+ |
fit = (TKey*) fits->At(i+offset); |
60 |
+ |
if(!fFit->GetKey(fit->GetName())){ |
61 |
+ |
cout<<"Didn't find "<<fit<<". Removing."<<endl; |
62 |
+ |
abort(); |
63 |
+ |
} |
64 |
+ |
inFitName = fit->GetName(); |
65 |
+ |
inFitName.erase(inFitName.length()-17,inFitName.length()); |
66 |
+ |
//std::cout << inFitName << std::endl; |
67 |
+ |
} |
68 |
+ |
|
69 |
|
TCanvas* c = new TCanvas(); |
70 |
|
c->Divide(1,2); |
71 |
|
|