CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes

HLTGlobalSums< T > Class Template Reference

#include <HLTGlobalSums.h>

Inheritance diagram for HLTGlobalSums< T >:
HLTFilter edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual bool hltFilter (edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct)
 HLTGlobalSums (const edm::ParameterSet &)
 ~HLTGlobalSums ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

Private Attributes

edm::InputTag inputTag_
double max_
double min_
int min_N_
std::string observable_
int tid_
int triggerType_

Detailed Description

template<typename T>
class HLTGlobalSums< T >

This class is an HLTFilter (-> EDFilter) implementing cuts on global sums such as the scalar sum of Et (a.k.a. H_T), available in the T=CaloMET or T=MET object.

Date:
2012/02/24 13:13:46
Revision:
1.8
Author:
Martin Grunewald

Definition at line 27 of file HLTGlobalSums.h.


Constructor & Destructor Documentation

template<typename T >
HLTGlobalSums< T >::HLTGlobalSums ( const edm::ParameterSet iConfig) [explicit]

Definition at line 28 of file HLTGlobalSums.cc.

References edm::InputTag::encode(), HLTGlobalSums< T >::inputTag_, LogDebug, HLTGlobalSums< T >::max_, HLTGlobalSums< T >::min_, HLTGlobalSums< T >::min_N_, HLTGlobalSums< T >::observable_, HLTGlobalSums< T >::tid_, trigger::TriggerELongit, trigger::TriggerHLongit, trigger::TriggerMETSig, trigger::TriggerMHTSig, trigger::TriggerTET, trigger::TriggerTHT, and HLTGlobalSums< T >::triggerType_.

                                                              : HLTFilter(iConfig),
  inputTag_   (iConfig.template getParameter<edm::InputTag>("inputTag")),
  triggerType_(iConfig.template getParameter<int>("triggerType")),
  observable_ (iConfig.template getParameter<std::string>("observable")),
  min_        (iConfig.template getParameter<double>("Min")),
  max_        (iConfig.template getParameter<double>("Max")),
  min_N_      (iConfig.template getParameter<int>("MinN")),
  tid_(triggerType_)
{
   LogDebug("") << "InputTags and cuts : " 
                << inputTag_.encode() << " "
                << triggerType_ << " "
                << observable_
                << " Range [" << min_ << " " << max_ << "]"
                << " MinN =" << min_N_ ;

   if (observable_=="sumEt") {
     tid_=triggerType_;
   } else if (observable_=="mEtSig") {
     if (triggerType_==trigger::TriggerTET) {
       tid_=trigger::TriggerMETSig;
     } else if (triggerType_==trigger::TriggerTHT) {
       tid_=trigger::TriggerMHTSig;
     } else {
       tid_=triggerType_;
     }
   } else if (observable_=="e_longitudinal") {
     if (triggerType_==trigger::TriggerTET) {
       tid_=trigger::TriggerELongit;
     } else if (triggerType_==trigger::TriggerTHT) {
       tid_=trigger::TriggerHLongit;
     } else {
       tid_=triggerType_;
     }
   } else {
     tid_=triggerType_;
   }
}
template<typename T >
HLTGlobalSums< T >::~HLTGlobalSums ( )

Definition at line 68 of file HLTGlobalSums.cc.

{
}

Member Function Documentation

template<typename T >
void HLTGlobalSums< T >::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Reimplemented from edm::EDFilter.

Definition at line 74 of file HLTGlobalSums.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::add(), mergeVDriftHistosByStation::name, and AlCaHLTBitMon_QueryRunRegistry::string.

                                                                             {
  edm::ParameterSetDescription desc;
  makeHLTFilterDescription(desc);
  desc.add<edm::InputTag>("inputTag",edm::InputTag("hltCollection"));
  desc.add<int>("triggerType",0);
  desc.add<std::string>("observable","");
  desc.add<double>("Min",-1e125);
  desc.add<double>("Max",+1e125);
  desc.add<int>("MinN",1);
  descriptions.add(std::string("hlt")+std::string(typeid(HLTGlobalSums<T>).name()),desc);
}
template<typename T >
bool HLTGlobalSums< T >::hltFilter ( edm::Event iEvent,
const edm::EventSetup iSetup,
trigger::TriggerFilterObjectWithRefs filterproduct 
) [virtual]

