CMS 3D CMS Logo

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;
22  double dRMin, double dRMax, bool do_propagation, double radius, double minZ, double maxZ, bool theIgnoreMaterial)
23  : dRMin_(dRMin),
24  dRMax_(dRMax),
25  do_propagation_(do_propagation),
26  SrcAtCal(radius, minZ, maxZ, theIgnoreMaterial) {}
28 
30  double operator()(const T1 &, const C2 &) const;
31 
32 private:
33  double dRMin_, dRMax_;
37 };
38 
39 template <typename T1, typename C2>
41 
42 template <typename T1, typename C2>
43 double CalIsolationAlgo<T1, C2>::operator()(const T1 &cand, const C2 &elements) const {
44  const GlobalPoint Vertex(cand.vx(), cand.vy(), cand.vz()); //@@check if this is [cm]!
45  //GlobalVector Cand(cand.pt(), cand.eta(), cand.phi());
46  GlobalVector Cand(cand.px(), cand.py(), cand.pz());
47 
50  if (do_propagation_ && cand.charge() != 0)
51  SrcAtCal.propagate(Vertex, Cand, cand.charge(), bField_);
52 
53  double etSum = 0;
54  for (typename C2::const_iterator elem = elements.begin(); elem != elements.end(); ++elem) {
55  double dR = deltaR(elem->eta(), elem->phi(), (double)Cand.eta(), (double)Cand.phi());
56  if (dR < dRMax_ && dR > dRMin_) {
57  etSum += elem->et();
58  }
59  }
60  return etSum;
61 }
62 
63 #endif
Vector3DBase
Definition: Vector3DBase.h:8
CalIsolationAlgo::bField_
const MagneticField * bField_
Definition: CalIsolationAlgo.h:35
CalIsolationAlgo::SrcAtCal
PropagateToCal SrcAtCal
Definition: CalIsolationAlgo.h:36
CalIsolationAlgo::value_type
double value_type
Definition: CalIsolationAlgo.h:19
CalIsolationAlgo::~CalIsolationAlgo
~CalIsolationAlgo()
Definition: CalIsolationAlgo.h:40
CalIsolationAlgo::CalIsolationAlgo
CalIsolationAlgo(double dRMin, double dRMax, bool do_propagation, double radius, double minZ, double maxZ, bool theIgnoreMaterial)
Definition: CalIsolationAlgo.h:21
HLT_FULL_cff.dRMin
dRMin
Definition: HLT_FULL_cff.py:8730
CalIsolationAlgo
Definition: CalIsolationAlgo.h:17
CalIsolationAlgo::operator()
double operator()(const T1 &, const C2 &) const
Definition: CalIsolationAlgo.h:43
CosmicsPD_Skims.maxZ
maxZ
Definition: CosmicsPD_Skims.py:136
PropagateToCal
Definition: PropagateToCal.h:26
Point3DBase< float, GlobalTag >
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
CalIsolationAlgo::dRMin_
double dRMin_
Definition: CalIsolationAlgo.h:33
deltaR.h
cand
Definition: decayParser.h:32
CalIsolationAlgo::do_propagation_
bool do_propagation_
Definition: CalIsolationAlgo.h:34
metBenchmark_cfi.dRMax
dRMax
Definition: metBenchmark_cfi.py:18
bookConverter.elements
elements
Definition: bookConverter.py:147
HltBtagValidation_cff.Vertex
Vertex
Definition: HltBtagValidation_cff.py:32
CalIsolationAlgo::dRMax_
double dRMax_
Definition: CalIsolationAlgo.h:33
PropagateToCal.h
Calorimetry_cff.bField
bField
Definition: Calorimetry_cff.py:292
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
GlobalVector.h
CalIsolationAlgo::setBfield
void setBfield(const MagneticField *bField)
Definition: CalIsolationAlgo.h:29
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
MagneticField
Definition: MagneticField.h:19
GlobalPoint.h
CalIsolationAlgo::CalIsolationAlgo
CalIsolationAlgo()
Definition: CalIsolationAlgo.h:20
CosmicGenFilterHelix_cff.minZ
minZ
i.e.
Definition: CosmicGenFilterHelix_cff.py:9