ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/auterman/PhysicsTools/IsolationUtils/interface/CalIsolationAlgo.h
Revision: 1.1.1.1 (vendor branch)
Committed: Wed May 23 17:29:36 2007 UTC (17 years, 11 months ago) by auterman
Content type: text/plain
Branch: tex, PatCrossCleaner, Demo, SusyScan, scripts, IsolationUtils, MAIN
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
Log Message:

File Contents

# User Rev Content
1 auterman 1.1 #ifndef IsolationUtils_CalIsolationAlgo_h
2     #define IsolationUtils_CalIsolationAlgo_h
3    
4     #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
5     #include "DataFormats/GeometryVector/interface/GlobalVector.h"
6     #include "PhysicsTools/Utilities/interface/Math.h"
7     #include "PhysicsTools/IsolationUtils/interface/PropagateToCal.h"
8    
9     template <typename T1, typename C2>
10     class CalIsolationAlgo {
11     public:
12     typedef double value_type;
13     CalIsolationAlgo( ) { }
14     CalIsolationAlgo(double dRMin, double dRMax, bool do_propagation,
15     double radius, double minZ, double maxZ, bool theIgnoreMaterial):
16     dRMin_( dRMin ), dRMax_( dRMax ), do_propagation_( do_propagation ),
17     SrcAtCal(radius, minZ, maxZ, theIgnoreMaterial) { }
18     ~CalIsolationAlgo();
19    
20     void setBfield( const MagneticField * bField ) {
21     bField_ = bField; }
22     double operator()(const T1 &, const C2 &) const;
23    
24     private:
25     double dRMin_, dRMax_;
26     bool do_propagation_;
27     const MagneticField * bField_;
28     PropagateToCal SrcAtCal;
29     };
30    
31    
32     template <typename T1, typename C2>
33     CalIsolationAlgo<T1,C2>::~CalIsolationAlgo() {
34     }
35    
36     template <typename T1, typename C2> double CalIsolationAlgo<T1,C2>::
37     operator()(const T1 & cand, const C2 & elements) const {
38     const GlobalPoint Vertex(cand.vx(), cand.vy(), cand.vz());//@@check if this is [cm]!
39     GlobalVector Cand(cand.pt(), cand.eta(), cand.phi());
40    
41     ///Extrapolate charged particles from their vertex to the point of entry into the
42     ///calorimeter, if this is requested in the cfg file.
43     if (do_propagation_ && cand.charge()!=0)
44     SrcAtCal.propagate(Vertex, Cand, cand.charge(), bField_);
45    
46     double etSum = 0;
47     for( typename C2::const_iterator elem = elements.begin();
48     elem != elements.end(); ++elem ) {
49     double dR = deltaR( elem->eta(), elem->phi(),
50     (double)Cand.eta(), (double)Cand.phi() );
51     if ( dR < dRMax_ && dR > dRMin_ ) {
52     etSum += elem->et();
53     }
54     }
55     return etSum;
56     }
57    
58     #endif