1 |
auterman |
1.1 |
#ifndef IsolationUtils_TrkCalIsolationAlgo_h
|
2 |
|
|
#define IsolationUtils_TrkCalIsolationAlgo_h
|
3 |
|
|
|
4 |
|
|
#include "PhysicsTools/Utilities/interface/Math.h"
|
5 |
|
|
|
6 |
|
|
template <typename T1, typename C2>
|
7 |
|
|
class TrkCalIsolationAlgo {
|
8 |
|
|
public:
|
9 |
|
|
typedef double value_type;
|
10 |
|
|
TrkCalIsolationAlgo( );
|
11 |
|
|
TrkCalIsolationAlgo( double dRMin, double dRMax) : dRMin_( dRMin ), dRMax_( dRMax ) { }
|
12 |
|
|
~TrkCalIsolationAlgo() { }
|
13 |
|
|
double operator()(const T1 &, const C2 &) const;
|
14 |
|
|
|
15 |
|
|
private:
|
16 |
|
|
double dRMin_, dRMax_;
|
17 |
|
|
};
|
18 |
|
|
|
19 |
|
|
//This source (track) already has defined outer eta and phi.
|
20 |
|
|
//This is the track's end point in the tracker, this should be close
|
21 |
|
|
//the tracks entry into the calorimeter.
|
22 |
|
|
//A specialized template operator () for tracks in the CalIsolationAlgo class is not
|
23 |
|
|
//feasable, since the () operator cannot be overloaded.
|
24 |
|
|
template <typename T1, typename C2> double TrkCalIsolationAlgo<T1,C2>::
|
25 |
|
|
operator()(const T1 & cand, const C2 & elements) const {
|
26 |
|
|
double etSum = 0;
|
27 |
|
|
for( typename C2::const_iterator elem = elements.begin();
|
28 |
|
|
elem != elements.end(); ++elem ) {
|
29 |
|
|
double dR = deltaR( elem->eta(), elem->phi(),
|
30 |
|
|
cand.outerEta(), cand.outerPhi() );
|
31 |
|
|
if ( dR < dRMax_ && dR > dRMin_ ) {
|
32 |
|
|
etSum += elem->et();
|
33 |
|
|
}
|
34 |
|
|
}
|
35 |
|
|
return etSum;
|
36 |
|
|
}
|
37 |
|
|
|
38 |
|
|
#endif
|