ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/Plotting/Modules/GeneralToolBox.C
(Generate patch)

Comparing UserCode/cbrown/Development/Plotting/Modules/GeneralToolBox.C (file contents):
Revision 1.14 by buchmann, Mon Jun 18 12:22:43 2012 UTC vs.
Revision 1.15 by buchmann, Tue Aug 14 12:16:04 2012 UTC

# Line 39 | Line 39
39   #include <TPaveText.h>
40   #include <TRandom.h>
41   #include <TGraphErrors.h>
42 + #include <TROOT.h>
43   #ifndef Verbosity
44   #define Verbosity 0
45   #endif
# Line 254 | Line 255 | void ensure_directory_exists(string this
255    }
256   }
257  
258 + void DeadEnd(string message) {
259 +  dout << endl;
260 +  dout << "\033[1;31m     _                _                  _  " << endl;
261 +  dout << "\033[1;31m  __| | ___  __ _  __| |   ___ _ __   __| | " << endl;
262 +  dout << "\033[1;31m / _` |/ _ \\/ _` |/ _` |  / _ \\ '_ \\ / _` | " << endl;
263 +  dout << "\033[1;31m| (_| |  __/ (_| | (_| | |  __/ | | | (_| | " << endl;
264 +  dout << "\033[1;31m \\__,_|\\___|\\__,_|\\__,_|  \\___|_| |_|\\__,_| " << endl;
265 +  dout << "\033[1;31m                                            " << endl;
266 +  dout << "" << endl;
267 +  dout << " A totally fatal error has occurred: " << endl;
268 +  dout << " " << message << endl;
269 +  dout << endl;
270 +  dout << "If you do not know how to deal with this error message please call Customer Support Mumbai (or Zurich...) \033[0m" << endl;
271 +  dout << "   ... aborting now ... " << endl;
272 +  assert(0);
273 + }
274 +
275 +
276 + void SanityChecks() {
277 +  //this function gets called whenever samples are initialized (see ActiveSamples.C)
278 +  //whatever is necessary for the code to run should be put here.
279 +  
280 +  if(gROOT->GetVersionInt()<53200) {
281 +    DeadEnd("ROOT version outdated, you are using "+any2string(gROOT->GetVersionInt())+" but the earliest recommended version is 5.32.00");
282 +  }
283 +  
284 +  
285 + }
286 +
287   void initialize_log() {
288    if(!PlottingSetup::publicmode) {
289      dout << "____________________________________________________________" << endl;
# Line 1282 | Line 1312 | Double_t MarcosChi2TestX(const TH1* h1,
1312     return prob;
1313   }
1314  
1315 + /*void save_with_difference(TH1F *obs, vector<TH1F*> predictions, vector<float> prediction_weights, vector<float> prediction_uncerts, TVirtualPad *canvas, string savemeas) {
1316 +  if(predictions.size()<1) {
1317 +    write_warning(__FUNCTION__,"Cannot make a pred-obs prediction plot because the prediction vector is empty. aborting!");
1318 +    return;
1319 +  }
1320 +  TH1F *comppred = predictions[0]->Clone("comppred");
1321 +  comppred->Scale(prediction_weights[0]);
1322 +  for(int i=1;i<predictions.size();i++) comppred->Add(predictions[i],prediction_weights[i]);
1323 +  
1324 +  TH1F *statpred = (TH1F*)comppred->Clone("statpred");
1325 +  for(int i=1;i<=statpred->GetNbinsX();i++) statpred->SetBinContent(0);
1326 +  
1327 +  TH1F *syspred = predictions[0];
1328 +  for(int i=1;i<=syspred->GetNbinsX();i++) syspred->SetBinContent(i,prediction_weights[0]*prediction_weights[0]*prediction_uncerts[0]*prediction_uncerts[0]*syspred->GetBinContent(i)*syspred->GetBinContent(i));
1329 +  for(int i=1;i<predictions.size();i++) {
1330 +    for(int ibin=1;ibin<=predictions[i]->GetNbinsX();ibin++) {
1331 +      float newentry=syspred->GetBinContent(ibin);
1332 +      newentry+=(predictions[i]->GetBinContent(ibin))*(predictions[i]->GetBinContent(ibin))*prediction_weights[i]*prediction_weights[i]*prediction_uncerts[i]*prediction_uncerts[i];
1333 +      syspred->SetBinContent(ibin,newentry);
1334 +    }
1335 +  }
1336 +  for(int ibin=1;ibin<=syspred->GetNbinsX();ibin++) {
1337 +    syspred->SetBinError(ibin,syspred->GetBinContent(i)+statpred->GetBinError());
1338 +    syspred->SetBinContent(ibin,0);
1339 +  }
1340 +  
1341 +  
1342 + }
1343 + */
1344   void save_with_ratio(TH1F *nominator, TH1F *denominator, TVirtualPad *canvas, string savemeas, bool do_bpred_ratio=false, bool extendrange=false, string yaxistitle="ratio",TH1F *syshisto=NULL) {
1345    //this function saves the pad being passed as well as a new one including the ratio.
1346    CompleteSave(canvas,savemeas);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines