1 |
#include "TrkUpgradeAnalysis/VHbb/interface/MuonInfoCollectionPlotSet.h"
|
2 |
|
3 |
#include <stdexcept>
|
4 |
|
5 |
#include <TDirectory.h>
|
6 |
#include <TH1F.h>
|
7 |
|
8 |
|
9 |
trkupgradeanalysis::MuonInfoCollectionPlotSet::MuonInfoCollectionPlotSet( bool createIsolationTree )
|
10 |
: histogramHaveBeenBooked_(false), muonInfoPlotSet_(createIsolationTree)
|
11 |
{
|
12 |
// No operation besides the initialiser list.
|
13 |
}
|
14 |
|
15 |
void trkupgradeanalysis::MuonInfoCollectionPlotSet::book( TDirectory* pDirectory )
|
16 |
{
|
17 |
if( histogramHaveBeenBooked_ ) throw std::runtime_error( "trkupgradeanalysis::MuonInfoCollectionPlotSet::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 |
pNumberOfMuons_=new TH1F( "numberOfMuons", "Number of muons in each collection", 21, -0.5, 20.5 );
|
26 |
pNumberOfMuons_->SetDirectory( pDirectory );
|
27 |
|
28 |
muonInfoPlotSet_.book( pDirectory );
|
29 |
|
30 |
histogramHaveBeenBooked_=true;
|
31 |
}
|
32 |
|
33 |
void trkupgradeanalysis::MuonInfoCollectionPlotSet::fill( const std::vector<VHbbEvent::MuonInfo>& muonCollection, const VHbbEventAuxInfo* pAuxInfo )
|
34 |
{
|
35 |
if( !histogramHaveBeenBooked_ ) throw std::runtime_error( "trkupgradeanalysis::MuonInfoCollectionPlotSet::book() - histograms have not been booked" );
|
36 |
|
37 |
pNumberOfMuons_->Fill( muonCollection.size() );
|
38 |
|
39 |
for( std::vector<VHbbEvent::MuonInfo>::const_iterator iMuon=muonCollection.begin(); iMuon!=muonCollection.end(); ++iMuon )
|
40 |
{
|
41 |
muonInfoPlotSet_.fill( *iMuon, pAuxInfo );
|
42 |
}
|
43 |
|
44 |
}
|
45 |
|