test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CalIsolationAlgo.h
Go to the documentation of this file.
1 #ifndef IsolationUtils_CalIsolationAlgo_h
2 #define IsolationUtils_CalIsolationAlgo_h
3 /* \class CalIsolationAlgo<T1, C2>
4  *
5  * \author Christian Autermann, U Hamburg
6  *
7  * template class to calculate calorimeter isolation, the extrapolation
8  * to the calorimeter surface is optional.
9  *
10  */
15 
16 template <typename T1, typename C2>
18 public:
19  typedef double value_type;
21  CalIsolationAlgo(double dRMin, double dRMax, bool do_propagation,
22  double radius, double minZ, double maxZ, bool theIgnoreMaterial):
23  dRMin_( dRMin ), dRMax_( dRMax ), do_propagation_( do_propagation ),
24  SrcAtCal(radius, minZ, maxZ, theIgnoreMaterial) { }
26 
27  void setBfield( const MagneticField * bField ) {
28  bField_ = bField; }
29  double operator()(const T1 &, const C2 &) const;
30 
31 private:
32  double dRMin_, dRMax_;
36 };
37 
38 
39 template <typename T1, typename C2>
41 }
42 
43 template <typename T1, typename C2> double CalIsolationAlgo<T1,C2>::
44 operator()(const T1 & cand, const C2 & elements) const {
45  const GlobalPoint Vertex(cand.vx(), cand.vy(), cand.vz());//@@check if this is [cm]!
46  //GlobalVector Cand(cand.pt(), cand.eta(), cand.phi());
47  GlobalVector Cand(cand.px(), cand.py(), cand.pz());
48 
51  if (do_propagation_ && cand.charge()!=0)
52  SrcAtCal.propagate(Vertex, Cand, cand.charge(), bField_);
53 
54  double etSum = 0;
55  for( typename C2::const_iterator elem = elements.begin();
56  elem != elements.end(); ++elem ) {
57  double dR = deltaR( elem->eta(), elem->phi(),
58  (double)Cand.eta(), (double)Cand.phi() );
59  if ( dR < dRMax_ && dR > dRMin_ ) {
60  etSum += elem->et();
61  }
62  }
63  return etSum;
64 }
65 
66 #endif
void setBfield(const MagneticField *bField)
const MagneticField * bField_
double operator()(const T1 &, const C2 &) const
dictionary elements
CalIsolationAlgo(double dRMin, double dRMax, bool do_propagation, double radius, double minZ, double maxZ, bool theIgnoreMaterial)
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
PropagateToCal SrcAtCal