ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/SFrameAnalysis/src/EventHists.cxx
Revision: 1.8
Committed: Tue Jun 25 16:42:03 2013 UTC (11 years, 10 months ago) by rkogler
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +1 -2 lines
Error occurred while calculating annotation data.
Log Message:
update for new data format and minor fixes

File Contents

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