ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/RateMonShiftTool_dev/dumpToPDF.C
(Generate patch)

Comparing UserCode/RateMonShiftTool_dev/dumpToPDF.C (file contents):
Revision 1.3 by fantasia, Mon Sep 17 13:34:12 2012 UTC vs.
Revision 1.4 by abrinke1, Fri Oct 26 12:06:54 2012 UTC

# Line 11 | Line 11 | void
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  
# Line 27 | Line 26 | dumpToPDF(string inName, string fitName)
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;
# Line 43 | Line 49 | dumpToPDF(string inName, string fitName)
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  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines