ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/grimes/VHbbAnalysisCode/src/SimpleJetCollectionPlotSet.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/SimpleJetCollectionPlotSet.h"
2
3 #include <stdexcept>
4
5 #include <TDirectory.h>
6 #include <TH1F.h>
7
8
9 trkupgradeanalysis::SimpleJetCollectionPlotSet::SimpleJetCollectionPlotSet()
10 : histogramHaveBeenBooked_(false)
11 {
12 // No operation besides the initialiser list.
13 }
14
15 void trkupgradeanalysis::SimpleJetCollectionPlotSet::book( TDirectory* pDirectory )
16 {
17 if( histogramHaveBeenBooked_ ) throw std::runtime_error( "trkupgradeanalysis::SimpleJetCollectionPlotSet::book() - histograms have already been booked" );
18
19 //
20 // Note that the root file which TDirectory is part of takes ownership of all
21 // of these objects, so I don't need to (and shouldn't) delete them when I'm
22 // finished.
23 //
24
25 pNumberOfJets_=new TH1F( "numberOfJets", "Number of jets in each collection", 101, -0.5, 100.5 );
26 pNumberOfJets_->SetDirectory( pDirectory );
27
28 simpleJetPlotSet_.book( pDirectory );
29
30 histogramHaveBeenBooked_=true;
31 }
32
33 void trkupgradeanalysis::SimpleJetCollectionPlotSet::fill( const std::vector<VHbbEvent::SimpleJet>& jetCollection, const VHbbEventAuxInfo* pAuxInfo )
34 {
35 if( !histogramHaveBeenBooked_ ) throw std::runtime_error( "trkupgradeanalysis::SimpleJetCollectionPlotSet::book() - histograms have not been booked" );
36
37 pNumberOfJets_->Fill( jetCollection.size() );
38
39 for( std::vector<VHbbEvent::SimpleJet>::const_iterator iJet=jetCollection.begin(); iJet!=jetCollection.end(); ++iJet )
40 {
41 simpleJetPlotSet_.fill( *iJet, pAuxInfo );
42 }
43
44 }
45