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< alCaGammaJetSelector::Counters > > edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 AlCaGammaJetSelector (const edm::ParameterSet &, const alCaGammaJetSelector::Counters *count)
 
void endStream () override
 
bool filter (edm::Event &, const edm::EventSetup &) override
 
 ~AlCaGammaJetSelector () override=default
 
- Public Member Functions inherited from edm::stream::EDFilter< edm::GlobalCache< alCaGammaJetSelector::Counters > >
 EDFilter ()=default
 
 EDFilter (const EDFilter &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDFilteroperator= (const EDFilter &)=delete
 
- 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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 alCaGammaJetSelector::Counters *counters)
 
static std::unique_ptr< alCaGammaJetSelector::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< alCaGammaJetSelector::Counters > >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

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

Implementation: [Notes on implementation]

Definition at line 48 of file AlCaGammaJetSelector.cc.

Constructor & Destructor Documentation

◆ AlCaGammaJetSelector()

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

Definition at line 90 of file AlCaGammaJetSelector.cc.

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

91  {
92  nProcessed_ = 0;
93  nSelected_ = 0;
94 
95  // get input
96  labelPhoton_ = iConfig.getParameter<edm::InputTag>("PhoInput");
97  labelPFJet_ = iConfig.getParameter<edm::InputTag>("PFjetInput");
98  minPtJet_ = iConfig.getParameter<double>("MinPtJet");
99  minPtPhoton_ = iConfig.getParameter<double>("MinPtPhoton");
100 
101  // Register consumption
102  tok_Photon_ = consumes<reco::PhotonCollection>(labelPhoton_);
103  tok_PFJet_ = consumes<reco::PFJetCollection>(labelPFJet_);
104 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< reco::PFJetCollection > tok_PFJet_
edm::EDGetTokenT< reco::PhotonCollection > tok_Photon_

◆ ~AlCaGammaJetSelector()

AlCaGammaJetSelector::~AlCaGammaJetSelector ( )
overridedefault

Member Function Documentation

◆ beginLuminosityBlock()

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 65 of file AlCaGammaJetSelector.cc.

65 {}

◆ beginRun()

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 63 of file AlCaGammaJetSelector.cc.

63 {}

◆ endLuminosityBlock()

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 66 of file AlCaGammaJetSelector.cc.

66 {}

◆ endRun()

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 64 of file AlCaGammaJetSelector.cc.

64 {}

◆ endStream()

void AlCaGammaJetSelector::endStream ( )
overridevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 150 of file AlCaGammaJetSelector.cc.

References nProcessed_, and nSelected_.

150  {
151  globalCache()->nProcessed_ += nProcessed_;
152  globalCache()->nSelected_ += nSelected_;
153 }

◆ fillDescriptions()

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

Definition at line 111 of file AlCaGammaJetSelector.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

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.add("alcaGammaJetSelector", desc);
120 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ filter()

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

Implements edm::stream::EDFilterBase.

Definition at line 123 of file AlCaGammaJetSelector.cc.

References iEvent, labelPFJet_, labelPhoton_, nProcessed_, nSelected_, BPHMonitor_cfi::photons, select(), tok_PFJet_, and tok_Photon_.

123  {
124  nProcessed_++;
125 
126  // Access the collections from iEvent
127  auto const& phoHandle = iEvent.getHandle(tok_Photon_);
128  if (!phoHandle.isValid()) {
129  edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get the product " << labelPhoton_;
130  return false; // do not filter
131  }
132  const reco::PhotonCollection photons = *(phoHandle.product());
133 
134  auto const& pfjetHandle = iEvent.getHandle(tok_PFJet_);
135  if (!pfjetHandle.isValid()) {
136  edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelPFJet_;
137  return false; // do not filter
138  }
139  const reco::PFJetCollection pfjets = *(pfjetHandle.product());
140 
141  // Check the conditions for a good event
142  if (!(select(photons, pfjets)))
143  return false;
144 
145  edm::LogVerbatim("AlCaGammaJet") << "good event\n";
146  nSelected_++;
147  return true;
148 }
Log< level::Info, true > LogVerbatim
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< reco::PFJetCollection > tok_PFJet_
bool select(const reco::PhotonCollection &, const reco::PFJetCollection &)
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
std::vector< PFJet > PFJetCollection
collection of PFJet objects
Log< level::Warning, false > LogWarning
edm::EDGetTokenT< reco::PhotonCollection > tok_Photon_

◆ globalEndJob()

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

Definition at line 157 of file AlCaGammaJetSelector.cc.

References submitPVResolutionJobs::count.

157  {
158  edm::LogWarning("AlCaGammaJet") << "Finds " << count->nSelected_ << " good events out of " << count->nProcessed_;
159 }
Log< level::Warning, false > LogWarning

◆ initializeGlobalCache()

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

Definition at line 53 of file AlCaGammaJetSelector.cc.

53  {
54  return std::make_unique<alCaGammaJetSelector::Counters>();
55  }

◆ select()

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

Definition at line 161 of file AlCaGammaJetSelector.cc.

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

Referenced by filter().

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

Member Data Documentation

◆ labelPFJet_

edm::InputTag AlCaGammaJetSelector::labelPFJet_
private

Definition at line 73 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and filter().

◆ labelPhoton_

edm::InputTag AlCaGammaJetSelector::labelPhoton_
private

Definition at line 73 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and filter().

◆ minPtJet_

double AlCaGammaJetSelector::minPtJet_
private

Definition at line 74 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and select().

◆ minPtPhoton_

double AlCaGammaJetSelector::minPtPhoton_
private

Definition at line 74 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and select().

◆ nProcessed_

unsigned int AlCaGammaJetSelector::nProcessed_
private

Definition at line 71 of file AlCaGammaJetSelector.cc.

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

◆ nSelected_

unsigned int AlCaGammaJetSelector::nSelected_
private

Definition at line 71 of file AlCaGammaJetSelector.cc.

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

◆ tok_PFJet_

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

Definition at line 76 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and filter().

◆ tok_Photon_

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

Definition at line 75 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and filter().