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::ProductRegistryHelper

Public Member Functions

 PrescalerFHN (const edm::ParameterSet &)
 
 ~PrescalerFHN ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
virtual bool filter (edm::Event &, const edm::EventSetup &)
 
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
 
std::map< std::string,
unsigned int > 
trigger_indices
 
edm::ParameterSetID triggerNamesID_
 
edm::InputTag triggerTag
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
typedef WorkerT< EDFilterWorkerType
 
- 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)
 
- Protected Member Functions inherited from edm::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 47 of file PrescalerFHN.cc.

Constructor & Destructor Documentation

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

Definition at line 82 of file PrescalerFHN.cc.

References edm::ParameterSet::getParameter(), AlCaRecoCosmics_cfg::name, prescale_counter, and prescales.

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

Definition at line 103 of file PrescalerFHN.cc.

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

Member Function Documentation

void PrescalerFHN::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDFilter.

Definition at line 185 of file PrescalerFHN.cc.

186 {
187 }
void PrescalerFHN::endJob ( void  )
privatevirtual

Reimplemented from edm::EDFilter.

Definition at line 191 of file PrescalerFHN.cc.

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

Implements edm::EDFilter.

Definition at line 137 of file PrescalerFHN.cc.

References edm::Event::getByLabel(), init(), LogDebug, prescale_counter, prescales, trigger_indices, edm::Event::triggerNames(), triggerNamesID_, and triggerTag.

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

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

Definition at line 116 of file PrescalerFHN.cc.

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

Referenced by filter().

118 {
119  trigger_indices.clear();
120 
121  for (std::map<std::string, unsigned int>::const_iterator cit = prescales.begin();
122  cit != prescales.end(); cit++) {
123 
124  trigger_indices[cit->first] = triggerNames.triggerIndex(cit->first);
125 
126  if (trigger_indices[cit->first] >= result.size()) {
127  // trigger path not found
128  LogDebug("") << "requested HLT path does not exist: " << cit->first;
129  trigger_indices.erase(cit->first);
130  }
131 
132  }
133 }
#define LogDebug(id)
std::map< std::string, unsigned int > prescales
Definition: PrescalerFHN.cc:65
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:68

Member Data Documentation

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

Definition at line 66 of file PrescalerFHN.cc.

Referenced by filter(), and PrescalerFHN().

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

Definition at line 65 of file PrescalerFHN.cc.

Referenced by filter(), init(), and PrescalerFHN().

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

Definition at line 68 of file PrescalerFHN.cc.

Referenced by filter(), and init().

edm::ParameterSetID PrescalerFHN::triggerNamesID_
private

Definition at line 61 of file PrescalerFHN.cc.

Referenced by filter().

edm::InputTag PrescalerFHN::triggerTag
private

Definition at line 63 of file PrescalerFHN.cc.

Referenced by filter().