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

File Contents

# Content
1 #include "TrkUpgradeAnalysis/VHbb/interface/SimpleJetPlotSet.h"
2
3 #include <stdexcept>
4
5 #include <TDirectory.h>
6 #include <TH1F.h>
7
8 #include "VHbbAnalysis/VHbbDataFormats/interface/VHbbEventAuxInfo.h"
9
10 trkupgradeanalysis::SimpleJetPlotSet::SimpleJetPlotSet()
11 : histogramHaveBeenBooked_(false)
12 {
13 // No operation besides the initialiser list.
14 }
15
16 void trkupgradeanalysis::SimpleJetPlotSet::book( TDirectory* pDirectory )
17 {
18 if( histogramHaveBeenBooked_ ) throw std::runtime_error( "trkupgradeanalysis::SimpleJetPlotSet::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 transverseMomentum_=new TH1F( "transverseMomentum","Transverse momentum", 60, 0, 100 );
27 transverseMomentum_->SetDirectory(pDirectory);
28
29 numberOfTracks_=new TH1F( "numberOfTracks","Number of tracks", 61, -0.5, 60.5 );
30 numberOfTracks_->SetDirectory(pDirectory);
31
32 numberOfConstituents_=new TH1F( "numberOfConstituents","Number of constituents", 81, -0.5, 80.5 );
33 numberOfConstituents_->SetDirectory(pDirectory);
34
35 histogramHaveBeenBooked_=true;
36 }
37
38 void trkupgradeanalysis::SimpleJetPlotSet::fill( const VHbbEvent::SimpleJet& jet, const VHbbEventAuxInfo* pAuxInfo )
39 {
40 if( !histogramHaveBeenBooked_ ) throw std::runtime_error( "trkupgradeanalysis::SimpleJetPlotSet::book() - histograms have not been booked" );
41
42 transverseMomentum_->Fill( jet.p4.Pt() );
43 numberOfTracks_->Fill( jet.ntracks );
44 numberOfConstituents_->Fill( jet.nConstituents );
45 }