ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Utils/src/IsolationTools.cc
Revision: 1.1
Committed: Tue Oct 14 06:13:55 2008 UTC (16 years, 6 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Error occurred while calculating annotation data.
Log Message:
Start of MitPhysics

File Contents

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