CMS 3D CMS Logo

Public Member Functions | Private Types | Private Attributes

HLTDoublet< T1, Tid1, T2, Tid2 > Class Template Reference

#include <HLTDoublet.h>

Inheritance diagram for HLTDoublet< T1, Tid1, T2, Tid2 >:
HLTFilter edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual bool filter (edm::Event &, const edm::EventSetup &)
 HLTDoublet (const edm::ParameterSet &)
 ~HLTDoublet ()

Private Types

typedef std::vector< T1 > T1Collection
typedef edm::Ref< T1CollectionT1Ref
typedef std::vector< T2 > T2Collection
typedef edm::Ref< T2CollectionT2Ref

Private Attributes

std::vector< T1Refcoll1_
std::vector< T2Refcoll2_
bool cutdelr_
bool cutdeta_
bool cutdphi_
bool cutminv_
edm::InputTag inputTag1_
edm::InputTag inputTag2_
double max_DelR_
double max_Deta_
double max_Dphi_
double max_Minv_
double min_DelR_
double min_Deta_
double min_Dphi_
double min_Minv_
int min_N_
bool same_
bool saveTags_

Detailed Description

template<typename T1, int Tid1, typename T2, int Tid2>
class HLTDoublet< T1, Tid1, T2, Tid2 >

This class is an HLTFilter (-> EDFilter) implementing a basic HLT trigger for pairs of object, evaluating all pairs with the first object from collection 1, and the second object from collection 2, cutting on variables relating to their 4-momentum representations. The object collections are assumed to be outputs of HLTSinglet single-object-type filters so that the access is thorugh RefToBases and polymorphic.

Date:
2010/09/26 10:38:10
Revision:
1.4
Author:
Martin Grunewald

See header file for documentation

Date:
2010/10/15 22:44:31
Revision:
1.13
Author:
Martin Grunewald

Definition at line 31 of file HLTDoublet.h.


Member Typedef Documentation

template<typename T1 , int Tid1, typename T2 , int Tid2>
typedef std::vector<T1> HLTDoublet< T1, Tid1, T2, Tid2 >::T1Collection [private]

Definition at line 55 of file HLTDoublet.h.

template<typename T1 , int Tid1, typename T2 , int Tid2>
typedef edm::Ref<T1Collection> HLTDoublet< T1, Tid1, T2, Tid2 >::T1Ref [private]

Definition at line 56 of file HLTDoublet.h.

template<typename T1 , int Tid1, typename T2 , int Tid2>
typedef std::vector<T2> HLTDoublet< T1, Tid1, T2, Tid2 >::T2Collection [private]

Definition at line 58 of file HLTDoublet.h.

template<typename T1 , int Tid1, typename T2 , int Tid2>
typedef edm::Ref<T2Collection> HLTDoublet< T1, Tid1, T2, Tid2 >::T2Ref [private]

Definition at line 59 of file HLTDoublet.h.


Constructor & Destructor Documentation

template<typename T1 , int Tid1, typename T2 , int Tid2>
HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet ( const edm::ParameterSet iConfig) [explicit]

Definition at line 30 of file HLTDoublet.cc.

References HLTDoublet< T1, Tid1, T2, Tid2 >::cutdelr_, HLTDoublet< T1, Tid1, T2, Tid2 >::cutdeta_, HLTDoublet< T1, Tid1, T2, Tid2 >::cutdphi_, HLTDoublet< T1, Tid1, T2, Tid2 >::cutminv_, edm::InputTag::encode(), HLTDoublet< T1, Tid1, T2, Tid2 >::inputTag1_, HLTDoublet< T1, Tid1, T2, Tid2 >::inputTag2_, LogDebug, HLTDoublet< T1, Tid1, T2, Tid2 >::max_DelR_, HLTDoublet< T1, Tid1, T2, Tid2 >::max_Deta_, HLTDoublet< T1, Tid1, T2, Tid2 >::max_Dphi_, HLTDoublet< T1, Tid1, T2, Tid2 >::max_Minv_, HLTDoublet< T1, Tid1, T2, Tid2 >::min_DelR_, HLTDoublet< T1, Tid1, T2, Tid2 >::min_Deta_, HLTDoublet< T1, Tid1, T2, Tid2 >::min_Dphi_, HLTDoublet< T1, Tid1, T2, Tid2 >::min_Minv_, HLTDoublet< T1, Tid1, T2, Tid2 >::min_N_, and HLTDoublet< T1, Tid1, T2, Tid2 >::same_.

                                                                      :
  inputTag1_(iConfig.template getParameter<edm::InputTag>("inputTag1")),
  inputTag2_(iConfig.template getParameter<edm::InputTag>("inputTag2")),
  saveTags_ (iConfig.template getUntrackedParameter<bool>("saveTags",false)),
  min_Dphi_ (iConfig.template getParameter<double>("MinDphi")),
  max_Dphi_ (iConfig.template getParameter<double>("MaxDphi")),
  min_Deta_ (iConfig.template getParameter<double>("MinDeta")),
  max_Deta_ (iConfig.template getParameter<double>("MaxDeta")),
  min_Minv_ (iConfig.template getParameter<double>("MinMinv")),
  max_Minv_ (iConfig.template getParameter<double>("MaxMinv")),
  min_DelR_ (iConfig.template getParameter<double>("MinDelR")),
  max_DelR_ (iConfig.template getParameter<double>("MaxDelR")),
  min_N_    (iConfig.template getParameter<int>("MinN")),
  coll1_(),
  coll2_()
{
   // same collections to be compared?
   same_ = (inputTag1_.encode()==inputTag2_.encode());

   cutdphi_ = (min_Dphi_ <= max_Dphi_); // cut active?
   cutdeta_ = (min_Deta_ <= max_Deta_); // cut active?
   cutminv_ = (min_Minv_ <= max_Minv_); // cut active?
   cutdelr_ = (min_DelR_ <= max_DelR_); // cut active?

   LogDebug("") << "InputTags and cuts : " 
                << inputTag1_.encode() << " " << inputTag2_.encode()
                << " Dphi [" << min_Dphi_ << " " << max_Dphi_ << "]"
                << " Deta [" << min_Deta_ << " " << max_Deta_ << "]"
                << " Minv [" << min_Minv_ << " " << max_Minv_ << "]"
                << " DelR [" << min_DelR_ << " " << max_DelR_ << "]"
                << " MinN =" << min_N_
                << " same/dphi/deta/minv/delr "
                << same_ << cutdphi_ << cutdeta_ << cutminv_ << cutdelr_;

   //register your products
   produces<trigger::TriggerFilterObjectWithRefs>();
}
template<typename T1 , int Tid1, typename T2 , int Tid2>
HLTDoublet< T1, Tid1, T2, Tid2 >::~HLTDoublet ( )

