CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
AlCaIsolatedBunchSelector Class Reference
Inheritance diagram for AlCaIsolatedBunchSelector:
edm::stream::EDFilter< edm::GlobalCache< alCaIsolatedBunchSelector::Counters > > edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 AlCaIsolatedBunchSelector (edm::ParameterSet const &, const alCaIsolatedBunchSelector::Counters *count)
 
void endStream () override
 
bool filter (edm::Event &, edm::EventSetup const &) override
 
 ~AlCaIsolatedBunchSelector () override=default
 
- Public Member Functions inherited from edm::stream::EDFilter< edm::GlobalCache< alCaIsolatedBunchSelector::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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static void globalEndJob (const alCaIsolatedBunchSelector::Counters *counters)
 
static std::unique_ptr< alCaIsolatedBunchSelector::CountersinitializeGlobalCache (edm::ParameterSet const &iConfig)
 
- 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 beginRun (edm::Run const &, edm::EventSetup const &) override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 

Private Attributes

HLTConfigProvider hltConfig_
 
unsigned int nAll_
 
unsigned int nGood_
 
unsigned int nRun_
 
const std::string processName_
 
const edm::InputTag theTriggerResultsLabel_
 
const edm::EDGetTokenT< edm::TriggerResultstok_trigRes_
 
const std::string trigName_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDFilter< edm::GlobalCache< alCaIsolatedBunchSelector::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 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

Definition at line 37 of file AlCaIsolatedBunchSelector.cc.

Constructor & Destructor Documentation

◆ AlCaIsolatedBunchSelector()

AlCaIsolatedBunchSelector::AlCaIsolatedBunchSelector ( edm::ParameterSet const &  iConfig,
const alCaIsolatedBunchSelector::Counters count 
)
explicit

Definition at line 67 of file AlCaIsolatedBunchSelector.cc.

References processName_, theTriggerResultsLabel_, and trigName_.

69  : nRun_(0),
70  nAll_(0),
71  nGood_(0),
72  trigName_(iConfig.getParameter<std::string>("triggerName")),
73  processName_(iConfig.getParameter<std::string>("processName")),
74  theTriggerResultsLabel_(iConfig.getParameter<edm::InputTag>("triggerResultLabel")),
75  tok_trigRes_(consumes<edm::TriggerResults>(theTriggerResultsLabel_)) {
76  edm::LogVerbatim("AlCaIsoBunch") << "Input tag for trigger results " << theTriggerResultsLabel_
77  << " with trigger name " << trigName_ << " and process " << processName_
78  << std::endl;
79 }
Log< level::Info, true > LogVerbatim
const edm::EDGetTokenT< edm::TriggerResults > tok_trigRes_
const edm::InputTag theTriggerResultsLabel_

◆ ~AlCaIsolatedBunchSelector()

AlCaIsolatedBunchSelector::~AlCaIsolatedBunchSelector ( )
overridedefault

Member Function Documentation

◆ beginRun()

void AlCaIsolatedBunchSelector::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 134 of file AlCaIsolatedBunchSelector.cc.

References hltConfig_, HLTConfigProvider::init(), nRun_, processName_, and edm::RunBase::run().

134  {
135  bool changed(false);
136  edm::LogVerbatim("AlCaIsoBunch") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init "
137  << hltConfig_.init(iRun, iSetup, processName_, changed) << std::endl;
138 }
Log< level::Info, true > LogVerbatim
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor

◆ endRun()

void AlCaIsolatedBunchSelector::endRun ( edm::Run const &  iRun,
edm::EventSetup const &   
)
overrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 140 of file AlCaIsolatedBunchSelector.cc.

References nRun_, and edm::RunBase::run().

140  {
141  ++nRun_;
142  edm::LogVerbatim("AlCaIsoBunch") << "endRun[" << nRun_ << "] " << iRun.run() << std::endl;
143 }
Log< level::Info, true > LogVerbatim

◆ endStream()

void AlCaIsolatedBunchSelector::endStream ( )
overridevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 124 of file AlCaIsolatedBunchSelector.cc.

References nAll_, and nGood_.

124  {
125  globalCache()->nAll_ += nAll_;
126  globalCache()->nGood_ += nGood_;
127 }

◆ fillDescriptions()

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

Definition at line 146 of file AlCaIsolatedBunchSelector.cc.

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

