CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
AlCaGammaJetSelector Class Reference

#include <Calibration/HcalAlCaRecoProducers/AlCaGammaJetSelector/src/AlCaGammaJetSelector.cc>

Inheritance diagram for AlCaGammaJetSelector:
edm::stream::EDFilter< edm::GlobalCache< AlCaGammaJet::Counters > > edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 AlCaGammaJetSelector (const edm::ParameterSet &, const AlCaGammaJet::Counters *count)
 
void endStream () override
 
bool filter (edm::Event &, const edm::EventSetup &) override
 
 ~AlCaGammaJetSelector () override
 
- Public Member Functions inherited from edm::stream::EDFilter< edm::GlobalCache< AlCaGammaJet::Counters > >
 EDFilter ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
 EDFilterBase (const EDFilterBase &)=delete
 
ModuleDescription const & moduleDescription () const
 
const EDFilterBaseoperator= (const EDFilterBase &)=delete
 
 ~EDFilterBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static void globalEndJob (const AlCaGammaJet::Counters *counters)
 
static std::unique_ptr< AlCaGammaJet::CountersinitializeGlobalCache (edm::ParameterSet const &)
 
- Static Public Member Functions inherited from edm::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
bool select (const reco::PhotonCollection &, const reco::PFJetCollection &)
 

Private Attributes

edm::InputTag labelPFJet_
 
edm::InputTag labelPhoton_
 
double minPtJet_
 
double minPtPhoton_
 
unsigned int nProcessed_
 
unsigned int nSelected_
 
edm::EDGetTokenT< reco::PFJetCollectiontok_PFJet_
 
edm::EDGetTokenT< reco::PhotonCollectiontok_Photon_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDFilter< edm::GlobalCache< AlCaGammaJet::Counters > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: Enable filtering of good events based on the AlCaGammaJetProducer info

Implementation: [Notes on implementation]

Definition at line 47 of file AlCaGammaJetSelector.cc.

Constructor & Destructor Documentation

◆ AlCaGammaJetSelector()

AlCaGammaJetSelector::AlCaGammaJetSelector ( const edm::ParameterSet iConfig,
const AlCaGammaJet::Counters count 
)
explicit

Definition at line 89 of file AlCaGammaJetSelector.cc.

89  {
90  nProcessed_ = 0;
91  nSelected_ = 0;
92 
93  // get input
94  labelPhoton_ = iConfig.getParameter<edm::InputTag>("PhoInput");
95  labelPFJet_ = iConfig.getParameter<edm::InputTag>("PFjetInput");
96  minPtJet_ = iConfig.getParameter<double>("MinPtJet");
97  minPtPhoton_ = iConfig.getParameter<double>("MinPtPhoton");
98 
99  // Register consumption
100  tok_Photon_ = consumes<reco::PhotonCollection>(labelPhoton_);
101  tok_PFJet_ = consumes<reco::PFJetCollection>(labelPFJet_);
102 }

References edm::ParameterSet::getParameter(), labelPFJet_, labelPhoton_, minPtJet_, minPtPhoton_, nProcessed_, nSelected_, tok_PFJet_, and tok_Photon_.

◆ ~AlCaGammaJetSelector()

AlCaGammaJetSelector::~AlCaGammaJetSelector ( )
override

Definition at line 104 of file AlCaGammaJetSelector.cc.

104 {}

Member Function Documentation

◆ beginLuminosityBlock()

void AlCaGammaJetSelector::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 64 of file AlCaGammaJetSelector.cc.

64 {}

◆ beginRun()

void AlCaGammaJetSelector::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 62 of file AlCaGammaJetSelector.cc.

62 {}

◆ endLuminosityBlock()

void AlCaGammaJetSelector::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 65 of file AlCaGammaJetSelector.cc.

65 {}

◆ endRun()

void AlCaGammaJetSelector::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 63 of file AlCaGammaJetSelector.cc.

63 {}

◆ endStream()

void AlCaGammaJetSelector::endStream ( )
overridevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 152 of file AlCaGammaJetSelector.cc.

152  {
153  globalCache()->nProcessed_ += nProcessed_;
154  globalCache()->nSelected_ += nSelected_;
155 }

References nProcessed_, and nSelected_.

◆ fillDescriptions()

void AlCaGammaJetSelector::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 111 of file AlCaGammaJetSelector.cc.

111  {
112  //The following says we do not know what parameters are allowed so do no validation
113  // Please change this to state exactly what you do use, even if it is no parameters
115  desc.add<edm::InputTag>("PhoInput", edm::InputTag("gedPhotons"));
116  desc.add<edm::InputTag>("PFjetInput", edm::InputTag("ak4PFJetsCHS"));
117  desc.add<double>("MinPtJet", 10.0);
118  desc.add<double>("MinPtPhoton", 10.0);
119  descriptions.addDefault(desc);
120 }

References edm::ConfigurationDescriptions::addDefault(), submitPVResolutionJobs::desc, and HLT_FULL_cff::InputTag.

◆ filter()

bool AlCaGammaJetSelector::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::stream::EDFilterBase.

Definition at line 123 of file AlCaGammaJetSelector.cc.

