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)
 
virtual void endStream () override
 
virtual bool filter (edm::Event &, const edm::EventSetup &) override
 
 ~AlCaGammaJetSelector ()
 
- Public Member Functions inherited from edm::stream::EDFilter< edm::GlobalCache< AlCaGammaJet::Counters > >
 EDFilter ()=default
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilterBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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 & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, 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 updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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

virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &) override
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
virtual 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
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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

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 93 of file AlCaGammaJetSelector.cc.

References edm::ParameterSet::getParameter(), AlCaGammaJet::Counters::nProcessed_, and AlCaGammaJet::Counters::nSelected_.

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

Definition at line 109 of file AlCaGammaJetSelector.cc.

109 { }

Member Function Documentation

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 67 of file AlCaGammaJetSelector.cc.

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 65 of file AlCaGammaJetSelector.cc.

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 68 of file AlCaGammaJetSelector.cc.

References TauGenJetsDecayModeSelectorAllHadrons_cfi::select.

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 66 of file AlCaGammaJetSelector.cc.

66 {}
void AlCaGammaJetSelector::endStream ( )
overridevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 157 of file AlCaGammaJetSelector.cc.

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

157  {
158  globalCache()->nProcessed_ += nProcessed_;
159  globalCache()->nSelected_ += nSelected_;
160 }
void AlCaGammaJetSelector::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 116 of file AlCaGammaJetSelector.cc.

References edm::ParameterSetDescription::add(), and edm::ConfigurationDescriptions::addDefault().

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

Definition at line 128 of file AlCaGammaJetSelector.cc.

References edm::Event::getByToken(), edm::HandleBase::isValid(), AlCaGammaJet::Counters::nProcessed_, AlCaGammaJet::Counters::nSelected_, jetCleaner_cfi::photons, edm::Handle< T >::product(), and TauGenJetsDecayModeSelectorAllHadrons_cfi::select.

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

128  {
129  nProcessed_++;
130 
131  // Access the collections from iEvent
133  iEvent.getByToken(tok_Photon_,phoHandle);
134  if (!phoHandle.isValid()) {
135  edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get the product " << labelPhoton_;
136  return false; // do not filter
137  }
138  const reco::PhotonCollection photons = *(phoHandle.product());
139 
141  iEvent.getByToken(tok_PFJet_,pfjetHandle);
142  if (!pfjetHandle.isValid()) {
143  edm::LogWarning("AlCaGammaJet") << "AlCaGammaJetProducer: Error! can't get product " << labelPFJet_;
144  return false; // do not filter
145  }
146  const reco::PFJetCollection pfjets = *(pfjetHandle.product());
147 
148  // Check the conditions for a good event
149  if (!(select(photons, pfjets))) return false;
150 
151  //std::cout << "good event\n";
152  nSelected_++;
153  return true;
154 
155 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
edm::EDGetTokenT< reco::PFJetCollection > tok_PFJet_
bool isValid() const
Definition: HandleBase.h:74
T const * product() const
Definition: Handle.h:81
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
edm::EDGetTokenT< reco::PhotonCollection > tok_Photon_
void AlCaGammaJetSelector::globalEndJob ( const AlCaGammaJet::Counters counters)
static

Definition at line 164 of file AlCaGammaJetSelector.cc.

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

164  {
165  edm::LogWarning("AlCaGammaJet") << "Finds " << count->nSelected_
166  <<" good events out of "
167  << count->nProcessed_;
168 }
static std::unique_ptr<AlCaGammaJet::Counters> AlCaGammaJetSelector::initializeGlobalCache ( edm::ParameterSet const &  )
inlinestatic

Definition at line 54 of file AlCaGammaJetSelector.cc.

References ALCARECOTkAlBeamHalo_cff::filter.

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

Definition at line 170 of file AlCaGammaJetSelector.cc.

References DEFINE_FWK_MODULE, and convertSQLiteXML::ok.

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), and Vispa.Views.AbstractView.AbstractView::restoreSelection().

171  {
172 
173  // Check the requirement for minimum pT
174  if (photons.size() == 0) return false;
175  bool ok(false);
176  for (reco::PFJetCollection::const_iterator itr=jets.begin();
177  itr!=jets.end(); ++itr) {
178  if (itr->pt() >= minPtJet_) {
179  ok = true;
180  break;
181  }
182  }
183  if (!ok) return ok;
184  for (reco::PhotonCollection::const_iterator itr=photons.begin();
185  itr!=photons.end(); ++itr) {
186  if (itr->pt() >= minPtPhoton_) return ok;
187  }
188  return false;
189 }
vector< PseudoJet > jets

Member Data Documentation

edm::InputTag AlCaGammaJetSelector::labelPFJet_
private

Definition at line 75 of file AlCaGammaJetSelector.cc.

edm::InputTag AlCaGammaJetSelector::labelPhoton_
private

Definition at line 75 of file AlCaGammaJetSelector.cc.

double AlCaGammaJetSelector::minPtJet_
private

Definition at line 76 of file AlCaGammaJetSelector.cc.

double AlCaGammaJetSelector::minPtPhoton_
private

Definition at line 76 of file AlCaGammaJetSelector.cc.

unsigned int AlCaGammaJetSelector::nProcessed_
private

Definition at line 73 of file AlCaGammaJetSelector.cc.

unsigned int AlCaGammaJetSelector::nSelected_
private

Definition at line 73 of file AlCaGammaJetSelector.cc.

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

Definition at line 78 of file AlCaGammaJetSelector.cc.

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

Definition at line 77 of file AlCaGammaJetSelector.cc.