ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/SFrameAnalysis/src/EventHists.cxx
Revision: 1.6
Committed: Thu Mar 14 08:13:01 2013 UTC (12 years, 1 month ago) by peiffer
Content type: text/plain
Branch: MAIN
CVS Tags: v1-00
Changes since 1.5: +1 -1 lines
Log Message:
new histograms

File Contents

# User Rev Content
1 mmeyer 1.1 #include "include/EventHists.h"
2     #include "include/ObjectHandler.h"
3     #include "include/SelectionModules.h"
4     #include <iostream>
5    
6     using namespace std;
7    
8     EventHists::EventHists(const char* name) : BaseHists(name)
9     {
10     // named default constructor
11    
12     }
13    
14     EventHists::~EventHists()
15     {
16     // default destructor, does nothing
17     }
18    
19     void EventHists::Init()
20     {
21     // book all histograms here
22     Book( TH1F( "N_PrimVertices","number of primary vertices", 56,-0.5,55.5));
23     Book( TH1F( "N_PrimVertices_ly","number of primary vertices", 56,-0.5,55.5));
24 peiffer 1.6 Book( TH1F( "N_events_perlumibin", "N^{evt}", 40, 0, 20) );
25 mmeyer 1.1 Book( TH1F( "HT", "H_{T}", 100,0,5000 ) );
26     Book( TH1F( "HT_ly", "H_{T}", 100,0,5000 ) );
27 peiffer 1.4 Book( TH1F( "HTLep", "H_{T}Lep", 100,0,1000 ) );
28     Book( TH1F( "HTLep_ly", "H_{T}Lep", 100,0,1000 ) );
29 mmeyer 1.1 Book( TH1F( "HT_Jets", "H_{T} Jets", 100,0,3500 ) );
30     Book( TH1F( "HT_Jets_ly", "H_{T} Jets", 100,0,3500 ) );
31 bazterra 1.3 Book( TH1F( "MET", "missing E_{T}", 200,0,1000 ) );
32     Book( TH1F( "MET_ly", "missing E_{T}", 200,0,1000 ) );
33 rkogler 1.5 Book( TH1F( "HT_MET_Jets", "H_{T} Jets + missing E_{T}", 100,0,3500 ) );
34     Book( TH1F( "HT_MET_Jets_ly", "H_{T} Jets + missing E_{T}", 100,0,3500 ) );
35 mmeyer 1.1
36     }
37    
38     void EventHists::Fill()
39     {
40     // important: get the event weight
41     EventCalc* calc = EventCalc::Instance();
42     double weight = calc -> GetWeight();
43    
44     ObjectHandler* objs = ObjectHandler::Instance();
45 rkogler 1.5 LuminosityHandler* lumih = calc->GetLumiHandler();
46 mmeyer 1.1 BaseCycleContainer* bcc = objs->GetBaseCycleContainer();
47    
48    
49     int NPrimVertices = bcc-> pvs -> size();
50     Hist("N_PrimVertices")-> Fill(NPrimVertices,weight);
51     Hist("N_PrimVertices_ly")-> Fill(NPrimVertices,weight);
52    
53 rkogler 1.5 int run = calc->GetRunNum();
54     int lumiblock = calc->GetLumiBlock();
55     if(calc->IsRealData()){
56     Hist( "N_events_perlumibin")->Fill( lumih->GetLumiBin(run, lumiblock)*0.5, weight);
57     }
58 mmeyer 1.1
59     double H_T =0;
60     double HT_MET = 0;
61     double H_T_Jets =0;
62     double HT_MET_Jets = 0;
63    
64     H_T = calc -> GetHT();
65     double H_Tlep = calc -> GetHTlep();
66    
67     for(unsigned int i=0; i< bcc->jets->size(); ++i)
68     {
69     Jet jet = bcc->jets->at(i);
70     H_T_Jets= H_T_Jets + jet.pt();
71     }
72     double met = bcc->met->pt();
73     HT_MET_Jets = H_T_Jets+ met;
74    
75     Hist("HT")->Fill(H_T, weight);
76     Hist("HT_ly")->Fill(H_T, weight);
77     Hist("HTLep")->Fill(H_Tlep, weight);
78     Hist("HTLep_ly")->Fill(H_Tlep, weight);
79     Hist("HT_Jets")->Fill(H_T_Jets, weight);
80     Hist("HT_Jets_ly")->Fill(H_T_Jets, weight);
81     Hist("MET")->Fill(met, weight);
82     Hist("MET_ly")->Fill(met, weight);
83     Hist("HT_MET_Jets")->Fill(HT_MET_Jets, weight);
84     Hist("HT_MET_Jets_ly")->Fill(HT_MET_Jets, weight);
85    
86     }
87    
88    
89    
90     void EventHists::Finish()
91     {
92     // final calculations, like division and addition of certain histograms
93     }
94