Implements HLTFilter.

Definition at line 93 of file HLTGlobalSums.cc.

References abs, accept(), trigger::TriggerFilterObjectWithRefs::addCollectionTag(), trigger::TriggerRefsCollections::addObject(), edm::Event::getByLabel(), LogDebug, n, dt_dqm_sourceclient_common_cff::reco, CommPDSkim_cfg::saveTags, trigger::TriggerELongit, trigger::TriggerHLongit, trigger::TriggerMETSig, trigger::TriggerMHTSig, trigger::TriggerTET, trigger::TriggerTHT, and relativeConstraints::value.

{
   using namespace std;
   using namespace edm;
   using namespace reco;
   using namespace trigger;

   typedef vector<T> TCollection;
   typedef Ref<TCollection> TRef;

   // All HLT filters must create and fill an HLT filter object,
   // recording any reconstructed physics objects satisfying (or not)
   // this HLT filter, and place it in the Event.

   // The filter object
   if (saveTags()) filterproduct.addCollectionTag(inputTag_);
   // Ref to Candidate object to be recorded in filter object
   TRef ref;


   // get hold of MET product from Event
   Handle<TCollection>   objects;
   iEvent.getByLabel(inputTag_,objects);
   if (!objects.isValid()) {
     LogDebug("") << inputTag_ << " collection not found!";
     return false;
   }

   LogDebug("") << "Size of MET collection: " << objects->size();
   if (objects->size()==0) {
     LogDebug("") << "MET collection does not contain a MET object!";
   } else if (objects->size()>1) {
     LogDebug("") << "MET collection contains more than one MET object!";
   }

   int n(0);
   double value(0.0);
   typename TCollection::const_iterator ibegin(objects->begin());
   typename TCollection::const_iterator iend(objects->end());
   typename TCollection::const_iterator iter;
   for (iter=ibegin; iter!=iend; iter++) {

     // get hold of value of observable to cut on
     if ( (tid_==TriggerTET) || (tid_==TriggerTHT) ) {
       value=iter->sumEt();
     } else if ( (tid_==TriggerMETSig) || (tid_==TriggerMHTSig) ) {
       value=iter->mEtSig();
     } else if ( (tid_==TriggerELongit) || (tid_==TriggerHLongit) ) {
       value=iter->e_longitudinal();
     } else {
       value=0.0;
     }

     value=std::abs(value);

     if ( ( (min_<0.0) || (min_<=value) ) &&
          ( (max_<0.0) || (value<=max_) ) ) {
       n++;
       ref=TRef(objects,distance(ibegin,iter));
       filterproduct.addObject(tid_,ref);
     }

   }

   // filter decision
   const bool accept(n>=min_N_);

   return accept;
}

Member Data Documentation

template<typename T >
edm::InputTag HLTGlobalSums< T >::inputTag_ [private]

Definition at line 38 of file HLTGlobalSums.h.

Referenced by HLTGlobalSums< T >::HLTGlobalSums().

template<typename T >
double HLTGlobalSums< T >::max_ [private]

Definition at line 41 of file HLTGlobalSums.h.

Referenced by HLTGlobalSums< T >::HLTGlobalSums().

template<typename T >
double HLTGlobalSums< T >::min_ [private]

Definition at line 41 of file HLTGlobalSums.h.

Referenced by HLTGlobalSums< T >::HLTGlobalSums().

template<typename T >
int HLTGlobalSums< T >::min_N_ [private]

Definition at line 42 of file HLTGlobalSums.h.

Referenced by HLTGlobalSums< T >::HLTGlobalSums().

template<typename T >
std::string HLTGlobalSums< T >::observable_ [private]

Definition at line 40 of file HLTGlobalSums.h.

Referenced by HLTGlobalSums< T >::HLTGlobalSums().

template<typename T >
int HLTGlobalSums< T >::tid_ [private]

Definition at line 43 of file HLTGlobalSums.h.

Referenced by HLTGlobalSums< T >::HLTGlobalSums().

template<typename T >
int HLTGlobalSums< T >::triggerType_ [private]

Definition at line 39 of file HLTGlobalSums.h.

Referenced by HLTGlobalSums< T >::HLTGlobalSums().