-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 72919 b: "refs/heads/CMSSW_7_1_X" c: a88ffa2 h: "refs/heads/CMSSW_7_1_X" i: 72917: 788c9ae 72915: ff88b29 72911: 11b048b v: v3
- Loading branch information
Volker Adler
committed
Sep 2, 2009
1 parent
6857d1d
commit 5710915
Showing
4 changed files
with
153 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
--- | ||
refs/heads/gh-pages: 09c786f70121f131b3715aaf3464996502bbeb7e | ||
"refs/heads/CMSSW_7_1_X": bd70caf661837561da9acf5b89cbb6d44eacacba | ||
"refs/heads/CMSSW_7_1_X": a88ffa277b1fec477b063f88918f3f1b3cfcdc8c |
74 changes: 74 additions & 0 deletions
74
trunk/PhysicsTools/PatExamples/plugins/PatTriggerAnalyzer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
|
||
#include "PhysicsTools/PatExamples/plugins/PatTriggerAnalyzer.h" | ||
|
||
#include "PhysicsTools/PatUtils/interface/TriggerHelper.h" | ||
|
||
#include "TMath.h" | ||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
#include "PhysicsTools/UtilAlgos/interface/TFileService.h" | ||
|
||
using namespace pat; | ||
using namespace pat::helper; | ||
using namespace TMath; | ||
|
||
PatTriggerAnalyzer::PatTriggerAnalyzer( const edm::ParameterSet & iConfig ) : | ||
trigger_( iConfig.getParameter< edm::InputTag >( "trigger" ) ), | ||
triggerEvent_( iConfig.getParameter< edm::InputTag >( "triggerEvent" ) ), | ||
muons_( iConfig.getParameter< edm::InputTag >( "muons" ) ), | ||
muonMatch_( iConfig.getParameter< std::string >( "muonMatch" ) ), | ||
histos1D_(), | ||
histos2D_() | ||
{ | ||
} | ||
|
||
PatTriggerAnalyzer::~PatTriggerAnalyzer() | ||
{ | ||
} | ||
|
||
void PatTriggerAnalyzer::beginJob( const edm::EventSetup & iSetup ) | ||
{ | ||
edm::Service< TFileService > fileService; | ||
// histogram definitions | ||
// YOUR HISTOGRAM DEFINITIONS GO HERE! | ||
// histos1D_[ "histoName" ] = fileService->make< TH1D >( "[normal TH1D constructor]" ); // EXAMPLE CODE | ||
// histos1D_[ "histoName" ]->SetXTitle( "x-axis label" ); // EXAMPLE CODE | ||
// histos1D_[ "histoName" ]->SetYTitle( "y-axis label" ); // EXAMPLE CODE | ||
} | ||
|
||
void PatTriggerAnalyzer::analyze( const edm::Event & iEvent, const edm::EventSetup & iSetup ) | ||
{ | ||
// PAT trigger information | ||
edm::Handle< TriggerEvent > triggerEvent; | ||
iEvent.getByLabel( triggerEvent_, triggerEvent ); | ||
edm::Handle< TriggerPathCollection > triggerPaths; | ||
iEvent.getByLabel( trigger_, triggerPaths ); | ||
edm::Handle< TriggerFilterCollection > triggerFilters; | ||
iEvent.getByLabel( trigger_, triggerFilters ); | ||
edm::Handle< TriggerObjectCollection > triggerObjects; | ||
iEvent.getByLabel( trigger_, triggerObjects ); | ||
|
||
// PAT object collection | ||
edm::Handle< MuonCollection > muons; | ||
iEvent.getByLabel( muons_, muons ); | ||
|
||
// PAT trigger helper for trigger matching information | ||
const TriggerMatchHelper matchHelper; | ||
|
||
// YOUR ANALYSIS CODE GOES HERE! | ||
|
||
// kinematics comparison | ||
for ( size_t iMuon = 0; iMuon < muons->size(); ++iMuon ) { // loop over muon references (PAT muons have been used in the matcher in task 3) | ||
const reco::CandidateBaseRef candBaseRef( MuonRef( muons, iMuon ) ); | ||
} // iMuon | ||
|
||
// mean pt | ||
|
||
} | ||
|
||
void PatTriggerAnalyzer::endJob() | ||
{ | ||
} | ||
|
||
|
||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
DEFINE_FWK_MODULE( PatTriggerAnalyzer ); |
46 changes: 46 additions & 0 deletions
46
trunk/PhysicsTools/PatExamples/plugins/PatTriggerAnalyzer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#ifndef PhysicsTools_PatExamples_PatTriggerAnalyzer_h | ||
#define PhysicsTools_PatExamples_PatTriggerAnalyzer_h | ||
|
||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/EDAnalyzer.h" | ||
|
||
#include <string> | ||
#include <map> | ||
|
||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Utilities/interface/InputTag.h" | ||
|
||
#include "DataFormats/PatCandidates/interface/TriggerEvent.h" | ||
#include "DataFormats/PatCandidates/interface/Muon.h" | ||
|
||
#include "TH1D.h" | ||
#include "TH2D.h" | ||
|
||
namespace pat { | ||
|
||
class PatTriggerAnalyzer : public edm::EDAnalyzer { | ||
|
||
public: | ||
|
||
explicit PatTriggerAnalyzer( const edm::ParameterSet & iConfig ); | ||
~PatTriggerAnalyzer(); | ||
|
||
private: | ||
|
||
virtual void beginJob( const edm::EventSetup & iSetup ) ; | ||
virtual void analyze( const edm::Event & iEvent, const edm::EventSetup & iSetup ); | ||
virtual void endJob(); | ||
|
||
edm::InputTag trigger_; | ||
edm::InputTag triggerEvent_; | ||
edm::InputTag muons_; | ||
std::string muonMatch_; | ||
|
||
std::map< std::string, TH1D* > histos1D_; | ||
std::map< std::string, TH2D* > histos2D_; | ||
}; | ||
|
||
} | ||
|
||
#endif |
32 changes: 32 additions & 0 deletions
32
trunk/PhysicsTools/PatExamples/test/analyzePatTrigger_cfg.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
process = cms.Process( "TEST" ) | ||
|
||
process.load( "FWCore.MessageService.MessageLogger_cfi" ) | ||
process.options = cms.untracked.PSet( | ||
wantSummary = cms.untracked.bool( False ) | ||
) | ||
|
||
process.source = cms.Source( "PoolSource", | ||
fileNames = cms.untracked.vstring( | ||
'file:edmPatTrigger.root' | ||
) | ||
) | ||
process.maxEvents = cms.untracked.PSet( | ||
input = cms.untracked.int32( -1 ) | ||
) | ||
|
||
process.TFileService = cms.Service( "TFileService", | ||
fileName = cms.string( 'rootPatTrigger.root' ) | ||
) | ||
|
||
process.triggerAnalysis = cms.EDAnalyzer( "PatTriggerAnalyzer", | ||
trigger = cms.InputTag( "patTrigger" ), | ||
triggerEvent = cms.InputTag( "patTriggerEvent" ), | ||
muons = cms.InputTag( "selectedLayer1Muons" ), | ||
muonMatch = cms.string( 'muonTriggerMatchHLTMuons' ) | ||
) | ||
|
||
process.p = cms.Path( | ||
process.triggerAnalysis | ||
) |