123  {
124  nProcessed_++;
125 
126  // Access the collections from iEvent
128  iEvent.getByToken(tok_Photon_, phoHandle);
129  if (!phoHandle.isValid()) {
130  edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get the product " << labelPhoton_;
131  return false; // do not filter
132  }
133  const reco::PhotonCollection photons = *(phoHandle.product());
134 
136  iEvent.getByToken(tok_PFJet_, pfjetHandle);
137  if (!pfjetHandle.isValid()) {
138  edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelPFJet_;
139  return false; // do not filter
140  }
141  const reco::PFJetCollection pfjets = *(pfjetHandle.product());
142 
143  // Check the conditions for a good event
144  if (!(select(photons, pfjets)))
145  return false;
146 
147  edm::LogVerbatim("AlCaGammaJet") << "good event\n";
148  nSelected_++;
149  return true;
150 }

References iEvent, edm::HandleBase::isValid(), labelPFJet_, labelPhoton_, nProcessed_, nSelected_, BPHMonitor_cfi::photons, edm::Handle< T >::product(), select(), tok_PFJet_, and tok_Photon_.

◆ globalEndJob()

void AlCaGammaJetSelector::globalEndJob ( const AlCaGammaJet::Counters counters)
static

Definition at line 159 of file AlCaGammaJetSelector.cc.

159  {
160  edm::LogWarning("AlCaGammaJet") << "Finds " << count->nSelected_ << " good events out of " << count->nProcessed_;
161 }

References submitPVResolutionJobs::count.

◆ initializeGlobalCache()

static std::unique_ptr<AlCaGammaJet::Counters> AlCaGammaJetSelector::initializeGlobalCache ( edm::ParameterSet const &  )
inlinestatic

Definition at line 52 of file AlCaGammaJetSelector.cc.

52  {
53  return std::make_unique<AlCaGammaJet::Counters>();
54  }

◆ select()

bool AlCaGammaJetSelector::select ( const reco::PhotonCollection photons,
const reco::PFJetCollection jets 
)
private

Definition at line 163 of file AlCaGammaJetSelector.cc.

163  {
164  // Check the requirement for minimum pT
165  if (photons.empty())
166  return false;
167  bool ok(false);
168  for (reco::PFJetCollection::const_iterator itr = jets.begin(); itr != jets.end(); ++itr) {
169  if (itr->pt() >= minPtJet_) {
170  ok = true;
171  break;
172  }
173  }
174  if (!ok)
175  return ok;
176  for (reco::PhotonCollection::const_iterator itr = photons.begin(); itr != photons.end(); ++itr) {
177  if (itr->pt() >= minPtPhoton_)
178  return ok;
179  }
180  return false;
181 }

References singleTopDQM_cfi::jets, minPtJet_, minPtPhoton_, convertSQLiteXML::ok, and BPHMonitor_cfi::photons.

Referenced by filter().

Member Data Documentation

◆ labelPFJet_

edm::InputTag AlCaGammaJetSelector::labelPFJet_
private

Definition at line 72 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and filter().

◆ labelPhoton_

edm::InputTag AlCaGammaJetSelector::labelPhoton_
private

Definition at line 72 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and filter().

◆ minPtJet_

double AlCaGammaJetSelector::minPtJet_
private

Definition at line 73 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and select().

◆ minPtPhoton_

double AlCaGammaJetSelector::minPtPhoton_
private

Definition at line 73 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and select().

◆ nProcessed_

unsigned int AlCaGammaJetSelector::nProcessed_
private

Definition at line 70 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), endStream(), and filter().

◆ nSelected_

unsigned int AlCaGammaJetSelector::nSelected_
private

Definition at line 70 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), endStream(), and filter().

◆ tok_PFJet_

edm::EDGetTokenT<reco::PFJetCollection> AlCaGammaJetSelector::tok_PFJet_
private

Definition at line 75 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and filter().

◆ tok_Photon_

edm::EDGetTokenT<reco::PhotonCollection> AlCaGammaJetSelector::tok_Photon_
private

Definition at line 74 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and filter().

AlCaGammaJetSelector::minPtPhoton_
double minPtPhoton_
Definition: AlCaGammaJetSelector.cc:73
AlCaGammaJetSelector::labelPhoton_
edm::InputTag labelPhoton_
Definition: AlCaGammaJetSelector.cc:72
edm::Handle::product
T const * product() const
Definition: Handle.h:70
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
edm::Handle< reco::PhotonCollection >
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
AlCaGammaJetSelector::tok_PFJet_
edm::EDGetTokenT< reco::PFJetCollection > tok_PFJet_
Definition: AlCaGammaJetSelector.cc:75
AlCaGammaJetSelector::nProcessed_
unsigned int nProcessed_
Definition: AlCaGammaJetSelector.cc:70
AlCaGammaJetSelector::nSelected_
unsigned int nSelected_
Definition: AlCaGammaJetSelector.cc:70
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
iEvent
int iEvent
Definition: GenABIO.cc:224
AlCaGammaJetSelector::select
bool select(const reco::PhotonCollection &, const reco::PFJetCollection &)
Definition: AlCaGammaJetSelector.cc:163
BPHMonitor_cfi.photons
photons
Definition: BPHMonitor_cfi.py:91
AlCaGammaJetSelector::tok_Photon_
edm::EDGetTokenT< reco::PhotonCollection > tok_Photon_
Definition: AlCaGammaJetSelector.cc:74
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
reco::PFJetCollection
std::vector< PFJet > PFJetCollection
collection of PFJet objects
Definition: PFJetCollection.h:14
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
AlCaGammaJetSelector::minPtJet_
double minPtJet_
Definition: AlCaGammaJetSelector.cc:73
reco::PhotonCollection
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
AlCaGammaJetSelector::labelPFJet_
edm::InputTag labelPFJet_
Definition: AlCaGammaJetSelector.cc:72
edm::InputTag
Definition: InputTag.h:15