ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/src/PhotonTools.cc
Revision: 1.2
Committed: Thu Apr 14 22:05:42 2011 UTC (14 years ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_020d, TMit_020d, Mit_020c, Mit_020b
Changes since 1.1: +24 -1 lines
Log Message:
add conversion veto option for photon isolation

File Contents

# Content
1 // $Id: PhotonTools.cc,v 1.1 2011/04/12 22:14:21 bendavid Exp $
2
3 #include "MitPhysics/Utils/interface/PhotonTools.h"
4 #include "MitPhysics/Utils/interface/ElectronTools.h"
5 #include "MitAna/DataTree/interface/StableData.h"
6 #include <TFile.h>
7
8 ClassImp(mithep::PhotonTools)
9
10 using namespace mithep;
11
12 //--------------------------------------------------------------------------------------------------
13 PhotonTools::PhotonTools()
14 {
15 // Constructor.
16 }
17
18 //--------------------------------------------------------------------------------------------------
19 Bool_t PhotonTools::PassConversionId(const Photon *p, const DecayParticle *c) {
20
21 if (!c) return kTRUE;
22
23 ThreeVector dirconvsc = ThreeVector(p->SCluster()->Point()) - c->Position();
24 Double_t deta = c->Eta()-dirconvsc.Eta();
25 Double_t dphi = MathUtils::DeltaPhi(c->Phi(),dirconvsc.Phi());
26 Double_t eoverp = p->SCluster()->Energy()/c->P();
27
28 if (p->IsEB() && eoverp>2.0) return kFALSE;
29 if (p->IsEE() && eoverp>3.0) return kFALSE;
30
31 if (p->IsEE() && TMath::Abs(deta)>0.01) return kFALSE;
32 if (p->IsEE() && TMath::Abs(dphi)>0.01) return kFALSE;
33
34 return kTRUE;
35
36 }
37
38 //--------------------------------------------------------------------------------------------------
39 Bool_t PhotonTools::PassElectronVeto(const Photon *p, const ElectronCol *els) {
40
41 Bool_t pass = kTRUE;
42 for (UInt_t i=0; i<els->GetEntries(); ++i) {
43 const Electron *e = els->At(i);
44 if (e->SCluster()==p->SCluster() && e->GsfTrk()->NExpectedHitsInner()==0) {
45 pass = kFALSE;
46 }
47 }
48
49 return pass;
50 }
51
52 //--------------------------------------------------------------------------------------------------
53 Bool_t PhotonTools::PassElectronVetoConvRecovery(const Photon *p, const ElectronCol *els, const DecayParticleCol *conversions, const BaseVertex *v) {
54
55 Bool_t pass = kTRUE;
56 for (UInt_t i=0; i<els->GetEntries(); ++i) {
57 const Electron *e = els->At(i);
58 if (e->SCluster()==p->SCluster() && e->GsfTrk()->NExpectedHitsInner()==0 && ElectronTools::PassConversionFilter(e, conversions,
59 v, 0, 1e-6, 2.0, kFALSE, kFALSE) ) {
60 pass = kFALSE;
61 }
62 }
63
64 return pass;
65 }
66
67 //--------------------------------------------------------------------------------------------------
68 Bool_t PhotonTools::PassTriggerMatching(const Photon *p, const TriggerObjectCol *trigobjs)
69 {
70
71 for (UInt_t i=0; i<trigobjs->GetEntries(); ++i) {
72 const TriggerObject *trigobj = trigobjs->At(i);
73 if (trigobj->TriggerType()==TriggerObject::TriggerCluster || trigobj->TriggerType()==TriggerObject::TriggerElectron || trigobj->TriggerType()==TriggerObject::TriggerPhoton) {
74 if (MathUtils::DeltaR(p->SCluster(),trigobj)<0.3) {
75 return kTRUE;
76 }
77 }
78 }
79
80 return kFALSE;
81
82
83 }
84
85 //--------------------------------------------------------------------------------------------------
86 const DecayParticle *PhotonTools::MatchedConversion(const Photon *p, const DecayParticleCol *conversions,
87 const BaseVertex *vtx, Int_t nWrongHitsMax, Double_t probMin,
88 Double_t lxyMin, Double_t dRMin) {
89
90 const DecayParticle *match = 0;
91 Double_t drsmallest = 999.;
92 for (UInt_t i=0; i<conversions->GetEntries(); ++i) {
93 const DecayParticle *c = conversions->At(i);
94 ThreeVector dirconvsc = ThreeVector(p->SCluster()->Point()) - c->Position();
95 Double_t dr = MathUtils::DeltaR(*c,dirconvsc);
96 if (dr<dRMin && dr<drsmallest && c->Prob()>probMin && c->LxyCorrected(vtx)>lxyMin) {
97 Int_t nhb1 = dynamic_cast<const StableData*>(c->DaughterDat(0))->NHitsBeforeVtx();
98 Int_t nhb2 = dynamic_cast<const StableData*>(c->DaughterDat(1))->NHitsBeforeVtx();
99 if (TMath::Max(nhb1,nhb2)<=nWrongHitsMax) {
100 drsmallest = dr;
101 match = c;
102 }
103 }
104
105 }
106
107 return match;
108
109 }
110
111 //--------------------------------------------------------------------------------------------------
112 const DecayParticle *PhotonTools::MatchedConversion(const Track *t, const DecayParticleCol *conversions,
113 const BaseVertex *vtx, Int_t nWrongHitsMax, Double_t probMin,
114 Double_t lxyMin) {
115
116 for (UInt_t i=0; i<conversions->GetEntries(); ++i) {
117 const DecayParticle *c = conversions->At(i);
118 if (c->Prob()>probMin && c->LxyCorrected(vtx)>lxyMin) {
119 Int_t nhb1 = dynamic_cast<const StableData*>(c->DaughterDat(0))->NHitsBeforeVtx();
120 Int_t nhb2 = dynamic_cast<const StableData*>(c->DaughterDat(1))->NHitsBeforeVtx();
121 if (TMath::Max(nhb1,nhb2)<=nWrongHitsMax) {
122 const Track *ct1 = dynamic_cast<const ChargedParticle*>(c->Daughter(0))->Trk();
123 const Track *ct2 = dynamic_cast<const ChargedParticle*>(c->Daughter(1))->Trk();
124 if (t==ct1 || t==ct2) return c;
125 }
126 }
127
128 }
129
130 return 0;
131
132 }
133
134 PhotonTools::DiphotonR9EtaCats PhotonTools::DiphotonR9EtaCat(const Photon *p1, const Photon *p2) {
135
136 if (p1->IsEB() && p2->IsEB()) {
137 if (p1->R9()>0.93 && p2->R9()>0.93) return kCat1;
138 else return kCat2;
139
140 }
141 else {
142 if (p1->R9()>0.93 && p2->R9()>0.93) return kCat3;
143 else return kCat4;
144 }
145
146 }
147
148 PhotonTools::DiphotonR9EtaConversionCats PhotonTools::DiphotonR9EtaConversionCat(const Photon *p1, const Photon *p2, const DecayParticleCol *conversions, const BaseVertex *v) {
149
150 const DecayParticle *conv1 = MatchedConversion(p1, conversions, v);
151 const DecayParticle *conv2 = MatchedConversion(p2, conversions, v);
152
153 if (p1->IsEB() && p2->IsEB()) {
154 if (p1->R9()>0.93 && p2->R9()>0.93) return kNewCat1;
155 else if (conv1||conv2) return kNewCat2;
156 else return kNewCat3;
157
158 }
159 else {
160 if (p1->R9()>0.93 && p2->R9()>0.93) return kNewCat4;
161 else if (conv1||conv2) return kNewCat5;
162 else return kNewCat6;
163 }
164
165 }