ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbb/src/cutFlow.cxx
Revision: 1.1
Committed: Fri Apr 27 14:26:29 2012 UTC (13 years ago) by bortigno
Content type: text/plain
Branch: MAIN
Log Message:
Pier code

File Contents

# User Rev Content
1 bortigno 1.1 #include <TROOT.h>
2     #include <TCanvas.h>
3     #include <TGraph.h>
4     #include <TGraphErrors.h>
5     #include <TLegend.h>
6     #include <iostream>
7     #include "CutsAndHistos.h"
8     #include "Histos.h"
9     #include "Cuts.h"
10     #include "TF1.h"
11     #include "TH1.h"
12     #include "samples.h"
13     #include "ntupleReader.h"
14     #include "sampleCollection.h"
15     #include "Riostream.h"
16     #include "TMatrixD.h"
17     #include "TVectorD.h"
18     #include "TDecompChol.h"
19     #include "TDecompSVD.h"
20     #include "setTDRStyle.C"
21     #include "controlRegions.h"
22    
23     #define ZeeL 4683.5
24     #define fA 0.46502
25     #define fB 0.53498
26    
27     int main(int argc, char **argv)
28     {
29    
30     typedef std::vector<Sample> samplesCollection;
31     setTDRStyle();
32     bool verbose_ = true;
33     TCanvas * c1 = new TCanvas("c1","c1", 600,600);
34     TH1D * h = new TH1D("h","h",30,0,300);
35     CutSample *PreSelZee = new PreSelectionZee;
36     PCutSet signalRegionCutFlow;
37    
38     signalRegionCutFlow.add( new EmptyCut );
39     signalRegionCutFlow.add( new VMassCutMin(75.) );
40     signalRegionCutFlow.add( new VMassCutMax(105.) );
41     signalRegionCutFlow.add( new JetPtCut(20.) );
42     signalRegionCutFlow.add( new HPtCut(100.) );
43     signalRegionCutFlow.add( new VPtCut(100.) );
44     signalRegionCutFlow.add( new JetBtagCut(0.5, 0.898) );
45     signalRegionCutFlow.add( new HVdPhiCut(2.9) );
46     signalRegionCutFlow.add( new JetVeto(2) );
47     signalRegionCutFlow.add( new HMassCut(100.) );
48     signalRegionCutFlow.add( new HMassCutMax(130.) );
49    
50     samplesCollection samples = Nov10thDiJetPtUpdatedFall11OKSlim();
51     std::vector< controlRegion > cutFlowCR;
52    
53     for(int i=0; i<signalRegionCutFlow.size(); ++i){
54     cutFlowCR.push_back( controlRegion(ZeeL,fA,fB) );
55     cutFlowCR.at(i).init();
56     }
57    
58     for(size_t iS = 0; iS < samples.size(); ++iS ){
59    
60     samples.at(iS).dump(1);
61    
62     TFile* f = samples.at(iS).file();
63     if(f==0){
64     std::cerr << "File not found " << std::endl;
65     std::cerr << "Please check the path of this file " << samples.at(iS).filename << std::endl;
66     return -1;
67     }
68    
69     ntupleReader event(samples.at(iS).filename.c_str());
70     bool trigger = true;
71     Long64_t entries = event.fChain->GetEntriesFast();
72     //Loop on all events of this file
73     for (unsigned int iEvent = 0; iEvent < entries; ++iEvent){
74     event.GetEntry(iEvent);
75    
76     //to speed up the loop
77     if( event.Vtype != 1 )
78     continue;
79    
80     //cut flow loop
81     for(int i=0; i<signalRegionCutFlow.size(); ++i){
82     cutFlowCR.at(i).fill( samples.at(iS), *PreSelZee, signalRegionCutFlow , i+1 , event );
83     }
84    
85     }
86    
87     }
88    
89     for(int i=0; i<signalRegionCutFlow.size(); ++i){
90     std::string cutFlowName = "";
91     cutFlowName += signalRegionCutFlow.getCut(i)->name() + " " ;
92     std::cout << " --- Cut Flow " << cutFlowName << " --- " << std::endl;
93     std::cout << "DYL = " << cutFlowCR.at(i).cDYL() << " +- " << cutFlowCR.at(i).eDYL() << std::endl;
94     std::cout << "DYB = " << cutFlowCR.at(i).cDYB() << " +- " << cutFlowCR.at(i).eDYB() << std::endl;
95     std::cout << "TTbar = " << cutFlowCR.at(i).cTTbar() << " +- " << cutFlowCR.at(i).eTTbar() << std::endl;
96     std::cout << "VV = " << cutFlowCR.at(i).cVV() << " +- " << cutFlowCR.at(i).eVV() << std::endl;
97     std::cout << "ST = " << cutFlowCR.at(i).cST() << " +- " << cutFlowCR.at(i).eST() << std::endl;
98     std::cout << "WJETS = " << cutFlowCR.at(i).cWJETS() << " +- " << cutFlowCR.at(i).eWJETS() << std::endl;
99     std::cout << "Others = " << cutFlowCR.at(i).cOthers() << " +- " << cutFlowCR.at(i).eOthers() << std::endl;
100     std::cout << "Signal = " << cutFlowCR.at(i).cSignal() << " +- " << cutFlowCR.at(i).eSignal() << std::endl;
101     std::cout << "Total = " << cutFlowCR.at(i).cTotal() << " +- " << cutFlowCR.at(i).eTotal() << std::endl;
102     std::cout << "Data = " << cutFlowCR.at(i).cData() << " +- " << cutFlowCR.at(i).eData() << std::endl;
103    
104     }
105    
106    
107     return 0;
108     }