ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/DistributedModelCalculations/ShapeLimits/ReadAndSave.C
Revision: 1.1
Committed: Mon Apr 16 09:58:07 2012 UTC (13 years ago) by buchmann
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Error occurred while calculating annotation data.
Log Message:
Added files for creating shape model and reading the information

File Contents

# Content
1 #include <iostream>
2 #include "../../Plotting/Modules/GeneralToolBox.C"
3 #include "../../Plotting/Modules/ShapeDroplet.C"
4
5
6 using namespace std;
7
8 int main(int nargs, const char ** args) {
9 cout << "Number of arguments: " << nargs << endl;
10 if(nargs<3) {
11 write_error(__FUNCTION__,"Problem while running: You're supposed to provide two arguments: the file you want the ShapeDroplet to be saved to, and the file I'm supposed to retrieve the information from.");
12 cout << "Correct way to run this: " << args[0] << " (root file to read from) (txt file to save droplet to)" << endl;
13 return -1;
14 }
15
16 TFile *input = new TFile(args[1]);
17 if(input->IsZombie()) {
18 write_error(__FUNCTION__,"Input file was a Zombie - cannot convert it to a shape droplet!");
19 return -1;
20 }
21
22 TTree *tlimit = (TTree*)input->Get("limit");
23 float quantileExpected;
24 Double_t limit;
25 tlimit->SetBranchAddress("limit",&limit);
26 tlimit->SetBranchAddress("quantileExpected",&quantileExpected);
27 cout << "There are : " << tlimit->GetEntries() << " entries" << endl;
28
29 ShapeDroplet results;
30
31 for(int i=0;i<tlimit->GetEntries();i++) {
32 tlimit->GetEntry(i);
33 if(TMath::Abs(quantileExpected+1)<0.01) results.observed=limit;
34 if(TMath::Abs(quantileExpected-0.5)<0.01) results.expected=limit;
35 if(TMath::Abs(quantileExpected-0.16)<0.01) results.expectedMinus1Sigma=limit;
36 if(TMath::Abs(quantileExpected-0.84)<0.01) results.expectedPlus1Sigma=limit;
37 if(TMath::Abs(quantileExpected-0.025)<0.01) results.expectedMinus2Sigma=limit;
38 if(TMath::Abs(quantileExpected-0.975)<0.01) results.expectedPlus2Sigma=limit;
39 }
40 results.saveDroplet(args[2]);
41 dout << "Saved the following results : " << endl;
42 dout << results << endl;
43 return 0;
44 }
45
46
47