1 |
grimes |
1.1 |
#include "TrkUpgradeAnalysis/VHbb/interface/ElectronInfoPlotSet.h"
|
2 |
|
|
|
3 |
|
|
#include <stdexcept>
|
4 |
|
|
|
5 |
|
|
#include <TDirectory.h>
|
6 |
|
|
#include <TH1F.h>
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
trkupgradeanalysis::ElectronInfoPlotSet::ElectronInfoPlotSet()
|
10 |
|
|
: histogramHaveBeenBooked_(false)
|
11 |
|
|
{
|
12 |
|
|
// No operation besides the initialiser list.
|
13 |
|
|
}
|
14 |
|
|
|
15 |
|
|
void trkupgradeanalysis::ElectronInfoPlotSet::book( TDirectory* pDirectory )
|
16 |
|
|
{
|
17 |
|
|
if( histogramHaveBeenBooked_ ) throw std::runtime_error( "trkupgradeanalysis::ElectronInfoPlotSet::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 |
|
|
|
26 |
|
|
pEta_=new TH1F( "eta", "Eta", 60, -3, 3 );
|
27 |
|
|
pEta_->SetDirectory(pDirectory);
|
28 |
|
|
|
29 |
|
|
pPt_=new TH1F( "pT", "pT", 60, 0, 250 );
|
30 |
|
|
pPt_->SetDirectory(pDirectory);
|
31 |
|
|
|
32 |
|
|
histogramHaveBeenBooked_=true;
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
void trkupgradeanalysis::ElectronInfoPlotSet::fill( const VHbbEvent::ElectronInfo& electron )
|
36 |
|
|
{
|
37 |
|
|
if( !histogramHaveBeenBooked_ ) throw std::runtime_error( "trkupgradeanalysis::ElectronInfoPlotSet::book() - histograms have not been booked" );
|
38 |
|
|
|
39 |
|
|
pEta_->Fill( electron.p4.Eta() );
|
40 |
|
|
pPt_->Fill( electron.p4.Pt() );
|
41 |
|
|
}
|
42 |
|
|
|