ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/grimes/VHbbAnalysisCode/src/VHbbCandidatePlotSet.cpp
Revision: 1.2
Committed: Wed Aug 15 22:37:47 2012 UTC (12 years, 8 months ago) by grimes
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +2 -2 lines
Log Message:
Long overdue commit with several new files

File Contents

# User Rev Content
1 grimes 1.1 #include "TrkUpgradeAnalysis/VHbb/interface/VHbbCandidatePlotSet.h"
2    
3     #include <stdexcept>
4    
5     #include <TDirectory.h>
6     #include <TH1F.h>
7    
8     #include "VHbbAnalysis/VHbbDataFormats/interface/VHbbCandidate.h"
9    
10     trkupgradeanalysis::VHbbCandidatePlotSet::VHbbCandidatePlotSet()
11     : histogramHaveBeenBooked_(false)
12     {
13     // No operation besides the initialiser list.
14     }
15    
16     void trkupgradeanalysis::VHbbCandidatePlotSet::book( TDirectory* pDirectory )
17     {
18     if( histogramHaveBeenBooked_ ) throw std::runtime_error( "trkupgradeanalysis::VHbbCandidatePlotSet::book() - histograms have already been booked" );
19    
20     //
21     // Note that the root file which TDirectory is part of takes ownership of all
22     // of these objects, so I don't need to (and shouldn't) delete them when I'm
23     // finished.
24     //
25    
26     pCandidateType_=new TH1F( "candidateType","Candidate type",6,-0.5,5.5);
27     pCandidateType_->SetDirectory(pDirectory);
28     pCandidateType_->GetXaxis()->SetBinLabel( VHbbCandidate::Zmumu+1, "Zmumu");
29     pCandidateType_->GetXaxis()->SetBinLabel( VHbbCandidate::Zee+1, "Zee");
30     pCandidateType_->GetXaxis()->SetBinLabel( VHbbCandidate::Wmun+1, "Wmun");
31     pCandidateType_->GetXaxis()->SetBinLabel( VHbbCandidate::Wen+1, "Wen");
32     pCandidateType_->GetXaxis()->SetBinLabel( VHbbCandidate::Znn+1, "Znn");
33     pCandidateType_->GetXaxis()->SetBinLabel( VHbbCandidate::UNKNOWN+1, "UNKNOWN");
34    
35 grimes 1.2 pHiggsMass_=new TH1F( "higgsMass","Higgs candidate mass",150,0,250);
36 grimes 1.1 pHiggsMass_->SetDirectory(pDirectory);
37    
38 grimes 1.2 pZMass_=new TH1F( "ZMass","Z candidate mass",130,0,200);
39 grimes 1.1 pZMass_->SetDirectory(pDirectory);
40    
41     pNumberOfElectrons_=new TH1F( "numberOfElectrons","Number of electrons",6,-0.5,5.5);
42     pNumberOfElectrons_->SetDirectory(pDirectory);
43    
44     pNumberOfMuons_=new TH1F( "numberOfMuons","Number of muons",6,-0.5,5.5);
45     pNumberOfMuons_->SetDirectory(pDirectory);
46    
47     pNumberOfTaus_=new TH1F( "numberOfTaus","Number of taus",6,-0.5,5.5);
48     pNumberOfTaus_->SetDirectory(pDirectory);
49    
50     pNumberOfMETs_=new TH1F( "numberOfMETs","Number of MET info objects",6,-0.5,5.5);
51     pNumberOfMETs_->SetDirectory(pDirectory);
52    
53     pNumberOfAdditionalJets_=new TH1F( "numberAdditionalJets", "Number of additional jets", 101, -0.5, 100.5 );
54     pNumberOfAdditionalJets_->SetDirectory(pDirectory);
55    
56     histogramHaveBeenBooked_=true;
57     }
58    
59     void trkupgradeanalysis::VHbbCandidatePlotSet::fill( const VHbbCandidate& vhbbCandidate )
60     {
61     if( !histogramHaveBeenBooked_ ) throw std::runtime_error( "trkupgradeanalysis::VHbbCandidatePlotSet::book() - histograms have not been booked" );
62    
63     pCandidateType_->Fill( vhbbCandidate.candidateType );
64     pHiggsMass_->Fill( vhbbCandidate.H.p4.M() );
65     pZMass_->Fill( vhbbCandidate.V.p4.M() );
66     pNumberOfElectrons_->Fill( vhbbCandidate.V.electrons.size() );
67     pNumberOfMuons_->Fill( vhbbCandidate.V.muons.size() );
68     pNumberOfTaus_->Fill( vhbbCandidate.V.taus.size() );
69     pNumberOfMETs_->Fill( vhbbCandidate.V.mets.size() );
70     pNumberOfAdditionalJets_->Fill( vhbbCandidate.additionalJets.size() );
71     }
72