CMS 3D CMS Logo

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

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. More...

#include <HLTrigger/HLTfilters/interface/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 cutdeta_
bool cutdphi_
bool cutminv_
edm::InputTag inputTag1_
edm::InputTag inputTag2_
double max_Deta_
double max_Dphi_
double max_Minv_
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.

See header file for documentation.

The object collections are assumed to be outputs of HLTSinglet single-object-type filters so that the access is thorugh RefToBases and polymorphic.

Date
2008/05/05 15:48:33
Revision
1.3

Author:
Martin Grunewald
Date
2008/12/10 07:59:10
Revision
1.9

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 54 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 55 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 57 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 58 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  )  [inline, explicit]

Definition at line 30 of file HLTDoublet.cc.

References 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_Deta_, HLTDoublet< T1, Tid1, T2, Tid2 >::max_Dphi_, HLTDoublet< T1, Tid1, T2, Tid2 >::max_Minv_, 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_.

00030                                                                       :
00031   inputTag1_(iConfig.template getParameter<edm::InputTag>("inputTag1")),
00032   inputTag2_(iConfig.template getParameter<edm::InputTag>("inputTag2")),
00033   saveTags_ (iConfig.template getUntrackedParameter<bool>("saveTags",false)),
00034   min_Dphi_ (iConfig.template getParameter<double>("MinDphi")),
00035   max_Dphi_ (iConfig.template getParameter<double>("MaxDphi")),
00036   min_Deta_ (iConfig.template getParameter<double>("MinDeta")),
00037   max_Deta_ (iConfig.template getParameter<double>("MaxDeta")),
00038   min_Minv_ (iConfig.template getParameter<double>("MinMinv")),
00039   max_Minv_ (iConfig.template getParameter<double>("MaxMinv")),
00040   min_N_    (iConfig.template getParameter<int>("MinN")),
00041   coll1_(),
00042   coll2_()
00043 {
00044    // same collections to be compared?
00045    same_ = (inputTag1_.encode()==inputTag2_.encode());
00046 
00047    cutdphi_ = (min_Dphi_ <= max_Dphi_); // cut active?
00048    cutdeta_ = (min_Deta_ <= max_Deta_); // cut active?
00049    cutminv_ = (min_Minv_ <= max_Minv_); // cut active?
00050 
00051    LogDebug("") << "InputTags and cuts : " 
00052                 << inputTag1_.encode() << " " << inputTag2_.encode()
00053                 << " Dphi [" << min_Dphi_ << " " << max_Dphi_ << "]"
00054                 << " Deta [" << min_Deta_ << " " << max_Deta_ << "]"
00055                 << " Minv [" << min_Minv_ << " " << max_Minv_ << "]"
00056                 << " MinN =" << min_N_
00057                 << " same/dphi/deta/minv "
00058                 << same_ << cutdphi_ << cutdeta_ << cutminv_;
00059 
00060    //register your products
00061    produces<trigger::TriggerFilterObjectWithRefs>();
00062 }

template<typename T1, int Tid1, typename T2, int Tid2>
HLTDoublet< T1, Tid1, T2, Tid2 >::~HLTDoublet (  )  [inline]

Definition at line 65 of file HLTDoublet.cc.

00066 {
00067 }


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 
) [inline, virtual]

Implements HLTFilter.

Definition at line 76 of file HLTDoublet.cc.

References funct::abs(), HLTDoublet< T1, Tid1, T2, Tid2 >::coll1_, HLTDoublet< T1, Tid1, T2, Tid2 >::coll2_, HLTDoublet< T1, Tid1, T2, Tid2 >::cutdeta_, HLTDoublet< T1, Tid1, T2, Tid2 >::cutdphi_, HLTDoublet< T1, Tid1, T2, Tid2 >::cutminv_, edm::Event::getByLabel(), edm::Event::getProvenance(), I, i1, i2, HLTDoublet< T1, Tid1, T2, Tid2 >::inputTag1_, HLTDoublet< T1, Tid1, T2, Tid2 >::inputTag2_, label, 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_Deta_, HLTDoublet< T1, Tid1, T2, Tid2 >::min_Dphi_, HLTDoublet< T1, Tid1, T2, Tid2 >::min_Minv_, HLTDoublet< T1, Tid1, T2, Tid2 >::min_N_, module(), n, p, p1, p2, path(), process, edm::Event::put(), r1, r2, HcalSimpleRecAlgoImpl::reco(), HLTDoublet< T1, Tid1, T2, Tid2 >::same_, HLTDoublet< T1, Tid1, T2, Tid2 >::saveTags_, and std.

