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