1 |
bendavid |
1.4 |
// $Id: MvfConversions.cc,v 1.3 2009/01/12 10:26:47 bendavid Exp $
|
2 |
bendavid |
1.1 |
#include <TH1.h>
|
3 |
|
|
#include <TH1F.h>
|
4 |
|
|
#include <TH2F.h>
|
5 |
|
|
#include <TCanvas.h>
|
6 |
|
|
|
7 |
|
|
#include "MitConversions/Mods/interface/MvfConversions.h"
|
8 |
|
|
#include "MitAna/DataTree/interface/Electron.h"
|
9 |
|
|
#include "MitAna/DataTree/interface/Track.h"
|
10 |
|
|
#include "MitAna/DataCont/interface/ObjArray.h"
|
11 |
|
|
#include "MitAna/DataTree/interface/Names.h"
|
12 |
|
|
#include "MitCommon/MathTools/interface/MathUtils.h"
|
13 |
|
|
|
14 |
|
|
using namespace mithep;
|
15 |
|
|
|
16 |
|
|
ClassImp(mithep::MvfConversions)
|
17 |
|
|
|
18 |
|
|
//__________________________________________________________________________________________________
|
19 |
|
|
MvfConversions::MvfConversions(const char *name, const char *title) :
|
20 |
bendavid |
1.3 |
BaseMod (name,title),
|
21 |
bendavid |
1.1 |
fPtMin (0),
|
22 |
|
|
fEtaMax (0),
|
23 |
|
|
fProbMin (0),
|
24 |
|
|
fExcludePXB1(false),
|
25 |
|
|
fMassMax(0),
|
26 |
|
|
fMissedHitsMax(0),
|
27 |
|
|
fWrongHitsMax(0),
|
28 |
|
|
fElectronPtMin(0),
|
29 |
|
|
fElectronEtaMax(0),
|
30 |
|
|
fComputeEff(kFALSE),
|
31 |
bendavid |
1.4 |
fHitBasedMatching(kFALSE),
|
32 |
|
|
fRequireCleanElectron(kFALSE),
|
33 |
|
|
fTrackQualityFirstOnly(kFALSE),
|
34 |
bendavid |
1.1 |
fTracks (0),
|
35 |
|
|
fGsfTracks (0),
|
36 |
|
|
fInOutTracks (0),
|
37 |
|
|
fOutInTracks (0),
|
38 |
|
|
fElectrons (0),
|
39 |
bendavid |
1.2 |
fTrkElectrons(0),
|
40 |
bendavid |
1.1 |
fPhotons (0),
|
41 |
|
|
fMCParticles (0),
|
42 |
|
|
fMvfConversions (0),
|
43 |
|
|
fMvfConversionsUnconstrained (0),
|
44 |
bendavid |
1.4 |
fCleanElectrons(0),
|
45 |
bendavid |
1.1 |
fMCPartName (Names::gkMCPartBrn),
|
46 |
|
|
fTrackName (Names::gkTrackBrn),
|
47 |
|
|
fConvElectronName ("Electrons"),
|
48 |
|
|
fPhotonName (Names::gkPhotonBrn),
|
49 |
|
|
fMvfConvName("MvfConversions"),
|
50 |
|
|
fMvfConvUnconstrainedName("MvfConversionsUnconstrained"),
|
51 |
|
|
fElectronName(Names::gkElectronBrn),
|
52 |
bendavid |
1.2 |
fTrkElectronName("TrackerElectrons"),
|
53 |
|
|
fGoodElectronsName("ConversionElectrons"),
|
54 |
|
|
fGoodTwoClusterElectronsName("TwoClusterConversionElectrons"),
|
55 |
|
|
fBadElectronsName("ConversionRemovedElectrons"),
|
56 |
bendavid |
1.1 |
hConversionRadius (0),
|
57 |
|
|
hConversionZ(0),
|
58 |
|
|
hConversionRPhi (0),
|
59 |
|
|
hConversionRZ(0),
|
60 |
|
|
hGammaPt (0),
|
61 |
|
|
hGammaEta (0),
|
62 |
|
|
hGammaMass (0),
|
63 |
|
|
hSimMatchedGammaMass(0),
|
64 |
|
|
hConvProb (0),
|
65 |
|
|
hConvChi2 (0),
|
66 |
|
|
hSimMatchedConvChi2(0),
|
67 |
|
|
hConvDCotTheta (0),
|
68 |
|
|
hConvDCotThetaPreCut (0),
|
69 |
|
|
hConvEOverP (0),
|
70 |
|
|
hElectronPt (0),
|
71 |
|
|
hMinElectronPt (0),
|
72 |
|
|
hSimMinElectronPt (0),
|
73 |
|
|
hSimMatchedMinElectronPt (0),
|
74 |
|
|
hSimMatchedMinElectronSimPt (0),
|
75 |
|
|
hElectronEta (0),
|
76 |
|
|
hEPairMass (0),
|
77 |
|
|
hEPairDeltaPhi (0),
|
78 |
|
|
hGenNumDaughters (0),
|
79 |
|
|
hGenDaughterPt (0),
|
80 |
|
|
hGenDecayRadius (0),
|
81 |
|
|
hSimPt (0),
|
82 |
bendavid |
1.4 |
hSimEta(0),
|
83 |
bendavid |
1.1 |
hSimConvRadius (0),
|
84 |
|
|
hSimConvPosition(0),
|
85 |
|
|
hTrackSimMatchType (0),
|
86 |
|
|
hParentSimMatchType (0),
|
87 |
|
|
hSimMatchedConvRadius (0),
|
88 |
|
|
hSimMatchedConvProb (0),
|
89 |
|
|
hSimMatchedEPairMass (0),
|
90 |
|
|
hSimMatchedEPairDeltaPhi (0),
|
91 |
|
|
hSimMatchedSimConvRadius (0),
|
92 |
|
|
hSimMatchedConvResolution (0),
|
93 |
|
|
hSimMatchedConvPhiRes (0),
|
94 |
|
|
hSimMatchedConvEOverP (0),
|
95 |
|
|
hSimMatchedElectronPt (0),
|
96 |
|
|
hSimMatchedGammaPt (0),
|
97 |
|
|
hSimMatchedGammaEta (0),
|
98 |
|
|
hSimMatchedSimGammaPt (0),
|
99 |
|
|
hSimMatchedSimGammaEta (0),
|
100 |
|
|
hTrackChi2 (0),
|
101 |
|
|
hTrackProb (0),
|
102 |
|
|
hTrackNHits (0),
|
103 |
|
|
hTrackNHitsProb (0),
|
104 |
|
|
hTrackD0 (0),
|
105 |
|
|
hUnMatchedTrackChi2 (0),
|
106 |
|
|
hUnMatchedTrackProb (0),
|
107 |
|
|
hUnMatchedTrackNHits (0),
|
108 |
|
|
hUnMatchedTrackNHitsProb (0),
|
109 |
|
|
hUnMatchedTrackD0 (0),
|
110 |
|
|
hSimMatchedTrackChi2 (0),
|
111 |
|
|
hSimMatchedTrackProb (0),
|
112 |
|
|
hSimMatchedTrackNHits (0),
|
113 |
|
|
hSimMatchedTrackNHitsProb (0),
|
114 |
|
|
hSimMatchedTrackD0 (0),
|
115 |
|
|
hLxy(0),
|
116 |
|
|
hLxyOverLxyErr(0),
|
117 |
|
|
hLz(0),
|
118 |
|
|
hLzOverLzErr(0),
|
119 |
|
|
hDxy(0),
|
120 |
|
|
hSimMatchedLxy(0),
|
121 |
|
|
hSimMatchedLz(0),
|
122 |
|
|
hSimMatchedDxy(0),
|
123 |
|
|
hNTracks(0),
|
124 |
|
|
hSimMatchedNTracks(0),
|
125 |
|
|
hIsolation(0),
|
126 |
|
|
hSimMatchedIsolation(0),
|
127 |
|
|
hNConversions(0),
|
128 |
|
|
hDoubleConvMass(0),
|
129 |
|
|
hConvGammaMass(0),
|
130 |
|
|
hPiPiMass(0)
|
131 |
|
|
{
|
132 |
|
|
// Constructor.
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
//__________________________________________________________________________________________________
|
136 |
|
|
void MvfConversions::Begin()
|
137 |
|
|
{
|
138 |
|
|
// Run startup code on the client machine. For this module, we dont do anything here.
|
139 |
|
|
}
|
140 |
|
|
|
141 |
|
|
//__________________________________________________________________________________________________
|
142 |
|
|
void MvfConversions::SlaveBegin()
|
143 |
|
|
{
|
144 |
|
|
// Run startup code on the computer (slave) doing the actual analysis. Here, we typically
|
145 |
|
|
// initialize histograms and other analysis objects and request branches. For this module, we
|
146 |
|
|
// request a branch of the MitTree.
|
147 |
|
|
|
148 |
|
|
// Request the branches
|
149 |
|
|
ReqBranch(fTrackName, fTracks);
|
150 |
|
|
ReqBranch("ConversionInOutTracks", fInOutTracks);
|
151 |
|
|
ReqBranch("ConversionOutInTracks", fOutInTracks);
|
152 |
bendavid |
1.4 |
//ReqBranch(fElectronName, fElectrons);
|
153 |
|
|
//ReqBranch(fTrkElectronName, fTrkElectrons);
|
154 |
bendavid |
1.1 |
ReqBranch(fPhotonName, fPhotons);
|
155 |
|
|
ReqBranch(fMCPartName, fMCParticles);
|
156 |
|
|
ReqBranch(fMvfConvName, fMvfConversions);
|
157 |
|
|
ReqBranch(fMvfConvUnconstrainedName, fMvfConversionsUnconstrained);
|
158 |
|
|
|
159 |
|
|
// Book our histograms
|
160 |
|
|
|
161 |
|
|
hConversionRPhi = new TH2F("Photon Conversion Position R-Phi","Conversion Position R-Phi (cm)", 100, -100.0,100.0,100,-100.0,100.0);
|
162 |
|
|
AddOutput(hConversionRPhi);
|
163 |
|
|
|
164 |
|
|
hConversionRZ = new TH2F("Photon Conversion Position R-Z","Conversion Position R-Z (cm)", 1000, -100.0,100.0,1000,-100.0,100.0);
|
165 |
|
|
AddOutput(hConversionRZ);
|
166 |
|
|
|
167 |
|
|
hSimConvPosition = new TH2F("Sim Photon Conversion Position","Sim Photon Conversion Position", 200, -200.0,200.0,200,-200.0,200.0);
|
168 |
|
|
AddOutput(hSimConvPosition);
|
169 |
|
|
|
170 |
|
|
|
171 |
|
|
//TH1::SetDefaultSumw2(kTRUE);
|
172 |
|
|
|
173 |
|
|
hConversionRadius = new TH1F("Photon Conversion Radius","Radius (cm)",800,0,200.0);
|
174 |
|
|
AddOutput(hConversionRadius);
|
175 |
|
|
|
176 |
|
|
hConversionZ = new TH1F("Photon Conversion Z position", "Conversion Z position (cm)", 200, -200.0, 200.0);
|
177 |
|
|
AddOutput(hConversionZ);
|
178 |
|
|
|
179 |
|
|
hGammaPt = new TH1F("Photon Pt","Photon Pt (GeV)",400,0,200.0);
|
180 |
|
|
AddOutput(hGammaPt);
|
181 |
|
|
|
182 |
|
|
hGammaEta = new TH1F("Photon Eta","Photon Eta",200,-5.0,5.0);
|
183 |
|
|
AddOutput(hGammaEta);
|
184 |
|
|
|
185 |
|
|
hGammaMass = new TH1F("Photon Invariant Mass","Photon Invariant Mass",200,0,20.0);
|
186 |
|
|
AddOutput(hGammaMass);
|
187 |
|
|
|
188 |
|
|
hSimMatchedGammaMass = new TH1F("SimMatched Photon Invariant Mass","SimMatched Photon Invariant Mass",200,0,20.0);
|
189 |
|
|
AddOutput(hSimMatchedGammaMass);
|
190 |
|
|
|
191 |
|
|
hConvProb = new TH1F("Conversion Vertex fit probability", "Vertex Fit Probability",200,0.0,1.0);
|
192 |
|
|
AddOutput(hConvProb);
|
193 |
|
|
|
194 |
|
|
hConvChi2 = new TH1F("Conversion Vertex fit Chi squared", "Vertex Fit Chi Squared",2000,0.0,100.0);
|
195 |
|
|
AddOutput(hConvChi2);
|
196 |
|
|
|
197 |
|
|
hSimMatchedConvChi2 = new TH1F("Sim Matched Conversion Vertex fit Chi squared", "Sim Matched Vertex Fit Chi Squared",2000,0.0,100.0);
|
198 |
|
|
AddOutput(hSimMatchedConvChi2);
|
199 |
|
|
|
200 |
|
|
hConvDCotTheta = new TH1F("Conversion DCotTheta", "DCotTheta",10001,-10.0,10.0);
|
201 |
|
|
AddOutput(hConvDCotTheta);
|
202 |
|
|
|
203 |
|
|
hConvDCotThetaPreCut = new TH1F("Conversion DCotTheta before fit prob cut", "DCotThetaPreCut",1000,-10.0,10.0);
|
204 |
|
|
AddOutput(hConvDCotThetaPreCut);
|
205 |
|
|
|
206 |
|
|
hConvEOverP = new TH1F("Conversion E over P", "Conversion E over P",200,0.0,50.0);
|
207 |
|
|
AddOutput(hConvEOverP);
|
208 |
|
|
|
209 |
|
|
hElectronPt = new TH1F("Electron Pt","Electron Pt (GeV)",400,0,200.0);
|
210 |
|
|
AddOutput(hElectronPt);
|
211 |
|
|
|
212 |
|
|
hMinElectronPt = new TH1F("Min Electron Pt","Min Electron Pt (GeV)",400,0,200.0);
|
213 |
|
|
AddOutput(hMinElectronPt);
|
214 |
|
|
|
215 |
|
|
hSimMatchedMinElectronPt = new TH1F("Sim Matched Min Electron Pt","Sim Matched Min Electron Pt (GeV)",400,0,200.0);
|
216 |
|
|
AddOutput(hSimMatchedMinElectronPt);
|
217 |
|
|
|
218 |
|
|
hSimMatchedMinElectronSimPt = new TH1F("Sim Matched Min Electron Sim Pt","Sim Matched Min Electron Sim Pt (GeV)",400,0,200.0);
|
219 |
|
|
AddOutput(hSimMatchedMinElectronSimPt);
|
220 |
|
|
|
221 |
|
|
hSimMinElectronPt = new TH1F("Sim Min Electron Pt","Sim Min Electron Pt (GeV)",400,0,200.0);
|
222 |
|
|
AddOutput(hSimMinElectronPt);
|
223 |
|
|
|
224 |
|
|
hElectronEta = new TH1F("Electron Eta","Electron Eta",200,-5.0,5.0);
|
225 |
|
|
AddOutput(hElectronEta);
|
226 |
|
|
|
227 |
|
|
hEPairMass = new TH1F("Electron Pair Invariant Mass","Electron Pair Invariant Mass",200,0.0,10);
|
228 |
|
|
AddOutput(hEPairMass);
|
229 |
|
|
|
230 |
|
|
hEPairDeltaPhi = new TH1F("Electron Pair Delta Phi","Electron Pair Delta Phi",200,-4.0,4.0);
|
231 |
|
|
AddOutput(hEPairDeltaPhi);
|
232 |
|
|
|
233 |
|
|
hGenNumDaughters = new TH1F("Number of Decay daughters - gen level","Number of Decay daughters - gen level",10,-0.5,9.5);
|
234 |
|
|
AddOutput(hGenNumDaughters);
|
235 |
|
|
|
236 |
|
|
hGenDaughterPt = new TH1F("Pt of decay daugthers - gen level","Pt of decay daugthers - gen level",400,0,200.0);
|
237 |
|
|
AddOutput(hGenDaughterPt);
|
238 |
|
|
|
239 |
|
|
hGenDecayRadius = new TH1F("Decay vertex radius - gen level","Decay vertex radius - gen level",800,0,200.0);
|
240 |
|
|
AddOutput(hGenDecayRadius);
|
241 |
|
|
|
242 |
|
|
hSimPt = new TH1F("Pt - sim level","Pt - sim level",400,0,200.0);
|
243 |
|
|
AddOutput(hSimPt);
|
244 |
bendavid |
1.4 |
|
245 |
|
|
hSimEta = new TH1F("Sim Photon Eta","Photon Eta",200,-5.0,5.0);
|
246 |
|
|
AddOutput(hSimEta);
|
247 |
bendavid |
1.1 |
|
248 |
|
|
hSimConvRadius = new TH1F("Sim Photon Conversion Radius","Sim Photon Conversion Radius",800,0,200.0);
|
249 |
|
|
AddOutput(hSimConvRadius);
|
250 |
|
|
|
251 |
|
|
// hTrackD0 = new TH1F("general track D0","general track D0",400,0,200.0);
|
252 |
|
|
// AddOutput(hTrackD0);
|
253 |
|
|
|
254 |
|
|
hTrackSimMatchType = new TH1F("Conversion Electron matched sim pdg","Conversion Electron matched sim pdg",10001,-5000.5,5000.5);
|
255 |
|
|
AddOutput(hTrackSimMatchType);
|
256 |
|
|
|
257 |
|
|
hParentSimMatchType = new TH1F("Conversion Parent matched sim pdg","Conversion Parent matched sim pdg",10001,-5000.5,5000.5);
|
258 |
|
|
AddOutput(hParentSimMatchType);
|
259 |
|
|
|
260 |
|
|
hSimMatchedConvRadius = new TH1F("Sim Matched Photon Conversion Radius","Sim Matched Photon Conversion Radius",800,0,200.0);
|
261 |
|
|
AddOutput(hSimMatchedConvRadius);
|
262 |
|
|
|
263 |
|
|
hSimMatchedConvProb = new TH1F("Sim Matched Conversion Vertex fit probability", "Sim Matched Vertex Fit Probability",200,0.0,1.0);
|
264 |
|
|
AddOutput(hSimMatchedConvProb);
|
265 |
|
|
|
266 |
|
|
hSimMatchedEPairMass = new TH1F("Sim Matched Electron Pair Invariant Mass","Sim Matched Electron Pair Invariant Mass",200,0.0,10);
|
267 |
|
|
AddOutput(hSimMatchedEPairMass);
|
268 |
|
|
|
269 |
|
|
hSimMatchedEPairDeltaPhi = new TH1F("Sim Matched Electron Pair Delta Phi","Sim Matched Electron Pair Delta Phi",200,-4.0,4.0);
|
270 |
|
|
AddOutput(hSimMatchedEPairDeltaPhi);
|
271 |
|
|
|
272 |
|
|
hSimMatchedSimConvRadius = new TH1F("Sim Matched Photon Sim Conversion Radius","Sim Matched Photon Conversion Sim Radius",800,0,200.0);
|
273 |
|
|
AddOutput(hSimMatchedSimConvRadius);
|
274 |
|
|
|
275 |
|
|
hSimMatchedConvResolution = new TH1F("Sim Matched Photon Conversion Radius Resolution","Sim Matched Photon Conversion Radius Resolution",300,-30.0,30.0);
|
276 |
|
|
AddOutput(hSimMatchedConvResolution);
|
277 |
|
|
|
278 |
|
|
hSimMatchedConvPhiRes = new TH1F("Sim Matched Photon Conversion Phi Resolution","Sim Matched Photon Conversion Phi Resolution",1000,-3.5,3.5);
|
279 |
|
|
AddOutput(hSimMatchedConvPhiRes);
|
280 |
|
|
|
281 |
|
|
hSimMatchedConvEOverP = new TH1F("Sim Matched Conversion E over P", "Sim Matched Conversion E over P",200,0.0,50.0);
|
282 |
|
|
AddOutput(hSimMatchedConvEOverP);
|
283 |
|
|
|
284 |
|
|
hSimMatchedElectronPt = new TH1F("Sim Matched Electron Pt","Sim Matched Electron Pt (GeV)",400,0,200.0);
|
285 |
|
|
AddOutput(hSimMatchedElectronPt);
|
286 |
|
|
|
287 |
|
|
hSimMatchedGammaPt = new TH1F("Sim Matched Photon Pt","Sim Matched Photon Pt (GeV)",400,0,200.0);
|
288 |
|
|
AddOutput(hSimMatchedGammaPt);
|
289 |
|
|
|
290 |
|
|
hSimMatchedGammaEta = new TH1F("Sim Matched Photon Eta","Sim Matched Photon Eta",200,-5.0,5.0);
|
291 |
|
|
AddOutput(hSimMatchedGammaEta);
|
292 |
|
|
|
293 |
|
|
hSimMatchedSimGammaPt = new TH1F("Sim Matched Sim Photon Pt","Sim Matched Sim Photon Pt (GeV)",400,0,200.0);
|
294 |
|
|
AddOutput(hSimMatchedSimGammaPt);
|
295 |
|
|
|
296 |
|
|
hSimMatchedSimGammaEta = new TH1F("Sim Matched Sim Photon Eta","Sim Matched Sim Photon Eta",200,-5.0,5.0);
|
297 |
|
|
AddOutput(hSimMatchedSimGammaEta);
|
298 |
|
|
|
299 |
|
|
hTrackChi2 = new TH1F("Conversion Track RChi squared", "Track RChi Squared",200,0.0,10.0);
|
300 |
|
|
AddOutput(hTrackChi2);
|
301 |
|
|
|
302 |
|
|
hTrackProb = new TH1F("Conversion Track fit probability", "Track Fit Probability",200,0.0,1.0);
|
303 |
|
|
AddOutput(hTrackProb);
|
304 |
|
|
|
305 |
|
|
hTrackNHits = new TH1F("Conversion Track NHits", "Track NHits",37,-0.5,36.5);
|
306 |
|
|
AddOutput(hTrackNHits);
|
307 |
|
|
|
308 |
|
|
hTrackNHitsProb = new TH2F("Track NHits-RChi2","Track NHits-RChi2", 37,-0.5,36.5,50,0.0,10.0);
|
309 |
|
|
AddOutput(hTrackNHitsProb);
|
310 |
|
|
|
311 |
|
|
hTrackD0 = new TH1F("Conversion track D0","Conversion track D0",100,-5.0,5.0);
|
312 |
|
|
AddOutput(hTrackD0);
|
313 |
|
|
|
314 |
|
|
hUnMatchedTrackChi2 = new TH1F("UnMatched Conversion Track RChi squared", "UnMatched Track RChi Squared",200,0.0,10.0);
|
315 |
|
|
AddOutput(hUnMatchedTrackChi2);
|
316 |
|
|
|
317 |
|
|
hUnMatchedTrackProb = new TH1F("UnMatched Conversion Track fit probability", "UnMatched Track Fit Probability",200,0.0,1.0);
|
318 |
|
|
AddOutput(hUnMatchedTrackProb);
|
319 |
|
|
|
320 |
|
|
hUnMatchedTrackNHits = new TH1F("UnMatched Conversion Track NHits", "UnMatched Track NHits",37,-0.5,36.5);
|
321 |
|
|
AddOutput(hUnMatchedTrackNHits);
|
322 |
|
|
|
323 |
|
|
hUnMatchedTrackNHitsProb = new TH2F("UnMatched Track NHits-RChi2","UnMatched Track NHits-RChi2", 37,-0.5,36.5,50,0.0,10.0);
|
324 |
|
|
AddOutput(hUnMatchedTrackNHitsProb);
|
325 |
|
|
|
326 |
|
|
hUnMatchedTrackD0 = new TH1F("UnMatched Conversion track D0","UnMatched Conversion track D0",100,-5.0,5.0);
|
327 |
|
|
AddOutput(hUnMatchedTrackD0);
|
328 |
|
|
|
329 |
|
|
hSimMatchedTrackChi2 = new TH1F("SimMatched Conversion Track RChi squared", "SimMatched Track RChi Squared",200,0.0,10.0);
|
330 |
|
|
AddOutput(hSimMatchedTrackChi2);
|
331 |
|
|
|
332 |
|
|
hSimMatchedTrackProb = new TH1F("SimMatched Conversion Track fit probability", "SimMatched Track Fit Probability",200,0.0,1.0);
|
333 |
|
|
AddOutput(hSimMatchedTrackProb);
|
334 |
|
|
|
335 |
|
|
hSimMatchedTrackNHits = new TH1F("SimMatched Conversion Track NHits", "SimMatched Track NHits",37,-0.5,36.5);
|
336 |
|
|
AddOutput(hSimMatchedTrackNHits);
|
337 |
|
|
|
338 |
|
|
hSimMatchedTrackNHitsProb = new TH2F("SimMatched Track NHits-RChi2","SimMatched Track NHits-RChi2", 37,-0.5,36.5,50,0.0,10.0);
|
339 |
|
|
AddOutput(hSimMatchedTrackNHitsProb);
|
340 |
|
|
|
341 |
|
|
hSimMatchedTrackD0 = new TH1F("SimMatched Conversion track D0","SimMatched Conversion track D0",100,-5.0,5.0);
|
342 |
|
|
AddOutput(hSimMatchedTrackD0);
|
343 |
|
|
|
344 |
|
|
hLxy = new TH1F("Conversion Lxy","Conversion Lxy",240,-30.0,30.0);
|
345 |
|
|
AddOutput(hLxy);
|
346 |
|
|
|
347 |
|
|
hLxyOverLxyErr = new TH1F("Conversion Lxy/LxyErr","Conversion Lxy/LxyErr",200,-100.0,100.0);
|
348 |
|
|
AddOutput(hLxyOverLxyErr);
|
349 |
|
|
|
350 |
|
|
hLz = new TH1F("Conversion Lz","Conversion Lz",200,-50.0,50.0);
|
351 |
|
|
AddOutput(hLz);
|
352 |
|
|
|
353 |
|
|
hLzOverLzErr = new TH1F("Conversion Lz/LzErr","Conversion Lz/LzErr",200,-100.0,100.0);
|
354 |
|
|
AddOutput(hLzOverLzErr);
|
355 |
|
|
|
356 |
|
|
hDxy = new TH1F("Conversion Dxy","Conversion Dxy",200,-5.0,5.0);
|
357 |
|
|
AddOutput(hDxy);
|
358 |
|
|
|
359 |
|
|
hSimMatchedLxy = new TH1F("SimMatched Conversion Lxy","SimMatched Conversion Lxy",100,-30.0,30.0);
|
360 |
|
|
AddOutput(hSimMatchedLxy);
|
361 |
|
|
|
362 |
|
|
hSimMatchedLz = new TH1F("SimMatched Conversion Lz","SimMatched Conversion Lz",200,-50.0,50.0);
|
363 |
|
|
AddOutput(hSimMatchedLz);
|
364 |
|
|
|
365 |
|
|
hSimMatchedDxy = new TH1F("SimMatched Conversion Dxy","SimMatched Conversion Dxy",200,-5.0,5.0);
|
366 |
|
|
AddOutput(hSimMatchedDxy);
|
367 |
|
|
|
368 |
|
|
hNTracks = new TH1F("Number of Tracks in the event", "Number of tracks in the event", 401, -0.5,400.5);
|
369 |
|
|
AddOutput(hNTracks);
|
370 |
|
|
|
371 |
|
|
hSimMatchedNTracks = new TH1F("SimMatched Number of Tracks in the event", "SimMatched Number of tracks in the event", 401, -0.5,400.5);
|
372 |
|
|
AddOutput(hSimMatchedNTracks);
|
373 |
|
|
|
374 |
|
|
hIsolation = new TH1F("Track Isolation of Conversion", "Track Isolation of Conversion", 201, -0.5,200.5);
|
375 |
|
|
AddOutput(hIsolation);
|
376 |
|
|
|
377 |
|
|
hSimMatchedIsolation = new TH1F("SimMatched Track Isolation of Conversion", "SimMatched Track Isolation of Conversion", 201, -0.5,200.5);
|
378 |
|
|
AddOutput(hSimMatchedIsolation);
|
379 |
|
|
|
380 |
|
|
hNConversions = new TH1F("Number of Conversions", "Number of Conversions",10,-0.5,10.5);
|
381 |
|
|
AddOutput(hNConversions);
|
382 |
|
|
|
383 |
|
|
hDoubleConvMass = new TH1F("Double Conversion Mass", "Double Conversion Mass", 1000, 0.0, 10.0);
|
384 |
|
|
AddOutput(hDoubleConvMass);
|
385 |
|
|
|
386 |
|
|
hConvGammaMass = new TH1F("Conversion plus Photon Mass", "Conversion plus Photon Mass", 1000, 0.0, 10.0);
|
387 |
|
|
AddOutput(hConvGammaMass);
|
388 |
|
|
|
389 |
|
|
hPiPiMass = new TH1F("Conversion two pion Mass", "Conversion two pion Mass", 1000,0.0,10.0);
|
390 |
|
|
AddOutput(hPiPiMass);
|
391 |
|
|
|
392 |
|
|
fTimer.Start(1e8);
|
393 |
|
|
|
394 |
|
|
}
|
395 |
|
|
|
396 |
|
|
//__________________________________________________________________________________________________
|
397 |
|
|
void MvfConversions::Process()
|
398 |
|
|
{
|
399 |
|
|
// Process entries of the tree. For this module, we just load the branch and fill the histograms.
|
400 |
|
|
// --> Why is this done on the basis of the name? should be the pointer!
|
401 |
|
|
|
402 |
|
|
// BitMask64 testMask;
|
403 |
|
|
// testMask.SetBit(Track::TIB1S);
|
404 |
|
|
// testMask.SetBit(Track::TIB2S);
|
405 |
|
|
// testMask.SetBit(Track::TID1S);
|
406 |
|
|
// testMask.SetBit(Track::TID2S);
|
407 |
|
|
// testMask.SetBit(Track::TID3S);
|
408 |
|
|
// testMask.SetBit(Track::TOB1S);
|
409 |
|
|
// testMask.SetBit(Track::TOB2S);
|
410 |
|
|
// testMask.SetBit(Track::TEC1S);
|
411 |
|
|
// testMask.SetBit(Track::TEC2S);
|
412 |
|
|
// testMask.SetBit(Track::TEC3S);
|
413 |
|
|
// testMask.SetBit(Track::TEC4S);
|
414 |
|
|
// testMask.SetBit(Track::TEC5S);
|
415 |
|
|
// testMask.SetBit(Track::TEC6S);
|
416 |
|
|
// testMask.SetBit(Track::TEC7S);
|
417 |
|
|
// testMask.SetBit(Track::TEC8S);
|
418 |
|
|
// testMask.SetBit(Track::TEC9S);
|
419 |
|
|
//
|
420 |
|
|
// const Long64_t *maskVal = reinterpret_cast<const Long64_t*>(testMask.Bits());
|
421 |
|
|
//
|
422 |
|
|
// printf("HitMaskVal = %lli\n",*maskVal);
|
423 |
|
|
//
|
424 |
|
|
// Track testTrack;
|
425 |
|
|
// if (testMask == testTrack.StereoLayers())
|
426 |
|
|
// printf("stereo mask match\n");
|
427 |
|
|
// else
|
428 |
|
|
// printf("stereo mask mismatch\n");
|
429 |
|
|
//
|
430 |
bendavid |
1.4 |
|
431 |
|
|
if (fRequireCleanElectron)
|
432 |
|
|
fCleanElectrons = GetObjThisEvt<ElectronCol>(fCleanElectronsName);
|
433 |
bendavid |
1.1 |
|
434 |
bendavid |
1.4 |
//printf("Loop over sim conversions\n");
|
435 |
bendavid |
1.1 |
if (fComputeEff) {
|
436 |
|
|
LoadBranch(fMCPartName);
|
437 |
|
|
for (UInt_t i=0; i<fMCParticles->GetEntries(); ++i) {
|
438 |
bendavid |
1.3 |
const MCParticle* p = fMCParticles->At(i);
|
439 |
bendavid |
1.2 |
const BitMask16 simFailed = FailedSimCuts(p);
|
440 |
|
|
|
441 |
|
|
BitMask16 simPtFailed = simFailed;
|
442 |
|
|
simPtFailed.ClearBit(eSimPt);
|
443 |
|
|
if (!simPtFailed.NBitsSet())
|
444 |
|
|
hSimPt->Fill(p->Pt());
|
445 |
bendavid |
1.4 |
|
446 |
|
|
BitMask16 simEtaFailed = simFailed;
|
447 |
|
|
simEtaFailed.ClearBit(eSimEta);
|
448 |
|
|
if (!simEtaFailed.NBitsSet())
|
449 |
|
|
hSimEta->Fill(p->Eta());
|
450 |
bendavid |
1.2 |
|
451 |
|
|
BitMask16 simRhoFailed = simFailed;
|
452 |
|
|
simRhoFailed.ClearBit(eSimRho);
|
453 |
|
|
if ( !simRhoFailed.NBitsSet() ) {
|
454 |
|
|
hSimConvRadius->Fill(p->DecayVertex().Rho());
|
455 |
|
|
hSimConvPosition->Fill(p->DecayVertex().X(),p->DecayVertex().Y());
|
456 |
|
|
}
|
457 |
|
|
Double_t minPt=999;
|
458 |
|
|
for (UInt_t j=0; j<p->NDaughters(); ++j) {
|
459 |
|
|
const MCParticle *d = p->Daughter(j);
|
460 |
|
|
if (TMath::Abs(d->PdgId())==11) {
|
461 |
|
|
if (d->Pt()<minPt)
|
462 |
|
|
minPt = d->Pt();
|
463 |
bendavid |
1.1 |
}
|
464 |
|
|
}
|
465 |
bendavid |
1.2 |
|
466 |
|
|
BitMask16 simElectronPtFailed = simFailed;
|
467 |
|
|
simElectronPtFailed.ClearBit(eSimElectronPt);
|
468 |
|
|
if ( !simElectronPtFailed.NBitsSet() )
|
469 |
|
|
hSimMinElectronPt->Fill(minPt);
|
470 |
bendavid |
1.4 |
|
471 |
|
|
if (fRequireCleanElectron && !simFailed.NBitsSet()) {
|
472 |
|
|
printf("Found good sim conversion, printing mother chain:\n");
|
473 |
|
|
const MCParticle *pm = p;
|
474 |
|
|
while (pm) {
|
475 |
|
|
pm->Print();
|
476 |
|
|
pm = pm->Mother();
|
477 |
|
|
}
|
478 |
|
|
const Electron *me = ElectronMatch(p);
|
479 |
|
|
if (me) {
|
480 |
|
|
printf("Matching Electron:\n");
|
481 |
|
|
me->Print();
|
482 |
|
|
}
|
483 |
|
|
const MCParticle *mce = GenElectronMatch(p);
|
484 |
|
|
if (mce) {
|
485 |
|
|
printf("Matching Gen Electron:\n");
|
486 |
|
|
mce->Print();
|
487 |
|
|
}
|
488 |
|
|
}
|
489 |
bendavid |
1.2 |
|
490 |
bendavid |
1.1 |
}
|
491 |
|
|
}
|
492 |
|
|
|
493 |
|
|
// Track* trackTest = new Track();
|
494 |
|
|
// Electron* electronTest = new Electron();
|
495 |
|
|
// electronTest->SetTrackerTrk(trackTest);
|
496 |
|
|
//
|
497 |
|
|
// Track *trackCopy = new Track(*trackTest);
|
498 |
|
|
// Electron* electronCopy = new Electron(*electronTest);
|
499 |
|
|
//
|
500 |
|
|
// const Track *electronTrack = electronTest->TrackerTrk();
|
501 |
|
|
// const Track *electronCopyTrack = electronCopy->TrackerTrk();
|
502 |
|
|
//
|
503 |
|
|
// Electron *secondElectron = new Electron();
|
504 |
|
|
// secondElectron->SetTrackerTrk(trackCopy);
|
505 |
|
|
//
|
506 |
|
|
// const Track *secondElectronTrack = secondElectron->TrackerTrk();
|
507 |
|
|
//
|
508 |
|
|
// if (electronTrack==trackTest)
|
509 |
|
|
// printf ("electronTrack==trackTest\n");
|
510 |
|
|
//
|
511 |
|
|
// if (electronTrack==trackCopy)
|
512 |
|
|
// printf("electronTrack==trackCopy\n");
|
513 |
|
|
//
|
514 |
|
|
// if (electronCopyTrack==trackTest)
|
515 |
|
|
// printf("electronCopyTrack==trackTest\n");
|
516 |
|
|
//
|
517 |
|
|
//
|
518 |
|
|
// if (electronCopyTrack==trackCopy)
|
519 |
|
|
// printf("electronCopyTrack==trackCopy\n");
|
520 |
|
|
//
|
521 |
|
|
// if (secondElectronTrack==trackTest)
|
522 |
|
|
// printf("secondElectronTrack==trackTest\n");
|
523 |
|
|
//
|
524 |
|
|
// if (secondElectronTrack==trackCopy)
|
525 |
|
|
// printf("secondElectronTrack==trackCopy\n");
|
526 |
|
|
|
527 |
bendavid |
1.4 |
|
528 |
|
|
//printf("Loop over reco conversions\n");
|
529 |
bendavid |
1.1 |
LoadBranch(fMvfConvName);
|
530 |
|
|
ObjArray<DecayParticle> goodConversions;
|
531 |
bendavid |
1.2 |
ObjArray<Electron> *goodElectrons = new ObjArray<Electron>;
|
532 |
|
|
ObjArray<Electron> *goodTwoClusterElectrons = new ObjArray<Electron>;
|
533 |
|
|
ObjArray<Electron> *badElectrons = new ObjArray<Electron>;
|
534 |
bendavid |
1.1 |
UInt_t nConversions = 0;
|
535 |
|
|
for (UInt_t i=0; i<fMvfConversions->GetEntries(); ++i) {
|
536 |
bendavid |
1.3 |
const DecayParticle* c = fMvfConversions->At(i);
|
537 |
bendavid |
1.2 |
const BitMask16 failed = FailedCuts(c);
|
538 |
|
|
|
539 |
bendavid |
1.4 |
// printf("Looking for sim match\n");
|
540 |
bendavid |
1.2 |
const MCParticle *simPhoton = SimMatch(c);
|
541 |
|
|
UInt_t nSimFailed=0;
|
542 |
|
|
BitMask16 simFailed;
|
543 |
bendavid |
1.4 |
//printf("Checking sim cuts\n");
|
544 |
bendavid |
1.2 |
if (simPhoton)
|
545 |
|
|
simFailed = FailedSimCuts(simPhoton);
|
546 |
|
|
|
547 |
bendavid |
1.4 |
//printf("getting on with life\n");
|
548 |
bendavid |
1.1 |
|
549 |
|
|
//make N-2 plots for decay length
|
550 |
bendavid |
1.2 |
BitMask16 decayLengthFailed = failed;
|
551 |
|
|
decayLengthFailed.ClearBit(eRho);
|
552 |
|
|
decayLengthFailed.ClearBit(eL);
|
553 |
|
|
if (!decayLengthFailed.NBitsSet()) {
|
554 |
|
|
hLxy->Fill(c->Lxy());
|
555 |
|
|
hLxyOverLxyErr->Fill(c->Lxy()/c->LxyError());
|
556 |
|
|
hLzOverLzErr->Fill(c->Lz()/c->LzError());
|
557 |
|
|
hLz->Fill(c->Lz());
|
558 |
|
|
if (simPhoton && !simFailed.NBitsSet() ) {
|
559 |
|
|
hSimMatchedLxy->Fill(c->Lxy());
|
560 |
|
|
hSimMatchedLz->Fill(c->Lz());
|
561 |
bendavid |
1.1 |
}
|
562 |
|
|
}
|
563 |
|
|
|
564 |
|
|
//make N-1 plots
|
565 |
bendavid |
1.4 |
//printf("Make N-1 plots\n");
|
566 |
bendavid |
1.2 |
|
567 |
|
|
BitMask16 ptFailed = failed;
|
568 |
|
|
ptFailed.ClearBit(ePt);
|
569 |
|
|
if (!ptFailed.NBitsSet()) {
|
570 |
|
|
hGammaPt->Fill(c->Pt());
|
571 |
|
|
if (simPhoton) {
|
572 |
|
|
BitMask16 simPtFailed = simFailed;
|
573 |
|
|
simPtFailed.ClearBit(eSimPt);
|
574 |
|
|
if (!simPtFailed.NBitsSet()) {
|
575 |
|
|
hSimMatchedGammaPt->Fill(c->Pt());
|
576 |
|
|
hSimMatchedSimGammaPt->Fill(simPhoton->Pt());
|
577 |
|
|
}
|
578 |
|
|
}
|
579 |
|
|
}
|
580 |
bendavid |
1.1 |
|
581 |
bendavid |
1.2 |
BitMask16 etaFailed = failed;
|
582 |
|
|
etaFailed.ClearBit(eEta);
|
583 |
|
|
if (!etaFailed.NBitsSet()) {
|
584 |
|
|
hGammaEta->Fill(c->Eta());
|
585 |
|
|
if (simPhoton) {
|
586 |
|
|
BitMask16 simEtaFailed = simFailed;
|
587 |
|
|
simEtaFailed.ClearBit(eSimEta);
|
588 |
|
|
if (!simEtaFailed.NBitsSet()) {
|
589 |
|
|
hSimMatchedGammaEta->Fill(c->Eta());
|
590 |
|
|
hSimMatchedSimGammaEta->Fill(simPhoton->Eta());
|
591 |
|
|
}
|
592 |
bendavid |
1.1 |
}
|
593 |
bendavid |
1.2 |
}
|
594 |
|
|
|
595 |
|
|
BitMask16 rhoFailed = failed;
|
596 |
|
|
rhoFailed.ClearBit(eRho);
|
597 |
|
|
if ( !rhoFailed.NBitsSet() ) {
|
598 |
|
|
hConversionRadius->Fill(c->Position().Rho());
|
599 |
|
|
hConversionRPhi->Fill(c->Position().X(), c->Position().Y());
|
600 |
|
|
hConversionRZ->Fill(c->Position().Z(), c->Position().Rho()*c->Position().Y()/TMath::Abs(c->Position().Y()));
|
601 |
|
|
if (simPhoton) {
|
602 |
|
|
BitMask16 simRhoFailed = simFailed;
|
603 |
|
|
simRhoFailed.ClearBit(eSimRho);
|
604 |
|
|
if ( !simRhoFailed.NBitsSet() ) {
|
605 |
|
|
hSimMatchedConvRadius->Fill(c->Position().Rho());
|
606 |
|
|
hSimMatchedSimConvRadius->Fill(simPhoton->DecayVertex().Rho());
|
607 |
|
|
}
|
608 |
|
|
}
|
609 |
|
|
}
|
610 |
|
|
|
611 |
|
|
BitMask16 dxyFailed = failed;
|
612 |
|
|
dxyFailed.ClearBit(eDxy);
|
613 |
|
|
if ( !dxyFailed.NBitsSet() ) {
|
614 |
|
|
hDxy->Fill(c->Dxy());
|
615 |
|
|
if (simPhoton && !simFailed.NBitsSet() )
|
616 |
|
|
hSimMatchedDxy->Fill(c->Dxy());
|
617 |
|
|
}
|
618 |
|
|
|
619 |
|
|
BitMask16 probFailed = failed;
|
620 |
|
|
probFailed.ClearBit(eProb);
|
621 |
|
|
if (!probFailed.NBitsSet()) {
|
622 |
|
|
hConvProb->Fill(c->Prob());
|
623 |
|
|
hConvChi2->Fill(c->Chi2());
|
624 |
|
|
if (simPhoton && !simFailed.NBitsSet() )
|
625 |
|
|
hSimMatchedConvProb->Fill(c->Prob());
|
626 |
|
|
}
|
627 |
|
|
|
628 |
bendavid |
1.4 |
//printf("Loop over daughters\n");
|
629 |
|
|
|
630 |
bendavid |
1.2 |
BitMask16 daughtersFailed = failed;
|
631 |
|
|
daughtersFailed.ClearBit(eDaughters);
|
632 |
|
|
if ( !daughtersFailed.NBitsSet() ) {
|
633 |
|
|
Double_t minElectronPt = c->Daughter(0)->Pt();
|
634 |
|
|
const Particle *minPtElectron = c->Daughter(0);
|
635 |
|
|
BitMask16 minPtElectronFailed;
|
636 |
|
|
for (UInt_t j=0; j<c->NDaughters(); ++j) {
|
637 |
|
|
const DaughterData* d = c->DaughterDat(j);
|
638 |
|
|
const ChargedParticle* dc = dynamic_cast<const ChargedParticle*>(c->Daughter(j));
|
639 |
|
|
if (!dc)
|
640 |
|
|
Fatal("FailedElectronCuts", "Daughter not a ChargedParticle");
|
641 |
|
|
|
642 |
|
|
const Track* t = dc->Trk();
|
643 |
|
|
|
644 |
|
|
const BitMask16 electronFailed = FailedElectronCuts(d);
|
645 |
|
|
|
646 |
|
|
if (d->Pt() < minElectronPt) {
|
647 |
|
|
minElectronPt = d->Pt();
|
648 |
|
|
minPtElectron = dc;
|
649 |
|
|
minPtElectronFailed = electronFailed;
|
650 |
|
|
}
|
651 |
|
|
|
652 |
|
|
BitMask16 failedEPt = electronFailed;
|
653 |
|
|
failedEPt.ClearBit(eEPt);
|
654 |
|
|
if (!failedEPt.NBitsSet())
|
655 |
|
|
hElectronPt->Fill(d->Pt());
|
656 |
|
|
|
657 |
|
|
BitMask16 failedEEta = electronFailed;
|
658 |
|
|
failedEEta.ClearBit(eEEta);
|
659 |
|
|
if (!failedEEta.NBitsSet())
|
660 |
|
|
hElectronEta->Fill(d->Eta());
|
661 |
|
|
|
662 |
|
|
BitMask16 failedENHits = electronFailed;
|
663 |
|
|
failedENHits.ClearBit(eENHits);
|
664 |
|
|
if (!failedENHits.NBitsSet()) {
|
665 |
|
|
hTrackNHits->Fill(t->NHits());
|
666 |
|
|
if (simPhoton && !simFailed.NBitsSet() )
|
667 |
|
|
hSimMatchedTrackNHits->Fill(t->NHits());
|
668 |
|
|
}
|
669 |
|
|
|
670 |
|
|
BitMask16 failedEProb = electronFailed;
|
671 |
|
|
failedEProb.ClearBit(eEProb);
|
672 |
|
|
if (!failedEProb.NBitsSet()) {
|
673 |
|
|
hTrackProb->Fill(t->Prob());
|
674 |
|
|
if (simPhoton && !simFailed.NBitsSet() ) {
|
675 |
|
|
hSimMatchedTrackChi2->Fill(t->Chi2()/((Double_t)t->Ndof()));
|
676 |
|
|
hSimMatchedTrackProb->Fill(t->Prob());
|
677 |
bendavid |
1.1 |
}
|
678 |
bendavid |
1.2 |
}
|
679 |
|
|
|
680 |
|
|
BitMask16 failedEProbNHits = electronFailed;
|
681 |
|
|
failedEProbNHits.ClearBit(eEProb);
|
682 |
|
|
failedEProbNHits.ClearBit(eENHits);
|
683 |
|
|
if ( !failedEProbNHits.NBitsSet() ) {
|
684 |
|
|
hTrackNHitsProb->Fill(t->NHits(),t->RChi2());
|
685 |
|
|
hTrackChi2->Fill(t->Chi2()/((Double_t)t->Ndof()));
|
686 |
|
|
if (simPhoton && !simFailed.NBitsSet() )
|
687 |
|
|
hSimMatchedTrackNHitsProb->Fill(t->NHits(),t->RChi2());
|
688 |
|
|
}
|
689 |
|
|
|
690 |
|
|
if ( !electronFailed.NBitsSet()) {
|
691 |
|
|
hTrackD0->Fill(t->D0());
|
692 |
|
|
}
|
693 |
bendavid |
1.1 |
}
|
694 |
bendavid |
1.2 |
|
695 |
|
|
minPtElectronFailed.ClearBit(eEPt);
|
696 |
|
|
if (!minPtElectronFailed.NBitsSet()) {
|
697 |
|
|
hMinElectronPt->Fill(minElectronPt);
|
698 |
|
|
if (simPhoton) {
|
699 |
|
|
BitMask16 simMinPtElectronFailed = simFailed;
|
700 |
|
|
simMinPtElectronFailed.ClearBit(eSimElectronPt);
|
701 |
|
|
if (!simMinPtElectronFailed.NBitsSet()) {
|
702 |
|
|
if (!minPtElectron)
|
703 |
|
|
printf("no minptelectron");
|
704 |
|
|
const ChargedParticle* minElectronC = dynamic_cast<const ChargedParticle*>(minPtElectron);
|
705 |
|
|
if (!minElectronC)
|
706 |
|
|
printf("no minelectronC\n");
|
707 |
|
|
const Track *t = minElectronC->Trk();
|
708 |
|
|
if (!t)
|
709 |
|
|
printf("no t\n");
|
710 |
bendavid |
1.4 |
if (t->MCPart())
|
711 |
|
|
hSimMatchedMinElectronSimPt->Fill(t->MCPart()->Pt());
|
712 |
bendavid |
1.2 |
hSimMatchedMinElectronPt->Fill(minElectronPt);
|
713 |
bendavid |
1.1 |
}
|
714 |
bendavid |
1.2 |
}
|
715 |
bendavid |
1.1 |
}
|
716 |
bendavid |
1.2 |
}
|
717 |
|
|
|
718 |
bendavid |
1.4 |
//printf("Good conversions only\n");
|
719 |
bendavid |
1.2 |
if ( !failed.NBitsSet() ) {
|
720 |
|
|
goodConversions.Add(c);
|
721 |
|
|
++nConversions;
|
722 |
|
|
//fill photon histograms
|
723 |
|
|
hConversionZ->Fill(c->Position().Z());
|
724 |
|
|
hConvDCotTheta->Fill(DCotTheta(c));
|
725 |
|
|
hGammaMass->Fill(c->Mass());
|
726 |
|
|
|
727 |
bendavid |
1.4 |
//LoadBranch(fTrkElectronName);
|
728 |
|
|
fTrkElectrons = new ElectronOArr;
|
729 |
bendavid |
1.2 |
const SuperCluster* cluster1 = static_cast<const ChargedParticle*>(c->Daughter(0))->Trk()->SCluster();
|
730 |
|
|
const SuperCluster* cluster2 = static_cast<const ChargedParticle*>(c->Daughter(1))->Trk()->SCluster();
|
731 |
|
|
for (UInt_t j=0; j<c->NDaughters(); ++j) {
|
732 |
|
|
const ChargedParticle* dc = dynamic_cast<const ChargedParticle*>(c->Daughter(j));
|
733 |
bendavid |
1.3 |
const Electron *e = MatchingElectron(dc,fTrkElectrons);
|
734 |
bendavid |
1.2 |
if (e) {
|
735 |
|
|
//printf("Matching Electron added\n");
|
736 |
|
|
if (cluster1 && cluster1!=cluster2)
|
737 |
|
|
if (!goodTwoClusterElectrons->HasObject(e))
|
738 |
|
|
goodTwoClusterElectrons->Add(e);
|
739 |
|
|
|
740 |
|
|
if ( !goodElectrons->HasObject(e) )
|
741 |
|
|
goodElectrons->Add(e);
|
742 |
|
|
}
|
743 |
bendavid |
1.1 |
}
|
744 |
bendavid |
1.2 |
|
745 |
|
|
if (simPhoton && !simFailed.NBitsSet() ) {
|
746 |
|
|
|
747 |
|
|
//if (c->Position().Rho() < fRhoMax)
|
748 |
|
|
hSimMatchedGammaMass->Fill(c->Mass());
|
749 |
|
|
hSimMatchedConvResolution->Fill(c->Position().Rho() - simPhoton->DecayVertex().Rho());
|
750 |
|
|
hSimMatchedConvPhiRes->Fill(c->Position().Phi() - simPhoton->DecayVertex().Phi());
|
751 |
|
|
|
752 |
bendavid |
1.1 |
for (UInt_t j=0; j<c->NDaughters(); ++j) {
|
753 |
|
|
const Particle* d = c->Daughter(j);
|
754 |
|
|
const ChargedParticle* dc = dynamic_cast<const ChargedParticle*>(d);
|
755 |
|
|
if (dc) {
|
756 |
|
|
const Track* t = dc->Trk();
|
757 |
bendavid |
1.2 |
hSimMatchedTrackD0->Fill(t->D0());
|
758 |
bendavid |
1.1 |
}
|
759 |
|
|
}
|
760 |
bendavid |
1.2 |
}
|
761 |
bendavid |
1.1 |
}
|
762 |
bendavid |
1.2 |
}
|
763 |
|
|
hNConversions->Fill(nConversions);
|
764 |
bendavid |
1.1 |
|
765 |
bendavid |
1.2 |
//Fill bad electron collection (all electrons, but with good electrons from conversions removed)
|
766 |
bendavid |
1.4 |
//LoadBranch(fElectronName);
|
767 |
|
|
fElectrons = new ElectronOArr;
|
768 |
bendavid |
1.2 |
for (UInt_t i = 0; i<fElectrons->GetEntries(); ++i) {
|
769 |
bendavid |
1.3 |
const Electron *e = fElectrons->At(i);
|
770 |
bendavid |
1.2 |
const Electron *goodElectronMatch = MatchingElectron(e,goodElectrons);
|
771 |
|
|
if (!goodElectronMatch)
|
772 |
|
|
badElectrons->Add(e);
|
773 |
bendavid |
1.1 |
}
|
774 |
bendavid |
1.2 |
|
775 |
|
|
AddObjThisEvt(goodElectrons, fGoodElectronsName.Data());
|
776 |
bendavid |
1.3 |
AddObjThisEvt(goodTwoClusterElectrons, fGoodTwoClusterElectronsName.Data());
|
777 |
bendavid |
1.2 |
AddObjThisEvt(badElectrons, fBadElectronsName.Data());
|
778 |
bendavid |
1.1 |
|
779 |
|
|
// LoadBranch(fPhotonName);
|
780 |
|
|
for (UInt_t i=0; i<goodConversions.GetEntries(); i++) {
|
781 |
bendavid |
1.3 |
const DecayParticle *conv1 = goodConversions.At(i);
|
782 |
bendavid |
1.1 |
for (UInt_t j=i+1; j<goodConversions.GetEntries(); j++) {
|
783 |
|
|
DecayParticle *conv2 = goodConversions.At(j);
|
784 |
|
|
if (!conv2->HasCommonDaughter(conv1)) {
|
785 |
|
|
CompositeParticle pi0;
|
786 |
|
|
pi0.AddDaughter(conv1);
|
787 |
|
|
pi0.AddDaughter(conv2);
|
788 |
|
|
hDoubleConvMass->Fill(pi0.Mass());
|
789 |
|
|
}
|
790 |
|
|
}
|
791 |
|
|
// for (UInt_t j=0; j<fPhotons->GetEntries(); j++) {
|
792 |
|
|
// Photon *photon = fPhotons->At(j);
|
793 |
|
|
// if (PassPhotonCuts(photon)) {
|
794 |
|
|
// CompositeParticle pi0;
|
795 |
|
|
// pi0.AddDaughter(conv1);
|
796 |
|
|
// pi0.AddDaughter(photon);
|
797 |
|
|
// hConvGammaMass->Fill(pi0.Mass());
|
798 |
|
|
// }
|
799 |
|
|
// }
|
800 |
|
|
}
|
801 |
|
|
|
802 |
|
|
}
|
803 |
|
|
|
804 |
|
|
//__________________________________________________________________________________________________
|
805 |
|
|
void MvfConversions::SlaveTerminate()
|
806 |
|
|
{
|
807 |
|
|
// Run finishing code on the computer (slave) that did the analysis. For this module, we dont do
|
808 |
|
|
// anything here.
|
809 |
|
|
}
|
810 |
|
|
|
811 |
|
|
//__________________________________________________________________________________________________
|
812 |
|
|
void MvfConversions::Terminate()
|
813 |
|
|
{
|
814 |
|
|
|
815 |
|
|
fTimer.Stop();
|
816 |
|
|
printf("Total Analysis Time = %f\n",fTimer.CpuTime());
|
817 |
|
|
|
818 |
|
|
|
819 |
|
|
TCanvas* c1 = new TCanvas();
|
820 |
|
|
hConversionRadius->Draw();
|
821 |
|
|
|
822 |
|
|
TCanvas* c2 = new TCanvas();
|
823 |
|
|
hConversionRPhi->Draw("col");
|
824 |
|
|
//c2->SetLogz();
|
825 |
|
|
|
826 |
|
|
// Run finishing code on the client computer. For this module, we dont do anything here.
|
827 |
|
|
}
|
828 |
|
|
|
829 |
bendavid |
1.2 |
BitMask16 MvfConversions::FailedCuts(const DecayParticle* c) {
|
830 |
bendavid |
1.1 |
|
831 |
|
|
|
832 |
|
|
//if (p->GetVertex()->Prob() < 0.005)
|
833 |
|
|
// return false;
|
834 |
|
|
UInt_t nFailed = 0;
|
835 |
|
|
|
836 |
bendavid |
1.2 |
BitMask16 failed;
|
837 |
|
|
|
838 |
bendavid |
1.1 |
if ( c->NDaughters() != 2)
|
839 |
bendavid |
1.2 |
failed.SetBit(eNDaughters);
|
840 |
bendavid |
1.1 |
|
841 |
|
|
if ( c->Pt() < fPtMin )
|
842 |
bendavid |
1.2 |
failed.SetBit(ePt);
|
843 |
bendavid |
1.1 |
|
844 |
|
|
if ( !PassRho(c->Position().Rho()) )
|
845 |
bendavid |
1.2 |
failed.SetBit(eRho);
|
846 |
bendavid |
1.1 |
|
847 |
|
|
if ( TMath::Abs(c->Eta()) > fEtaMax )
|
848 |
bendavid |
1.2 |
failed.SetBit(eEta);
|
849 |
bendavid |
1.1 |
|
850 |
|
|
if ( c->Lxy() < fLxyMin || c->Lz() < fLzMin )
|
851 |
bendavid |
1.2 |
failed.SetBit(eL);
|
852 |
|
|
|
853 |
bendavid |
1.1 |
if ( TMath::Abs(c->Dxy()) > fAbsDxyMax )
|
854 |
bendavid |
1.2 |
failed.SetBit(eDxy);
|
855 |
|
|
|
856 |
bendavid |
1.1 |
if ( c->Charge() != 0 )
|
857 |
bendavid |
1.2 |
failed.SetBit(eCharge);
|
858 |
|
|
|
859 |
bendavid |
1.1 |
Bool_t failedElectrons=false;
|
860 |
|
|
for (UInt_t i=0; i<c->NDaughters(); ++i) {
|
861 |
|
|
const DaughterData* d = c->DaughterDat(i);
|
862 |
bendavid |
1.4 |
Bool_t trackQuality = ( i==0 || !fTrackQualityFirstOnly );
|
863 |
|
|
BitMask16 failedElectronCuts = FailedElectronCuts(d, trackQuality);
|
864 |
bendavid |
1.2 |
if (failedElectronCuts.NBitsSet())
|
865 |
bendavid |
1.1 |
failedElectrons=true;
|
866 |
|
|
}
|
867 |
|
|
if (failedElectrons)
|
868 |
bendavid |
1.2 |
failed.SetBit(eDaughters);
|
869 |
bendavid |
1.1 |
|
870 |
|
|
if ( c->Prob() < fProbMin )
|
871 |
bendavid |
1.2 |
failed.SetBit(eProb);
|
872 |
bendavid |
1.1 |
|
873 |
bendavid |
1.2 |
return failed;
|
874 |
bendavid |
1.1 |
// LoadBranch(fMvfConvUnconstrainedName);
|
875 |
|
|
// const DecayParticle *unconstrained = MatchingConversion(c, fMvfConversionsUnconstrained);
|
876 |
|
|
//
|
877 |
|
|
// if (!unconstrained)
|
878 |
|
|
// nFailed++;
|
879 |
|
|
//
|
880 |
|
|
// if ( TwoPionMass(unconstrained) > 0.4 )
|
881 |
|
|
// nFailed++;
|
882 |
|
|
//hConvDCotTheta->Fill(dCotTheta);
|
883 |
|
|
|
884 |
|
|
}
|
885 |
|
|
|
886 |
|
|
Bool_t MvfConversions::PassConvCuts(const Conversion* p) {
|
887 |
|
|
if (p->NDaughters() != 2)
|
888 |
|
|
return false;
|
889 |
|
|
|
890 |
bendavid |
1.4 |
Double_t convRadius = p->DecayVertex().Position().Rho();
|
891 |
bendavid |
1.1 |
if (convRadius < 2.0)
|
892 |
|
|
//if (convRadius < 2.0 || convRadius > 20.0)
|
893 |
|
|
//if (convRadius < 20.0)
|
894 |
|
|
return false;
|
895 |
|
|
|
896 |
|
|
const Electron* pElectron1 = (Electron*)p->Daughter(0);
|
897 |
|
|
const Electron* pElectron2 = (Electron*)p->Daughter(1);
|
898 |
|
|
|
899 |
|
|
|
900 |
|
|
//Double_t deltaPhi = TMath::ACos((pElectron1->Px()*pElectron2->Px() + pElectron1->Py()*pElectron2->Py() + pElectron1->Pz()*pElectron2->Pz())/(pElectron1->Mom().P()*pElectron2->Mom().P()));
|
901 |
|
|
|
902 |
|
|
//if (deltaPhi>0.5)
|
903 |
|
|
// return false;
|
904 |
|
|
// if (fabs(p->DCotTheta())>0.2)
|
905 |
|
|
if (fabs(p->DCotTheta())>0.75)
|
906 |
|
|
return false;
|
907 |
|
|
|
908 |
|
|
if (p->Charge()!=0)
|
909 |
|
|
return false;
|
910 |
|
|
|
911 |
|
|
|
912 |
|
|
/* for (Int_t i=0; i<p->NDaughters(); i++) {
|
913 |
|
|
const Electron* e = p->Daughter(i);
|
914 |
|
|
if (!PassElectronCuts(e))
|
915 |
|
|
return false;
|
916 |
|
|
} */
|
917 |
|
|
//if (p->Mass()<0.6)
|
918 |
|
|
// return false;
|
919 |
|
|
|
920 |
|
|
//if (p->GetVertex().Prob() < 0.2)// || p->GetVertex().Prob() > 0.9)
|
921 |
|
|
// return false;
|
922 |
|
|
|
923 |
|
|
return true;
|
924 |
|
|
}
|
925 |
|
|
|
926 |
bendavid |
1.4 |
BitMask16 MvfConversions::FailedElectronCuts(const DaughterData* d, Bool_t trackQuality) {
|
927 |
bendavid |
1.1 |
//if (p->Pt() < 5.0)
|
928 |
|
|
// return false;
|
929 |
|
|
|
930 |
bendavid |
1.2 |
BitMask16 failed;
|
931 |
|
|
|
932 |
bendavid |
1.1 |
if (d->Pt() < fElectronPtMin)
|
933 |
bendavid |
1.2 |
failed.SetBit(eEPt);
|
934 |
bendavid |
1.1 |
|
935 |
|
|
if (TMath::Abs(d->Eta()) > fElectronEtaMax)
|
936 |
bendavid |
1.2 |
failed.SetBit(eEEta);
|
937 |
bendavid |
1.1 |
|
938 |
|
|
const StableData *s = dynamic_cast<const StableData*>(d);
|
939 |
|
|
|
940 |
|
|
if (!s)
|
941 |
bendavid |
1.2 |
Fatal("FailedElectronCuts", "DaughterData not a StableData");
|
942 |
bendavid |
1.1 |
|
943 |
|
|
const ChargedParticle* c = dynamic_cast<const ChargedParticle*>(s->Original());
|
944 |
|
|
|
945 |
|
|
if (!c)
|
946 |
bendavid |
1.2 |
Fatal("FailedElectronCuts", "Daughter not a ChargedParticle");
|
947 |
bendavid |
1.1 |
|
948 |
|
|
const Track* t = c->Trk();
|
949 |
bendavid |
1.2 |
|
950 |
|
|
if (!t)
|
951 |
|
|
Fatal("FailedElectronCuts", "Daughter has no track");
|
952 |
bendavid |
1.1 |
|
953 |
bendavid |
1.2 |
if (s->NMissedHits() > fMissedHitsMax)
|
954 |
|
|
failed.SetBit(eEMissedHits);
|
955 |
|
|
|
956 |
|
|
if (s->NWrongHits() > fWrongHitsMax)
|
957 |
|
|
failed.SetBit(eEWrongHits);
|
958 |
|
|
|
959 |
bendavid |
1.4 |
if (trackQuality && t->NHits()<fNHitsMin)
|
960 |
bendavid |
1.2 |
failed.SetBit(eENHits);
|
961 |
|
|
|
962 |
bendavid |
1.4 |
if (trackQuality && t->Prob()<fTrackProbMin)
|
963 |
bendavid |
1.2 |
failed.SetBit(eEProb);
|
964 |
bendavid |
1.1 |
|
965 |
bendavid |
1.4 |
if (trackQuality && fExcludePXB1 && t->Hit(Track::PXB1))
|
966 |
bendavid |
1.2 |
failed.SetBit(eEPxb1);
|
967 |
|
|
|
968 |
|
|
return failed;
|
969 |
bendavid |
1.1 |
}
|
970 |
|
|
|
971 |
|
|
Bool_t MvfConversions::PassTrackCuts(const Track* t) {
|
972 |
|
|
|
973 |
|
|
// if ( t->Prob()<fTrackProbMin && t->NHits()<fNHitsMin )
|
974 |
|
|
|
975 |
|
|
// if (t->NStereoHits() < 2)
|
976 |
|
|
// return false;
|
977 |
|
|
|
978 |
bendavid |
1.2 |
return false;
|
979 |
bendavid |
1.1 |
|
980 |
|
|
}
|
981 |
|
|
|
982 |
bendavid |
1.2 |
BitMask16 MvfConversions::FailedSimCuts(const MCParticle* p) {
|
983 |
bendavid |
1.1 |
|
984 |
bendavid |
1.2 |
BitMask16 failed;
|
985 |
bendavid |
1.1 |
|
986 |
|
|
if (p->PdgId()!=22)
|
987 |
bendavid |
1.2 |
failed.SetBit(eSimPdg);
|
988 |
bendavid |
1.1 |
if (TMath::Abs(p->Eta())>fEtaMax)
|
989 |
bendavid |
1.2 |
failed.SetBit(eSimEta);
|
990 |
bendavid |
1.1 |
//if (p->Pt()<5.0 || p->Pt()>25.0)
|
991 |
|
|
//if (p->Pt()<25.0)
|
992 |
|
|
if (p->Pt()<fPtMin)
|
993 |
bendavid |
1.2 |
failed.SetBit(eSimPt);
|
994 |
bendavid |
1.1 |
|
995 |
|
|
Double_t simRad = p->DecayVertex().Rho();
|
996 |
|
|
//if (simRad<2.0 || simRad>128.0)
|
997 |
|
|
//if (simRad<2.0 || simRad>20.0)
|
998 |
|
|
//if (simRad<20.0 || simRad>128.0)
|
999 |
|
|
if ( !PassRho(simRad) )
|
1000 |
bendavid |
1.2 |
failed.SetBit(eSimRho);
|
1001 |
bendavid |
1.1 |
|
1002 |
|
|
Int_t nEPlus = 0;
|
1003 |
|
|
Int_t nEMinus = 0;
|
1004 |
|
|
Bool_t failedElectronPt=false;
|
1005 |
|
|
Bool_t failedElectronEta=false;
|
1006 |
|
|
for (UInt_t j=0; j<p->NDaughters(); j++) {
|
1007 |
|
|
const MCParticle* pDaughter = p->Daughter(j);
|
1008 |
|
|
if (pDaughter->PdgId()==11)
|
1009 |
|
|
nEPlus++;
|
1010 |
|
|
if (pDaughter->PdgId()==-11)
|
1011 |
|
|
nEMinus++;
|
1012 |
|
|
if (TMath::Abs(pDaughter->PdgId())==11) {
|
1013 |
|
|
if (pDaughter->Pt() < fElectronPtMin)
|
1014 |
|
|
failedElectronPt = true;
|
1015 |
|
|
if (TMath::Abs(pDaughter->Eta()) > fElectronEtaMax)
|
1016 |
|
|
failedElectronEta=true;
|
1017 |
|
|
}
|
1018 |
|
|
}
|
1019 |
|
|
if (failedElectronPt)
|
1020 |
bendavid |
1.2 |
failed.SetBit(eSimElectronPt);
|
1021 |
bendavid |
1.1 |
if (failedElectronEta)
|
1022 |
bendavid |
1.2 |
failed.SetBit(eSimElectronEta);
|
1023 |
bendavid |
1.1 |
|
1024 |
|
|
if (nEPlus!=1 || nEMinus!=1)
|
1025 |
bendavid |
1.2 |
failed.SetBit(eSimDaughters);
|
1026 |
bendavid |
1.1 |
|
1027 |
bendavid |
1.4 |
//get rid of all conversions which either don't produce a clean electron, or which
|
1028 |
|
|
//were produced from a real primary electron
|
1029 |
|
|
//if (fRequireCleanElectron && ( !ElectronMatch(p) || GenElectronMatch(p) ) )
|
1030 |
|
|
if (fRequireCleanElectron && !ElectronMatch(p))
|
1031 |
|
|
failed.SetBit(eCleanElectron);
|
1032 |
|
|
|
1033 |
bendavid |
1.2 |
return failed;
|
1034 |
bendavid |
1.1 |
}
|
1035 |
|
|
|
1036 |
bendavid |
1.4 |
const Electron* MvfConversions::ElectronMatch(const MCParticle *p) {
|
1037 |
|
|
// if (p->HasMother(22))
|
1038 |
|
|
// return 0;
|
1039 |
|
|
const Electron *eMatch = 0;
|
1040 |
|
|
if (fHitBasedMatching) {
|
1041 |
|
|
for (UInt_t i=0; i<fCleanElectrons->GetEntries(); ++i) {
|
1042 |
|
|
const Electron *e = fCleanElectrons->At(i);
|
1043 |
|
|
const MCParticle *ep = e->Trk()->MCPart();
|
1044 |
|
|
if ( ep && ep->DistinctMother()==p)
|
1045 |
|
|
return e;
|
1046 |
|
|
}
|
1047 |
|
|
}
|
1048 |
|
|
else {
|
1049 |
|
|
Double_t minDeltaR = 0.3;
|
1050 |
|
|
for (UInt_t i=0; i<fCleanElectrons->GetEntries(); ++i) {
|
1051 |
|
|
const Electron *e = fCleanElectrons->At(i);
|
1052 |
|
|
Double_t deltaR = MathUtils::DeltaR(*e,*p);
|
1053 |
|
|
if (deltaR < minDeltaR) {
|
1054 |
|
|
minDeltaR = deltaR;
|
1055 |
|
|
eMatch = e;
|
1056 |
|
|
}
|
1057 |
|
|
}
|
1058 |
|
|
}
|
1059 |
|
|
|
1060 |
|
|
return eMatch;
|
1061 |
|
|
|
1062 |
|
|
}
|
1063 |
|
|
|
1064 |
|
|
const MCParticle* MvfConversions::GenElectronMatch(const MCParticle *p) {
|
1065 |
|
|
const MCParticle *mother = p;
|
1066 |
|
|
while (p) {
|
1067 |
|
|
if ( p->AbsPdgId()==11 && p->IsGenerated() )
|
1068 |
|
|
return p;
|
1069 |
|
|
else
|
1070 |
|
|
p = p->Mother();
|
1071 |
|
|
}
|
1072 |
|
|
return 0;
|
1073 |
|
|
}
|
1074 |
|
|
|
1075 |
bendavid |
1.1 |
const MCParticle* MvfConversions::SimMatch(const DecayParticle* p) {
|
1076 |
|
|
if ( p->NDaughters()!=2 )
|
1077 |
|
|
return 0;
|
1078 |
|
|
|
1079 |
|
|
const ChargedParticle *electron1 = dynamic_cast<const ChargedParticle*>(p->Daughter(0));
|
1080 |
|
|
const ChargedParticle *electron2 = dynamic_cast<const ChargedParticle*>(p->Daughter(1));
|
1081 |
|
|
|
1082 |
|
|
if (!electron1 || !electron2)
|
1083 |
|
|
return 0;
|
1084 |
|
|
|
1085 |
bendavid |
1.4 |
const MCParticle *simElectron1 = 0;
|
1086 |
|
|
const MCParticle *simElectron2 = 0;
|
1087 |
|
|
if (fHitBasedMatching) {
|
1088 |
|
|
simElectron1 = electron1->Trk()->MCPart();
|
1089 |
|
|
simElectron2 = electron2->Trk()->MCPart();
|
1090 |
|
|
}
|
1091 |
|
|
else {
|
1092 |
|
|
LoadBranch(fMCPartName);
|
1093 |
|
|
for (UInt_t i=0; i<fMCParticles->GetEntries(); ++i) {
|
1094 |
|
|
const MCParticle *mcp = fMCParticles->At(i);
|
1095 |
|
|
if (mcp->PdgId()==22 && mcp->DecayVertex().Rho()<80.0 && MathUtils::DeltaR(*mcp,*p) < 0.3)
|
1096 |
|
|
return mcp;
|
1097 |
|
|
}
|
1098 |
|
|
return 0;
|
1099 |
|
|
}
|
1100 |
|
|
|
1101 |
bendavid |
1.1 |
if (simElectron1) {
|
1102 |
|
|
hTrackSimMatchType->Fill(simElectron1->PdgId());
|
1103 |
|
|
if (simElectron1->HasMother())
|
1104 |
|
|
hParentSimMatchType->Fill(simElectron1->Mother()->PdgId());
|
1105 |
|
|
}
|
1106 |
|
|
|
1107 |
|
|
if (simElectron2) {
|
1108 |
|
|
hTrackSimMatchType->Fill(simElectron2->PdgId());
|
1109 |
|
|
if (simElectron2->HasMother())
|
1110 |
|
|
hParentSimMatchType->Fill(simElectron2->Mother()->PdgId());
|
1111 |
|
|
}
|
1112 |
|
|
|
1113 |
|
|
|
1114 |
|
|
if (!simElectron1) {
|
1115 |
|
|
const Track *t = electron1->Trk();
|
1116 |
|
|
hUnMatchedTrackChi2->Fill(t->Chi2()/((Double_t)t->Ndof()));
|
1117 |
|
|
hUnMatchedTrackProb->Fill(t->Prob());
|
1118 |
|
|
hUnMatchedTrackNHits->Fill(t->NHits());
|
1119 |
|
|
hUnMatchedTrackNHitsProb->Fill(t->NHits(),t->RChi2());
|
1120 |
|
|
hUnMatchedTrackD0->Fill(t->D0());
|
1121 |
|
|
}
|
1122 |
|
|
|
1123 |
|
|
if (!simElectron2) {
|
1124 |
|
|
const Track *t = electron2->Trk();
|
1125 |
|
|
hUnMatchedTrackChi2->Fill(t->Chi2()/((Double_t)t->Ndof()));
|
1126 |
|
|
hUnMatchedTrackProb->Fill(t->Prob());
|
1127 |
|
|
hUnMatchedTrackNHits->Fill(t->NHits());
|
1128 |
|
|
hUnMatchedTrackNHitsProb->Fill(t->NHits(),t->RChi2());
|
1129 |
|
|
hUnMatchedTrackD0->Fill(t->D0());
|
1130 |
|
|
}
|
1131 |
|
|
|
1132 |
|
|
if (!simElectron1 || !simElectron2) {
|
1133 |
|
|
//printf("unmatched electron\n");
|
1134 |
|
|
return 0;
|
1135 |
|
|
}
|
1136 |
|
|
|
1137 |
|
|
|
1138 |
|
|
if ( TMath::Abs(simElectron1->PdgId())!=11 || TMath::Abs(simElectron2->PdgId())!=11 ) {
|
1139 |
|
|
//printf("not electrons\n");
|
1140 |
|
|
return 0;
|
1141 |
|
|
}
|
1142 |
|
|
|
1143 |
|
|
const MCParticle *simPhoton = simElectron1->DistinctMother();
|
1144 |
|
|
|
1145 |
|
|
if (!simPhoton) {
|
1146 |
|
|
// printf("no photon\n");
|
1147 |
|
|
// hParentSimMatchType->Fill(0);
|
1148 |
|
|
return 0;
|
1149 |
|
|
}
|
1150 |
|
|
|
1151 |
|
|
if (simElectron2->DistinctMother()!=simPhoton) {
|
1152 |
|
|
//printf("different mothers\n");
|
1153 |
|
|
// hParentSimMatchType->Fill(0);
|
1154 |
|
|
return 0;
|
1155 |
|
|
}
|
1156 |
|
|
|
1157 |
|
|
if (simPhoton->PdgId()!=22) {
|
1158 |
|
|
//printf("not a photon\n");
|
1159 |
|
|
return 0;
|
1160 |
|
|
}
|
1161 |
|
|
|
1162 |
|
|
// printf("found common mother with pdg=%i, daughter pdgs: %i, %i\n", simPhoton->PdgId(), simElectron1->PdgId(),simElectron2->PdgId());
|
1163 |
|
|
|
1164 |
|
|
// hParentSimMatchType->Fill(simPhoton->PdgId());
|
1165 |
|
|
|
1166 |
|
|
return simPhoton;
|
1167 |
|
|
|
1168 |
|
|
|
1169 |
|
|
}
|
1170 |
|
|
|
1171 |
bendavid |
1.4 |
const MCParticle* MvfConversions::SimMatch(const Track* t) {
|
1172 |
|
|
|
1173 |
|
|
const MCParticle *simElectron1 = 0;
|
1174 |
|
|
//const MCParticle *simElectron2 = 0;
|
1175 |
|
|
if (fHitBasedMatching) {
|
1176 |
|
|
simElectron1 = t->MCPart();
|
1177 |
|
|
}
|
1178 |
|
|
else {
|
1179 |
|
|
LoadBranch(fMCPartName);
|
1180 |
|
|
//Double_t minDeltaR = 999.9;
|
1181 |
|
|
for (UInt_t i=0; i<fMCParticles->GetEntries(); ++i) {
|
1182 |
|
|
const MCParticle *p = fMCParticles->At(i);
|
1183 |
|
|
if (p->PdgId()==22 && p->DecayVertex().Rho()<80.0 && MathUtils::DeltaR(*p,*t) < 0.3)
|
1184 |
|
|
return p;
|
1185 |
|
|
}
|
1186 |
|
|
}
|
1187 |
|
|
|
1188 |
|
|
if (!simElectron1) {
|
1189 |
|
|
//printf("unmatched electron\n");
|
1190 |
|
|
return 0;
|
1191 |
|
|
}
|
1192 |
|
|
|
1193 |
|
|
|
1194 |
|
|
if ( TMath::Abs(simElectron1->PdgId())!=11 ) {
|
1195 |
|
|
//printf("not electrons\n");
|
1196 |
|
|
return 0;
|
1197 |
|
|
}
|
1198 |
|
|
|
1199 |
|
|
const MCParticle *simPhoton = simElectron1->DistinctMother();
|
1200 |
|
|
|
1201 |
|
|
if (!simPhoton) {
|
1202 |
|
|
// printf("no photon\n");
|
1203 |
|
|
// hParentSimMatchType->Fill(0);
|
1204 |
|
|
return 0;
|
1205 |
|
|
}
|
1206 |
|
|
|
1207 |
|
|
if (simPhoton->PdgId()!=22) {
|
1208 |
|
|
//printf("not a photon\n");
|
1209 |
|
|
return 0;
|
1210 |
|
|
}
|
1211 |
|
|
|
1212 |
|
|
// printf("found common mother with pdg=%i, daughter pdgs: %i, %i\n", simPhoton->PdgId(), simElectron1->PdgId(),simElectron2->PdgId());
|
1213 |
|
|
|
1214 |
|
|
// hParentSimMatchType->Fill(simPhoton->PdgId());
|
1215 |
|
|
|
1216 |
|
|
return simPhoton;
|
1217 |
|
|
|
1218 |
|
|
|
1219 |
|
|
}
|
1220 |
|
|
|
1221 |
bendavid |
1.1 |
UInt_t MvfConversions::NTracks(const TrackCol *col)
|
1222 |
|
|
{
|
1223 |
|
|
UInt_t ntracks=0;
|
1224 |
|
|
for (UInt_t i=0; i<col->GetEntries(); ++i) {
|
1225 |
|
|
const Track *t = col->At(i);
|
1226 |
|
|
if ( PassTrackCuts(t) )
|
1227 |
|
|
ntracks++;
|
1228 |
|
|
}
|
1229 |
|
|
|
1230 |
|
|
return ntracks;
|
1231 |
|
|
}
|
1232 |
|
|
|
1233 |
bendavid |
1.2 |
// Double_t MvfConversions::TrackPtIsolation(const DecayParticle *p, Double_t r)
|
1234 |
|
|
// {
|
1235 |
|
|
// TObjArray conversionTracks;
|
1236 |
|
|
// for (UInt_t i=0; i<p->NDaughters(); ++i) {
|
1237 |
|
|
// const ChargedParticle* d = dynamic_cast<const ChargedParticle*>(p->Daughter(i));
|
1238 |
|
|
// if (d) {
|
1239 |
|
|
// const Track *t = d->Trk();
|
1240 |
|
|
// if (t)
|
1241 |
|
|
// conversionTracks.Add((TObject*)t);
|
1242 |
|
|
// }
|
1243 |
|
|
// }
|
1244 |
|
|
//
|
1245 |
|
|
//
|
1246 |
|
|
// LoadBranch(fTrackName);
|
1247 |
|
|
// Double_t sumPt=0.0;
|
1248 |
|
|
// for (UInt_t i=0; i<fTracks->GetEntries(); ++i) {
|
1249 |
|
|
// const Track *t = fTracks->At(i);
|
1250 |
|
|
// if (conversionTracks.IndexOf(t)==-1) {
|
1251 |
|
|
// Double_t deltaR = MathUtils::DeltaR(p->Phi(),p->Eta(),t->Phi(),t->Eta());
|
1252 |
|
|
// if (deltaR<r)
|
1253 |
|
|
// sumPt = sumPt + 1.0;//sumPt += t->Pt();
|
1254 |
|
|
// }
|
1255 |
|
|
// }
|
1256 |
|
|
//
|
1257 |
|
|
// return sumPt;
|
1258 |
|
|
//
|
1259 |
|
|
// }
|
1260 |
bendavid |
1.1 |
|
1261 |
|
|
Bool_t MvfConversions::PassPhotonCuts(const Photon *p)
|
1262 |
|
|
{
|
1263 |
|
|
if (p->IsConverted())
|
1264 |
|
|
return false;
|
1265 |
|
|
|
1266 |
|
|
return true;
|
1267 |
|
|
}
|
1268 |
|
|
|
1269 |
|
|
Double_t MvfConversions::DCotTheta(const DecayParticle *c)
|
1270 |
|
|
{
|
1271 |
|
|
if (c->NDaughters()!=2)
|
1272 |
|
|
return 0.0;
|
1273 |
|
|
|
1274 |
|
|
Double_t theta1 = c->DaughterDat(0)->Theta();
|
1275 |
|
|
Double_t theta2 = c->DaughterDat(1)->Theta();
|
1276 |
|
|
|
1277 |
|
|
Double_t dCotTheta = 1./TMath::Tan(theta1) - 1./TMath::Tan(theta2);
|
1278 |
|
|
//Double_t dCotTheta = c->DaughterDat(0)->Pt() - c->DaughterDat(1)->Pt();
|
1279 |
|
|
|
1280 |
|
|
if (c->DaughterDat(0)->Charge()==1)
|
1281 |
|
|
return dCotTheta;
|
1282 |
|
|
else
|
1283 |
|
|
return (-dCotTheta);
|
1284 |
|
|
}
|
1285 |
|
|
|
1286 |
|
|
Double_t MvfConversions::DPhi(const DecayParticle *c)
|
1287 |
|
|
{
|
1288 |
|
|
if (c->NDaughters()!=2)
|
1289 |
|
|
return 0.0;
|
1290 |
|
|
|
1291 |
bendavid |
1.4 |
ThreeVectorC mom1 = ((const StableData*)c->DaughterDat(0))->ThreeMom();
|
1292 |
|
|
ThreeVectorC mom2 = ((const StableData*)c->DaughterDat(1))->ThreeMom();
|
1293 |
bendavid |
1.1 |
|
1294 |
|
|
Double_t dPhi = TMath::ACos(mom1.Dot(mom2)/(mom1.R()*mom2.R()));
|
1295 |
|
|
|
1296 |
|
|
return dPhi;
|
1297 |
|
|
}
|
1298 |
|
|
|
1299 |
|
|
Double_t MvfConversions::TwoPionMass(const DecayParticle *c)
|
1300 |
|
|
{
|
1301 |
|
|
if (c->NDaughters()!=2)
|
1302 |
|
|
return 0.0;
|
1303 |
|
|
|
1304 |
|
|
StableParticle *pi1 = new StableParticle(211, (Track*)((ChargedParticle*)c->Daughter(0))->Trk());
|
1305 |
|
|
StableParticle *pi2 = new StableParticle(211, (Track*)((ChargedParticle*)c->Daughter(1))->Trk());
|
1306 |
|
|
|
1307 |
|
|
StableData *pi1d = new StableData(pi1, ((StableData*)c->DaughterDat(0))->ThreeMom());
|
1308 |
|
|
StableData *pi2d = new StableData(pi2, ((StableData*)c->DaughterDat(1))->ThreeMom());
|
1309 |
|
|
|
1310 |
|
|
CompositeParticle *meson = new CompositeParticle();
|
1311 |
|
|
meson->AddDaughter(pi1d);
|
1312 |
|
|
meson->AddDaughter(pi2d);
|
1313 |
|
|
|
1314 |
|
|
Double_t mesonMass = meson->Mass();
|
1315 |
|
|
|
1316 |
|
|
delete meson;
|
1317 |
|
|
delete pi1d;
|
1318 |
|
|
delete pi2d;
|
1319 |
|
|
delete pi1;
|
1320 |
|
|
delete pi2;
|
1321 |
|
|
|
1322 |
|
|
return mesonMass;
|
1323 |
|
|
}
|
1324 |
|
|
|
1325 |
|
|
const DecayParticle *MvfConversions::MatchingConversion(const DecayParticle *c, const DecayParticleCol *col) const
|
1326 |
|
|
{
|
1327 |
|
|
for (UInt_t i=0; i<col->GetEntries(); ++i) {
|
1328 |
|
|
const DecayParticle *p = col->At(i);
|
1329 |
|
|
if ( p->HasSameDaughters(c) )
|
1330 |
|
|
return c;
|
1331 |
|
|
}
|
1332 |
|
|
|
1333 |
|
|
return 0;
|
1334 |
|
|
}
|
1335 |
|
|
|
1336 |
bendavid |
1.3 |
const Electron *MvfConversions::MatchingElectron(const ChargedParticle *c, const ElectronCol *col) const
|
1337 |
bendavid |
1.1 |
{
|
1338 |
|
|
for (UInt_t i=0; i<col->GetEntries(); ++i) {
|
1339 |
bendavid |
1.3 |
const Electron *e = col->At(i);
|
1340 |
bendavid |
1.2 |
|
1341 |
|
|
if ( c->Trk() == e->Trk() )
|
1342 |
|
|
return e;
|
1343 |
bendavid |
1.1 |
}
|
1344 |
|
|
|
1345 |
bendavid |
1.2 |
return 0;
|
1346 |
|
|
}
|
1347 |
|
|
|
1348 |
bendavid |
1.3 |
const Electron *MvfConversions::MatchingElectron(const Electron *ein, const ElectronCol *col) const
|
1349 |
bendavid |
1.2 |
{
|
1350 |
|
|
for (UInt_t i=0; i<col->GetEntries(); ++i) {
|
1351 |
bendavid |
1.3 |
const Electron *e = col->At(i);
|
1352 |
bendavid |
1.2 |
|
1353 |
|
|
if ( e->SCluster() == ein->SCluster() )
|
1354 |
|
|
return e;
|
1355 |
|
|
}
|
1356 |
|
|
|
1357 |
|
|
return 0;
|
1358 |
bendavid |
1.1 |
}
|
1359 |
|
|
|
1360 |
|
|
void MvfConversions::AddRhoRange(Double_t lower, Double_t upper)
|
1361 |
|
|
{
|
1362 |
|
|
fRhoLbs.push_back(lower);
|
1363 |
|
|
fRhoUbs.push_back(upper);
|
1364 |
|
|
}
|
1365 |
|
|
|
1366 |
|
|
Bool_t MvfConversions::PassRho(Double_t rho)
|
1367 |
|
|
{
|
1368 |
|
|
for (UInt_t i=0; i<fRhoLbs.size(); ++i) {
|
1369 |
|
|
if ( rho>fRhoLbs.at(i) && rho<fRhoUbs.at(i) )
|
1370 |
|
|
return true;
|
1371 |
|
|
}
|
1372 |
|
|
|
1373 |
|
|
return false;
|
1374 |
|
|
}
|