CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PrescalerFHN Class Reference
Inheritance diagram for PrescalerFHN:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PrescalerFHN (const edm::ParameterSet &)
 
 ~PrescalerFHN ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginJob () override
 
virtual void endJob () override
 
virtual bool filter (edm::Event &, const edm::EventSetup &) override
 
void init (const edm::TriggerResults &, const edm::TriggerNames &triggerNames)
 

Private Attributes

std::map< std::string,
unsigned int > 
prescale_counter
 
std::map< std::string,
unsigned int > 
prescales
 
edm::EDGetTokenT< TriggerResultstok_trigger
 
std::map< std::string,
unsigned int > 
trigger_indices
 
edm::ParameterSetID triggerNamesID_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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

Definition at line 46 of file PrescalerFHN.cc.

Constructor & Destructor Documentation

PrescalerFHN::PrescalerFHN ( const edm::ParameterSet iConfig)
explicit

Definition at line 81 of file PrescalerFHN.cc.

References edm::ParameterSet::getParameter(), mergeVDriftHistosByStation::name, makeHLTPrescaleTable::prescales, and AlCaHLTBitMon_QueryRunRegistry::string.

82 {
83  tok_trigger = consumes<TriggerResults>(iConfig.getParameter<edm::InputTag>("TriggerResultsTag"));
84  //now do what ever initialization is needed
85  std::vector<edm::ParameterSet> prescales_in(iConfig.getParameter<std::vector<edm::ParameterSet> >("Prescales"));
86 
87  for (std::vector<edm::ParameterSet>::const_iterator cit = prescales_in.begin();
88  cit != prescales_in.end(); cit++) {
89 
90  std::string name(cit->getParameter<std::string>("HLTName"));
91  unsigned int factor(cit->getParameter<unsigned int>("PrescaleFactor"));
92 
93  // does some exception get thrown if parameters aren't available? should test...
94 
95  prescales[name] = factor;
97  }
98 
99 }
T getParameter(std::string const &) const
std::map< std::string, unsigned int > prescales
Definition: PrescalerFHN.cc:64
std::map< std::string, unsigned int > prescale_counter
Definition: PrescalerFHN.cc:65
edm::EDGetTokenT< TriggerResults > tok_trigger
Definition: PrescalerFHN.cc:62
PrescalerFHN::~PrescalerFHN ( )

Definition at line 102 of file PrescalerFHN.cc.

103 {
104 
105  // do anything here that needs to be done at desctruction time
106  // (e.g. close files, deallocate resources etc.)
107 
108 }

Member Function Documentation

void PrescalerFHN::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 184 of file PrescalerFHN.cc.

185 {
186 }
void PrescalerFHN::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 190 of file PrescalerFHN.cc.

190  {
191 }
bool PrescalerFHN::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDFilter.

Definition at line 136 of file PrescalerFHN.cc.

References edm::Event::getByToken(), init, LogDebug, edm::TriggerNames::parameterSetID(), makeHLTPrescaleTable::prescales, and edm::Event::triggerNames().

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().

137 {
138  using namespace edm;
139 
140  /* Goal for this skim:
141  Prescaling MET HLT paths
142  Option to turn off HSCP filter
143  - Doing that by treating it as an HLT with prescale 1
144  */
145 
146  // Trying to mirror HLTrigger/HLTfilters/src/HLTHighLevel.cc where possible
147 
149  iEvent.getByToken(tok_trigger, trh);
150 
151  if (trh.isValid()) {
152  LogDebug("") << "TriggerResults found, number of HLT paths: " << trh->size();
153  } else {
154  LogDebug("") << "TriggerResults product not found - returning result=false!";
155  return false;
156  }
157 
158  const edm::TriggerNames & triggerNames = iEvent.triggerNames(*trh);
159  if (triggerNamesID_ != triggerNames.parameterSetID()) {
160  triggerNamesID_ = triggerNames.parameterSetID();
161  init(*trh, triggerNames);
162  }
163 
164  // Trigger indices are ready at this point
165  // - Begin checking for HLT bits
166 
167  bool accept_event = false;
168  for (std::map<std::string, unsigned int>::const_iterator cit = trigger_indices.begin();
169  cit != trigger_indices.end(); cit++) {
170  if (trh->accept(cit->second)) {
171  prescale_counter[cit->first]++;
172  if (prescale_counter[cit->first] >= prescales[cit->first]) {
173  accept_event = true;
174  prescale_counter[cit->first] = 0;
175  }
176  }
177  }
178 
179  return accept_event;
180 }
#define LogDebug(id)
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:199
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
edm::ParameterSetID triggerNamesID_
Definition: PrescalerFHN.cc:60
void init(const edm::TriggerResults &, const edm::TriggerNames &triggerNames)
std::map< std::string, unsigned int > prescales
Definition: PrescalerFHN.cc:64
std::map< std::string, unsigned int > prescale_counter
Definition: PrescalerFHN.cc:65
std::map< std::string, unsigned int > trigger_indices
Definition: PrescalerFHN.cc:67
edm::EDGetTokenT< TriggerResults > tok_trigger
Definition: PrescalerFHN.cc:62
void PrescalerFHN::init ( const edm::TriggerResults result,
const edm::TriggerNames triggerNames 
)
private

Definition at line 115 of file PrescalerFHN.cc.

References LogDebug, makeHLTPrescaleTable::prescales, edm::HLTGlobalStatus::size(), and edm::TriggerNames::triggerIndex().

117 {
118  trigger_indices.clear();
119 
120  for (std::map<std::string, unsigned int>::const_iterator cit = prescales.begin();
121  cit != prescales.end(); cit++) {
122 
123  trigger_indices[cit->first] = triggerNames.triggerIndex(cit->first);
124 
125  if (trigger_indices[cit->first] >= result.size()) {
126  // trigger path not found
127  LogDebug("") << "requested HLT path does not exist: " << cit->first;
128  trigger_indices.erase(cit->first);
129  }
130 
131  }
132 }
#define LogDebug(id)
std::map< std::string, unsigned int > prescales
Definition: PrescalerFHN.cc:64
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
unsigned int size() const
Get number of paths stored.
std::map< std::string, unsigned int > trigger_indices
Definition: PrescalerFHN.cc:67

Member Data Documentation

std::map<std::string, unsigned int> PrescalerFHN::prescale_counter
private

Definition at line 65 of file PrescalerFHN.cc.

std::map<std::string, unsigned int> PrescalerFHN::prescales
private

Definition at line 64 of file PrescalerFHN.cc.

edm::EDGetTokenT<TriggerResults> PrescalerFHN::tok_trigger
private

Definition at line 62 of file PrescalerFHN.cc.

std::map<std::string, unsigned int> PrescalerFHN::trigger_indices
private

Definition at line 67 of file PrescalerFHN.cc.

edm::ParameterSetID PrescalerFHN::triggerNamesID_
private

Definition at line 60 of file PrescalerFHN.cc.