ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/src/IsolationTools.cc
Revision: 1.3
Committed: Tue Mar 3 18:11:19 2009 UTC (16 years, 2 months ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009c, Mit_009b, Mit_009a, Mit_009, Mit_008, Mit_008pre2, Mit_008pre1
Changes since 1.2: +2 -3 lines
Log Message:
Remove usage of removed BasicCluster variables

File Contents

# User Rev Content
1 bendavid 1.3 // $Id: IsolationTools.cc,v 1.2 2009/02/17 06:49:28 phedex Exp $
2 loizides 1.1
3     #include "MitPhysics/Utils/interface/IsolationTools.h"
4     #include "MitCommon/MathTools/interface/MathUtils.h"
5    
6     using namespace mithep;
7    
8     //--------------------------------------------------------------------------------------------------
9     Double_t IsolationTools::TrackIsolation(const Track *p, Double_t extRadius, Double_t intRadius,
10     Double_t ptLow, Double_t maxVtxZDist,
11 phedex 1.2 const Collection<Track> *tracks)
12 loizides 1.1 {
13     //Computes the Track Isolation: Summed Transverse Momentum of all tracks inside an
14     //annulus around the electron seed track.
15    
16     Double_t ptSum =0.;
17     for (UInt_t i=0; i<tracks->GetEntries();i++) {
18     Double_t tmpPt = tracks->At(i)->Pt();
19     Double_t deltaZ = fabs(p->Z0() - tracks->At(i)->Z0());
20    
21     //ignore the track if it is below the pt threshold
22     if (tmpPt < ptLow)
23     continue;
24     //ingore the track if it is too far away in Z
25     if (deltaZ > maxVtxZDist)
26     continue;
27    
28 phedex 1.2 Double_t dr = MathUtils::DeltaR(p->Phi(),p->Eta(),tracks->At(i)->Phi(), tracks->At(i)->Eta());
29 loizides 1.1 //add the track pt if it is inside the annulus
30     if ( dr < extRadius &&
31     dr >= intRadius ) {
32     ptSum += tmpPt;
33     }
34     }
35     return ptSum;
36     }
37    
38     //--------------------------------------------------------------------------------------------------
39     Double_t IsolationTools::EcalIsolation(const SuperCluster *sc, Double_t coneSize, Double_t etLow,
40 phedex 1.2 const Collection<BasicCluster> *basicClusters)
41 loizides 1.1 {
42     //Computes the Ecal Isolation: Summed Transverse Energy of all Basic Clusters inside a
43     //cone around the electron, excluding those that are inside the electron super cluster.
44    
45     Double_t ecalIsol=0.;
46     const BasicCluster *basicCluster= 0;
47     for (UInt_t i=0; i<basicClusters->GetEntries();i++) {
48     basicCluster = basicClusters->At(i);
49     Double_t basicClusterEnergy = basicCluster->Energy();
50     Double_t basicClusterEta = basicCluster->Eta();
51     Double_t basicClusterEt = basicClusterEnergy*sin(2*atan(exp(basicClusterEta)));
52    
53 bendavid 1.3 if (basicClusterEt > etLow) {
54 loizides 1.1 bool inSuperCluster = false;
55    
56     // loop over the basic clusters of the supercluster
57     // to make sure that the basic cluster is not inside
58     // the super cluster. We exclude those.
59     for (UInt_t j=0; j<sc->ClusterSize(); j++) {
60     const BasicCluster *tempBasicClusterInSuperCluster = sc->Cluster(j);
61     if (tempBasicClusterInSuperCluster == basicCluster) {
62     inSuperCluster = true;
63     }
64     }
65    
66     if (!inSuperCluster) {
67 phedex 1.2 Double_t dr = MathUtils::DeltaR(sc->Phi(), sc->Eta(),
68     basicCluster->Phi(),basicCluster->Eta());
69 loizides 1.1 if(dr < coneSize) {
70     ecalIsol += basicClusterEt;
71     }
72     }
73     }
74     }
75     return ecalIsol;
76     }
77    
78     //--------------------------------------------------------------------------------------------------
79     Double_t IsolationTools::CaloTowerHadIsolation(const ThreeVector *p, Double_t extRadius,
80     Double_t intRadius, Double_t etLow,
81 phedex 1.2 const Collection<CaloTower> *caloTowers)
82 loizides 1.1 {
83     //Computes the CaloTower Had Et Isolation: Summed Hadronic Transverse Energy of all Calo Towers
84     //inside an annulus around the electron super cluster position.
85    
86     Double_t sumEt = 0;
87     for (UInt_t i=0; i<caloTowers->GetEntries();i++) {
88     Double_t caloTowerEt = caloTowers->At(i)->HadEt();
89     Double_t dr = MathUtils::DeltaR(caloTowers->At(i)->Phi(), caloTowers->At(i)->Eta(),
90     p->Phi(), p->Eta());
91     if (dr < extRadius && dr > intRadius && caloTowerEt > etLow) {
92     sumEt += caloTowerEt;
93     }
94     }
95     return sumEt;
96     }
97    
98     //--------------------------------------------------------------------------------------------------
99     Double_t IsolationTools::CaloTowerEmIsolation(const ThreeVector *p, Double_t extRadius,
100     Double_t intRadius, Double_t etLow,
101 phedex 1.2 const Collection<CaloTower> *caloTowers)
102 loizides 1.1 {
103     //Computes the CaloTower Em Et Isolation: Summed Hadronic Transverse Energy of all Calo Towers
104     //inside an annulus around the electron super cluster position.
105    
106     Double_t sumEt = 0;
107     for (UInt_t i=0; i<caloTowers->GetEntries();i++) {
108     Double_t caloTowerEt = caloTowers->At(i)->EmEt();
109     Double_t dr = MathUtils::DeltaR(caloTowers->At(i)->Phi(), caloTowers->At(i)->Eta(),
110     p->Phi(), p->Eta());
111     if (dr < extRadius && dr > intRadius && caloTowerEt > etLow) {
112     sumEt += caloTowerEt;
113     }
114     }
115     return sumEt;
116     }