146  {
148  desc.add<edm::InputTag>("triggerResultLabel", edm::InputTag("TriggerResults", "", "HLT"));
149  desc.add<std::string>("processName", "HLT");
150  desc.add<std::string>("triggerName", "");
151  descriptions.add("alcaIsolatedBunchSelector", desc);
152 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ filter()

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

Implements edm::stream::EDFilterBase.

Definition at line 86 of file AlCaIsolatedBunchSelector.cc.

References accept(), spr::find(), ValidationMatrix::hlt, iEvent, nAll_, nGood_, tok_trigRes_, L1TEGammaOffline_cfi::triggerNames, triggerResults, and trigName_.

86  {
87  bool accept(false);
88  ++nAll_;
89 #ifdef EDM_ML_DEBUG
90  edm::LogVerbatim("AlCaIsoBunch") << "Run " << iEvent.id().run() << " Event " << iEvent.id().event() << " Luminosity "
91  << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing() << std::endl;
92 #endif
93  if (trigName_.empty()) {
94  accept = true;
95  } else {
96  //Step1: Find if the event passes the chosen trigger
97  auto const& triggerResults = iEvent.getHandle(tok_trigRes_);
98  if (triggerResults.isValid()) {
99  const edm::TriggerNames& triggerNames = iEvent.triggerNames(*triggerResults);
100  const std::vector<std::string>& triggerNames_ = triggerNames.triggerNames();
101  for (unsigned int iHLT = 0; iHLT < triggerResults->size(); iHLT++) {
102  int hlt = triggerResults->accept(iHLT);
103  if (triggerNames_[iHLT].find(trigName_) != std::string::npos) {
104  if (hlt > 0) {
105  accept = true;
106 #ifdef EDM_ML_DEBUG
107  edm::LogVerbatim("AlCaIsoBunch")
108  << triggerNames_[iHLT] << " has got HLT flag " << hlt << ":" << accept << std::endl;
109 #endif
110  break;
111  }
112  }
113  }
114  }
115  }
116 
117  // Step 2: Return the acceptance flag
118  if (accept)
119  ++nGood_;
120  return accept;
121 
122 } // AlCaIsolatedBunchSelector::filter
Log< level::Info, true > LogVerbatim
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
const edm::EDGetTokenT< edm::TriggerResults > tok_trigRes_
int iEvent
Definition: GenABIO.cc:224
static std::string const triggerResults
Definition: EdmProvDump.cc:47

◆ globalEndJob()

void AlCaIsolatedBunchSelector::globalEndJob ( const alCaIsolatedBunchSelector::Counters counters)
static

Definition at line 129 of file AlCaIsolatedBunchSelector.cc.

References submitPVResolutionJobs::count.

129  {
130  edm::LogVerbatim("AlCaIsoBunch") << "Selects " << count->nGood_ << " in " << count->nAll_ << " events" << std::endl;
131 }
Log< level::Info, true > LogVerbatim

◆ initializeGlobalCache()

static std::unique_ptr<alCaIsolatedBunchSelector::Counters> AlCaIsolatedBunchSelector::initializeGlobalCache ( edm::ParameterSet const &  iConfig)
inlinestatic

Definition at line 42 of file AlCaIsolatedBunchSelector.cc.

42  {
43  return std::make_unique<alCaIsolatedBunchSelector::Counters>();
44  }

Member Data Documentation

◆ hltConfig_

HLTConfigProvider AlCaIsolatedBunchSelector::hltConfig_
private

Definition at line 56 of file AlCaIsolatedBunchSelector.cc.

Referenced by beginRun().

◆ nAll_

unsigned int AlCaIsolatedBunchSelector::nAll_
private

Definition at line 57 of file AlCaIsolatedBunchSelector.cc.

Referenced by endStream(), and filter().

◆ nGood_

unsigned int AlCaIsolatedBunchSelector::nGood_
private

Definition at line 57 of file AlCaIsolatedBunchSelector.cc.

Referenced by endStream(), and filter().

◆ nRun_

unsigned int AlCaIsolatedBunchSelector::nRun_
private

Definition at line 57 of file AlCaIsolatedBunchSelector.cc.

Referenced by beginRun(), and endRun().

◆ processName_

const std::string AlCaIsolatedBunchSelector::processName_
private

Definition at line 59 of file AlCaIsolatedBunchSelector.cc.

Referenced by AlCaIsolatedBunchSelector(), and beginRun().

◆ theTriggerResultsLabel_

const edm::InputTag AlCaIsolatedBunchSelector::theTriggerResultsLabel_
private

Definition at line 60 of file AlCaIsolatedBunchSelector.cc.

Referenced by AlCaIsolatedBunchSelector().

◆ tok_trigRes_

const edm::EDGetTokenT<edm::TriggerResults> AlCaIsolatedBunchSelector::tok_trigRes_
private

Definition at line 61 of file AlCaIsolatedBunchSelector.cc.

Referenced by filter().

◆ trigName_

const std::string AlCaIsolatedBunchSelector::trigName_
private

Definition at line 58 of file AlCaIsolatedBunchSelector.cc.

Referenced by AlCaIsolatedBunchSelector(), and filter().