#include <PatTriggerAnalyzer.h>
Public Member Functions | |
PatTriggerAnalyzer (const edm::ParameterSet &iConfig) | |
default constructor | |
~PatTriggerAnalyzer () | |
default destructor | |
Private Member Functions | |
virtual void | analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) |
everythin that needs to be done during the event loop | |
virtual void | beginJob () |
everythin that needs to be done before the event loop | |
virtual void | endJob () |
everythin that needs to be done after the event loop | |
Private Attributes | |
std::map< std::string, TH1D * > | histos1D_ |
histogram management | |
std::map< std::string, TH2D * > | histos2D_ |
unsigned | maxID_ |
maximal id for meanPt plot | |
unsigned | minID_ |
minimal id for meanPt plot | |
std::string | muonMatch_ |
input for trigger match objects | |
edm::InputTag | muons_ |
input for muons | |
std::map< unsigned, unsigned > | sumN_ |
internals for meanPt histogram calculation | |
std::map< unsigned, double > | sumPt_ |
edm::InputTag | trigger_ |
input for patTrigger | |
edm::InputTag | triggerEvent_ |
input for patTriggerEvent |
Definition at line 19 of file PatTriggerAnalyzer.h.
PatTriggerAnalyzer::PatTriggerAnalyzer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
default constructor
Definition at line 11 of file PatTriggerAnalyzer.cc.
: // pat::Trigger trigger_( iConfig.getParameter< edm::InputTag >( "trigger" ) ), // pat::TriggerEvent triggerEvent_( iConfig.getParameter< edm::InputTag >( "triggerEvent" ) ), // muon input collection muons_( iConfig.getParameter< edm::InputTag >( "muons" ) ), // muon match objects muonMatch_( iConfig.getParameter< std::string >( "muonMatch" ) ), // minimal id for of all trigger objects minID_( iConfig.getParameter< unsigned >( "minID" ) ), // maximal id for of all trigger objects maxID_( iConfig.getParameter< unsigned >( "maxID" ) ), histos1D_(), histos2D_() { }
PatTriggerAnalyzer::~PatTriggerAnalyzer | ( | ) |
void PatTriggerAnalyzer::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
everythin that needs to be done during the event loop
Implements edm::EDAnalyzer.
Definition at line 64 of file PatTriggerAnalyzer.cc.
References edm::Event::getByLabel(), histos1D_, histos2D_, maxID_, minID_, muonMatch_, patZpeak::muons, muons_, sumN_, sumPt_, triggerEvent_, and trigger::TriggerMuon.
{ // PAT trigger event edm::Handle< TriggerEvent > triggerEvent; iEvent.getByLabel( triggerEvent_, triggerEvent ); // PAT object collection edm::Handle< MuonCollection > muons; iEvent.getByLabel( muons_, muons ); // PAT trigger helper for trigger matching information const helper::TriggerMatchHelper matchHelper; /* kinematics comparison */ // loop over muon references (PAT muons have been used in the matcher in task 3) for( size_t iMuon = 0; iMuon < muons->size(); ++iMuon ) { // we need all these ingedients to recieve matched trigger objects from the matchHelper const TriggerObjectRef trigRef( matchHelper.triggerMatchObject( muons, iMuon, muonMatch_, iEvent, *triggerEvent ) ); // finally we can fill the histograms if ( trigRef.isAvailable() && trigRef.isNonnull() ) { // check references (necessary!) histos2D_[ "ptTrigCand" ]->Fill( muons->at( iMuon ).pt(), trigRef->pt() ); histos2D_[ "etaTrigCand" ]->Fill( muons->at( iMuon ).eta(), trigRef->eta() ); histos2D_[ "phiTrigCand" ]->Fill( muons->at( iMuon ).phi(), trigRef->phi() ); } } /* turn-on curve */ // get the trigger objects corresponding to the used matching (HLT muons) const TriggerObjectRefVector trigRefs( triggerEvent->objects( trigger::TriggerMuon ) ); // loop over selected trigger objects for ( TriggerObjectRefVector::const_iterator iTrig = trigRefs.begin(); iTrig != trigRefs.end(); ++iTrig ) { // get all matched candidates for the trigger object const reco::CandidateBaseRefVector candRefs( matchHelper.triggerMatchCandidates( ( *iTrig ), muonMatch_, iEvent, *triggerEvent ) ); if ( candRefs.empty() ) continue; // fill the histogram... // (only for the first match, since we resolved ambiguities in the matching configuration, // so that we have one at maximum per trigger object) reco::CandidateBaseRef muonRef( candRefs.at( 0 ) ); if ( muonRef.isAvailable() && muonRef.isNonnull() ) { histos1D_[ "turnOn" ]->Fill( muonRef->pt() ); } } /* mean pt */ // loop over all trigger match objects from minID to maxID; have // a look to DataFormats/HLTReco/interface/TriggerTypeDefs.h to // know more about the available trrigger object id's for ( unsigned id=minID_; id<=maxID_; ++id ) { // vector of all objects for a given object id const TriggerObjectRefVector objRefs( triggerEvent->objects( id ) ); // buffer the number of objects sumN_[ id ] += objRefs.size(); // iterate the objects and buffer the pt of the objects for ( TriggerObjectRefVector::const_iterator iRef = objRefs.begin(); iRef != objRefs.end(); ++iRef ) { sumPt_[ id ] += ( *iRef )->pt(); } } }
void PatTriggerAnalyzer::beginJob | ( | void | ) | [private, virtual] |
everythin that needs to be done before the event loop
Reimplemented from edm::EDAnalyzer.
Definition at line 32 of file PatTriggerAnalyzer.cc.
References fileService, histos1D_, histos2D_, maxID_, minID_, Pi, sumN_, and sumPt_.
{ edm::Service< TFileService > fileService; // pt correlation plot histos2D_[ "ptTrigCand" ] = fileService->make< TH2D >( "ptTrigCand", "Object vs. candidate p_{T} (GeV)", 60, 0., 300., 60, 0., 300. ); histos2D_[ "ptTrigCand" ]->SetXTitle( "candidate p_{T} (GeV)" ); histos2D_[ "ptTrigCand" ]->SetYTitle( "object p_{T} (GeV)" ); // eta correlation plot histos2D_[ "etaTrigCand" ] = fileService->make< TH2D >( "etaTrigCand", "Object vs. candidate #eta", 50, -2.5, 2.5, 50, -2.5, 2.5 ); histos2D_[ "etaTrigCand" ]->SetXTitle( "candidate #eta" ); histos2D_[ "etaTrigCand" ]->SetYTitle( "object #eta" ); // phi correlation plot histos2D_[ "phiTrigCand" ] = fileService->make< TH2D >( "phiTrigCand", "Object vs. candidate #phi", 60, -TMath::Pi(), TMath::Pi(), 60, -TMath::Pi(), TMath::Pi() ); histos2D_[ "phiTrigCand" ]->SetXTitle( "candidate #phi" ); histos2D_[ "phiTrigCand" ]->SetYTitle( "object #phi" ); // turn-on curves histos1D_[ "turnOn" ] = fileService->make< TH1D >( "turnOn", "p_{T} (GeV) of matched candidate", 10, 0., 50.); histos1D_[ "turnOn" ]->SetXTitle( "candidate p_{T} (GeV)" ); histos1D_[ "turnOn" ]->SetYTitle( "# of objects" ); // mean pt for all trigger objects histos1D_[ "ptMean" ] = fileService->make< TH1D >( "ptMean", "Mean p_{T} (GeV) per trigger object type", maxID_ - minID_ + 1, minID_ - 0.5, maxID_ + 0.5); histos1D_[ "ptMean" ]->SetXTitle( "trigger object type" ); histos1D_[ "ptMean" ]->SetYTitle( "mean p_{T} (GeV)" ); // initialize counters for mean pt calculation for( unsigned id = minID_; id <= maxID_; ++id ){ sumN_ [ id ] = 0; sumPt_[ id ] = 0.; } }
void PatTriggerAnalyzer::endJob | ( | void | ) | [private, virtual] |
everythin that needs to be done after the event loop
Reimplemented from edm::EDAnalyzer.
Definition at line 132 of file PatTriggerAnalyzer.cc.
std::map< std::string, TH1D* > PatTriggerAnalyzer::histos1D_ [private] |
histogram management
Definition at line 49 of file PatTriggerAnalyzer.h.
Referenced by analyze(), beginJob(), and endJob().
std::map< std::string, TH2D* > PatTriggerAnalyzer::histos2D_ [private] |
Definition at line 50 of file PatTriggerAnalyzer.h.
Referenced by analyze(), and beginJob().
unsigned PatTriggerAnalyzer::maxID_ [private] |
maximal id for meanPt plot
Definition at line 46 of file PatTriggerAnalyzer.h.
Referenced by analyze(), beginJob(), and endJob().
unsigned PatTriggerAnalyzer::minID_ [private] |
minimal id for meanPt plot
Definition at line 44 of file PatTriggerAnalyzer.h.
Referenced by analyze(), beginJob(), and endJob().
std::string PatTriggerAnalyzer::muonMatch_ [private] |
input for trigger match objects
Definition at line 42 of file PatTriggerAnalyzer.h.
Referenced by analyze().
edm::InputTag PatTriggerAnalyzer::muons_ [private] |
std::map< unsigned, unsigned > PatTriggerAnalyzer::sumN_ [private] |
internals for meanPt histogram calculation
Definition at line 53 of file PatTriggerAnalyzer.h.
Referenced by analyze(), beginJob(), and endJob().
std::map< unsigned, double > PatTriggerAnalyzer::sumPt_ [private] |
Definition at line 54 of file PatTriggerAnalyzer.h.
Referenced by analyze(), beginJob(), and endJob().
edm::InputTag PatTriggerAnalyzer::trigger_ [private] |
input for patTrigger
Definition at line 36 of file PatTriggerAnalyzer.h.
input for patTriggerEvent
Definition at line 38 of file PatTriggerAnalyzer.h.
Referenced by analyze().