CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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=default
 
- Public Member Functions inherited from edm::stream::EDFilter< edm::GlobalCache< AlCaGammaJet::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
 
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)
 
 ~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 AlCaGammaJet::Counters *counters)
 
static std::unique_ptr
< AlCaGammaJet::Counters
initializeGlobalCache (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::PFJetCollection
tok_PFJet_
 
edm::EDGetTokenT
< reco::PhotonCollection
tok_Photon_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDFilter< edm::GlobalCache< AlCaGammaJet::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
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
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< B > consumes (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 () noexcept
 
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...
 
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 ( const edm::ParameterSet iConfig,
const AlCaGammaJet::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_.

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

Member Function Documentation

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 65 of file AlCaGammaJetSelector.cc.

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 63 of file AlCaGammaJetSelector.cc.

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 66 of file AlCaGammaJetSelector.cc.

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 64 of file AlCaGammaJetSelector.cc.

64 {}
void AlCaGammaJetSelector::endStream ( )
overridevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 149 of file AlCaGammaJetSelector.cc.

References nProcessed_, and nSelected_.

149  {
150  globalCache()->nProcessed_ += nProcessed_;
151  globalCache()->nSelected_ += nSelected_;
152 }
void AlCaGammaJetSelector::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 110 of file AlCaGammaJetSelector.cc.

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

110  {
111  //The following says we do not know what parameters are allowed so do no validation
112  // Please change this to state exactly what you do use, even if it is no parameters
114  desc.add<edm::InputTag>("PhoInput", edm::InputTag("gedPhotons"));
115  desc.add<edm::InputTag>("PFjetInput", edm::InputTag("ak4PFJetsCHS"));
116  desc.add<double>("MinPtJet", 10.0);
117  desc.add<double>("MinPtPhoton", 10.0);
118  descriptions.add("alcaGammaJetSelector", desc);
119 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool AlCaGammaJetSelector::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::stream::EDFilterBase.

Definition at line 122 of file AlCaGammaJetSelector.cc.

References edm::Event::getHandle(), labelPFJet_, labelPhoton_, nProcessed_, nSelected_, interactiveExample::photons, select(), tok_PFJet_, and tok_Photon_.

122  {
123  nProcessed_++;
124 
125  // Access the collections from iEvent
126  auto const& phoHandle = iEvent.getHandle(tok_Photon_);
127  if (!phoHandle.isValid()) {
128  edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get the product " << labelPhoton_;
129  return false; // do not filter
130  }
131  const reco::PhotonCollection photons = *(phoHandle.product());
132 
133  auto const& pfjetHandle = iEvent.getHandle(tok_PFJet_);
134  if (!pfjetHandle.isValid()) {
135  edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelPFJet_;
136  return false; // do not filter
137  }
138  const reco::PFJetCollection pfjets = *(pfjetHandle.product());
139 
140  // Check the conditions for a good event
141  if (!(select(photons, pfjets)))
142  return false;
143 
144  edm::LogVerbatim("AlCaGammaJet") << "good event\n";
145  nSelected_++;
146  return true;
147 }
Log< level::Info, true > LogVerbatim
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
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_
void AlCaGammaJetSelector::globalEndJob ( const AlCaGammaJet::Counters counters)
static

Definition at line 156 of file AlCaGammaJetSelector.cc.

References AlCaGammaJet::Counters::nProcessed_, and AlCaGammaJet::Counters::nSelected_.

156  {
157  edm::LogWarning("AlCaGammaJet") << "Finds " << count->nSelected_ << " good events out of " << count->nProcessed_;
158 }
Log< level::Warning, false > LogWarning
static std::unique_ptr<AlCaGammaJet::Counters> AlCaGammaJetSelector::initializeGlobalCache ( edm::ParameterSet const &  )
inlinestatic

Definition at line 53 of file AlCaGammaJetSelector.cc.

53  {
54  return std::make_unique<AlCaGammaJet::Counters>();
55  }
bool AlCaGammaJetSelector::select ( const reco::PhotonCollection photons,
const reco::PFJetCollection jets 
)
private

Definition at line 160 of file AlCaGammaJetSelector.cc.

References minPtJet_, minPtPhoton_, and convertSQLiteXML::ok.

Referenced by filter().

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

Member Data Documentation

edm::InputTag AlCaGammaJetSelector::labelPFJet_
private

Definition at line 73 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and filter().

edm::InputTag AlCaGammaJetSelector::labelPhoton_
private

Definition at line 73 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and filter().

double AlCaGammaJetSelector::minPtJet_
private

Definition at line 74 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and select().

double AlCaGammaJetSelector::minPtPhoton_
private

Definition at line 74 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and select().

unsigned int AlCaGammaJetSelector::nProcessed_
private

Definition at line 71 of file AlCaGammaJetSelector.cc.

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

unsigned int AlCaGammaJetSelector::nSelected_
private

Definition at line 71 of file AlCaGammaJetSelector.cc.

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

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

Definition at line 76 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and filter().

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

Definition at line 75 of file AlCaGammaJetSelector.cc.

Referenced by AlCaGammaJetSelector(), and filter().