CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PrescalerFHN Class Reference

Inheritance diagram for PrescalerFHN:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 PrescalerFHN (const edm::ParameterSet &)
 ~PrescalerFHN ()

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

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(), mergeVDriftHistosByStation::name, prescale_counter, and prescales.

  : triggerTag(iConfig.getParameter<edm::InputTag>("TriggerResultsTag"))
{
   //now do what ever initialization is needed
  std::vector<edm::ParameterSet> prescales_in(iConfig.getParameter<std::vector<edm::ParameterSet> >("Prescales"));

  for (std::vector<edm::ParameterSet>::const_iterator cit = prescales_in.begin();
       cit != prescales_in.end(); cit++) {

    std::string name(cit->getParameter<std::string>("HLTName"));
    unsigned int factor(cit->getParameter<unsigned int>("PrescaleFactor"));

    // does some exception get thrown if parameters aren't available? should test...

    prescales[name] = factor;
    prescale_counter[name] = 0;
  }
  
}
PrescalerFHN::~PrescalerFHN ( )

Definition at line 103 of file PrescalerFHN.cc.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void PrescalerFHN::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 185 of file PrescalerFHN.cc.

{
}
void PrescalerFHN::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 191 of file PrescalerFHN.cc.

                     {
}
bool PrescalerFHN::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

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.

{
   using namespace edm;

   /* Goal for this skim:
      Prescaling MET HLT paths
      Option to turn off HSCP filter
      - Doing that by treating it as an HLT with prescale 1
   */

   // Trying to mirror HLTrigger/HLTfilters/src/HLTHighLevel.cc where possible

   Handle<TriggerResults> trh;
   iEvent.getByLabel(triggerTag, trh);

   if (trh.isValid()) {
     LogDebug("") << "TriggerResults found, number of HLT paths: " << trh->size();
   } else {
     LogDebug("") << "TriggerResults product not found - returning result=false!";
     return false;
   }

   const edm::TriggerNames & triggerNames = iEvent.triggerNames(*trh);
   if (triggerNamesID_ != triggerNames.parameterSetID()) {
     triggerNamesID_ = triggerNames.parameterSetID();
     init(*trh, triggerNames);
   }

   // Trigger indices are ready at this point
   // - Begin checking for HLT bits

   bool accept_event = false;
   for (std::map<std::string, unsigned int>::const_iterator cit = trigger_indices.begin();
        cit != trigger_indices.end(); cit++) {
     if (trh->accept(cit->second)) {
       prescale_counter[cit->first]++;
       if (prescale_counter[cit->first] >= prescales[cit->first]) {
         accept_event = true;
         prescale_counter[cit->first] = 0;
       }
     }
   }

   return accept_event;
}
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().

{
  trigger_indices.clear();

  for (std::map<std::string, unsigned int>::const_iterator cit = prescales.begin();
       cit != prescales.end(); cit++) {

    trigger_indices[cit->first] = triggerNames.triggerIndex(cit->first);
    
    if (trigger_indices[cit->first] >= result.size()) {
      // trigger path not found
      LogDebug("") << "requested HLT path does not exist: " << cit->first;
      trigger_indices.erase(cit->first);
    }
    
  }
}

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

Definition at line 61 of file PrescalerFHN.cc.

Referenced by filter().

Definition at line 63 of file PrescalerFHN.cc.

Referenced by filter().