ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/src/IsolationTools.cc
Revision: 1.4
Committed: Mon Jul 20 04:55:33 2009 UTC (15 years, 9 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012, Mit_011a, Mit_011, Mit_010a, Mit_010
Changes since 1.3: +3 -1 lines
Log Message:
Changes for docu

File Contents

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