ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/SFrameAnalysis/src/MuonHists.cxx
Revision: 1.1
Committed: Thu Sep 27 15:44:34 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/MuonHists.h"
2     #include "include/ObjectHandler.h"
3     #include "include/SelectionModules.h"
4     #include <iostream>
5    
6     using namespace std;
7    
8     MuonHists::MuonHists(const char* name) : BaseHists(name)
9     {
10     // named default constructor
11    
12     }
13    
14     MuonHists::~MuonHists()
15     {
16     // default destructor, does nothing
17     }
18    
19     void MuonHists::Init()
20     {
21     // book all histograms here
22     Book( TH1F( "number","number of muons",5,-0.5,4.5));
23     Book( TH1F( "number_ly","number of muons",5,-0.5,4.5));
24     Book( TH1F( "pT","p_{T} muon",100,0,500));
25     Book( TH1F( "pT_ly","p_{T} muon",100,0,500));
26     Book( TH1F( "eta","#eta muon",100,-3,3));
27     Book( TH1F( "eta_ly","#eta muon",100,-3,3));
28     Book( TH1F( "phi","#phi muon",100,-PI,PI));
29     Book( TH1F( "phi_ly","#phi muon",100,-PI,PI));
30     Book( TH1F( "isolation","relIso muon",100,0,0.5));
31     Book( TH1F( "isolation_ly","relIso muon",100,0,0.5));
32     Book( TH1F( "pT_1"," p_{T} leading muon",100,0,500));
33     Book( TH1F( "pT_1_ly"," p_{T} leading muon",100,0,500));
34     Book( TH1F( "pT_2","p_{T} 2nd muon",100,0,500));
35     Book( TH1F( "pT_2_ly","p_{T} 2nd muon",100,0,500));
36     Book( TH1F( "eta_1","#eta leading muon",100,-3,3));
37     Book( TH1F( "eta_1_ly","#eta leading muon",100,-3,3));
38     Book( TH1F( "eta_2","#eta 2nd muon",100,-3,3));
39     Book( TH1F( "eta_2_ly","#eta 2nd muon",100,-3,3));
40     Book( TH1F( "phi_1","#phi leading muon",100,-PI,PI));
41     Book( TH1F( "phi_1_ly","#phi leading muon",100,-PI,PI));
42     Book( TH1F( "phi_2","#phi 2nd muon",100,-PI,PI));
43     Book( TH1F( "phi_2_ly","#phi 2nd muon",100,-PI,PI));
44     Book( TH1F( "isolation_1","relIso leading muon",100,0,0.5));
45     Book( TH1F( "isolation_1_ly","relIso leading muon",100,0,0.5));
46     Book( TH1F( "isolation_2","relIso 2nd muon",100,0,0.5));
47     Book( TH1F( "isolation_2_ly","relIso 2nd muon",100,0,0.5));
48    
49     }
50    
51    
52     void MuonHists::Fill()
53     {
54     // important: get the event weight
55     EventCalc* calc = EventCalc::Instance();
56     double weight = calc -> GetWeight();
57    
58     ObjectHandler* objs = ObjectHandler::Instance();
59     BaseCycleContainer* bcc = objs->GetBaseCycleContainer();
60    
61     int NMuons = bcc->muons->size();
62     Hist("number")-> Fill(NMuons,weight);
63     Hist("number_ly")-> Fill(NMuons,weight);
64    
65     for(unsigned int i=0; i< bcc->muons->size(); ++i)
66     {
67     Muon muon = bcc->muons->at(i);
68     Hist("pT")-> Fill(muon.pt(),weight);
69     Hist("pT_ly")-> Fill(muon.pt(),weight);
70     Hist("eta") -> Fill(muon.eta(),weight);
71     Hist("eta_ly") -> Fill(muon.eta(),weight);
72     Hist("phi") -> Fill(muon.phi(),weight);
73     Hist("phi_ly") -> Fill(muon.phi(),weight);
74     Hist("isolation")->Fill(muon.relIso(),weight);
75     Hist("isolation_ly")->Fill(muon.relIso(),weight);
76     }
77     sort(bcc->muons->begin(), bcc->muons->end(), HigherPt());
78     for (unsigned int i =0; i<=1; ++i)
79     {
80     if (bcc->muons->size()> i)
81     {
82     Muon muon = bcc->muons->at(i);
83     TString hname = TString::Format("pT_%d", i+1);
84     Hist(hname)->Fill(muon.pt(),weight);
85     TString hname_ly = TString::Format("pT_%d_ly", i+1);
86     Hist(hname_ly)->Fill(muon.pt(),weight);
87     TString hname_eta = TString::Format("eta_%d", i+1);
88     Hist(hname_eta)->Fill(muon.eta(),weight);
89     TString hname_eta_ly = TString::Format("eta_%d_ly", i+1);
90     Hist(hname_eta_ly)->Fill(muon.eta(),weight);
91     TString hname_phi = TString::Format("phi_%d", i+1);
92     Hist(hname_phi)->Fill(muon.phi(),weight);
93     TString hname_phi_ly = TString::Format("phi_%d_ly", i+1);
94     Hist(hname_phi_ly)->Fill(muon.phi(),weight);
95     TString hname_iso = TString::Format("isolation_%d", i+1);
96     Hist(hname_iso)->Fill(muon.relIso(),weight);
97     TString hname_iso_ly = TString::Format("isolation_%d_ly", i+1);
98     Hist(hname_iso_ly)->Fill(muon.relIso(),weight);
99     }
100     }
101     }
102    
103    
104     void MuonHists::Finish()
105     {
106     // final calculations, like division and addition of certain histograms
107     }
108