Definition at line 69 of file HLTDoublet.cc.

{
}

Member Function Documentation

template<typename T1 , int Tid1, typename T2 , int Tid2>
bool HLTDoublet< T1, Tid1, T2, Tid2 >::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements HLTFilter.

Definition at line 80 of file HLTDoublet.cc.

References abs, accept(), edm::HandleBase::clear(), edm::InputTag::encode(), edm::Event::getByLabel(), edm::Event::getProvenance(), Exhume::I, label, M_PI, module(), edm::Provenance::moduleLabel(), n, L1TEmulatorMonitor_cff::p, p1, p2, path(), evf::utils::pid, align_tpl::process, edm::Provenance::processName(), edm::Provenance::productInstanceName(), edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, and mathSSE::sqrt().

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

   // 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
   auto_ptr<TriggerFilterObjectWithRefs>
     filterobject (new TriggerFilterObjectWithRefs(path(),module()));
   // Don't saveTag the TFOWRs, but rather the collections pointed to!
   //   if (saveTags_) {
   //     filterobject->addCollectionTag(inputTag1_);
   //     filterobject->addCollectionTag(inputTag2_);
   //   }
   bool accept(false);

   // get hold of pre-filtered object collections
   Handle<TriggerFilterObjectWithRefs> coll1,coll2;
   if (iEvent.getByLabel (inputTag1_,coll1) && iEvent.getByLabel (inputTag2_,coll2)) {
     coll1_.clear();
     coll1->getObjects(Tid1,coll1_);
     const size_type n1(coll1_.size());
     coll2_.clear();
     coll2->getObjects(Tid2,coll2_);
     const size_type n2(coll2_.size());

     if (saveTags_) {
       InputTag tagOld;
       tagOld=InputTag();
       for (size_type i1=0; i1!=n1; ++i1) {
         const ProductID pid(coll1_[i1].id());
         const string&    label(iEvent.getProvenance(pid).moduleLabel());
         const string& instance(iEvent.getProvenance(pid).productInstanceName());
         const string&  process(iEvent.getProvenance(pid).processName());
         InputTag tagNew(InputTag(label,instance,process));
         if (tagOld.encode()!=tagNew.encode()) {
           filterobject->addCollectionTag(tagNew);
           tagOld=tagNew;
         }
       }
       tagOld=InputTag();
       for (size_type i2=0; i2!=n2; ++i2) {
         const ProductID pid(coll2_[i2].id());
         const string&    label(iEvent.getProvenance(pid).moduleLabel());
         const string& instance(iEvent.getProvenance(pid).productInstanceName());
         const string&  process(iEvent.getProvenance(pid).processName());
         InputTag tagNew(InputTag(label,instance,process));
         if (tagOld.encode()!=tagNew.encode()) {
           filterobject->addCollectionTag(tagNew);
           tagOld=tagNew;
         }
       }
     }

     int n(0);
     T1Ref r1;
     T2Ref r2;
     Particle::LorentzVector p1,p2,p;
     for (unsigned int i1=0; i1!=n1; i1++) {
       r1=coll1_[i1];
       p1=r1->p4();
       unsigned int I(0);
       if (same_) {I=i1+1;}
       for (unsigned int i2=I; i2!=n2; i2++) {
         r2=coll2_[i2];
         p2=r2->p4();

         double Dphi(std::abs(p1.phi()-p2.phi()));
         if (Dphi>M_PI) Dphi=2.0*M_PI-Dphi;
         
         double Deta(std::abs(p1.eta()-p2.eta()));
         
         p=p1+p2;
         double Minv(std::abs(p.mass()));

         double DelR(sqrt(Dphi*Dphi+Deta*Deta));
         
         if ( ( (!cutdphi_) || ((min_Dphi_<=Dphi) && (Dphi<=max_Dphi_)) ) &&
              ( (!cutdeta_) || ((min_Deta_<=Deta) && (Deta<=max_Deta_)) ) &&
              ( (!cutminv_) || ((min_Minv_<=Minv) && (Minv<=max_Minv_)) ) &&
              ( (!cutdelr_) || ((min_DelR_<=DelR) && (DelR<=max_DelR_)) ) ) {
           n++;
           filterobject->addObject(Tid1,r1);
           filterobject->addObject(Tid2,r2);
         }
         
       }
     }
     // filter decision
     accept = accept || (n>=min_N_);
   }

   iEvent.put(filterobject);
   return accept;
}

