]>
Commit | Line | Data |
---|---|---|
bd092f0f | 1 | // $Id$ |
30159e6f | 2 | |
bd092f0f | 3 | #include "AliAnalysisTaskEMCALIsoPhoton.h" |
30159e6f | 4 | |
bd092f0f | 5 | #include <TCanvas.h> |
6 | #include <TChain.h> | |
7 | #include <TFile.h> | |
8 | #include <TH1F.h> | |
9 | #include <TH2F.h> | |
caaf99d3 | 10 | #include <TH3F.h> |
965c985f | 11 | #include <THnSparse.h> |
bd092f0f | 12 | #include <TLorentzVector.h> |
a62631a9 | 13 | #include <TList.h> |
bd092f0f | 14 | |
15 | #include "AliAnalysisManager.h" | |
16 | #include "AliAnalysisTask.h" | |
17 | #include "AliEMCALGeometry.h" | |
18 | #include "AliEMCALRecoUtils.h" | |
19 | #include "AliESDCaloCells.h" | |
20 | #include "AliESDCaloCluster.h" | |
30159e6f | 21 | #include "AliESDEvent.h" |
22 | #include "AliESDHeader.h" | |
30159e6f | 23 | #include "AliESDInputHandler.h" |
bd092f0f | 24 | #include "AliESDUtils.h" |
30159e6f | 25 | #include "AliESDtrack.h" |
26 | #include "AliESDtrackCuts.h" | |
2e20efe5 | 27 | #include "AliAODEvent.h" |
28 | #include "AliAODTrack.h" | |
bd092f0f | 29 | #include "AliMCEvent.h" |
30 | #include "AliMCEventHandler.h" | |
31 | #include "AliStack.h" | |
2e20efe5 | 32 | #include "AliVEvent.h" |
33 | #include "AliVTrack.h" | |
30159e6f | 34 | #include "AliV0vertexer.h" |
30159e6f | 35 | #include "AliVCluster.h" |
822c9944 | 36 | #include "AliOADBContainer.h" |
30159e6f | 37 | |
c2aad3ae | 38 | #include <iostream> |
39 | using std::cout; | |
40 | using std::endl; | |
41 | ||
30159e6f | 42 | ClassImp(AliAnalysisTaskEMCALIsoPhoton) |
43 | ||
44 | //________________________________________________________________________ | |
bd092f0f | 45 | AliAnalysisTaskEMCALIsoPhoton::AliAnalysisTaskEMCALIsoPhoton() : |
46 | AliAnalysisTaskSE(), | |
2e20efe5 | 47 | fESDClusters(0), |
48 | fAODClusters(0), | |
bd092f0f | 49 | fSelPrimTracks(0), |
3f4073ba | 50 | fTracks(0), |
2e20efe5 | 51 | fESDCells(0), |
52 | fAODCells(0), | |
bd092f0f | 53 | fPrTrCuts(0), |
54 | fGeom(0x0), | |
9148fa89 | 55 | fGeoName("EMCAL_COMPLETEV1"), |
4d4ce2d2 | 56 | fOADBContainer(0), |
9148fa89 | 57 | fPeriod("LHC11c"), |
58 | fTrigBit("kEMC7"), | |
59 | fIsTrain(0), | |
c7bb0b43 | 60 | fIsMc(0), |
ecd47673 | 61 | fDebug(0), |
f3843637 | 62 | fPathStrOpt("/"), |
9148fa89 | 63 | fExoticCut(0.97), |
64 | fIsoConeR(0.4), | |
965c985f | 65 | fNDimensions(7), |
66 | fECut(3.), | |
16a4050e | 67 | fTrackMult(0), |
f507c09b | 68 | fMcIdFamily(""), |
69 | fNClusForDirPho(0), | |
70 | fDirPhoPt(0), | |
f9e2362a | 71 | fHigherPtCone(0), |
26a8db0f | 72 | fImportGeometryFromFile(0), |
73 | fImportGeometryFilePath(""), | |
2b7205ad | 74 | fMaxPtTrack(0), |
75 | fMaxEClus(0), | |
112eb594 | 76 | fNCells50(0), |
bd092f0f | 77 | fESD(0), |
2e20efe5 | 78 | fAOD(0), |
c7bb0b43 | 79 | fMCEvent(0), |
80 | fStack(0), | |
bd092f0f | 81 | fOutputList(0), |
82 | fEvtSel(0), | |
0b21f686 | 83 | fNClusEt10(0), |
cc57d293 | 84 | fRecoPV(0), |
f507c09b | 85 | fPVtxZ(0), |
86 | fTrMultDist(0), | |
caaf99d3 | 87 | fMCDirPhotonPtEtaPhi(0), |
c7bb0b43 | 88 | fDecayPhotonPtMC(0), |
bd092f0f | 89 | fCellAbsIdVsAmpl(0), |
16a4050e | 90 | fNClusHighClusE(0), |
f9e2362a | 91 | fHigherPtConeM02(0), |
f507c09b | 92 | fClusEtMcPt(0), |
93 | fClusMcDetaDphi(0), | |
94 | fNClusPerPho(0), | |
f912f9a9 | 95 | fMcPtInConeBG(0), |
96 | fMcPtInConeSBG(0), | |
97 | fMcPtInConeBGnoUE(0), | |
98 | fMcPtInConeSBGnoUE(0), | |
81f2660f | 99 | fAllIsoEtMcGamma(0), |
100 | fAllIsoNoUeEtMcGamma(0), | |
092ceec8 | 101 | fMCDirPhotonPtEtaPhiNoClus(0), |
2b7205ad | 102 | fHnOutput(0), |
103 | fQAList(0), | |
104 | fNTracks(0), | |
105 | fEmcNCells(0), | |
106 | fEmcNClus(0), | |
107 | fEmcNClusCut(0), | |
108 | fNTracksECut(0), | |
109 | fEmcNCellsCut(0), | |
e4ba80ad | 110 | fEmcClusEPhi(0), |
111 | fEmcClusEPhiCut(0), | |
112 | fEmcClusEEta(0), | |
113 | fEmcClusEEtaCut(0), | |
114 | fTrackPtPhi(0), | |
115 | fTrackPtPhiCut(0), | |
116 | fTrackPtEta(0), | |
3ae97198 | 117 | fTrackPtEtaCut(0), |
118 | fMaxCellEPhi(0) | |
bd092f0f | 119 | { |
120 | // Default constructor. | |
26a8db0f | 121 | for(Int_t i = 0; i < 12; i++) fGeomMatrix[i] = 0; |
bd092f0f | 122 | } |
123 | ||
124 | //________________________________________________________________________ | |
125 | AliAnalysisTaskEMCALIsoPhoton::AliAnalysisTaskEMCALIsoPhoton(const char *name) : | |
126 | AliAnalysisTaskSE(name), | |
2e20efe5 | 127 | fESDClusters(0), |
128 | fAODClusters(0), | |
30159e6f | 129 | fSelPrimTracks(0), |
3f4073ba | 130 | fTracks(0), |
2e20efe5 | 131 | fESDCells(0), |
132 | fAODCells(0), | |
30159e6f | 133 | fPrTrCuts(0), |
134 | fGeom(0x0), | |
135 | fGeoName("EMCAL_COMPLETEV1"), | |
4d4ce2d2 | 136 | fOADBContainer(0), |
30159e6f | 137 | fPeriod("LHC11c"), |
751194e8 | 138 | fTrigBit("kEMC7"), |
30159e6f | 139 | fIsTrain(0), |
c7bb0b43 | 140 | fIsMc(0), |
ecd47673 | 141 | fDebug(0), |
f3843637 | 142 | fPathStrOpt("/"), |
30159e6f | 143 | fExoticCut(0.97), |
144 | fIsoConeR(0.4), | |
965c985f | 145 | fNDimensions(7), |
146 | fECut(3.), | |
16a4050e | 147 | fTrackMult(0), |
f507c09b | 148 | fMcIdFamily(""), |
149 | fNClusForDirPho(0), | |
150 | fDirPhoPt(0), | |
f9e2362a | 151 | fHigherPtCone(0), |
26a8db0f | 152 | fImportGeometryFromFile(0), |
153 | fImportGeometryFilePath(""), | |
2b7205ad | 154 | fMaxPtTrack(0), |
155 | fMaxEClus(0), | |
112eb594 | 156 | fNCells50(0), |
30159e6f | 157 | fESD(0), |
2e20efe5 | 158 | fAOD(0), |
c7bb0b43 | 159 | fMCEvent(0), |
160 | fStack(0), | |
30159e6f | 161 | fOutputList(0), |
30159e6f | 162 | fEvtSel(0), |
0b21f686 | 163 | fNClusEt10(0), |
cc57d293 | 164 | fRecoPV(0), |
bd092f0f | 165 | fPVtxZ(0), |
f507c09b | 166 | fTrMultDist(0), |
caaf99d3 | 167 | fMCDirPhotonPtEtaPhi(0), |
c7bb0b43 | 168 | fDecayPhotonPtMC(0), |
169 | fCellAbsIdVsAmpl(0), | |
bd092f0f | 170 | fNClusHighClusE(0), |
f9e2362a | 171 | fHigherPtConeM02(0), |
f507c09b | 172 | fClusEtMcPt(0), |
173 | fClusMcDetaDphi(0), | |
174 | fNClusPerPho(0), | |
f912f9a9 | 175 | fMcPtInConeBG(0), |
176 | fMcPtInConeSBG(0), | |
177 | fMcPtInConeBGnoUE(0), | |
178 | fMcPtInConeSBGnoUE(0), | |
81f2660f | 179 | fAllIsoEtMcGamma(0), |
180 | fAllIsoNoUeEtMcGamma(0), | |
092ceec8 | 181 | fMCDirPhotonPtEtaPhiNoClus(0), |
2b7205ad | 182 | fHnOutput(0), |
183 | fQAList(0), | |
184 | fNTracks(0), | |
185 | fEmcNCells(0), | |
186 | fEmcNClus(0), | |
187 | fEmcNClusCut(0), | |
188 | fNTracksECut(0), | |
189 | fEmcNCellsCut(0), | |
e4ba80ad | 190 | fEmcClusEPhi(0), |
191 | fEmcClusEPhiCut(0), | |
192 | fEmcClusEEta(0), | |
193 | fEmcClusEEtaCut(0), | |
194 | fTrackPtPhi(0), | |
195 | fTrackPtPhiCut(0), | |
196 | fTrackPtEta(0), | |
3ae97198 | 197 | fTrackPtEtaCut(0), |
198 | fMaxCellEPhi(0) | |
30159e6f | 199 | { |
200 | // Constructor | |
201 | ||
202 | // Define input and output slots here | |
203 | // Input slot #0 works with a TChain | |
204 | DefineInput(0, TChain::Class()); | |
205 | // Output slot #0 id reserved by the base class for AOD | |
206 | // Output slot #1 writes into a TH1 container | |
207 | DefineOutput(1, TList::Class()); | |
2b7205ad | 208 | DefineOutput(2, TList::Class()); |
30159e6f | 209 | } |
bd092f0f | 210 | |
30159e6f | 211 | //________________________________________________________________________ |
212 | void AliAnalysisTaskEMCALIsoPhoton::UserCreateOutputObjects() | |
213 | { | |
bd092f0f | 214 | // Create histograms, called once. |
30159e6f | 215 | |
2e20efe5 | 216 | fESDClusters = new TObjArray(); |
30159e6f | 217 | fSelPrimTracks = new TObjArray(); |
218 | ||
219 | ||
220 | fOutputList = new TList(); | |
a62631a9 | 221 | fOutputList->SetOwner();// Container cleans up all histos (avoids leaks in merging) |
30159e6f | 222 | |
f507c09b | 223 | fGeom = AliEMCALGeometry::GetInstance(fGeoName.Data()); |
4d4ce2d2 | 224 | fOADBContainer = new AliOADBContainer("AliEMCALgeo"); |
225 | fOADBContainer->InitFromFile(Form("$ALICE_ROOT/OADB/EMCAL/EMCALlocal2master.root"),"AliEMCALgeo"); | |
226 | ||
30159e6f | 227 | fEvtSel = new TH1F("hEvtSel","Event selection counter (0=all trg, 1=pvz cut) ;evt cut ;dN/dcut}",2,0,2); |
228 | fOutputList->Add(fEvtSel); | |
0b21f686 | 229 | |
230 | fNClusEt10 = new TH1F("hNClusEt10","# of cluster with E_{T}>10 per event;E;",101,-0.5,100.5); | |
231 | fOutputList->Add(fNClusEt10); | |
30159e6f | 232 | |
cc57d293 | 233 | fRecoPV = new TH1F("hRecoPV","Prim. vert. reconstruction (yes or no);reco (0=no, 1=yes) ;",2,-0.5,1.5); |
234 | fOutputList->Add(fRecoPV); | |
235 | ||
30159e6f | 236 | fPVtxZ = new TH1F("hPVtxZ","primary vertex Z before cut;prim-vz(cm) ;",200,-100,100); |
237 | fOutputList->Add(fPVtxZ); | |
c7bb0b43 | 238 | |
f507c09b | 239 | fTrMultDist = new TH1F("fTrMultDist","track multiplicity;tracks/event;#events",200,0.5,200.5); |
240 | fOutputList->Add(fTrMultDist); | |
241 | ||
c254c556 | 242 | fMCDirPhotonPtEtaPhi = new TH3F("hMCDirPhotonPtEtaPhi","photon (gq->#gammaq) p_{T}, #eta, #phi;GeV/c;#eta;#phi",101,-1.5,99.5,154,-0.77,0.77,130,1.38,3.20); |
caaf99d3 | 243 | fMCDirPhotonPtEtaPhi->Sumw2(); |
244 | fOutputList->Add(fMCDirPhotonPtEtaPhi); | |
c7bb0b43 | 245 | |
246 | fDecayPhotonPtMC = new TH1F("hDecayPhotonPtMC","decay photon p_{T};GeV/c;dN/dp_{T} (c GeV^{-1})",1000,0,100); | |
247 | fDecayPhotonPtMC->Sumw2(); | |
248 | fOutputList->Add(fDecayPhotonPtMC); | |
249 | ||
30159e6f | 250 | fCellAbsIdVsAmpl = new TH2F("hCellAbsIdVsAmpl","cell abs id vs cell amplitude (energy);E (GeV);ID",200,0,100,24*48*10,-0.5,24*48*10-0.5); |
a62631a9 | 251 | fOutputList->Add(fCellAbsIdVsAmpl); |
30159e6f | 252 | |
253 | fNClusHighClusE = new TH2F("hNClusHighClusE","total number of clusters vs. highest clus energy in the event;E (GeV);NClus",200,0,100,301,-0.5,300.5); | |
254 | fOutputList->Add(fNClusHighClusE); | |
255 | ||
f9e2362a | 256 | fHigherPtConeM02 = new TH2F("hHigherPtConeM02","#lambda_{0}^{2} vs. in-cone-p_{T}^{max};p_{T}^{max} (GeV/c, in the cone);#lambda_{0}^{2}",1000,0,100,400,0,4); |
257 | fOutputList->Add(fHigherPtConeM02); | |
258 | ||
f507c09b | 259 | fClusEtMcPt = new TH2F("hClusEtMcPt","E_{T}^{clus} vs. p_{T}^{mc}; p_{T}^{mc};E_{T}^{clus}",500,0,100,500,0,100); |
260 | fOutputList->Add(fClusEtMcPt); | |
261 | ||
262 | fClusMcDetaDphi = new TH2F("hClusMcDetaDphi","#Delta#phi vs. #Delta#eta (reco-mc);#Delta#eta;#Delta#phi",100,-.7,.7,100,-.7,.7); | |
263 | fOutputList->Add(fClusMcDetaDphi); | |
264 | ||
265 | fNClusPerPho = new TH2F("hNClusPerPho","Number of clusters per prompt photon;p_{T}^{MC};N_{clus}",500,0,100,11,-0.5,10.5); | |
266 | fOutputList->Add(fNClusPerPho); | |
267 | ||
d4f449df | 268 | fMcPtInConeBG = new TH2F("hMcPtInConeBG","#sum_{in-cone}p_{T}^{mc-primaries} vs. ISO^{TRK+EMC} (BG template);ISO^{TRK+EMC} (GeV);#sum_{in-cone}p_{T}^{mc-primaries}",600,-10,50,1000,0,100); |
f912f9a9 | 269 | fOutputList->Add(fMcPtInConeBG); |
270 | ||
d4f449df | 271 | fMcPtInConeSBG = new TH2F("hMcPtInConeSBG","#sum_{in-cone}p_{T}^{mc-primaries} vs. ISO^{TRK+EMC} (SBG range);ISO^{TRK+EMC} (GeV);#sum_{in-cone}p_{T}^{mc-primaries}",600,-10,50,1000,0,100); |
f912f9a9 | 272 | fOutputList->Add(fMcPtInConeSBG); |
273 | ||
d4f449df | 274 | fMcPtInConeBGnoUE = new TH2F("hMcPtInConeBGnoUE","#sum_{in-cone}p_{T}^{mc-primaries} vs. ISO^{TRK+EMC} (BG template);ISO^{TRK+EMC} (GeV);#sum_{in-cone}p_{T}^{mc-primaries}",600,-10,50,1000,0,100); |
f912f9a9 | 275 | fOutputList->Add(fMcPtInConeBGnoUE); |
276 | ||
d4f449df | 277 | fMcPtInConeSBGnoUE = new TH2F("hMcPtInConeSBGnoUE","#sum_{in-cone}p_{T}^{mc-primaries} vs. ISO^{TRK+EMC} (SBG range);ISO^{TRK+EMC} (GeV);#sum_{in-cone}p_{T}^{mc-primaries}",600,-10,50,1000,0,100); |
f912f9a9 | 278 | fOutputList->Add(fMcPtInConeSBGnoUE); |
279 | ||
81f2660f | 280 | fAllIsoEtMcGamma = new TH2F("hAllIsoEtMcGammaE","ISO^{TRK+EMC} vs. E_{T}^{clus} for clusters comming from a MC prompt #gamma; E_{T}^{clus} (GeV);ISO^{TRK+EMC} (GeV);",1000,0,100,600,-10,50); |
281 | fOutputList->Add(fAllIsoEtMcGamma); | |
282 | ||
283 | fAllIsoNoUeEtMcGamma = new TH2F("hAllIsoNoUeEtMcGammaE","ISO^{TRK+EMC}_{noue} vs. E_{T}^{clus} for clusters comming from a MC prompt #gamma; E_{T}^{clus} (GeV);ISO^{TRK+EMC}_{noue} (GeV);",1000,0,100,600,-10,50); | |
284 | fOutputList->Add(fAllIsoNoUeEtMcGamma); | |
285 | ||
f912f9a9 | 286 | |
092ceec8 | 287 | fMCDirPhotonPtEtaPhiNoClus = new TH3F("hMCDirPhotonPhiEtaNoClus","p_{T}, #eta and #phi of prompt photons with no reco clusters;p_{T};#eta;#phi",1000,0,100,154,-0.77,0.77,130,1.38,3.20); |
288 | fOutputList->Add(fMCDirPhotonPtEtaPhiNoClus); | |
f507c09b | 289 | |
84898d7b | 290 | Int_t nEt=1000, nM02=400, nCeIso=1000, nTrIso=1000, nAllIso=1000, nCeIsoNoUE=1000, nAllIsoNoUE=1000, nTrClDphi=200, nTrClDeta=100, nClEta=140, nClPhi=128, nTime=60, nMult=100, nPhoMcPt=100; |
f507c09b | 291 | Int_t bins[] = {nEt, nM02, nCeIso, nTrIso, nAllIso, nCeIsoNoUE, nAllIsoNoUE, nTrClDphi, nTrClDeta,nClEta,nClPhi,nTime,nMult,nPhoMcPt}; |
c1f18270 | 292 | fNDimensions = sizeof(bins)/sizeof(Int_t); |
293 | const Int_t ndims = fNDimensions; | |
84898d7b | 294 | Double_t xmin[] = { -0.5, 0., -10., -10., -10., -10., -10., -0.1,-0.05, -0.7, 1.4,-0.15e-06,-0.5,-0.5}; |
295 | Double_t xmax[] = { 99.5, 4., 190., 190., 190., 190., 190., 0.1, 0.05, 0.7, 3.192, 0.15e-06,99.5,99.5}; | |
80c98845 | 296 | if(fPeriod.Contains("11h")){ |
297 | xmax[12]=3999.5; | |
298 | } | |
f507c09b | 299 | fHnOutput = new THnSparseF("fHnOutput","Output matrix: E_{T},M02,CeIso,TrIso,AllIso, CeIsoNoUESub, AllIsoNoUESub, d#phi_{trk},d#eta_{trk},#eta_{clus},#phi_{clus},T_{max},mult,mc-p_{T}^{#gamma}", ndims, bins, xmin, xmax); |
965c985f | 300 | fOutputList->Add(fHnOutput); |
301 | ||
2b7205ad | 302 | //QA outputs |
303 | fQAList = new TList(); | |
304 | fQAList->SetOwner();// Container cleans up all histos (avoids leaks in merging) | |
965c985f | 305 | |
2b7205ad | 306 | fNTracks = new TH1F("hNTracks","# of selected tracks;n-tracks;counts",120,-0.5,119.5); |
307 | fNTracks->Sumw2(); | |
308 | fQAList->Add(fNTracks); | |
309 | ||
310 | fEmcNCells = new TH1F("fEmcNCells",";n/event;count",120,-0.5,119.5); | |
311 | fEmcNCells->Sumw2(); | |
312 | fQAList->Add(fEmcNCells); | |
313 | fEmcNClus = new TH1F("fEmcNClus",";n/event;count",120,-0.5,119.5); | |
314 | fEmcNClus->Sumw2(); | |
315 | fQAList->Add(fEmcNClus); | |
316 | fEmcNClusCut = new TH1F("fEmcNClusCut",";n/event;count",120,-0.5,119.5); | |
317 | fEmcNClusCut->Sumw2(); | |
318 | fQAList->Add(fEmcNClusCut); | |
319 | fNTracksECut = new TH1F("fNTracksECut",";n/event;count",120,-0.5,119.5); | |
320 | fNTracksECut->Sumw2(); | |
321 | fQAList->Add(fNTracksECut); | |
322 | fEmcNCellsCut = new TH1F("fEmcNCellsCut",";n/event;count",120,-0.5,119.5); | |
323 | fEmcNCellsCut->Sumw2(); | |
324 | fQAList->Add(fEmcNCellsCut); | |
e4ba80ad | 325 | fEmcClusEPhi = new TH2F("fEmcClusEPhi",";GeV;#phi",100,-0.25,49.75,63,0,6.3); |
326 | fEmcClusEPhi->Sumw2(); | |
327 | fQAList->Add(fEmcClusEPhi); | |
328 | fEmcClusEPhiCut = new TH2F("fEmcClusEPhiCut",";GeV;#phi",100,-0.25,49.75,63,0,6.3); | |
329 | fEmcClusEPhiCut->Sumw2(); | |
330 | fQAList->Add(fEmcClusEPhiCut); | |
331 | fEmcClusEEta = new TH2F("fEmcClusEEta",";GeV;#eta",100,-0.25,49.75,19,-0.9,0.9); | |
332 | fEmcClusEEta->Sumw2(); | |
333 | fQAList->Add(fEmcClusEEta); | |
334 | fEmcClusEEtaCut = new TH2F("fEmcClusEEtaCut",";GeV;#eta",100,-0.25,49.75,18,-0.9,0.9); | |
335 | fEmcClusEEtaCut->Sumw2(); | |
336 | fQAList->Add(fEmcClusEEtaCut); | |
337 | fTrackPtPhi = new TH2F("fTrackPtPhi",";p_{T} [GeV/c];#phi",100,-0.25,49.75,63,0,6.3); | |
338 | fTrackPtPhi->Sumw2(); | |
339 | fQAList->Add(fTrackPtPhi); | |
340 | fTrackPtPhiCut = new TH2F("fTrackPtPhiCut",";p_{T} [GeV/c];#phi",100,-0.25,49.75,63,0,6.3); | |
341 | fTrackPtPhiCut->Sumw2(); | |
342 | fQAList->Add(fTrackPtPhiCut); | |
343 | fTrackPtEta = new TH2F("fTrackPtEta",";p_{T} [GeV/c];#eta",100,-0.25,49.75,18,-0.9,0.9); | |
344 | fTrackPtEta->Sumw2(); | |
345 | fQAList->Add(fTrackPtEta); | |
346 | fTrackPtEtaCut = new TH2F("fTrackPtEtaCut",";p_{T} [GeV/c];#eta",100,-0.25,49.75,18,-0.9,0.9); | |
347 | fTrackPtEtaCut->Sumw2(); | |
348 | fQAList->Add(fTrackPtEtaCut); | |
965c985f | 349 | |
3ae97198 | 350 | |
351 | fMaxCellEPhi = new TH2F("fMaxCellEPhi","Most energetic cell in event; GeV;#phi",100,-0.25,49.75,63,0,6.3); | |
352 | fMaxCellEPhi->Sumw2(); | |
353 | fQAList->Add(fMaxCellEPhi); | |
354 | ||
30159e6f | 355 | PostData(1, fOutputList); |
2b7205ad | 356 | PostData(2, fQAList); |
30159e6f | 357 | } |
358 | ||
359 | //________________________________________________________________________ | |
360 | void AliAnalysisTaskEMCALIsoPhoton::UserExec(Option_t *) | |
361 | { | |
bd092f0f | 362 | // Main loop, called for each event. |
2e20efe5 | 363 | fESDClusters = 0; |
364 | fESDCells = 0; | |
365 | fAODClusters = 0; | |
366 | fAODCells = 0; | |
bd092f0f | 367 | // event trigger selection |
30159e6f | 368 | Bool_t isSelected = 0; |
751194e8 | 369 | if(fPeriod.Contains("11a")){ |
370 | if(fTrigBit.Contains("kEMC")) | |
371 | isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMC1); | |
372 | else | |
373 | isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB); | |
374 | } | |
375 | else{ | |
376 | if(fTrigBit.Contains("kEMC")) | |
377 | isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMC7); | |
378 | else | |
f507c09b | 379 | if(fTrigBit.Contains("kMB")) |
380 | isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB); | |
381 | else | |
382 | isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kINT7); | |
751194e8 | 383 | } |
80c98845 | 384 | if(fPeriod.Contains("11h")){ |
385 | if(fTrigBit.Contains("kAny")) | |
386 | isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kAny); | |
387 | if(fTrigBit.Contains("kAnyINT")) | |
388 | isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kAnyINT); | |
389 | } | |
c7bb0b43 | 390 | if(fIsMc) |
391 | isSelected = kTRUE; | |
ecd47673 | 392 | if(fDebug) |
393 | printf("isSelected = %d, fIsMC=%d\n", isSelected, fIsMc); | |
30159e6f | 394 | if(!isSelected ) |
395 | return; | |
f3843637 | 396 | if(fIsMc){ |
397 | TTree *tree = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->GetTree(); | |
398 | TFile *file = (TFile*)tree->GetCurrentFile(); | |
399 | TString filename = file->GetName(); | |
400 | if(!filename.Contains(fPathStrOpt.Data())) | |
401 | return; | |
402 | } | |
2e20efe5 | 403 | AliVEvent *event = (AliVEvent*)InputEvent(); |
404 | if (!event) { | |
405 | printf("ERROR: event not available\n"); | |
30159e6f | 406 | return; |
407 | } | |
822c9944 | 408 | Int_t runnumber = InputEvent()->GetRunNumber() ; |
7a7744db | 409 | if(fDebug) |
410 | printf("run number = %d\n",runnumber); | |
411 | ||
2e20efe5 | 412 | fESD = dynamic_cast<AliESDEvent*>(event); |
7a7744db | 413 | if(!fESD){ |
414 | fAOD = dynamic_cast<AliAODEvent*>(event); | |
415 | if(!fAOD){ | |
416 | printf("ERROR: Invalid type of event!!!\n"); | |
417 | return; | |
418 | } | |
419 | else if(fDebug) | |
420 | printf("AOD EVENT!\n"); | |
421 | } | |
30159e6f | 422 | |
423 | fEvtSel->Fill(0); | |
ecd47673 | 424 | if(fDebug) |
26a8db0f | 425 | printf("event is ok,\n run number=%d\n",runnumber); |
426 | ||
30159e6f | 427 | |
2e20efe5 | 428 | AliVVertex *pv = (AliVVertex*)event->GetPrimaryVertex(); |
429 | Bool_t pvStatus = kTRUE; | |
430 | if(fESD){ | |
431 | AliESDVertex *esdv = (AliESDVertex*)fESD->GetPrimaryVertex(); | |
432 | pvStatus = esdv->GetStatus(); | |
433 | } | |
d1582697 | 434 | if(!pv) |
30159e6f | 435 | return; |
2e20efe5 | 436 | if(!pvStatus) |
d1582697 | 437 | fRecoPV->Fill(0); |
cc57d293 | 438 | else |
439 | fRecoPV->Fill(1); | |
30159e6f | 440 | fPVtxZ->Fill(pv->GetZ()); |
441 | if(TMath::Abs(pv->GetZ())>15) | |
442 | return; | |
ecd47673 | 443 | if(fDebug) |
444 | printf("passed vertex cut\n"); | |
30159e6f | 445 | |
446 | fEvtSel->Fill(1); | |
2e20efe5 | 447 | if(fESD) |
448 | fTracks = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject("Tracks")); | |
449 | if(fAOD) | |
450 | fTracks = dynamic_cast<TClonesArray*>(fAOD->GetTracks()); | |
bd092f0f | 451 | |
06a28959 | 452 | if(!fTracks){ |
453 | AliError("Track array in event is NULL!"); | |
2e20efe5 | 454 | if(fDebug) |
455 | printf("returning due to not finding tracks!\n"); | |
06a28959 | 456 | return; |
457 | } | |
30159e6f | 458 | // Track loop to fill a pT spectrum |
3f4073ba | 459 | const Int_t Ntracks = fTracks->GetEntriesFast(); |
460 | for (Int_t iTracks = 0; iTracks < Ntracks; ++iTracks) { | |
461 | // for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) { | |
462 | //AliESDtrack* track = (AliESDtrack*)fESD->GetTrack(iTracks); | |
2e20efe5 | 463 | AliVTrack *track = (AliVTrack*)fTracks->At(iTracks); |
30159e6f | 464 | if (!track) |
465 | continue; | |
2e20efe5 | 466 | AliAODTrack *aodTrack = dynamic_cast<AliAODTrack*>(track); |
467 | AliESDtrack *esdTrack = dynamic_cast<AliESDtrack*>(track); | |
468 | if (esdTrack && fPrTrCuts && fPrTrCuts->IsSelected(track)){ | |
30159e6f | 469 | fSelPrimTracks->Add(track); |
2b7205ad | 470 | /*if(fTrackMaxPt<track->Pt()) |
471 | fTrackMaxPt = track->Pt();*/ | |
30159e6f | 472 | //printf("pt,eta,phi:%1.1f,%1.1f,%1.1f \n",track->Pt(),track->Eta(), track->Phi()); |
473 | } | |
2b7205ad | 474 | else if(aodTrack){ |
2e20efe5 | 475 | fSelPrimTracks->Add(track); |
2b7205ad | 476 | /*if(fTrackMaxPt<track->Pt()) |
477 | fTrackMaxPt = track->Pt();*/ | |
478 | } | |
bd092f0f | 479 | } |
480 | ||
4d4ce2d2 | 481 | TObjArray *matEMCAL=(TObjArray*)fOADBContainer->GetObject(runnumber,"EmcalMatrices"); |
822c9944 | 482 | for(Int_t mod=0; mod < (fGeom->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){ |
483 | if(fGeoName=="EMCAL_FIRSTYEARV1" && mod>3) | |
484 | break; | |
485 | /*if(fESD) | |
486 | fGeom->SetMisalMatrix(fESD->GetEMCALMatrix(mod), mod); | |
487 | else*/ | |
488 | // if(event->GetEMCALMatrix(mod)) | |
489 | fGeomMatrix[mod] = (TGeoHMatrix*) matEMCAL->At(mod); | |
490 | fGeom->SetMisalMatrix(fGeomMatrix[mod] , mod); | |
30159e6f | 491 | } |
4d4ce2d2 | 492 | |
2e20efe5 | 493 | if(fESD){ |
494 | AliESDtrackCuts *fTrackCuts = new AliESDtrackCuts(); | |
495 | fTrackMult = fTrackCuts->GetReferenceMultiplicity(fESD);//kTrackletsITSTPC ,0.5); | |
496 | if(fDebug) | |
497 | printf("ESD Track mult= %d\n",fTrackMult); | |
498 | } | |
499 | else if(fAOD){ | |
500 | fTrackMult = Ntracks; | |
501 | if(fDebug) | |
502 | printf("AOD Track mult= %d\n",fTrackMult); | |
503 | } | |
f507c09b | 504 | fTrMultDist->Fill(fTrackMult); |
16a4050e | 505 | |
2e20efe5 | 506 | if(fESD){ |
507 | TList *l = fESD->GetList(); | |
508 | fESDClusters = dynamic_cast<TClonesArray*>(l->FindObject("CaloClusters")); | |
509 | fESDCells = fESD->GetEMCALCells(); | |
510 | if(fDebug) | |
511 | printf("ESD cluster mult= %d\n",fESDClusters->GetEntriesFast()); | |
512 | } | |
513 | else if(fAOD){ | |
514 | fAODClusters = dynamic_cast<TClonesArray*>(fAOD->GetCaloClusters()); | |
515 | fAODCells = fAOD->GetEMCALCells(); | |
516 | if(fDebug) | |
517 | printf("AOD cluster mult= %d\n",fAODClusters->GetEntriesFast()); | |
518 | } | |
30159e6f | 519 | |
c7bb0b43 | 520 | |
521 | fMCEvent = MCEvent(); | |
ecd47673 | 522 | if(fMCEvent){ |
523 | if(fDebug) | |
ec9ab86b | 524 | std::cout<<"MCevent exists\n"; |
c7bb0b43 | 525 | fStack = (AliStack*)fMCEvent->Stack(); |
ecd47673 | 526 | } |
527 | else{ | |
528 | if(fDebug) | |
ec9ab86b | 529 | std::cout<<"ERROR: NO MC EVENT!!!!!!\n"; |
ecd47673 | 530 | } |
112eb594 | 531 | LoopOnCells(); |
f507c09b | 532 | FollowGamma(); |
533 | if(fDebug) | |
534 | printf("passed calling of FollowGamma\n"); | |
535 | FillClusHists(); | |
536 | if(fDebug) | |
537 | printf("passed calling of FillClusHists\n"); | |
63e40cb8 | 538 | FillMcHists(); |
ecd47673 | 539 | if(fDebug) |
540 | printf("passed calling of FillMcHists\n"); | |
2b7205ad | 541 | FillQA(); |
542 | if(fDebug) | |
543 | printf("passed calling of FillQA\n"); | |
2e20efe5 | 544 | /*if(fESD) |
545 | fESDClusters->Clear();*/ | |
f507c09b | 546 | fSelPrimTracks->Clear(); |
547 | fNClusForDirPho = 0; | |
112eb594 | 548 | fNCells50 = 0; |
c7bb0b43 | 549 | |
30159e6f | 550 | PostData(1, fOutputList); |
2b7205ad | 551 | PostData(2, fQAList); |
30159e6f | 552 | } |
bd092f0f | 553 | |
30159e6f | 554 | //________________________________________________________________________ |
555 | void AliAnalysisTaskEMCALIsoPhoton::FillClusHists() | |
556 | { | |
2e20efe5 | 557 | if(fDebug) |
558 | printf("Inside FillClusHists()....\n"); | |
bd092f0f | 559 | // Fill cluster histograms. |
2e20efe5 | 560 | TObjArray *clusters = fESDClusters; |
bd092f0f | 561 | |
2e20efe5 | 562 | if (!clusters){ |
563 | clusters = fAODClusters; | |
564 | if(fDebug) | |
565 | printf("ESD clusters empty..."); | |
566 | } | |
567 | if (!clusters){ | |
568 | if(fDebug) | |
569 | printf(" and AOD clusters as well!!!\n"); | |
30159e6f | 570 | return; |
2e20efe5 | 571 | } |
572 | if(fDebug) | |
573 | printf("\n"); | |
574 | ||
575 | const Int_t nclus = clusters->GetEntries(); | |
30159e6f | 576 | if(nclus==0) |
577 | return; | |
ecd47673 | 578 | if(fDebug) |
579 | printf("Inside FillClusHists and there are %d clusters\n",nclus); | |
e681d9ce | 580 | Double_t maxE = 0; |
0b21f686 | 581 | Int_t nclus10 = 0; |
f507c09b | 582 | Double_t ptmc=-1; |
30159e6f | 583 | for(Int_t ic=0;ic<nclus;ic++){ |
584 | maxE=0; | |
2e20efe5 | 585 | AliVCluster *c = static_cast<AliVCluster*>(clusters->At(ic)); |
30159e6f | 586 | if(!c) |
587 | continue; | |
588 | if(!c->IsEMCAL()) | |
589 | continue; | |
965c985f | 590 | if(c->E()<fECut) |
591 | continue; | |
30159e6f | 592 | Short_t id; |
593 | Double_t Emax = GetMaxCellEnergy( c, id); | |
594 | Double_t Ecross = GetCrossEnergy( c, id); | |
595 | if((1-Ecross/Emax)>fExoticCut) | |
596 | continue; | |
597 | Float_t clsPos[3] = {0,0,0}; | |
598 | c->GetPosition(clsPos); | |
599 | TVector3 clsVec(clsPos); | |
3dc2825e | 600 | Double_t Et = c->E()*TMath::Sin(clsVec.Theta()); |
f507c09b | 601 | if(fDebug) |
602 | printf("\tcluster eta=%1.1f,phi=%1.1f,E=%1.1f\n",clsVec.Eta(),clsVec.Phi(),c->E()); | |
0b21f686 | 603 | if(Et>10) |
604 | nclus10++; | |
30159e6f | 605 | Float_t ceiso, cephiband, cecore; |
606 | Float_t triso, trphiband, trcore; | |
607 | Float_t alliso, allphiband, allcore; | |
608 | Float_t phibandArea = (1.4 - 2*fIsoConeR)*2*fIsoConeR; | |
609 | Float_t netConeArea = TMath::Pi()*(fIsoConeR*fIsoConeR - 0.04*0.04); | |
f224025f | 610 | GetCeIso(clsVec, id, ceiso, cephiband, cecore); |
30159e6f | 611 | GetTrIso(clsVec, triso, trphiband, trcore); |
f9e2362a | 612 | Double_t dr = TMath::Sqrt(c->GetTrackDx()*c->GetTrackDx() + c->GetTrackDz()*c->GetTrackDz()); |
613 | if(Et>10 && Et<15 && dr>0.025){ | |
614 | fHigherPtConeM02->Fill(fHigherPtCone,c->GetM02()); | |
615 | if(fDebug) | |
616 | printf("\t\tHigher track pt inside the cone: %1.1f GeV/c; M02=%1.2f\n",fHigherPtCone,c->GetM02()); | |
617 | } | |
30159e6f | 618 | alliso = ceiso + triso; |
619 | allphiband = cephiband + trphiband; | |
620 | allcore = cecore + trcore; | |
621 | Float_t ceisoue = cephiband/phibandArea*netConeArea; | |
622 | Float_t trisoue = trphiband/phibandArea*netConeArea; | |
623 | Float_t allisoue = allphiband/phibandArea*netConeArea; | |
f912f9a9 | 624 | Float_t mcptsum = GetMcPtSumInCone(clsVec.Eta(), clsVec.Phi(),fIsoConeR); |
625 | if(fDebug && Et>10) | |
626 | printf("\t alliso=%1.1f, Et=%1.1f=-=-=-=-=\n",alliso,Et); | |
627 | if(c->GetM02()>0.5 && c->GetM02()<2.0){ | |
628 | fMcPtInConeBG->Fill(alliso-Et-allisoue, mcptsum); | |
629 | fMcPtInConeBGnoUE->Fill(alliso-Et, mcptsum); | |
630 | } | |
b16ded35 | 631 | if(c->GetM02()>0.1 && c->GetM02()<0.3 && dr>0.03){ |
f912f9a9 | 632 | fMcPtInConeSBG->Fill(alliso-Et-allisoue, mcptsum); |
633 | fMcPtInConeSBGnoUE->Fill(alliso-Et, mcptsum); | |
81f2660f | 634 | if(fMcIdFamily.Contains((Form("%d",c->GetLabel())))){ |
672df96f | 635 | fAllIsoEtMcGamma->Fill(Et, alliso-/*Et*/cecore-allisoue); |
636 | fAllIsoNoUeEtMcGamma->Fill(Et, alliso-/*Et*/cecore); | |
81f2660f | 637 | } |
f912f9a9 | 638 | } |
965c985f | 639 | const Int_t ndims = fNDimensions; |
640 | Double_t outputValues[ndims]; | |
f507c09b | 641 | ptmc = GetClusSource(c); |
965c985f | 642 | outputValues[0] = Et; |
643 | outputValues[1] = c->GetM02(); | |
1c86c72c | 644 | outputValues[2] = ceiso/*cecore*/-ceisoue; |
965c985f | 645 | outputValues[3] = triso-trisoue; |
1c86c72c | 646 | outputValues[4] = alliso/*cecore*/-allisoue - trcore; |
647 | outputValues[5] = ceiso; | |
648 | outputValues[6] = alliso - trcore; | |
717bb45b | 649 | outputValues[7] = c->GetTrackDx(); |
650 | outputValues[8] = c->GetTrackDz(); | |
651 | outputValues[9] = clsVec.Eta(); | |
652 | outputValues[10] = clsVec.Phi(); | |
2e20efe5 | 653 | if(fESDCells) |
654 | outputValues[11] = fESDCells->GetCellTime(id); | |
655 | else if(fAODCells) | |
656 | outputValues[11] = fAODCells->GetCellTime(id); | |
16a4050e | 657 | outputValues[12] = fTrackMult; |
f507c09b | 658 | outputValues[13] = ptmc; |
965c985f | 659 | fHnOutput->Fill(outputValues); |
30159e6f | 660 | if(c->E()>maxE) |
661 | maxE = c->E(); | |
662 | } | |
663 | fNClusHighClusE->Fill(maxE,nclus); | |
ee3d9c10 | 664 | fMaxEClus = maxE; |
0b21f686 | 665 | fNClusEt10->Fill(nclus10); |
f507c09b | 666 | fNClusPerPho->Fill(fDirPhoPt,fNClusForDirPho); |
30159e6f | 667 | } |
bd092f0f | 668 | |
30159e6f | 669 | //________________________________________________________________________ |
f224025f | 670 | void AliAnalysisTaskEMCALIsoPhoton::GetCeIso(TVector3 vec, Int_t maxid, Float_t &iso, Float_t &phiband, Float_t &core) |
30159e6f | 671 | { |
bd092f0f | 672 | // Get cell isolation. |
2e20efe5 | 673 | AliVCaloCells *cells = fESDCells; |
1c86c72c | 674 | if (!cells){ |
2e20efe5 | 675 | cells = fAODCells; |
1c86c72c | 676 | if(fDebug) |
677 | printf("ESD cells empty..."); | |
678 | } | |
679 | if (!cells){ | |
680 | if(fDebug) | |
681 | printf(" and AOD cells are empty as well!!!\n"); | |
30159e6f | 682 | return; |
1c86c72c | 683 | } |
2e20efe5 | 684 | |
1c86c72c | 685 | TObjArray *clusters = fESDClusters; |
686 | if (!clusters) | |
687 | clusters = fAODClusters; | |
688 | if (!clusters) | |
689 | return; | |
690 | ||
691 | ||
692 | const Int_t nclus = clusters->GetEntries(); | |
693 | //const Int_t ncells = cells->GetNumberOfCells(); | |
30159e6f | 694 | Float_t totiso=0; |
695 | Float_t totband=0; | |
696 | Float_t totcore=0; | |
697 | Float_t etacl = vec.Eta(); | |
698 | Float_t phicl = vec.Phi(); | |
2e20efe5 | 699 | Float_t maxtcl = cells->GetCellTime(maxid); |
30159e6f | 700 | if(phicl<0) |
701 | phicl+=TMath::TwoPi(); | |
1c86c72c | 702 | /*Int_t absid = -1; |
30159e6f | 703 | Float_t eta=-1, phi=-1; |
704 | for(int icell=0;icell<ncells;icell++){ | |
2e20efe5 | 705 | absid = TMath::Abs(cells->GetCellNumber(icell)); |
706 | Float_t celltime = cells->GetCellTime(absid); | |
f224025f | 707 | //if(TMath::Abs(celltime)>2e-8 && (!fIsMc)) |
708 | if(TMath::Abs(celltime-maxtcl)>2e-8 ) | |
c3f33463 | 709 | continue; |
30159e6f | 710 | if(!fGeom) |
711 | return; | |
712 | fGeom->EtaPhiFromIndex(absid,eta,phi); | |
713 | Float_t dphi = TMath::Abs(phi-phicl); | |
714 | Float_t deta = TMath::Abs(eta-etacl); | |
1c86c72c | 715 | Float_t R = TMath::Sqrt(deta*deta + dphi*dphi);*/ |
716 | for(int ic=0;ic<nclus;ic++){ | |
717 | AliVCluster *c = static_cast<AliVCluster*>(clusters->At(ic)); | |
718 | if(!c) | |
719 | continue; | |
720 | if(!c->IsEMCAL()) | |
721 | continue; | |
722 | Short_t id; | |
2280356c | 723 | GetMaxCellEnergy( c, id); |
1c86c72c | 724 | Double_t maxct = cells->GetCellTime(id); |
725 | if(TMath::Abs(maxtcl-maxct)>2.5e-9) | |
726 | continue; | |
727 | Float_t clsPos[3] = {0,0,0}; | |
728 | c->GetPosition(clsPos); | |
729 | TVector3 cv(clsPos); | |
730 | Double_t Et = c->E()*TMath::Sin(cv.Theta()); | |
731 | Float_t dphi = TMath::Abs(cv.Phi()-phicl); | |
732 | Float_t deta = TMath::Abs(cv.Eta()-etacl); | |
30159e6f | 733 | Float_t R = TMath::Sqrt(deta*deta + dphi*dphi); |
1c86c72c | 734 | if(R<0.007) |
735 | continue; | |
736 | Double_t matchedpt = GetTrackMatchedPt(c->GetTrackMatchedIndex()); | |
737 | Double_t nEt = TMath::Max(Et-matchedpt, 0.0); | |
738 | if(nEt<0) | |
739 | printf("nEt=%1.1f\n",nEt); | |
30159e6f | 740 | if(R<fIsoConeR){ |
1c86c72c | 741 | totiso += nEt; |
30159e6f | 742 | if(R<0.04) |
1c86c72c | 743 | totcore += nEt; |
30159e6f | 744 | } |
745 | else{ | |
746 | if(dphi>fIsoConeR) | |
747 | continue; | |
748 | if(deta<fIsoConeR) | |
749 | continue; | |
1c86c72c | 750 | totband += nEt; |
30159e6f | 751 | } |
752 | } | |
753 | iso = totiso; | |
754 | phiband = totband; | |
755 | core = totcore; | |
756 | } | |
757 | //________________________________________________________________________ | |
758 | void AliAnalysisTaskEMCALIsoPhoton::GetTrIso(TVector3 vec, Float_t &iso, Float_t &phiband, Float_t &core) | |
759 | { | |
bd092f0f | 760 | // Get track isolation. |
761 | ||
30159e6f | 762 | if(!fSelPrimTracks) |
763 | return; | |
f9e2362a | 764 | fHigherPtCone = 0; |
30159e6f | 765 | const Int_t ntracks = fSelPrimTracks->GetEntries(); |
766 | Double_t totiso=0; | |
767 | Double_t totband=0; | |
768 | Double_t totcore=0; | |
769 | Double_t etacl = vec.Eta(); | |
770 | Double_t phicl = vec.Phi(); | |
771 | if(phicl<0) | |
772 | phicl+=TMath::TwoPi(); | |
773 | for(int itrack=0;itrack<ntracks;itrack++){ | |
3f4073ba | 774 | AliVTrack *track = static_cast<AliVTrack*> (fSelPrimTracks->At(itrack)); |
30159e6f | 775 | if(!track) |
776 | continue; | |
777 | Double_t dphi = TMath::Abs(track->Phi()-phicl); | |
778 | Double_t deta = TMath::Abs(track->Eta()-etacl); | |
779 | Double_t R = TMath::Sqrt(deta*deta + dphi*dphi); | |
780 | Double_t pt = track->Pt(); | |
f9e2362a | 781 | if(pt>fHigherPtCone) |
782 | fHigherPtCone = pt; | |
30159e6f | 783 | if(R<fIsoConeR){ |
784 | totiso += track->Pt(); | |
785 | if(R<0.04) | |
786 | totcore += pt; | |
787 | } | |
788 | else{ | |
789 | if(dphi>fIsoConeR) | |
790 | continue; | |
791 | if(deta<fIsoConeR) | |
792 | continue; | |
793 | totband += track->Pt(); | |
794 | } | |
795 | } | |
796 | iso = totiso; | |
797 | phiband = totband; | |
798 | core = totcore; | |
799 | } | |
bd092f0f | 800 | |
30159e6f | 801 | //________________________________________________________________________ |
802 | Double_t AliAnalysisTaskEMCALIsoPhoton::GetCrossEnergy(const AliVCluster *cluster, Short_t &idmax) | |
803 | { | |
804 | // Calculate the energy of cross cells around the leading cell. | |
805 | ||
806 | AliVCaloCells *cells = 0; | |
2e20efe5 | 807 | cells = fESDCells; |
808 | if (!cells) | |
809 | cells = fAODCells; | |
30159e6f | 810 | if (!cells) |
811 | return 0; | |
812 | ||
30159e6f | 813 | if (!fGeom) |
814 | return 0; | |
815 | ||
816 | Int_t iSupMod = -1; | |
817 | Int_t iTower = -1; | |
818 | Int_t iIphi = -1; | |
819 | Int_t iIeta = -1; | |
820 | Int_t iphi = -1; | |
821 | Int_t ieta = -1; | |
822 | Int_t iphis = -1; | |
823 | Int_t ietas = -1; | |
824 | ||
825 | Double_t crossEnergy = 0; | |
826 | ||
827 | fGeom->GetCellIndex(idmax,iSupMod,iTower,iIphi,iIeta); | |
828 | fGeom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi, iIeta,iphis,ietas); | |
829 | ||
830 | Int_t ncells = cluster->GetNCells(); | |
831 | for (Int_t i=0; i<ncells; i++) { | |
832 | Int_t cellAbsId = cluster->GetCellAbsId(i); | |
833 | fGeom->GetCellIndex(cellAbsId,iSupMod,iTower,iIphi,iIeta); | |
834 | fGeom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi, iIeta,iphi,ieta); | |
835 | Int_t aphidiff = TMath::Abs(iphi-iphis); | |
836 | if (aphidiff>1) | |
837 | continue; | |
838 | Int_t aetadiff = TMath::Abs(ieta-ietas); | |
839 | if (aetadiff>1) | |
840 | continue; | |
841 | if ( (aphidiff==1 && aetadiff==0) || | |
842 | (aphidiff==0 && aetadiff==1) ) { | |
843 | crossEnergy += cells->GetCellAmplitude(cellAbsId); | |
844 | } | |
845 | } | |
846 | ||
847 | return crossEnergy; | |
848 | } | |
849 | ||
30159e6f | 850 | //________________________________________________________________________ |
851 | Double_t AliAnalysisTaskEMCALIsoPhoton ::GetMaxCellEnergy(const AliVCluster *cluster, Short_t &id) const | |
852 | { | |
853 | // Get maximum energy of attached cell. | |
854 | ||
855 | id = -1; | |
856 | ||
857 | AliVCaloCells *cells = 0; | |
2e20efe5 | 858 | cells = fESDCells; |
30159e6f | 859 | if (!cells) |
2e20efe5 | 860 | cells = fAODCells; |
861 | if(!cells) | |
30159e6f | 862 | return 0; |
863 | ||
864 | Double_t maxe = 0; | |
865 | Int_t ncells = cluster->GetNCells(); | |
866 | for (Int_t i=0; i<ncells; i++) { | |
867 | Double_t e = cells->GetCellAmplitude(TMath::Abs(cluster->GetCellAbsId(i))); | |
868 | if (e>maxe) { | |
869 | maxe = e; | |
870 | id = cluster->GetCellAbsId(i); | |
871 | } | |
872 | } | |
873 | return maxe; | |
874 | } | |
bd092f0f | 875 | |
c7bb0b43 | 876 | //________________________________________________________________________ |
877 | void AliAnalysisTaskEMCALIsoPhoton ::FillMcHists() | |
878 | { | |
879 | if(!fStack) | |
880 | return; | |
881 | Int_t nTracks = fStack->GetNtrack(); | |
ecd47673 | 882 | if(fDebug) |
883 | printf("Inside FillMcHists and there are %d mcparts\n",nTracks); | |
c7bb0b43 | 884 | for(Int_t iTrack=0;iTrack<nTracks;iTrack++){ |
885 | TParticle *mcp = static_cast<TParticle*>(fStack->Particle(iTrack)); | |
886 | if(!mcp) | |
887 | continue; | |
888 | Int_t pdg = mcp->GetPdgCode(); | |
889 | if(pdg!=22) | |
890 | continue; | |
f2acdbe9 | 891 | if(TMath::Abs(mcp->Eta())>0.7 ||mcp->Phi()<1.4 || mcp->Phi()>3.2) |
892 | continue; | |
c7bb0b43 | 893 | Int_t imom = mcp->GetMother(0); |
894 | if(imom<0 || imom>nTracks) | |
895 | continue; | |
896 | TParticle *mcmom = static_cast<TParticle*>(fStack->Particle(imom)); | |
897 | if(!mcmom) | |
898 | continue; | |
899 | Int_t pdgMom = mcmom->GetPdgCode(); | |
ec9ab86b | 900 | if((imom==6 || imom==7) && pdgMom==22) { |
caaf99d3 | 901 | fMCDirPhotonPtEtaPhi->Fill(mcp->Pt(),mcp->Eta(),mcp->Phi()); |
f507c09b | 902 | if(fNClusForDirPho==0) |
092ceec8 | 903 | fMCDirPhotonPtEtaPhiNoClus->Fill(mcp->Pt(),mcp->Eta(),mcp->Phi()); |
40c4f1bf | 904 | if(fDebug){ |
f2acdbe9 | 905 | printf("Found \"photonic\" parton at position %d, with pt=%1.1f, eta=%1.1f and phi=%1.1f, and status=%d,\n",imom,mcmom->Pt(), mcmom->Eta(), mcmom->Phi(), mcmom->GetStatusCode()); |
40c4f1bf | 906 | printf("with a final photon at position %d, with pt=%1.1f, eta=%1.1f and phi=%1.1f, and status=%d\n",iTrack,mcp->Pt(), mcp->Eta(), mcp->Phi(),mcp->GetStatusCode()); |
907 | } | |
f2acdbe9 | 908 | } |
c7bb0b43 | 909 | else{ |
910 | if(TMath::Abs(pdgMom)>100 && TMath::Abs(pdgMom)<1000) | |
911 | fDecayPhotonPtMC->Fill(mcp->Pt()); | |
912 | } | |
913 | } | |
914 | } | |
30159e6f | 915 | //________________________________________________________________________ |
f507c09b | 916 | Float_t AliAnalysisTaskEMCALIsoPhoton::GetClusSource(const AliVCluster *c) |
917 | { | |
918 | if(!c) | |
84898d7b | 919 | return -0.1; |
f507c09b | 920 | if(!fStack) |
84898d7b | 921 | return -0.1; |
f507c09b | 922 | Int_t nmcp = fStack->GetNtrack(); |
923 | Int_t clabel = c->GetLabel(); | |
924 | if(fDebug && fMcIdFamily.Contains(Form("%d",clabel))) | |
925 | printf("\n\t ==== Label %d is a descendent of the prompt photon ====\n\n",clabel); | |
926 | if(!fMcIdFamily.Contains(Form("%d",clabel))) | |
84898d7b | 927 | return -0.1; |
f507c09b | 928 | fNClusForDirPho++; |
929 | TString partonposstr = (TSubString)fMcIdFamily.operator()(0,1); | |
930 | Int_t partonpos = partonposstr.Atoi(); | |
931 | if(fDebug) | |
932 | printf("\t^^^^ parton position = %d ^^^^\n",partonpos); | |
933 | if(clabel<0 || clabel>nmcp) | |
934 | return 0; | |
935 | Float_t clsPos[3] = {0,0,0}; | |
936 | c->GetPosition(clsPos); | |
937 | TVector3 clsVec(clsPos); | |
938 | Double_t Et = c->E()*TMath::Sin(clsVec.Theta()); | |
939 | TParticle *mcp = static_cast<TParticle*>(fStack->Particle(partonpos)); | |
940 | if(!mcp) | |
84898d7b | 941 | return -0.1; |
f507c09b | 942 | if(fDebug){ |
943 | printf("\tclus mc truth eta=%1.1f,phi=%1.1f,E=%1.1f, pdgcode=%d, stackpos=%d\n",mcp->Eta(),mcp->Phi(),mcp->Energy(),mcp->GetPdgCode(),clabel); | |
944 | } | |
945 | Int_t lab1 = mcp->GetFirstDaughter(); | |
946 | if(lab1<0 || lab1>nmcp) | |
84898d7b | 947 | return -0.1; |
f507c09b | 948 | TParticle *mcd = static_cast<TParticle*>(fStack->Particle(lab1)); |
949 | if(!mcd) | |
84898d7b | 950 | return -0.1; |
f507c09b | 951 | if(fDebug) |
952 | printf("\t\tmom mc truth eta=%1.1f,phi=%1.1f,E=%1.1f, pdgcode=%d, stackpos=%d\n",mcd->Eta(),mcd->Phi(),mcd->Energy(),mcd->GetPdgCode(),lab1); | |
953 | if(mcd->GetPdgCode()==22){ | |
954 | fClusEtMcPt->Fill(mcd->Pt(), Et); | |
955 | fClusMcDetaDphi->Fill(clsVec.Eta() - mcd->Eta(), clsVec.Phi() - mcd->Phi()); | |
956 | } | |
957 | else{ | |
958 | printf("Warning: daughter of photon parton is not a photon\n"); | |
84898d7b | 959 | return -0.1; |
f507c09b | 960 | } |
961 | return fDirPhoPt; | |
962 | } | |
963 | //________________________________________________________________________ | |
964 | void AliAnalysisTaskEMCALIsoPhoton::FollowGamma() | |
965 | { | |
966 | if(!fStack) | |
967 | return; | |
968 | Int_t selfid = 6; | |
969 | TParticle *mcp = static_cast<TParticle*>(fStack->Particle(selfid)); | |
970 | if(!mcp) | |
971 | return; | |
972 | if(mcp->GetPdgCode()!=22){ | |
973 | mcp = static_cast<TParticle*>(fStack->Particle(++selfid)); | |
974 | if(!mcp) | |
975 | return; | |
976 | } | |
977 | Int_t daug0f = mcp->GetFirstDaughter(); | |
978 | Int_t daug0l = mcp->GetLastDaughter(); | |
979 | Int_t nd0 = daug0l - daug0f; | |
980 | if(fDebug) | |
981 | printf("\n\tGenerated gamma (%d) eta=%1.1f,phi=%1.1f,E=%1.1f, pdgcode=%d, n-daug=%d\n",selfid,mcp->Eta(),mcp->Phi(),mcp->Energy(),mcp->GetPdgCode(),nd0+1); | |
982 | fMcIdFamily = Form("%d,",selfid); | |
983 | GetDaughtersInfo(daug0f,daug0l, selfid,""); | |
984 | if(fDebug){ | |
985 | printf("\t---- end of the prompt gamma's family tree ----\n\n"); | |
986 | printf("Family id string = %s,\n\n",fMcIdFamily.Data()); | |
987 | } | |
988 | TParticle *md = static_cast<TParticle*>(fStack->Particle(daug0f)); | |
989 | if(!md) | |
990 | return; | |
991 | fDirPhoPt = md->Pt(); | |
992 | } | |
993 | //________________________________________________________________________ | |
22ad7981 | 994 | void AliAnalysisTaskEMCALIsoPhoton::GetDaughtersInfo(int firstd, int lastd, int selfid, const char *inputind) |
f507c09b | 995 | { |
996 | int nmcp = fStack->GetNtrack(); | |
997 | if(firstd<0 || firstd>nmcp) | |
998 | return; | |
999 | if(lastd<0 || lastd>nmcp) | |
1000 | return; | |
1001 | if(firstd>lastd){ | |
1002 | printf("WARNING: First daughter > last (%d,%d)\n",firstd,lastd); | |
1003 | return; | |
1004 | } | |
1005 | TString indenter = Form("\t%s",inputind); | |
1006 | TParticle *dp = 0x0; | |
1007 | if(fDebug) | |
1008 | printf("\t%s--- Daughters of particle %d ---\n", indenter.Data(), selfid); | |
1009 | for(int id=firstd; id<lastd+1; id++){ | |
1010 | dp = static_cast<TParticle*>(fStack->Particle(id)); | |
1011 | if(!dp) | |
1012 | continue; | |
1013 | Int_t dfd = dp->GetFirstDaughter(); | |
1014 | Int_t dld = dp->GetLastDaughter(); | |
1015 | Int_t dnd = dld - dfd + 1; | |
1016 | Float_t vr = TMath::Sqrt(dp->Vx()*dp->Vx()+dp->Vy()*dp->Vy()); | |
1017 | if(fDebug) | |
1018 | printf("\t%sParticle daughter(%d) eta=%1.1f,phi=%1.1f,E=%1.1f, vR=%1.1f, pdgcode=%d, n-daug=%d(%d,%d)\n", indenter.Data(),id, dp->Eta(), dp->Phi(), dp->Energy(), vr, dp->GetPdgCode(), dnd, dfd, dld); | |
1019 | fMcIdFamily += Form("%d,",id); | |
1020 | GetDaughtersInfo(dfd,dld,id,indenter.Data()); | |
1021 | } | |
1022 | } | |
f912f9a9 | 1023 | |
1024 | //________________________________________________________________________ | |
1025 | Float_t AliAnalysisTaskEMCALIsoPhoton::GetMcPtSumInCone(Float_t etaclus, Float_t phiclus, Float_t R) | |
1026 | { | |
1027 | if(!fStack) | |
1028 | return 0; | |
1029 | if(fDebug) | |
1030 | printf("Inside GetMcPtSumInCone!!\n"); | |
1031 | Int_t nTracks = fStack->GetNtrack(); | |
1032 | Float_t ptsum = 0; | |
672df96f | 1033 | TString addpartlabels = ""; |
f912f9a9 | 1034 | for(Int_t iTrack=0;iTrack<nTracks;iTrack++){ |
1035 | TParticle *mcp = static_cast<TParticle*>(fStack->Particle(iTrack)); | |
1036 | if(!mcp) | |
1037 | continue; | |
672df96f | 1038 | Int_t firstd = mcp->GetFirstDaughter(); |
1039 | Int_t lastd = mcp->GetLastDaughter(); | |
1040 | if((iTrack==6 || iTrack==7) && mcp->GetPdgCode()==22){ | |
1041 | for(Int_t id=firstd;id<=lastd;id++) | |
1042 | addpartlabels += Form("%d,",id); | |
1043 | continue; | |
1044 | } | |
1045 | if(mcp->Rho()>2.5) | |
f912f9a9 | 1046 | continue; |
1047 | else { | |
1048 | if(fDebug) | |
1049 | printf(" >>>> mcp Rho, Vx, Vy, Vz = %1.1f,%1.1f,%1.1f,%1.1f.......\n",mcp->Rho(),mcp->Vx(), mcp->Vy(),mcp->Vz()); | |
1050 | } | |
1051 | Float_t dphi = mcp->Phi() - phiclus; | |
1052 | Float_t deta = mcp->Eta() - etaclus; | |
1053 | if(fDebug) | |
1054 | printf(" >>>> mcphi = %1.1f, mceta = %1.1f\n>>>> dphi = %1.1f, deta = %1.1f\n", mcp->Phi(), mcp->Eta(),dphi,deta); | |
1055 | if(deta>10) | |
1056 | continue; | |
1057 | Float_t dR = TMath::Sqrt(dphi*dphi + deta*deta); | |
1058 | if(dR>R) | |
1059 | continue; | |
672df96f | 1060 | if(addpartlabels.Contains(Form("%d",iTrack))){ |
1061 | if(fDebug) | |
1062 | printf(" >>>> list of particles included (and their daughters) %s\n",addpartlabels.Data()); | |
1063 | continue; | |
1064 | } | |
1065 | addpartlabels += Form("%d,",iTrack); | |
1066 | for(Int_t id=firstd;id<=lastd;id++) | |
1067 | addpartlabels += Form("%d,",id); | |
f912f9a9 | 1068 | ptsum += mcp->Pt(); |
1069 | } | |
1070 | return ptsum; | |
1071 | } | |
f507c09b | 1072 | //________________________________________________________________________ |
2b7205ad | 1073 | void AliAnalysisTaskEMCALIsoPhoton::FillQA() |
1074 | { | |
1075 | if(!fSelPrimTracks) | |
1076 | return; | |
1077 | const int ntracks = fSelPrimTracks->GetEntriesFast(); | |
112eb594 | 1078 | const int ncells = fNCells50;//fESDCells->GetNumberOfCells(); |
2b7205ad | 1079 | const Int_t nclus = fESDClusters->GetEntries(); |
1080 | ||
1081 | fNTracks->Fill(ntracks); | |
1082 | fEmcNCells->Fill(ncells); | |
1083 | fEmcNClus->Fill(nclus); | |
1084 | if(fMaxEClus>fECut){ | |
1085 | fNTracksECut->Fill(ntracks); | |
1086 | fEmcNCellsCut->Fill(ncells); | |
1087 | fEmcNClusCut->Fill(nclus); | |
1088 | } | |
1089 | for(int it=0;it<ntracks;it++){ | |
1090 | AliVTrack *t = (AliVTrack*)fSelPrimTracks->At(it); | |
1091 | if(!t) | |
1092 | continue; | |
e4ba80ad | 1093 | fTrackPtPhi->Fill(t->Pt(),t->Phi()); |
1094 | fTrackPtEta->Fill(t->Pt(),t->Eta()); | |
1095 | if(fMaxEClus>fECut){ | |
1096 | fTrackPtPhiCut->Fill(t->Pt(), t->Phi()); | |
1097 | fTrackPtEtaCut->Fill(t->Pt(), t->Eta()); | |
1098 | } | |
2b7205ad | 1099 | } |
1100 | for(int ic=0;ic<nclus;ic++){ | |
3ae97198 | 1101 | AliVCluster *c = dynamic_cast<AliVCluster*>(fESDClusters->At(ic)); |
1102 | //AliESDCaloCluster *c = (AliESDCaloCluster*)fESDClusters->At(ic); | |
2b7205ad | 1103 | if(!c) |
1104 | continue; | |
3ae97198 | 1105 | if(!c->IsEMCAL()) |
1106 | continue; | |
e4ba80ad | 1107 | Float_t clsPos[3] = {0,0,0}; |
1108 | c->GetPosition(clsPos); | |
1109 | TVector3 clsVec(clsPos); | |
1110 | Double_t cphi = clsVec.Phi(); | |
1111 | Double_t ceta = clsVec.Eta(); | |
1112 | fEmcClusEPhi->Fill(c->E(), cphi); | |
1113 | fEmcClusEEta->Fill(c->E(), ceta); | |
1114 | if(fMaxEClus>fECut){ | |
1115 | fEmcClusEPhiCut->Fill(c->E(), cphi); | |
1116 | fEmcClusEEtaCut->Fill(c->E(), ceta); | |
1117 | } | |
2b7205ad | 1118 | } |
1119 | } | |
1120 | //________________________________________________________________________ | |
1c86c72c | 1121 | Double_t AliAnalysisTaskEMCALIsoPhoton::GetTrackMatchedPt(Int_t matchIndex) |
1122 | { | |
1123 | Double_t pt = 0; | |
1124 | if(!fTracks) | |
1125 | return pt; | |
1126 | if(matchIndex<0 || matchIndex>fTracks->GetEntries()){ | |
1127 | if(fDebug) | |
1128 | printf("track-matched index out of track array range!!!\n"); | |
1129 | return pt; | |
1130 | } | |
1131 | AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(matchIndex)); | |
1132 | if(!track){ | |
1133 | if(fDebug) | |
1134 | printf("track-matched pointer does not exist!!!\n"); | |
1135 | return pt; | |
1136 | } | |
1137 | if(fESD){ | |
1138 | if(!fPrTrCuts) | |
1139 | return pt; | |
1140 | if(!fPrTrCuts->IsSelected(track)) | |
1141 | return pt; | |
1142 | pt = track->Pt(); | |
1143 | } | |
1144 | return pt; | |
1145 | } | |
1146 | //________________________________________________________________________ | |
112eb594 | 1147 | void AliAnalysisTaskEMCALIsoPhoton::LoopOnCells() |
1148 | { | |
1149 | AliVCaloCells *cells = 0; | |
1150 | cells = fESDCells; | |
1151 | if (!cells) | |
1152 | cells = fAODCells; | |
1153 | if(!cells) | |
1154 | return; | |
3ae97198 | 1155 | Double_t maxe = 0; |
1156 | Double_t maxphi = -10; | |
112eb594 | 1157 | Int_t ncells = cells->GetNumberOfCells(); |
3ae97198 | 1158 | Double_t eta,phi; |
112eb594 | 1159 | for (Int_t i=0; i<ncells; i++) { |
1160 | Short_t absid = TMath::Abs(cells->GetCellNumber(i)); | |
1161 | Double_t e = cells->GetCellAmplitude(absid); | |
1162 | if(e>0.05) | |
1163 | fNCells50++; | |
3ae97198 | 1164 | else |
1165 | continue; | |
1166 | fGeom->EtaPhiFromIndex(absid,eta,phi); | |
1167 | if(maxe<e){ | |
1168 | maxe = e; | |
1169 | maxphi = phi; | |
1170 | } | |
112eb594 | 1171 | } |
3ae97198 | 1172 | fMaxCellEPhi->Fill(maxe,maxphi); |
112eb594 | 1173 | |
1174 | } | |
1175 | //________________________________________________________________________ | |
30159e6f | 1176 | void AliAnalysisTaskEMCALIsoPhoton::Terminate(Option_t *) |
1177 | { | |
bd092f0f | 1178 | // Called once at the end of the query. |
30159e6f | 1179 | } |