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

Public Member Functions

virtual bool filter (edm::Event &, const edm::EventSetup &)
 
 HLTDoublet (const edm::ParameterSet &)
 
 ~HLTDoublet ()
 
- Public Member Functions inherited from HLTFilter
 HLTFilter ()
 
virtual ~HLTFilter ()
 
- 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 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_
 

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

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:
2008/05/05 15:48:33
Revision:
1.3
Author
Martin Grunewald

See header file for documentation

Date:
2010/09/26 10:40:31
Revision:
1.12
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_.

30  :
31  inputTag1_(iConfig.template getParameter<edm::InputTag>("inputTag1")),
32  inputTag2_(iConfig.template getParameter<edm::InputTag>("inputTag2")),
33  saveTags_ (iConfig.template getUntrackedParameter<bool>("saveTags",false)),
34  min_Dphi_ (iConfig.template getParameter<double>("MinDphi")),
35  max_Dphi_ (iConfig.template getParameter<double>("MaxDphi")),
36  min_Deta_ (iConfig.template getParameter<double>("MinDeta")),
37  max_Deta_ (iConfig.template getParameter<double>("MaxDeta")),
38  min_Minv_ (iConfig.template getParameter<double>("MinMinv")),
39  max_Minv_ (iConfig.template getParameter<double>("MaxMinv")),
40  min_DelR_ (iConfig.template getParameter<double>("MinDelR")),
41  max_DelR_ (iConfig.template getParameter<double>("MaxDelR")),
42  min_N_ (iConfig.template getParameter<int>("MinN")),
43  coll1_(),
44  coll2_()
45 {
46  // same collections to be compared?
48 
49  cutdphi_ = (min_Dphi_ <= max_Dphi_); // cut active?
50  cutdeta_ = (min_Deta_ <= max_Deta_); // cut active?
51  cutminv_ = (min_Minv_ <= max_Minv_); // cut active?
52  cutdelr_ = (min_DelR_ <= max_DelR_); // cut active?
53 
54  LogDebug("") << "InputTags and cuts : "
55  << inputTag1_.encode() << " " << inputTag2_.encode()
56  << " Dphi [" << min_Dphi_ << " " << max_Dphi_ << "]"
57  << " Deta [" << min_Deta_ << " " << max_Deta_ << "]"
58  << " Minv [" << min_Minv_ << " " << max_Minv_ << "]"
59  << " DelR [" << min_DelR_ << " " << max_DelR_ << "]"
60  << " MinN =" << min_N_
61  << " same/dphi/deta/minv/delr "
62  << same_ << cutdphi_ << cutdeta_ << cutminv_ << cutdelr_;
63 
64  //register your products
65  produces<trigger::TriggerFilterObjectWithRefs>();
66 }
#define LogDebug(id)
bool cutdelr_
Definition: HLTDoublet.h:52
edm::InputTag inputTag1_
Definition: HLTDoublet.h:41
double min_Deta_
Definition: HLTDoublet.h:45
double max_DelR_
Definition: HLTDoublet.h:47
int min_N_
Definition: HLTDoublet.h:48
double min_Dphi_
Definition: HLTDoublet.h:44
edm::InputTag inputTag2_
Definition: HLTDoublet.h:42
bool saveTags_
Definition: HLTDoublet.h:43
bool cutminv_
Definition: HLTDoublet.h:52
std::vector< T1Ref > coll1_
Definition: HLTDoublet.h:57
std::string encode() const
Definition: InputTag.cc:72
double min_DelR_
Definition: HLTDoublet.h:47
double max_Dphi_
Definition: HLTDoublet.h:44
double min_Minv_
Definition: HLTDoublet.h:46
double max_Minv_
Definition: HLTDoublet.h:46
std::vector< T2Ref > coll2_
Definition: HLTDoublet.h:60
bool cutdeta_
Definition: HLTDoublet.h:52
bool cutdphi_
Definition: HLTDoublet.h:52
double max_Deta_
Definition: HLTDoublet.h:45
bool same_
Definition: HLTDoublet.h:51
template<typename T1 , int Tid1, typename T2 , int Tid2>
HLTDoublet< T1, Tid1, T2, Tid2 >::~HLTDoublet ( )

Definition at line 69 of file HLTDoublet.cc.

70 {
71 }

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

