CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
EgammaProbeSelector Class Reference

#include <EgammaProbeSelector.h>

Inheritance diagram for EgammaProbeSelector:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EgammaProbeSelector (const edm::ParameterSet &)
 
virtual bool filter (edm::Event &, const edm::EventSetup &)
 
 ~EgammaProbeSelector ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

bool debug
 
double jetEtaMax
 
double jetEtaMin
 
double jetEtMin
 
edm::EDGetTokenT
< reco::CaloJetCollection
jetToken
 
int minNumberOfjets
 
int minNumberOfSuperClusters
 
int nEvents
 
int nSelectedEvents
 
edm::EDGetTokenT
< reco::SuperClusterCollection
scEEToken
 
double scEtaMax
 
double scEtaMin
 
double scEtMin
 
edm::EDGetTokenT
< reco::SuperClusterCollection
scToken
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Filter to select events passing offline jets and superclusters

This class is an EDFilter for heavy W+jet and Z+jet events

Definition at line 31 of file EgammaProbeSelector.h.

Constructor & Destructor Documentation

EgammaProbeSelector::EgammaProbeSelector ( const edm::ParameterSet iConfig)
explicit

Definition at line 22 of file EgammaProbeSelector.cc.

References edm::ParameterSet::getParameter(), and nEvents.

