ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/AnalysisFramework/DistributedModelCalculations/ShapeLimit/calc_limits.C
Revision: 1.1
Committed: Thu Jul 28 08:12:52 2011 UTC (13 years, 9 months ago) by buchmann
Content type: text/plain
Branch: MAIN
Log Message:
Testing extraction from root file

File Contents

# User Rev Content
1 buchmann 1.1 #include <iostream>
2     #include <vector>
3     #include <sys/stat.h>
4     #include <sstream>
5     #include <algorithm>
6    
7     #include <TCut.h>
8     #include <TLatex.h>
9     #include <TROOT.h>
10     #include <TCanvas.h>
11     #include <TFile.h>
12     #include <TTree.h>
13     #include <TString.h>
14     #include <TMath.h>
15     #include <stdio.h>
16     #include <stdlib.h>
17     #include <TH2.h>
18     #include <TColor.h>
19     #include <TStyle.h>
20     #include <TText.h>
21     #include "../../Plotting/Modules/setTDRStyle.C"
22     using namespace std;
23    
24     int main (int narg, char * args[]) {
25     if(narg<2||narg>2) {
26     cout << "USAGE : " << endl;
27     cout << args[0] << " fusefile.root" << endl;
28     cout << " where fusefile.root is the file that results from the fusion of all partial shape limit files" << endl;
29     return -1;
30     }
31     TFile *infile = new TFile(args[1]);
32     TTree *limit = (TTree*)infile->Get("limit");
33     Double_t lim;
34     limit->SetBranchAddress("limit",&lim);
35     vector<float> limits;
36     for (int i=0;i<limit->GetEntries();i++) {
37     limit->GetEntry(i);
38     limits.push_back(lim);
39     }
40     sort(limits.begin(),limits.end());
41     cout << "Median: " << limits[limits.size()*0.5] << endl;
42     cout << "1 \\sigma (68%): [ " << limits[(limits.size()*(1-0.6827))*0.5] << " , " << limits[(limits.size()*(1+0.6827))*0.5] << " ]" << endl;
43     cout << "2 \\sigma (95%): [ " << limits[(limits.size()*(1-0.9545))*0.5] << " , " << limits[(limits.size()*(1+0.9545))*0.5] << " ]" << endl;
44     cout << "3 \\sigma (99.7%): [ " << limits[(limits.size()*(1-0.9973))*0.5] << " , " << limits[(limits.size()*(1+0.9973))*0.5] << " ]" << endl;
45    
46    
47     return 0;
48     }