81 {
82  using namespace std;
83  using namespace edm;
84  using namespace reco;
85  using namespace trigger;
86 
87  // All HLT filters must create and fill an HLT filter object,
88  // recording any reconstructed physics objects satisfying (or not)
89  // this HLT filter, and place it in the Event.
90 
91  // The filter object
92  auto_ptr<TriggerFilterObjectWithRefs>
93  filterobject (new TriggerFilterObjectWithRefs(path(),module()));
94  // Don't saveTag the TFOWRs, but rather the collections pointed to!
95  // if (saveTags_) {
96  // filterobject->addCollectionTag(inputTag1_);
97  // filterobject->addCollectionTag(inputTag2_);
98  // }
99  bool accept(false);
100 
101  // get hold of pre-filtered object collections
103  if (iEvent.getByLabel (inputTag1_,coll1) && iEvent.getByLabel (inputTag2_,coll2)) {
104  coll1_.clear();
105  coll1->getObjects(Tid1,coll1_);
106  const size_type n1(coll1_.size());
107  coll2_.clear();
108  coll2->getObjects(Tid2,coll2_);
109  const size_type n2(coll2_.size());
110 
111  if (saveTags_) {
112  InputTag tagOld;
113  tagOld=InputTag();
114  for (size_type i1=0; i1!=n1; ++i1) {
115  const ProductID pid(coll1_[i1].id());
116  const string& label(iEvent.getProvenance(pid).moduleLabel());
117  const string& instance(iEvent.getProvenance(pid).productInstanceName());
118  const string& process(iEvent.getProvenance(pid).processName());
119  InputTag tagNew(InputTag(label,instance,process));
120  if (tagOld.encode()!=tagNew.encode()) {
121  filterobject->addCollectionTag(tagNew);
122  tagOld=tagNew;
123  }
124  }
125  tagOld=InputTag();
126  for (size_type i2=0; i2!=n2; ++i2) {
127  const ProductID pid(coll2_[i2].id());
128  const string& label(iEvent.getProvenance(pid).moduleLabel());
129  const string& instance(iEvent.getProvenance(pid).productInstanceName());
130  const string& process(iEvent.getProvenance(pid).processName());
131  InputTag tagNew(InputTag(label,instance,process));
132  if (tagOld.encode()!=tagNew.encode()) {
133  filterobject->addCollectionTag(tagNew);
134  tagOld=tagNew;
135  }
136  }
137  }
138 
139  int n(0);
140  T1Ref r1;
141  T2Ref r2;
143  for (unsigned int i1=0; i1!=n1; i1++) {
144  r1=coll1_[i1];
145  p1=r1->p4();
146  unsigned int I(0);
147  if (same_) {I=i1+1;}
148  for (unsigned int i2=I; i2!=n2; i2++) {
149  r2=coll2_[i2];
150  p2=r2->p4();
151 
152  double Dphi(std::abs(p1.phi()-p2.phi()));
153  if (Dphi>M_PI) Dphi=2.0*M_PI-Dphi;
154 
155  double Deta(std::abs(p1.eta()-p2.eta()));
156 
157  p=p1+p2;
158  double Minv(std::abs(p.mass()));
159 
160  double DelR(sqrt(Dphi*Dphi+Deta*Deta));
161 
162  if ( ( (!cutdphi_) || ((min_Dphi_<=Dphi) && (Dphi<=max_Dphi_)) ) &&
163  ( (!cutdeta_) || ((min_Deta_<=Deta) && (Deta<=max_Deta_)) ) &&
164  ( (!cutminv_) || ((min_Minv_<=Minv) && (Minv<=max_Minv_)) ) &&
165  ( (!cutdelr_) || ((min_DelR_<=DelR) && (DelR<=max_DelR_)) ) ) {
166  n++;
167  filterobject->addObject(Tid1,r1);
168  filterobject->addObject(Tid2,r2);
169  }
170 
171  }
172  }
173  // filter decision
174  accept = accept || (n>=min_N_);
175  }
176 
177  iEvent.put(filterobject);
178  return accept;
179 }
bool cutdelr_
Definition: HLTDoublet.h:52
edm::InputTag inputTag1_
Definition: HLTDoublet.h:41
int module() const
Definition: HLTadd.h:12
double min_Deta_
Definition: HLTDoublet.h:45
double max_DelR_
Definition: HLTDoublet.h:47
const std::string & label
Definition: MVAComputer.cc:186
int min_N_
Definition: HLTDoublet.h:48
double min_Dphi_
Definition: HLTDoublet.h:44
edm::Ref< T1Collection > T1Ref
Definition: HLTDoublet.h:56
edm::InputTag inputTag2_
Definition: HLTDoublet.h:42
bool saveTags_
Definition: HLTDoublet.h:43
#define abs(x)
Definition: mlp_lapack.h:159
bool cutminv_
Definition: HLTDoublet.h:52
std::vector< T1Ref > coll1_
Definition: HLTDoublet.h:57
std::string const & processName() const
Definition: Provenance.h:63
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:21
uint16_t size_type
std::string encode() const
Definition: InputTag.cc:72
double min_DelR_
Definition: HLTDoublet.h:47
int path() const
Definition: HLTadd.h:3
double max_Dphi_
Definition: HLTDoublet.h:44
double min_Minv_
Definition: HLTDoublet.h:46
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
double max_Minv_
Definition: HLTDoublet.h:46
std::vector< T2Ref > coll2_
Definition: HLTDoublet.h:60
T sqrt(T t)
Definition: SSEVec.h:28
const std::complex< double > I
Definition: I.h:8
bool cutdeta_
Definition: HLTDoublet.h:52
double p2[4]
Definition: TauolaWrapper.h:90
edm::Ref< T2Collection > T2Ref
Definition: HLTDoublet.h:59
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
#define M_PI
Definition: BFit3D.cc:3
std::string const & moduleLabel() const
Definition: Provenance.h:62
bool cutdphi_
Definition: HLTDoublet.h:52
double max_Deta_
Definition: HLTDoublet.h:45
bool same_
Definition: HLTDoublet.h:51
tuple process
Definition: align_tpl.py:3
double p1[4]
Definition: TauolaWrapper.h:89
std::string const & productInstanceName() const
Definition: Provenance.h:65
Provenance getProvenance(BranchID const &theID) const
Definition: Event.cc:61
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:26

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.