22  {
23 
24  jetToken = consumes<CaloJetCollection>(iConfig.getParameter<InputTag>("JetCollection"));
25  minNumberOfjets = iConfig.getParameter<int>("MinNumberOfJets");
26  jetEtMin = iConfig.getParameter<double>("JetEtMin");
27  jetEtaMin = iConfig.getParameter<double>("JetEtaMin");
28  jetEtaMax = iConfig.getParameter<double>("JetEtaMax");
29 
30  nEvents = 0;
31  nSelectedEvents = 0;
32 
33  scToken = consumes<SuperClusterCollection>(iConfig.getParameter<InputTag>("SuperClusterBarrelCollection"));
34  scEEToken = consumes<SuperClusterCollection>(iConfig.getParameter<InputTag>("SuperClusterEndCapCollection"));
35  minNumberOfSuperClusters = iConfig.getParameter<int>("MinNumberOfSuperClusters");
36  scEtMin = iConfig.getParameter<double>("ScEtMin");
37  scEtaMin = iConfig.getParameter<double>("ScEtaMin");
38  scEtaMax = iConfig.getParameter<double>("ScEtaMax");
39 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::CaloJetCollection > jetToken
edm::EDGetTokenT< reco::SuperClusterCollection > scEEToken
edm::EDGetTokenT< reco::SuperClusterCollection > scToken
EgammaProbeSelector::~EgammaProbeSelector ( )

Definition at line 42 of file EgammaProbeSelector.cc.

References nEvents.

42  {
43  edm::LogVerbatim("EgammaProbeSelector")
44  << " Number_events_read " << nEvents
45  << " Number_events_kept " << nSelectedEvents
46  << " Efficiency " << ((double)nSelectedEvents)/((double) nEvents + 0.01) << std::endl;
47 
48 }

Member Function Documentation

bool EgammaProbeSelector::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDFilter.

Definition at line 51 of file EgammaProbeSelector.cc.

References edm::Event::getByToken(), edm::HandleBase::isValid(), fwrapper::jets, nEvents, and edm::Handle< T >::product().

51  {
52  int nSC = 0;
53  int nJets = 0;
54  nEvents++;
55 
56  // Get reconstructed Jets, check their Et and eta, and count their number
57  Handle<CaloJetCollection> jetHandle;
58  iEvent.getByToken(jetToken,jetHandle);
59 
60  if(jetHandle.isValid()){
61  const reco::CaloJetCollection & jets = *(jetHandle.product());
62  CaloJetCollection::const_iterator ijet;
63  for(ijet = jets.begin(); ijet!= jets.end(); ijet++){
64  if(ijet->pt() > jetEtMin &&
65  ijet->eta() > jetEtaMin &&
66  ijet->eta() < jetEtaMax )
67  nJets++;
68  }
69  }
70 
71  // Get Super Clusters, check their Et and eta, and count their number
72  // EB
74  iEvent.getByToken(scToken,scHandle);
75 
76  if(scHandle.isValid()){
77  const reco::SuperClusterCollection & SCs = *(scHandle.product());
78 
79  for(reco::SuperClusterCollection::const_iterator scIt = SCs.begin();
80  scIt!= SCs.end(); scIt++){
81 
82  double scEt = scIt->energy() * TMath::Sin(scIt->position().theta());
83  double _eta = scIt->position().eta();
84  if(scEt > scEtMin && _eta > scEtaMin && _eta < scEtaMax) nSC++;
85  }
86  }
87 
88  // EE
90  iEvent.getByToken(scEEToken,scEEHandle);
91 
92  if(scEEHandle.isValid()){
93  const reco::SuperClusterCollection & SCs = *(scEEHandle.product());
94  for(reco::SuperClusterCollection::const_iterator scIt = SCs.begin();
95  scIt!= SCs.end(); scIt++){
96 
97  double scEt = scIt->energy() * TMath::Sin(scIt->position().theta());
98  double _eta = scIt->position().eta();
99  if(scEt > scEtMin && _eta > scEtaMin && _eta < scEtaMax) nSC++;
100  }
101  }
102 
103  // Make final desicion on passed events
104  bool accepted = false;
105  if(nJets >= minNumberOfjets || nSC >=minNumberOfSuperClusters) {
106  accepted = true;
107  nSelectedEvents++;
108  }
109 
110  return accepted;
111 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
edm::EDGetTokenT< reco::CaloJetCollection > jetToken
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
vector< PseudoJet > jets
bool isValid() const
Definition: HandleBase.h:75
T const * product() const
Definition: Handle.h:81
edm::EDGetTokenT< reco::SuperClusterCollection > scEEToken
edm::EDGetTokenT< reco::SuperClusterCollection > scToken
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects

Member Data Documentation

bool EgammaProbeSelector::debug
private

Definition at line 40 of file EgammaProbeSelector.h.

double EgammaProbeSelector::jetEtaMax
private

Definition at line 46 of file EgammaProbeSelector.h.

double EgammaProbeSelector::jetEtaMin
private

Definition at line 45 of file EgammaProbeSelector.h.

double EgammaProbeSelector::jetEtMin
private

Definition at line 44 of file EgammaProbeSelector.h.

edm::EDGetTokenT<reco::CaloJetCollection> EgammaProbeSelector::jetToken
private

Definition at line 42 of file EgammaProbeSelector.h.

int EgammaProbeSelector::minNumberOfjets
private

Definition at line 43 of file EgammaProbeSelector.h.

int EgammaProbeSelector::minNumberOfSuperClusters
private

Definition at line 50 of file EgammaProbeSelector.h.

int EgammaProbeSelector::nEvents
private

Definition at line 55 of file EgammaProbeSelector.h.

int EgammaProbeSelector::nSelectedEvents
private

Definition at line 55 of file EgammaProbeSelector.h.

edm::EDGetTokenT<reco::SuperClusterCollection> EgammaProbeSelector::scEEToken
private

Definition at line 49 of file EgammaProbeSelector.h.

double EgammaProbeSelector::scEtaMax
private

Definition at line 53 of file EgammaProbeSelector.h.

double EgammaProbeSelector::scEtaMin
private

Definition at line 52 of file EgammaProbeSelector.h.

double EgammaProbeSelector::scEtMin
private

Definition at line 51 of file EgammaProbeSelector.h.

edm::EDGetTokenT<reco::SuperClusterCollection> EgammaProbeSelector::scToken
private

Definition at line 48 of file EgammaProbeSelector.h.