Member Data Documentation

template<typename T1 , int Tid1, typename T2 , int Tid2>
std::vector<T1Ref> HLTDoublet< T1, Tid1, T2, Tid2 >::coll1_ [private]

Definition at line 57 of file HLTDoublet.h.

template<typename T1 , int Tid1, typename T2 , int Tid2>
std::vector<T2Ref> HLTDoublet< T1, Tid1, T2, Tid2 >::coll2_ [private]

Definition at line 60 of file HLTDoublet.h.

template<typename T1 , int Tid1, typename T2 , int Tid2>
bool HLTDoublet< T1, Tid1, T2, Tid2 >::cutdelr_ [private]

Definition at line 52 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet().

template<typename T1 , int Tid1, typename T2 , int Tid2>
bool HLTDoublet< T1, Tid1, T2, Tid2 >::cutdeta_ [private]

Definition at line 52 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet().

template<typename T1 , int Tid1, typename T2 , int Tid2>
bool HLTDoublet< T1, Tid1, T2, Tid2 >::cutdphi_ [private]

Definition at line 52 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet().

template<typename T1 , int Tid1, typename T2 , int Tid2>
bool HLTDoublet< T1, Tid1, T2, Tid2 >::cutminv_ [private]

Definition at line 52 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet().

template<typename T1 , int Tid1, typename T2 , int Tid2>
edm::InputTag HLTDoublet< T1, Tid1, T2, Tid2 >::inputTag1_ [private]

Definition at line 41 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet().

template<typename T1 , int Tid1, typename T2 , int Tid2>
edm::InputTag HLTDoublet< T1, Tid1, T2, Tid2 >::inputTag2_ [private]

Definition at line 42 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet().

template<typename T1 , int Tid1, typename T2 , int Tid2>
double HLTDoublet< T1, Tid1, T2, Tid2 >::max_DelR_ [private]

Definition at line 47 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet().

template<typename T1 , int Tid1, typename T2 , int Tid2>
double HLTDoublet< T1, Tid1, T2, Tid2 >::max_Deta_ [private]

Definition at line 45 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet().

template<typename T1 , int Tid1, typename T2 , int Tid2>
double HLTDoublet< T1, Tid1, T2, Tid2 >::max_Dphi_ [private]

Definition at line 44 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet().

template<typename T1 , int Tid1, typename T2 , int Tid2>
double HLTDoublet< T1, Tid1, T2, Tid2 >::max_Minv_ [private]

Definition at line 46 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet().

template<typename T1 , int Tid1, typename T2 , int Tid2>
double HLTDoublet< T1, Tid1, T2, Tid2 >::min_DelR_ [private]

Definition at line 47 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet().

template<typename T1 , int Tid1, typename T2 , int Tid2>
double HLTDoublet< T1, Tid1, T2, Tid2 >::min_Deta_ [private]

Definition at line 45 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet().

template<typename T1 , int Tid1, typename T2 , int Tid2>
double HLTDoublet< T1, Tid1, T2, Tid2 >::min_Dphi_ [private]

Definition at line 44 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet().

template<typename T1 , int Tid1, typename T2 , int Tid2>
double HLTDoublet< T1, Tid1, T2, Tid2 >::min_Minv_ [private]

Definition at line 46 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet().

template<typename T1 , int Tid1, typename T2 , int Tid2>
int HLTDoublet< T1, Tid1, T2, Tid2 >::min_N_ [private]

Definition at line 48 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet().

template<typename T1 , int Tid1, typename T2 , int Tid2>
bool HLTDoublet< T1, Tid1, T2, Tid2 >::same_ [private]

Definition at line 51 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::HLTDoublet().

template<typename T1 , int Tid1, typename T2 , int Tid2>
bool HLTDoublet< T1, Tid1, T2, Tid2 >::saveTags_ [private]

Definition at line 43 of file HLTDoublet.h.