00077 {
00078    using namespace std;
00079    using namespace edm;
00080    using namespace reco;
00081    using namespace trigger;
00082 
00083    // All HLT filters must create and fill an HLT filter object,
00084    // recording any reconstructed physics objects satisfying (or not)
00085    // this HLT filter, and place it in the Event.
00086 
00087    // The filter object
00088    auto_ptr<TriggerFilterObjectWithRefs>
00089      filterobject (new TriggerFilterObjectWithRefs(path(),module()));
00090    // Don't saveTag the TFOWRs, but rather the collections pointed to!
00091    //   if (saveTags_) {
00092    //     filterobject->addCollectionTag(inputTag1_);
00093    //     filterobject->addCollectionTag(inputTag2_);
00094    //   }
00095    bool accept(false);
00096 
00097    // get hold of pre-filtered object collections
00098    Handle<TriggerFilterObjectWithRefs> coll1,coll2;
00099    if (iEvent.getByLabel (inputTag1_,coll1) && iEvent.getByLabel (inputTag2_,coll2)) {
00100      coll1_.clear();
00101      coll1->getObjects(Tid1,coll1_);
00102      const size_type n1(coll1_.size());
00103      coll2_.clear();
00104      coll2->getObjects(Tid2,coll2_);
00105      const size_type n2(coll2_.size());
00106 
00107      if (saveTags_) {
00108        InputTag tagOld;
00109        tagOld=InputTag();
00110        for (size_type i1=0; i1!=n1; ++i1) {
00111          const ProductID pid(coll1_[i1].id());
00112          const string&    label(iEvent.getProvenance(pid).moduleLabel());
00113          const string& instance(iEvent.getProvenance(pid).productInstanceName());
00114          const string&  process(iEvent.getProvenance(pid).processName());
00115          InputTag tagNew(InputTag(label,instance,process));
00116          if (tagOld.encode()!=tagNew.encode()) {
00117            filterobject->addCollectionTag(tagNew);
00118            tagOld=tagNew;
00119          }
00120        }
00121        tagOld=InputTag();
00122        for (size_type i2=0; i2!=n2; ++i2) {
00123          const ProductID pid(coll2_[i2].id());
00124          const string&    label(iEvent.getProvenance(pid).moduleLabel());
00125          const string& instance(iEvent.getProvenance(pid).productInstanceName());
00126          const string&  process(iEvent.getProvenance(pid).processName());
00127          InputTag tagNew(InputTag(label,instance,process));
00128          if (tagOld.encode()!=tagNew.encode()) {
00129            filterobject->addCollectionTag(tagNew);
00130            tagOld=tagNew;
00131          }
00132        }
00133      }
00134 
00135      int n(0);
00136      T1Ref r1;
00137      T2Ref r2;
00138      Particle::LorentzVector p1,p2,p;
00139      for (unsigned int i1=0; i1!=n1; i1++) {
00140        r1=coll1_[i1];
00141        p1=r1->p4();
00142        unsigned int I(0);
00143        if (same_) {I=i1+1;}
00144        for (unsigned int i2=I; i2!=n2; i2++) {
00145          r2=coll2_[i2];
00146          p2=r2->p4();
00147 
00148          double Dphi(abs(p1.phi()-p2.phi()));
00149          if (Dphi>M_PI) Dphi=2.0*M_PI-Dphi;
00150          
00151          double Deta(abs(p1.eta()-p2.eta()));
00152          
00153          p=p1+p2;
00154          double Minv(abs(p.mass()));
00155          
00156          if ( ( (!cutdphi_) || (min_Dphi_ <= Dphi) && (Dphi <= max_Dphi_) ) &&
00157               ( (!cutdeta_) || (min_Deta_ <= Deta) && (Deta <= max_Deta_) ) &&
00158               ( (!cutminv_) || (min_Minv_ <= Minv) && (Minv <= max_Minv_) ) ) {
00159            n++;
00160            filterobject->addObject(Tid1,r1);
00161            filterobject->addObject(Tid2,r2);
00162          }
00163          
00164        }
00165      }
00166      // filter decision
00167      accept = accept || (n>=min_N_);
00168    }
00169 
00170    iEvent.put(filterobject);
00171    return accept;
00172 }


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 56 of file HLTDoublet.h.

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

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

Definition at line 59 of file HLTDoublet.h.

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

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

Definition at line 51 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::filter(), and 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 51 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::filter(), and 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 51 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::filter(), and 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 >::filter(), and 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 >::filter(), and 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 >::filter(), and 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 >::filter(), and 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 >::filter(), and 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 >::filter(), and 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 >::filter(), and 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 >::filter(), and 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 47 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::filter(), and 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 50 of file HLTDoublet.h.

Referenced by HLTDoublet< T1, Tid1, T2, Tid2 >::filter(), and 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.

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:24:27 2009 for CMSSW by  doxygen 1.5.4