ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/auterman/PhysicsTools/LeptonIsolation/interface/TrkCalIsolationAlgo.h
Revision: 1.1
Committed: Wed May 16 09:47:03 2007 UTC (17 years, 11 months ago) by auterman
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Branch point for: tex, PatCrossCleaner, Demo, SusyScan, scripts
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 auterman 1.1 #include <algorithm>
2     #include <vector>
3    
4     #include "FWCore/Framework/interface/EDProducer.h"
5     #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
6     #include "FWCore/ParameterSet/interface/ParameterSet.h"
7     #include "PhysicsTools/Utilities/interface/Math.h"
8     #include "DataFormats/TrackReco/interface/Track.h"
9    
10     #include "FWCore/Framework/interface/EventSetup.h"
11     #include "FWCore/Framework/interface/Event.h"
12     #include "FWCore/Framework/interface/ESHandle.h"
13     #include "DataFormats/Common/interface/Handle.h"
14     #include <TObjArray.h>
15    
16     template <typename T1, typename C2>
17     class TrkCalIsolationAlgo {
18     public:
19     typedef double value_type;
20     TrkCalIsolationAlgo( const edm::ParameterSet & );
21     ~TrkCalIsolationAlgo();
22     double operator()(const T1 &, const C2 &, const edm::EventSetup &) const;
23    
24     private:
25     double dRMin_, dRMax_, dzMax_;
26     };
27    
28     template <typename T1, typename C2>
29     TrkCalIsolationAlgo<T1,C2>::TrkCalIsolationAlgo( const edm::ParameterSet & cfg ) :
30     dRMin_( cfg.template getParameter<double>( "dRMin" ) ),
31     dRMax_( cfg.template getParameter<double>( "dRMax" ) )
32     {
33     }
34    
35     template <typename T1, typename C2>
36     TrkCalIsolationAlgo<T1,C2>::~TrkCalIsolationAlgo() {
37     }
38    
39     ///This source (track) already has defined outer eta and phi.
40     ///This is the track's end point in the tracker, this should be close
41     ///the tracks entry into the calorimeter.
42     ///A specialized template operator () for tracks in the CalIsolationAlgo class is not
43     ///feasable, since the () operator cannot be overloaded.
44     template <typename T1, typename C2> double TrkCalIsolationAlgo<T1,C2>::
45     operator()(const T1 & cand, const C2 & elements, const edm::EventSetup &iSetup) const {
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     cand.outerEta(), cand.outerPhi() );
51     if ( dR < dRMax_ && dR > dRMin_ ) {
52     etSum += elem->et();
53     }
54     }
55     return etSum;
56     }