ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/SFrameAnalysis/src/JetHists.cxx
Revision: 1.1
Committed: Thu Sep 27 15:46:33 2012 UTC (12 years, 7 months ago) by mmeyer
Content type: text/plain
Branch: MAIN
Log Message:
first commit

File Contents

# User Rev Content
1 mmeyer 1.1 #include "include/JetHists.h"
2     #include "include/ObjectHandler.h"
3     #include "include/SelectionModules.h"
4     #include <iostream>
5    
6     using namespace std;
7    
8     JetHists::JetHists(const char* name) : BaseHists(name)
9     {
10     // named default constructor
11    
12     }
13    
14     JetHists::~JetHists()
15     {
16     // default destructor, does nothing
17     }
18    
19     void JetHists::Init()
20     {
21     // book all histograms here
22     Book( TH1F( "NJets", "number of jets", 13, -0.5, 12.5 ) );
23     Book( TH1F( "NJets_ly", "number of jets", 13, -0.5, 12.5 ) );
24     Book( TH1F( "pT"," p_{T} jets",100,0,2000));
25     Book( TH1F( "pT_ly"," p_{T} jets",100,0,2000));
26     Book( TH1F( "eta","#eta jets",100,-3,3));
27     Book( TH1F( "eta_ly","#eta jets",100,-3,3));
28     Book( TH1F( "phi","#phi jets",100,-PI,PI));
29     Book( TH1F( "phi_ly","#phi jets",100,-PI,PI));
30     Book( TH1F( "pT_1"," p_{T} leading jet",100,0,2000));
31     Book( TH1F( "pT_1_ly"," p_{T} leading jet",100,0,2000));
32     Book( TH1F( "pT_2","p_{T} 2nd jet",100,0,2000));
33     Book( TH1F( "pT_2_ly","p_{T} 2nd jet",100,0,2000));
34     Book( TH1F( "pT_3","p_{T} 3rd jet",100,0,1000));
35     Book( TH1F( "pT_3_ly","p_{T} 3rd jet",100,0,1000));
36     Book( TH1F( "pT_4","p_{T} 4th jet",100,0,1000));
37     Book( TH1F( "pT_4_ly","p_{T} 4th jet",100,0,1000));
38     Book( TH1F( "eta_1","#eta leading jet",100,-3,3));
39     Book( TH1F( "eta_1_ly","#eta leading jet",100,-3,3));
40     Book( TH1F( "eta_2","#eta 2nd jet",100,-3,3));
41     Book( TH1F( "eta_2_ly","#eta 2nd jet",100,-3,3));
42     Book( TH1F( "eta_3","#eta 3rd jet",100,-3,3));
43     Book( TH1F( "eta_3_ly","#eta 3rd jet",100,-3,3));
44     Book( TH1F( "eta_4","#eta 4th jet",100,-3,3));
45     Book( TH1F( "eta_4_ly","#eta 4th jet",100,-3,3));
46     Book( TH1F( "phi_1","#phi leading jet",100,-PI,PI));
47     Book( TH1F( "phi_1_ly","#phi leading jet",100,-PI,PI));
48     Book( TH1F( "phi_2","#phi 2nd jet",100,-PI,PI));
49     Book( TH1F( "phi_2_ly","#phi 2nd jet",100,-PI,PI));
50     Book( TH1F( "phi_3","#phi 3rd jet",100,-PI,PI));
51     Book( TH1F( "phi_3_ly","#phi 3rd jet",100,-PI,PI));
52     Book( TH1F( "phi_4","#phi 4th jet",100,-PI,PI));
53     Book( TH1F( "phi_4_ly","#phi 4th jet",100,-PI,PI));
54     Book( TH1F( "NbJets", "number of bJets", 8, -0.5, 7.5 ) );
55     Book( TH1F( "NbJets_ly", "number of bJets", 8, -0.5, 7.5 ) );
56     Book( TH1F( "pT_bJet_1"," p_{T} leading bJet",100,0,1300));
57     Book( TH1F( "pT_bJet_1_ly"," p_{T} leading bJet",100,0,1300));
58     Book( TH1F( "pT_bJet_2"," p_{T} 2nd bJet",100,0,1300));
59     Book( TH1F( "pT_bJet_2_ly"," p_{T} 2nd bJet",100,0,1300));
60     Book( TH1F( "eta_bJet_1"," #eta leading bJet",100,-3,3));
61     Book( TH1F( "eta_bJet_1_ly"," #eta leading bJet",100,-3,3));
62     Book( TH1F( "eta_bJet_2"," #eta 2nd bJet",100,-3,3));
63     Book( TH1F( "eta_bJet_2_ly"," #eta 2nd bJet",100,-3,3));
64     Book( TH1F( "phi_bJet_1"," #phi leading bJet",100,-PI,PI));
65     Book( TH1F( "phi_bJet_1_ly"," #phi leading bJet",100,-PI,PI));
66     Book( TH1F( "phi_bJet_2"," #phi 2nd bJet",100,-PI,PI));
67     Book( TH1F( "phi_bJet_2_ly"," #phi 2nd bJet",100,-PI,PI));
68     Book( TH1F( "bjet_tag","b jet",4,0.5,4.5));
69     }
70    
71     void JetHists::Fill()
72     {
73     // important: get the event weight
74     EventCalc* calc = EventCalc::Instance();
75     double weight = calc -> GetWeight();
76    
77     ObjectHandler* objs = ObjectHandler::Instance();
78     BaseCycleContainer* bcc = objs->GetBaseCycleContainer();
79    
80     int NJets = bcc-> jets -> size();
81     Hist("NJets")->Fill(NJets, weight);
82     Hist("NJets_ly")->Fill(NJets, weight);
83    
84     for (unsigned int i =0; i<bcc->jets->size(); ++i)
85     {
86     Jet jet = bcc->jets->at(i);
87     Hist("pT") -> Fill(jet.pt(),weight );
88     Hist("pT_ly") -> Fill(jet.pt(),weight);
89     Hist("eta") -> Fill(jet.eta(),weight);
90     Hist("eta_ly") -> Fill(jet.eta(),weight);
91     Hist("phi") -> Fill(jet.phi(),weight);
92     Hist("phi_ly") -> Fill(jet.phi(),weight);
93     }
94    
95     sort(bcc->jets->begin(), bcc->jets->end(), HigherPt());
96     for (unsigned int i =0; i<=3; ++i)
97     {
98     if (bcc->jets->size()> i)
99     {
100     Jet jet = bcc->jets->at(i);
101     TString hname = TString::Format("pT_%d", i+1);
102     Hist(hname)->Fill(jet.pt(),weight);
103     TString hname_ly = TString::Format("pT_%d_ly", i+1);
104     Hist(hname_ly)->Fill(jet.pt(),weight);
105     TString hname_eta = TString::Format("eta_%d", i+1);
106     Hist(hname_eta)->Fill(jet.eta(),weight);
107     TString hname_eta_ly = TString::Format("eta_%d_ly", i+1);
108     Hist(hname_eta_ly)->Fill(jet.eta(),weight);
109     TString hname_phi_ly = TString::Format("phi_%d_ly", i+1);
110     Hist(hname_phi_ly)->Fill(jet.phi(),weight);
111     if (jet.btag_combinedSecondaryVertex()>0.244)
112     {
113     Hist("bjet_tag")-> Fill(i+1,weight);
114     }
115     }
116     }
117    
118     vector<Jet> bjets;
119     for (unsigned int i =0; i<bcc->jets->size(); ++i)
120     {
121     if(bcc->jets->at(i).btag_combinedSecondaryVertex()>0.244)
122     {
123     bjets.push_back(bcc->jets->at(i));
124     }
125     }
126    
127     int NbJets = bjets.size();
128     Hist("NbJets")-> Fill(NbJets,weight);
129     Hist("NbJets_ly")-> Fill(NbJets,weight);
130    
131     sort(bjets.begin(), bjets.end(), HigherPt());
132     for (unsigned int i =0; i<=1; ++i)
133     {
134     if (bjets.size()> i)
135     {
136     Jet bjet = bjets[i];
137     TString hname = TString::Format("pT_bJet_%d", i+1);
138     Hist(hname)->Fill(bjet.pt(),weight);
139     TString hname_ly = TString::Format("pT_bJet_%d_ly", i+1);
140     Hist(hname_ly)->Fill(bjet.pt(),weight);
141     TString hname_eta = TString::Format("eta_bJet_%d", i+1);
142     Hist(hname_eta)->Fill(bjet.eta(),weight);
143     TString hname_eta_ly = TString::Format("eta_bJet_%d_ly", i+1);
144     Hist(hname_eta_ly)->Fill(bjet.eta(),weight);
145     TString hname_phi = TString::Format("phi_bJet_%d", i+1);
146     Hist(hname_phi)->Fill(bjet.phi(),weight);
147     TString hname_phi_ly = TString::Format("phi_bJet_%d_ly", i+1);
148     Hist(hname_phi_ly)->Fill(bjet.phi(),weight);
149     }
150     }
151     }
152    
153    
154    
155     void JetHists::Finish()
156     {
157     // final calculations, like division and addition of certain histograms
158    
159    
160     }
161