CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L2TauIsolationAlgs.cc
Go to the documentation of this file.
2 #include "Math/GenVector/VectorUtil.h"
3 
4 
6 {
7 
8 }
9 
11 {
12 
13 }
14 
15 
16 
17 double
18 L2TauIsolationAlgs::isolatedEt(const math::PtEtaPhiELorentzVectorCollection& hits,const math::XYZVector& direction,double innerCone, double outerCone) const
19 {
20  //Compute the Isolation
21  double eRMax = 0.;
22  double eRMin = 0;
23  if(hits.size()>0)
24  for (math::PtEtaPhiELorentzVectorCollection::const_iterator mRH = hits.begin();mRH!=hits.end();++mRH)
25  {
26  double delta = ROOT::Math::VectorUtil::DeltaR(direction,(*mRH));
27  if(delta <outerCone)
28  eRMax+= mRH->pt();
29  if(delta <innerCone)
30  eRMin+= mRH->pt();
31  }
32  double etIsol = eRMax - eRMin;
33  return etIsol;
34 }
35 
36 
37 int
38 L2TauIsolationAlgs::nClustersAnnulus(const math::PtEtaPhiELorentzVectorCollection& hits,const math::XYZVector& direction,double innerCone, double outerCone) const
39 {
40  //Compute the Isolation
41  int cands=0;
42  if(hits.size()>0)
43  for (math::PtEtaPhiELorentzVectorCollection::const_iterator mRH = hits.begin();mRH!=hits.end();++mRH)
44  {
45  double delta = ROOT::Math::VectorUtil::DeltaR(direction,(*mRH));
46  if(delta <outerCone)
47  if(delta >innerCone)
48  cands++;
49  }
50  return cands;
51 }
52 
53 
54 std::vector<double>
55 L2TauIsolationAlgs::clusterShape(const math::PtEtaPhiELorentzVectorCollection& hits,const math::XYZVector& direction,double innerCone,double outerCone) const
56 {
57  double eta_rms=0.;
58  double phi_rms=0.;
59  double dr_rms=0.;
60  double sumpt = 0.;
61 
62  std::vector<double> rmsVector; //declare the vector
63  if(hits.size()>0)
64  {
65  for(math::PtEtaPhiELorentzVectorCollection::const_iterator c = hits.begin();c!=hits.end();++c) //loop on clusters
66  {
67  eta_rms+=c->pt()*std::pow(c->eta()-direction.eta(),2);
68  phi_rms+=c->pt()*std::pow(ROOT::Math::VectorUtil::DeltaPhi(*c,direction),2);
69  dr_rms+=c->pt()*std::pow(ROOT::Math::VectorUtil::DeltaR(*c,direction),2);
70  sumpt+=c->pt();
71  }
72  }
73  else
74  {
75  eta_rms=0.;
76  phi_rms=0.;
77  dr_rms =0.;
78  sumpt=1.;
79  }
80 
81  rmsVector.push_back(eta_rms/sumpt);
82  rmsVector.push_back(phi_rms/sumpt);
83  rmsVector.push_back(dr_rms/sumpt);
84 
85  return rmsVector;
86 }
87 
dbl * delta
Definition: mlp_gen.cc:36
double isolatedEt(const math::PtEtaPhiELorentzVectorCollection &, const math::XYZVector &, double innerCone, double outerCone) const
std::vector< PtEtaPhiELorentzVector > PtEtaPhiELorentzVectorCollection
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
int nClustersAnnulus(const math::PtEtaPhiELorentzVectorCollection &, const math::XYZVector &, double innerCone, double outerCone) const
std::vector< double > clusterShape(const math::PtEtaPhiELorentzVectorCollection &, const math::XYZVector &, double innerCone, double outerCone) const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40