]>
Commit | Line | Data |
---|---|---|
ea3fd2d5 | 1 | // $Id$ |
2 | ||
ea3fd2d5 | 3 | #include "AliAnalysisTaskEMCALPi0PbPb.h" |
fa443410 | 4 | #include <TAxis.h> |
717fe7de | 5 | #include <TChain.h> |
6 | #include <TClonesArray.h> | |
f5d4ab70 | 7 | #include <TFile.h> |
296ea9b4 | 8 | #include <TGeoGlobalMagField.h> |
717fe7de | 9 | #include <TH1F.h> |
10 | #include <TH2F.h> | |
11 | #include <TList.h> | |
12 | #include <TLorentzVector.h> | |
f5d4ab70 | 13 | #include <TNtuple.h> |
296ea9b4 | 14 | #include <TProfile.h> |
15 | #include <TVector2.h> | |
717fe7de | 16 | #include "AliAODEvent.h" |
17 | #include "AliAODVertex.h" | |
18 | #include "AliAnalysisManager.h" | |
19 | #include "AliAnalysisTaskEMCALClusterizeFast.h" | |
296ea9b4 | 20 | #include "AliCDBManager.h" |
ea3fd2d5 | 21 | #include "AliCentrality.h" |
ea3fd2d5 | 22 | #include "AliEMCALGeoUtils.h" |
296ea9b4 | 23 | #include "AliEMCALRecoUtils.h" |
717fe7de | 24 | #include "AliESDEvent.h" |
25 | #include "AliESDVertex.h" | |
c4236a58 | 26 | #include "AliTrackerBase.h" |
296ea9b4 | 27 | #include "AliESDtrack.h" |
28 | #include "AliGeomManager.h" | |
43cfaa06 | 29 | #include "AliLog.h" |
296ea9b4 | 30 | #include "AliMagF.h" |
ea3fd2d5 | 31 | |
32 | ClassImp(AliAnalysisTaskEMCALPi0PbPb) | |
717fe7de | 33 | |
ea3fd2d5 | 34 | //________________________________________________________________________ |
35 | AliAnalysisTaskEMCALPi0PbPb::AliAnalysisTaskEMCALPi0PbPb(const char *name) | |
36 | : AliAnalysisTaskSE(name), | |
717fe7de | 37 | fCentVar("V0M"), |
38 | fCentFrom(0), | |
39 | fCentTo(100), | |
76332037 | 40 | fVtxZMin(-10), |
41 | fVtxZMax(+10), | |
43cfaa06 | 42 | fUseQualFlag(1), |
717fe7de | 43 | fClusName(), |
f5d4ab70 | 44 | fDoNtuple(0), |
a49742b5 | 45 | fDoAfterburner(0), |
f224d35b | 46 | fAsymMax(1), |
a49742b5 | 47 | fNminCells(1), |
3c661da5 | 48 | fMinE(0.100), |
f224d35b | 49 | fMinErat(0), |
50 | fMinEcc(0), | |
6bf90832 | 51 | fGeoName("EMCAL_FIRSTYEARV1"), |
296ea9b4 | 52 | fMinNClustPerTrack(50), |
53 | fMinPtPerTrack(0.25), | |
54 | fIsoDist(0.2), | |
d9f26424 | 55 | fNEvs(0), |
d595acbb | 56 | fGeom(0), |
296ea9b4 | 57 | fReco(0), |
717fe7de | 58 | fOutput(0), |
59 | fEsdEv(0), | |
60 | fAodEv(0), | |
43cfaa06 | 61 | fRecPoints(0), |
717fe7de | 62 | fEsdClusters(0), |
63 | fEsdCells(0), | |
64 | fAodClusters(0), | |
286b47a5 | 65 | fAodCells(0), |
fa443410 | 66 | fPtRanges(0), |
f5d4ab70 | 67 | fNtuple(0), |
296ea9b4 | 68 | fSelTracks(0), |
fa443410 | 69 | fHCuts(0x0), |
70 | fHVertexZ(0x0), | |
76332037 | 71 | fHVertexZ2(0x0), |
fa443410 | 72 | fHCent(0x0), |
73 | fHCentQual(0x0), | |
d595acbb | 74 | fHColuRow(0x0), |
75 | fHColuRowE(0x0), | |
76 | fHCellMult(0x0), | |
77 | fHCellE(0x0), | |
78 | fHCellH(0x0), | |
6eb6260e | 79 | fHCellM(0x0), |
a49742b5 | 80 | fHCellM2(0x0), |
296ea9b4 | 81 | fHCellFreqNoCut(0x0), |
82 | fHCellFrequCut100M(0x0), | |
83 | fHCellFrequCut300M(0x0), | |
84 | fHCellCheckE(0x0), | |
6eb6260e | 85 | fHClustEccentricity(0), |
fa443410 | 86 | fHClustEtaPhi(0x0), |
87 | fHClustEnergyPt(0x0), | |
88 | fHClustEnergySigma(0x0), | |
d595acbb | 89 | fHClustSigmaSigma(0x0), |
6eb6260e | 90 | fHClustNCellEnergyRatio(0x0), |
fa443410 | 91 | fHPionEtaPhi(0x0), |
92 | fHPionMggPt(0x0), | |
6eb6260e | 93 | fHPionMggAsym(0x0), |
94 | fHPionMggDgg(0x0) | |
ea3fd2d5 | 95 | { |
717fe7de | 96 | // Constructor. |
ea3fd2d5 | 97 | |
d595acbb | 98 | if (!name) |
99 | return; | |
100 | SetName(name); | |
ea3fd2d5 | 101 | DefineInput(0, TChain::Class()); |
ea3fd2d5 | 102 | DefineOutput(1, TList::Class()); |
296ea9b4 | 103 | fBranchNames="ESD:AliESDRun.,AliESDHeader.,PrimaryVertex.,SPDVertex.,TPCVertex.,EMCALCells.,Tracks " |
104 | "AOD:header,vertices,emcalCells,tracks"; | |
ea3fd2d5 | 105 | } |
ea3fd2d5 | 106 | |
717fe7de | 107 | //________________________________________________________________________ |
108 | AliAnalysisTaskEMCALPi0PbPb::~AliAnalysisTaskEMCALPi0PbPb() | |
109 | { | |
110 | // Destructor. | |
ea3fd2d5 | 111 | |
717fe7de | 112 | delete fOutput; fOutput = 0; |
fa443410 | 113 | delete fPtRanges; fPtRanges = 0; |
d595acbb | 114 | delete fGeom; fGeom = 0; |
296ea9b4 | 115 | delete fReco; fReco = 0; |
116 | delete fSelTracks; | |
d595acbb | 117 | delete [] fHColuRow; |
118 | delete [] fHColuRowE; | |
119 | delete [] fHCellMult; | |
296ea9b4 | 120 | delete [] fHCellFreqNoCut; |
121 | delete [] fHCellFrequCut100M; | |
122 | delete [] fHCellFrequCut300M; | |
ea3fd2d5 | 123 | } |
717fe7de | 124 | |
ea3fd2d5 | 125 | //________________________________________________________________________ |
126 | void AliAnalysisTaskEMCALPi0PbPb::UserCreateOutputObjects() | |
127 | { | |
717fe7de | 128 | // Create user objects here. |
ea3fd2d5 | 129 | |
296ea9b4 | 130 | fGeom = new AliEMCALGeoUtils(fGeoName,"EMCAL"); |
131 | fReco = new AliEMCALRecoUtils(); | |
717fe7de | 132 | fOutput = new TList(); |
133 | fOutput->SetOwner(); | |
296ea9b4 | 134 | fSelTracks = new TObjArray; |
ea3fd2d5 | 135 | |
f5d4ab70 | 136 | if (fDoNtuple) { |
137 | TFile *f = OpenFile(1); | |
6bf90832 | 138 | if (f) { |
139 | f->SetCompressionLevel(2); | |
6eb6260e | 140 | fNtuple = new TNtuple(Form("nt%.0fto%.0f",fCentFrom,fCentTo),"nt", |
c4236a58 | 141 | "run:evt:l0:cent:pt:eta:phi:e:emax:n:n1:db:disp:mn:ms:ecc:sig:tkdz:tkdr:tkep:tkiso:ceiso"); |
6bf90832 | 142 | fNtuple->SetDirectory(f); |
143 | fNtuple->SetAutoFlush(-1024*1024*1024); | |
144 | fNtuple->SetAutoSave(-1024*1024*1024); | |
145 | } | |
f5d4ab70 | 146 | } |
147 | ||
d595acbb | 148 | // histograms |
a49742b5 | 149 | TH1::SetDefaultSumw2(kTRUE); |
150 | TH2::SetDefaultSumw2(kTRUE); | |
fa443410 | 151 | fHCuts = new TH1F("hEventCuts","",4,0.5,4.5); |
152 | fHCuts->GetXaxis()->SetBinLabel(1,"All (PS)"); | |
153 | fHCuts->GetXaxis()->SetBinLabel(2,Form("%s: %.0f-%.0f",fCentVar.Data(),fCentFrom,fCentTo)); | |
154 | fHCuts->GetXaxis()->SetBinLabel(3,"QFlag"); | |
155 | fHCuts->GetXaxis()->SetBinLabel(4,Form("zvtx: %.0f-%.0f",fVtxZMin,fVtxZMax)); | |
156 | fOutput->Add(fHCuts); | |
157 | fHVertexZ = new TH1F("hVertexZBeforeCut","",100,-25,25); | |
158 | fHVertexZ->SetXTitle("z [cm]"); | |
159 | fOutput->Add(fHVertexZ); | |
76332037 | 160 | fHVertexZ2 = new TH1F("hVertexZAfterCut","",100,-25,25); |
161 | fHVertexZ2->SetXTitle("z [cm]"); | |
162 | fOutput->Add(fHVertexZ2); | |
fa443410 | 163 | fHCent = new TH1F("hCentBeforeCut","",101,-1,100); |
164 | fHCent->SetXTitle(fCentVar.Data()); | |
76332037 | 165 | fOutput->Add(fHCent); |
fa443410 | 166 | fHCentQual = new TH1F("hCentAfterCut","",101,-1,100); |
167 | fHCentQual->SetXTitle(fCentVar.Data()); | |
168 | fOutput->Add(fHCentQual); | |
90d5b88b | 169 | |
d595acbb | 170 | // histograms for cells |
296ea9b4 | 171 | Int_t nsm = fGeom->GetEMCGeometry()->GetNumberOfSuperModules(); |
172 | fHColuRow = new TH2*[nsm]; | |
173 | fHColuRowE = new TH2*[nsm]; | |
174 | fHCellMult = new TH1*[nsm]; | |
175 | for (Int_t i = 0; i<nsm; ++i) { | |
d595acbb | 176 | fHColuRow[i] = new TH2F(Form("hColRow_Mod%d",i),"",49,0,49,25,0,25); |
177 | fHColuRow[i]->SetTitle(Form("Module %d: Occupancy", i)); | |
178 | fHColuRow[i]->SetXTitle("col (i#eta)"); | |
179 | fHColuRow[i]->SetYTitle("row (i#phi)"); | |
180 | fHColuRowE[i] = new TH2F(Form("hColRowE_Mod%d", i),"",49,0,49,25,0,25); | |
90d5b88b | 181 | fHColuRowE[i]->SetTitle(Form("Module %d: Cell energy",i)); |
d595acbb | 182 | fHColuRowE[i]->SetXTitle("col (i#eta)"); |
183 | fHColuRowE[i]->SetYTitle("row (i#phi)"); | |
184 | fHCellMult[i] = new TH1F(Form("hCellMult_Mod%d",i),"",1000,0,1000); | |
185 | fHCellMult[i]->SetTitle(Form("Module %d: Cell multiplicity",i)); | |
90d5b88b | 186 | fHCellMult[i]->SetXTitle("# of cells"); |
d595acbb | 187 | fOutput->Add(fHColuRow[i]); |
188 | fOutput->Add(fHColuRowE[i]); | |
189 | fOutput->Add(fHCellMult[i]); | |
190 | } | |
a49742b5 | 191 | fHCellE = new TH1F("hCellE","",150,0.,15.); |
d595acbb | 192 | fHCellE->SetXTitle("E_{cell} [GeV]"); |
193 | fOutput->Add(fHCellE); | |
a49742b5 | 194 | fHCellH = new TH1F ("fHCellHighestE","",150,0.,15.); |
6eb6260e | 195 | fHCellH->SetXTitle("E^{max}_{cell} [GeV]"); |
d595acbb | 196 | fOutput->Add(fHCellH); |
a49742b5 | 197 | fHCellM = new TH1F ("fHCellMeanEperHitCell","",250,0.,2.5); |
6eb6260e | 198 | fHCellM->SetXTitle("#LT E_{cell}#GT [GeV]"); |
199 | fOutput->Add(fHCellM); | |
a49742b5 | 200 | fHCellM2 = new TH1F ("fHCellMeanEperAllCells","",250,0.,1); |
f4ec884e | 201 | fHCellM2->SetXTitle("1/N_{cells} #Sigma E_{cell} [GeV]"); |
a49742b5 | 202 | fOutput->Add(fHCellM2); |
90d5b88b | 203 | |
296ea9b4 | 204 | fHCellFreqNoCut = new TH1*[nsm]; |
205 | fHCellFrequCut100M = new TH1*[nsm]; | |
206 | fHCellFrequCut300M = new TH1*[nsm]; | |
207 | for (Int_t i = 0; i<nsm; ++i){ | |
208 | Double_t lbin = i*24*48-0.5; | |
209 | Double_t hbin = lbin+24*48; | |
210 | fHCellFreqNoCut[i] = new TH1F(Form("fHCellFreqNoCut_SM%d",i), | |
211 | Form("Frequency SM%d (no cut);id;#",i), 1152, lbin, hbin); | |
212 | fHCellFrequCut100M[i] = new TH1F(Form("fHCellFreqCut100M_SM%d",i), | |
213 | Form("Frequency SM%d (>0.1GeV);id;#",i), 1152, lbin, hbin); | |
214 | fHCellFrequCut300M[i] = new TH1F(Form("fHCellFreqCut300M_SM%d",i), | |
215 | Form("Frequency SM%d (>0.3GeV);id;#",i), 1152, lbin, hbin); | |
216 | fOutput->Add(fHCellFreqNoCut[i]); | |
217 | fOutput->Add(fHCellFrequCut100M[i]); | |
218 | fOutput->Add(fHCellFrequCut300M[i]); | |
219 | } | |
220 | if (1) { | |
221 | fHCellCheckE = new TH1*[24*48*nsm]; | |
222 | memset(fHCellCheckE,0,sizeof(fHCellCheckE)); | |
223 | Int_t tcs[1] = {4102}; | |
224 | for (UInt_t i = 0; i<sizeof(tcs)/sizeof(Int_t); ++i){ | |
225 | Int_t c=tcs[i]; | |
226 | if (c<24*48*nsm) { | |
227 | fHCellCheckE[i] = new TH1F(Form("fHCellE_id%d",c), Form("Cell %d;E [GeV/c];#",c), 500, 0, 8); | |
228 | fOutput->Add(fHCellCheckE[i]); | |
229 | } | |
230 | } | |
231 | } | |
232 | ||
d595acbb | 233 | // histograms for clusters |
6eb6260e | 234 | fHClustEccentricity = new TH1F("hClustEccentricity","",100,-0.1,1.1); |
235 | fHClustEccentricity->SetXTitle("#epsilon_{C}"); | |
236 | fOutput->Add(fHClustEccentricity); | |
a49742b5 | 237 | fHClustEtaPhi = new TH2F("hClustEtaPhi","",500,-0.8,0.8,500,1.2,2.2); |
fa443410 | 238 | fHClustEtaPhi->SetXTitle("#eta"); |
239 | fHClustEtaPhi->SetYTitle("#varphi"); | |
240 | fOutput->Add(fHClustEtaPhi); | |
241 | fHClustEnergyPt = new TH2F("hClustEnergyPt","",250,0,50,250,0,50); | |
242 | fHClustEnergyPt->SetXTitle("E [GeV]"); | |
6eb6260e | 243 | fHClustEnergyPt->SetYTitle("p_{T} [GeV/c]"); |
fa443410 | 244 | fOutput->Add(fHClustEnergyPt); |
a49742b5 | 245 | fHClustEnergySigma = new TH2F("hClustEnergySigma","",100,0,100,500,0,50); |
246 | fHClustEnergySigma->SetXTitle("E_{C} * #sigma_{max} [GeV*cm]"); | |
6eb6260e | 247 | fHClustEnergySigma->SetYTitle("E_{C} [GeV]"); |
d595acbb | 248 | fOutput->Add(fHClustEnergySigma); |
a49742b5 | 249 | fHClustSigmaSigma = new TH2F("hClustSigmaSigma","",500,0,50,500,0,50); |
6eb6260e | 250 | fHClustSigmaSigma->SetXTitle("#lambda_{0} [cm]"); |
251 | fHClustSigmaSigma->SetYTitle("#sigma_{max} [cm]"); | |
d595acbb | 252 | fOutput->Add(fHClustSigmaSigma); |
6eb6260e | 253 | fHClustNCellEnergyRatio = new TH2F("hClustNCellEnergyRatio","",27,-0.5,26.5,101,-0.05,1.05); |
254 | fHClustNCellEnergyRatio->SetXTitle("N_{cells}"); | |
255 | fHClustNCellEnergyRatio->SetYTitle("E^{max}_{cell}/E_{clus}"); | |
256 | fOutput->Add(fHClustNCellEnergyRatio); | |
90d5b88b | 257 | |
d595acbb | 258 | // histograms for pion candidates |
fa443410 | 259 | fHPionEtaPhi = new TH2F("hPionEtaPhi","",100,-0.8,0.8,100,1.2,2.2); |
a49742b5 | 260 | fHPionEtaPhi->SetXTitle("#eta_{#gamma#gamma}"); |
261 | fHPionEtaPhi->SetYTitle("#varphi_{#gamma#gamma}"); | |
fa443410 | 262 | fOutput->Add(fHPionEtaPhi); |
a49742b5 | 263 | fHPionMggPt = new TH2F("hPionMggPt","",1000,0,2,100,0,20.0); |
fa443410 | 264 | fHPionMggPt->SetXTitle("M_{#gamma#gamma} [GeV/c^{2}]"); |
265 | fHPionMggPt->SetYTitle("p_{T}^{#gamma#gamma} [GeV/c]"); | |
266 | fOutput->Add(fHPionMggPt); | |
a49742b5 | 267 | fHPionMggAsym = new TH2F("hPionMggAsym","",1000,0,2,100,0,1); |
fa443410 | 268 | fHPionMggAsym->SetXTitle("M_{#gamma#gamma} [GeV/c^{2}]"); |
269 | fHPionMggAsym->SetYTitle("Z_{#gamma#gamma} [GeV]"); | |
270 | fOutput->Add(fHPionMggAsym); | |
a49742b5 | 271 | fHPionMggDgg = new TH2F("hPionMggDgg","",1000,0,2,100,0,10); |
6eb6260e | 272 | fHPionMggDgg->SetXTitle("M_{#gamma#gamma} [GeV/c^{2}]"); |
273 | fHPionMggDgg->SetYTitle("opening angle [grad]"); | |
274 | fOutput->Add(fHPionMggDgg); | |
78204d3d | 275 | const Int_t nbins = 20; |
276 | Double_t xbins[nbins] = {0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,6,7,8,9,10,12.5,15,20,25,50}; | |
fa443410 | 277 | fPtRanges = new TAxis(nbins-1,xbins); |
278 | for (Int_t i = 0; i<=nbins; ++i) { | |
a49742b5 | 279 | fHPionInvMasses[i] = new TH1F(Form("hPionInvMass%d",i),"",1000,0,2); |
fa443410 | 280 | fHPionInvMasses[i]->SetXTitle("M_{#gamma#gamma} [GeV/c^{2}]"); |
281 | if (i==0) | |
282 | fHPionInvMasses[i]->SetTitle(Form("0 < p_{T}^{#gamma#gamma} <%.1f",xbins[0])); | |
283 | else if (i==nbins) | |
284 | fHPionInvMasses[i]->SetTitle(Form("p_{T}^{#gamma#gamma} > 50")); | |
285 | else | |
286 | fHPionInvMasses[i]->SetTitle(Form("%.1f < p_{T}^{#gamma#gamma} <%.1f",xbins[i-1],xbins[i])); | |
fa443410 | 287 | fOutput->Add(fHPionInvMasses[i]); |
288 | } | |
296ea9b4 | 289 | |
717fe7de | 290 | PostData(1, fOutput); |
ea3fd2d5 | 291 | } |
292 | ||
293 | //________________________________________________________________________ | |
294 | void AliAnalysisTaskEMCALPi0PbPb::UserExec(Option_t *) | |
295 | { | |
717fe7de | 296 | // Called for each event. |
297 | ||
298 | if (!InputEvent()) | |
299 | return; | |
300 | ||
43cfaa06 | 301 | AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager(); |
302 | fEsdEv = dynamic_cast<AliESDEvent*>(InputEvent()); | |
303 | if (fEsdEv) { | |
304 | am->LoadBranch("AliESDRun."); | |
305 | am->LoadBranch("AliESDHeader."); | |
306 | } else { | |
307 | fAodEv = dynamic_cast<AliAODEvent*>(InputEvent()); | |
308 | am->LoadBranch("header"); | |
309 | } | |
310 | ||
296ea9b4 | 311 | if (fHCuts->GetEntries()==0) { |
312 | if (!AliGeomManager::GetGeometry()) { // get geometry | |
313 | AliWarning("Accessing geometry from OCDB, this is not very efficient!"); | |
314 | AliCDBManager *cdb = AliCDBManager::Instance(); | |
315 | if (!cdb->IsDefaultStorageSet()) | |
316 | cdb->SetDefaultStorage("raw://"); | |
317 | Int_t runno = InputEvent()->GetRunNumber(); | |
318 | if (runno != cdb->GetRun()) | |
319 | cdb->SetRun(runno); | |
320 | AliGeomManager::LoadGeometry(); | |
321 | } | |
322 | ||
323 | if (fEsdEv) { // set misalignment matrices (stored in first event) | |
6bf90832 | 324 | for (Int_t i=0; i<fGeom->GetEMCGeometry()->GetNumberOfSuperModules(); ++i) |
d595acbb | 325 | fGeom->SetMisalMatrix(fEsdEv->GetESDRun()->GetEMCALMatrix(i),i); |
326 | } else { | |
6bf90832 | 327 | for (Int_t i=0; i<fGeom->GetEMCGeometry()->GetNumberOfSuperModules(); ++i) |
d595acbb | 328 | fGeom->SetMisalMatrix(fAodEv->GetHeader()->GetEMCALMatrix(i),i); |
329 | } | |
296ea9b4 | 330 | |
331 | if (!TGeoGlobalMagField::Instance()->GetField()) { // construct field map | |
332 | if (fEsdEv) { | |
333 | const AliESDRun *erun = fEsdEv->GetESDRun(); | |
334 | AliMagF *field = AliMagF::CreateFieldMap(erun->GetCurrentL3(), | |
335 | erun->GetCurrentDip(), | |
336 | AliMagF::kConvLHC, | |
337 | kFALSE, | |
338 | erun->GetBeamEnergy(), | |
339 | erun->GetBeamType()); | |
340 | TGeoGlobalMagField::Instance()->SetField(field); | |
341 | } else { | |
342 | Double_t pol = -1; //polarity | |
343 | Double_t be = -1; //beam energy | |
344 | AliMagF::BeamType_t btype = AliMagF::kBeamTypepp; | |
345 | Int_t runno = fAodEv->GetRunNumber(); | |
346 | if (runno>=136851 && runno<138275) { | |
347 | pol = -1; | |
348 | be = 2760; | |
349 | btype = AliMagF::kBeamTypeAA; | |
350 | } else if (runno>=138275 && runno<=139517) { | |
351 | pol = +1; | |
352 | be = 2760; | |
353 | btype = AliMagF::kBeamTypeAA; | |
354 | } else { | |
355 | AliError(Form("Do not know the bfield parameters for run %d! Using defaults!!!", runno)); | |
356 | } | |
357 | TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", pol, pol, AliMagF::k5kG, btype, be)); | |
358 | } | |
359 | } | |
d595acbb | 360 | } |
361 | ||
286b47a5 | 362 | Int_t cut = 1; |
fa443410 | 363 | fHCuts->Fill(cut++); |
286b47a5 | 364 | |
717fe7de | 365 | const AliCentrality *centP = InputEvent()->GetCentrality(); |
366 | Double_t cent = centP->GetCentralityPercentileUnchecked(fCentVar); | |
fa443410 | 367 | fHCent->Fill(cent); |
717fe7de | 368 | if (cent<fCentFrom||cent>fCentTo) |
286b47a5 | 369 | return; |
43cfaa06 | 370 | |
fa443410 | 371 | fHCuts->Fill(cut++); |
286b47a5 | 372 | |
43cfaa06 | 373 | if (fUseQualFlag) { |
374 | if (centP->GetQuality()>0) | |
375 | return; | |
376 | } | |
286b47a5 | 377 | |
fa443410 | 378 | fHCentQual->Fill(cent); |
379 | fHCuts->Fill(cut++); | |
717fe7de | 380 | |
d9f26424 | 381 | // count number of accepted events |
382 | ++fNEvs; | |
383 | ||
43cfaa06 | 384 | if (fEsdEv) { |
fa443410 | 385 | am->LoadBranch("PrimaryVertex."); |
386 | am->LoadBranch("SPDVertex."); | |
387 | am->LoadBranch("TPCVertex."); | |
43cfaa06 | 388 | } else { |
389 | fAodEv = dynamic_cast<AliAODEvent*>(InputEvent()); | |
390 | am->LoadBranch("vertices"); | |
3c661da5 | 391 | if (!fAodEv) return; |
43cfaa06 | 392 | } |
393 | ||
394 | const AliVVertex *vertex = InputEvent()->GetPrimaryVertex(); | |
717fe7de | 395 | if (!vertex) |
396 | return; | |
397 | ||
fa443410 | 398 | fHVertexZ->Fill(vertex->GetZ()); |
286b47a5 | 399 | |
717fe7de | 400 | if(vertex->GetZ()<fVtxZMin||vertex->GetZ()>fVtxZMax) |
401 | return; | |
286b47a5 | 402 | |
fa443410 | 403 | fHCuts->Fill(cut++); |
76332037 | 404 | fHVertexZ2->Fill(vertex->GetZ()); |
717fe7de | 405 | |
43cfaa06 | 406 | fRecPoints = 0; // will be set if fClusName is given and AliAnalysisTaskEMCALClusterizeFast is used |
407 | fEsdClusters = 0; // will be set if ESD input used and if fRecPoints are not set of if clusters are attached | |
408 | fEsdCells = 0; // will be set if ESD input used | |
409 | fAodClusters = 0; // will be set if AOD input used and if fRecPoints are not set of if clusters are attached | |
410 | // or if fClusName is given and AliAnalysisTaskEMCALClusterizeFast in AOD output mode | |
411 | fAodCells = 0; // will be set if AOD input used | |
717fe7de | 412 | |
43cfaa06 | 413 | // deal with special output from AliAnalysisTaskEMCALClusterizeFast first |
414 | Bool_t clusattached = 0; | |
415 | Bool_t recalibrated = 0; | |
416 | if (1 && !fClusName.IsNull()) { | |
417 | AliAnalysisTaskEMCALClusterizeFast *cltask = 0; | |
418 | TObjArray *ts = am->GetTasks(); | |
419 | cltask = dynamic_cast<AliAnalysisTaskEMCALClusterizeFast*>(ts->FindObject(fClusName)); | |
420 | if (cltask && cltask->GetClusters()) { | |
d595acbb | 421 | fRecPoints = const_cast<TObjArray*>(cltask->GetClusters()); |
43cfaa06 | 422 | clusattached = cltask->GetAttachClusters(); |
423 | if (cltask->GetCalibData()!=0) | |
424 | recalibrated = kTRUE; | |
425 | } | |
426 | } | |
427 | if (1 && AODEvent() && !fClusName.IsNull()) { | |
717fe7de | 428 | TList *l = AODEvent()->GetList(); |
429 | TClonesArray *clus = 0; | |
430 | if (l) { | |
431 | clus = dynamic_cast<TClonesArray*>(l->FindObject(fClusName)); | |
432 | fAodClusters = clus; | |
433 | } | |
ea3fd2d5 | 434 | } |
717fe7de | 435 | |
436 | if (fEsdEv) { // ESD input mode | |
43cfaa06 | 437 | if (1 && (!fRecPoints||clusattached)) { |
438 | if (!clusattached) | |
439 | am->LoadBranch("CaloClusters"); | |
717fe7de | 440 | TList *l = fEsdEv->GetList(); |
441 | TClonesArray *clus = 0; | |
442 | if (l) { | |
443 | clus = dynamic_cast<TClonesArray*>(l->FindObject("CaloClusters")); | |
444 | fEsdClusters = clus; | |
ea3fd2d5 | 445 | } |
446 | } | |
43cfaa06 | 447 | if (1) { |
448 | if (!recalibrated) | |
449 | am->LoadBranch("EMCALCells."); | |
717fe7de | 450 | fEsdCells = fEsdEv->GetEMCALCells(); |
451 | } | |
452 | } else if (fAodEv) { // AOD input mode | |
43cfaa06 | 453 | if (1 && (!fAodClusters || clusattached)) { |
454 | if (!clusattached) | |
455 | am->LoadBranch("caloClusters"); | |
717fe7de | 456 | TList *l = fAodEv->GetList(); |
457 | TClonesArray *clus = 0; | |
458 | if (l) { | |
459 | clus = dynamic_cast<TClonesArray*>(l->FindObject("caloClusters")); | |
460 | fAodClusters = clus; | |
ea3fd2d5 | 461 | } |
462 | } | |
43cfaa06 | 463 | if (1) { |
464 | if (!recalibrated) | |
465 | am->LoadBranch("emcalCells"); | |
717fe7de | 466 | fAodCells = fAodEv->GetEMCALCells(); |
467 | } | |
468 | } else { | |
469 | AliFatal("Impossible to not have either pointer to ESD or AOD event"); | |
470 | } | |
ea3fd2d5 | 471 | |
43cfaa06 | 472 | if (1) { |
473 | AliDebug(2,Form("fRecPoints set: %p", fRecPoints)); | |
474 | AliDebug(2,Form("fEsdClusters set: %p", fEsdClusters)); | |
475 | AliDebug(2,Form("fEsdCells set: %p", fEsdCells)); | |
476 | AliDebug(2,Form("fAodClusters set: %p", fAodClusters)); | |
477 | AliDebug(2,Form("fAodCells set: %p", fAodCells)); | |
478 | } | |
479 | ||
a49742b5 | 480 | if (fDoAfterburner) |
481 | ClusterAfterburner(); | |
6eb6260e | 482 | |
296ea9b4 | 483 | CalcTracks(); |
484 | CalcClusterProps(); | |
485 | ||
286b47a5 | 486 | FillCellHists(); |
487 | FillClusHists(); | |
488 | FillPionHists(); | |
323834f0 | 489 | FillOtherHists(); |
ea3fd2d5 | 490 | |
717fe7de | 491 | PostData(1, fOutput); |
ea3fd2d5 | 492 | } |
493 | ||
494 | //________________________________________________________________________ | |
495 | void AliAnalysisTaskEMCALPi0PbPb::Terminate(Option_t *) | |
496 | { | |
717fe7de | 497 | // Terminate called at the end of analysis. |
f5d4ab70 | 498 | |
499 | if (fNtuple) { | |
500 | TFile *f = OpenFile(1); | |
501 | if (f) | |
502 | fNtuple->Write(); | |
503 | } | |
d9f26424 | 504 | |
f224d35b | 505 | AliInfo(Form("\n%s: Accepted %lld events", GetName(), fNEvs)); |
ea3fd2d5 | 506 | } |
ea3fd2d5 | 507 | |
296ea9b4 | 508 | //________________________________________________________________________ |
509 | void AliAnalysisTaskEMCALPi0PbPb::CalcTracks() | |
510 | { | |
511 | // Calculate track properties. | |
512 | ||
513 | fSelTracks->Clear(); | |
514 | ||
515 | AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager(); | |
516 | TClonesArray *tracks = 0; | |
517 | if (fEsdEv) { | |
518 | am->LoadBranch("Tracks"); | |
519 | TList *l = fEsdEv->GetList(); | |
520 | tracks = dynamic_cast<TClonesArray*>(l->FindObject("Tracks")); | |
521 | } else { | |
522 | am->LoadBranch("tracks"); | |
523 | TList *l = fAodEv->GetList(); | |
524 | tracks = dynamic_cast<TClonesArray*>(l->FindObject("tracks")); | |
525 | } | |
526 | ||
527 | if (!tracks) | |
528 | return; | |
529 | ||
530 | if (fEsdEv) { | |
531 | //todo implement esd track filtering | |
532 | Int_t ntracks = tracks->GetEntries(); | |
533 | for (Int_t i=0; i<ntracks; ++i) { | |
534 | AliESDtrack *track = static_cast<AliESDtrack*>(tracks->At(i)); | |
535 | if (!track) | |
536 | continue; | |
537 | Double_t eta = track->Eta(); | |
538 | if (eta<-1||eta>1) | |
539 | continue; | |
540 | Double_t pt = track->Pt(); | |
541 | if (pt<fMinPtPerTrack) | |
542 | continue; | |
543 | if(track->GetTPCNcls()<fMinNClustPerTrack) | |
544 | continue; | |
545 | fSelTracks->Add(track); | |
546 | } | |
547 | } else { | |
548 | Int_t ntracks = tracks->GetEntries(); | |
549 | for (Int_t i=0; i<ntracks; ++i) { | |
550 | AliAODTrack *track = static_cast<AliAODTrack*>(tracks->At(i)); | |
551 | if (!track) | |
552 | continue; | |
553 | Double_t eta = track->Eta(); | |
554 | if (eta<-1||eta>1) | |
555 | continue; | |
556 | Double_t pt = track->Pt(); | |
557 | if (pt<fMinPtPerTrack) | |
558 | continue; | |
559 | if(track->GetTPCNcls()<fMinNClustPerTrack) | |
560 | continue; | |
c4236a58 | 561 | |
562 | if (0 && (pt>=0.6) && (track->PxAtDCA()==-999)) { // compute position on EMCAL | |
563 | AliExternalTrackParam tParam(track); | |
564 | if (AliTrackerBase::PropagateTrackToBxByBz(&tParam, 438, 0.139, 1, kTRUE)) { | |
565 | Double_t trkPos[3]; | |
566 | tParam.GetXYZ(trkPos); | |
567 | track->SetPxPyPzAtDCA(trkPos[0],trkPos[1],trkPos[2]); | |
568 | } | |
569 | } | |
296ea9b4 | 570 | fSelTracks->Add(track); |
571 | } | |
572 | } | |
573 | } | |
574 | ||
575 | //________________________________________________________________________ | |
576 | void AliAnalysisTaskEMCALPi0PbPb::CalcClusterProps() | |
577 | { | |
578 | // Calculate cluster properties | |
579 | ||
580 | TObjArray *clusters = fEsdClusters; | |
581 | if (!clusters) | |
582 | clusters = fAodClusters; | |
583 | if (!clusters) | |
584 | return; | |
585 | ||
586 | Int_t nclus = clusters->GetEntries(); | |
c4236a58 | 587 | Int_t ntrks = fSelTracks->GetEntries(); |
588 | ||
296ea9b4 | 589 | for(Int_t i = 0; i<nclus; ++i) { |
590 | fClusProps[i].Reset(); | |
591 | ||
592 | AliVCluster *clus = static_cast<AliVCluster*>(clusters->At(i)); | |
593 | if (!clus) | |
594 | continue; | |
595 | if (!clus->IsEMCAL()) | |
596 | continue; | |
597 | if (clus->E()<fMinE) | |
598 | continue; | |
599 | ||
600 | Float_t clsPos[3] = {0}; | |
601 | clus->GetPosition(clsPos); | |
c4236a58 | 602 | Double_t vertex[3] = {0}; |
603 | InputEvent()->GetPrimaryVertex()->GetXYZ(vertex); | |
604 | TLorentzVector clusterVec; | |
605 | clus->GetMomentum(clusterVec,vertex); | |
606 | Double_t clsEta = clusterVec.Eta(); | |
296ea9b4 | 607 | |
296ea9b4 | 608 | Double_t mind2 = 1e10; |
609 | for(Int_t j = 0; j<ntrks; ++j) { | |
610 | AliVTrack *track = static_cast<AliVTrack*>(fSelTracks->At(j)); | |
611 | if (!track) | |
612 | continue; | |
613 | if (track->Pt()<0.6) | |
614 | continue; | |
c4236a58 | 615 | if (TMath::Abs(clsEta-track->Eta())>fIsoDist) |
616 | continue; | |
617 | ||
296ea9b4 | 618 | AliExternalTrackParam tParam(track); |
619 | Float_t tmpR=-1, tmpZ=-1; | |
620 | if (!fReco->ExtrapolateTrackToCluster(&tParam, clus, tmpR, tmpZ)) | |
621 | continue; | |
c4236a58 | 622 | Double_t d2 = tmpR; |
296ea9b4 | 623 | if (mind2>d2) { |
624 | mind2=d2; | |
625 | fClusProps[i].fTrIndex = j; | |
626 | fClusProps[i].fTrDz = tmpZ; | |
c4236a58 | 627 | fClusProps[i].fTrDr = TMath::Sqrt(tmpR*tmpR-tmpZ*tmpZ); |
296ea9b4 | 628 | fClusProps[i].fTrDist = d2; |
629 | fClusProps[i].fTrEp = clus->E()/track->P(); | |
630 | } | |
631 | } | |
632 | ||
c4236a58 | 633 | if (0 && (fClusProps[i].fTrIndex>=0)) { |
634 | cout << i << " " << fClusProps[i].fTrIndex << ": Dr " << fClusProps[i].fTrDr << " " << " Dz " << fClusProps[i].fTrDz << endl; | |
635 | } | |
296ea9b4 | 636 | if (1) { |
296ea9b4 | 637 | fClusProps[i].fTrIso = GetTrackIsolation(clusterVec.Eta(),clusterVec.Phi(),fIsoDist); |
638 | fClusProps[i].fTrLowPtIso = 0; | |
639 | } | |
640 | if (1) { | |
641 | TVector3 pVec(clsPos); | |
642 | fClusProps[i].fCellIso = GetCellIsolation(pVec.Eta(),pVec.Phi(),fIsoDist); | |
643 | } | |
644 | } | |
645 | } | |
646 | ||
323834f0 | 647 | //________________________________________________________________________ |
648 | void AliAnalysisTaskEMCALPi0PbPb::ClusterAfterburner() | |
649 | { | |
296ea9b4 | 650 | // Run custer reconstruction afterburner. |
323834f0 | 651 | |
652 | AliVCaloCells *cells = fEsdCells; | |
653 | if (!cells) | |
654 | cells = fAodCells; | |
655 | ||
656 | if (!cells) | |
657 | return; | |
658 | ||
659 | Int_t ncells = cells->GetNumberOfCells(); | |
660 | if (ncells<=0) | |
661 | return; | |
662 | ||
663 | Double_t cellMeanE = 0, cellSigE = 0; | |
664 | for (Int_t i = 0; i<ncells; ++i) { | |
665 | Double_t cellE = cells->GetAmplitude(i); | |
666 | cellMeanE += cellE; | |
667 | cellSigE += cellE*cellE; | |
668 | } | |
669 | cellMeanE /= ncells; | |
670 | cellSigE /= ncells; | |
671 | cellSigE -= cellMeanE*cellMeanE; | |
672 | if (cellSigE<0) | |
673 | cellSigE = 0; | |
674 | cellSigE = TMath::Sqrt(cellSigE / ncells); | |
675 | ||
676 | Double_t subE = cellMeanE - 7*cellSigE; | |
677 | if (subE<0) | |
678 | return; | |
679 | ||
680 | for (Int_t i = 0; i<ncells; ++i) { | |
681 | Short_t id=-1; | |
682 | Double_t amp=0,time=0; | |
683 | if (!cells->GetCell(i, id, amp, time)) | |
684 | continue; | |
685 | amp -= cellMeanE; | |
686 | if (amp<0.001) | |
687 | amp = 0; | |
688 | cells->SetCell(i, id, amp, time); | |
689 | } | |
690 | ||
691 | TObjArray *clusters = fEsdClusters; | |
692 | if (!clusters) | |
693 | clusters = fAodClusters; | |
323834f0 | 694 | if (!clusters) |
695 | return; | |
696 | ||
697 | Int_t nclus = clusters->GetEntries(); | |
698 | for (Int_t i = 0; i<nclus; ++i) { | |
699 | AliVCluster *clus = static_cast<AliVCluster*>(clusters->At(i)); | |
700 | if (!clus->IsEMCAL()) | |
701 | continue; | |
702 | Int_t nc = clus->GetNCells(); | |
703 | Double_t clusE = 0; | |
704 | UShort_t ids[100] = {0}; | |
705 | Double_t fra[100] = {0}; | |
706 | for (Int_t j = 0; j<nc; ++j) { | |
707 | Short_t id = TMath::Abs(clus->GetCellAbsId(j)); | |
708 | Double_t cen = cells->GetCellAmplitude(id); | |
709 | clusE += cen; | |
710 | if (cen>0) { | |
711 | ids[nc] = id; | |
712 | ++nc; | |
713 | } | |
714 | } | |
715 | if (clusE<=0) { | |
716 | clusters->RemoveAt(i); | |
717 | continue; | |
718 | } | |
719 | ||
720 | for (Int_t j = 0; j<nc; ++j) { | |
721 | Short_t id = ids[j]; | |
722 | Double_t cen = cells->GetCellAmplitude(id); | |
723 | fra[j] = cen/clusE; | |
724 | } | |
725 | clus->SetE(clusE); | |
726 | AliAODCaloCluster *aodclus = dynamic_cast<AliAODCaloCluster*>(clus); | |
727 | if (aodclus) { | |
728 | aodclus->Clear(""); | |
729 | aodclus->SetNCells(nc); | |
730 | aodclus->SetCellsAmplitudeFraction(fra); | |
731 | aodclus->SetCellsAbsId(ids); | |
732 | } | |
733 | } | |
734 | clusters->Compress(); | |
735 | } | |
736 | ||
286b47a5 | 737 | //________________________________________________________________________ |
738 | void AliAnalysisTaskEMCALPi0PbPb::FillCellHists() | |
739 | { | |
740 | // Fill histograms related to cell properties. | |
d595acbb | 741 | |
90d5b88b | 742 | AliVCaloCells *cells = fEsdCells; |
743 | if (!cells) | |
744 | cells = fAodCells; | |
745 | ||
296ea9b4 | 746 | if (!cells) |
747 | return; | |
90d5b88b | 748 | |
296ea9b4 | 749 | Int_t cellModCount[12] = {0}; |
750 | Double_t cellMaxE = 0; | |
751 | Double_t cellMeanE = 0; | |
752 | Int_t ncells = cells->GetNumberOfCells(); | |
753 | if (ncells==0) | |
754 | return; | |
755 | ||
756 | Int_t nsm = fGeom->GetEMCGeometry()->GetNumberOfSuperModules(); | |
757 | ||
758 | for (Int_t i = 0; i<ncells; ++i) { | |
759 | Int_t absID = TMath::Abs(cells->GetCellNumber(i)); | |
760 | Double_t cellE = cells->GetAmplitude(i); | |
761 | fHCellE->Fill(cellE); | |
762 | if (cellE>cellMaxE) | |
763 | cellMaxE = cellE; | |
764 | cellMeanE += cellE; | |
765 | ||
766 | Int_t iSM=-1, iTower=-1, nIphi=-1, nIeta=-1; | |
767 | Bool_t ret = fGeom->GetCellIndex(absID, iSM, iTower, nIphi, nIeta); | |
768 | if (!ret) { | |
769 | AliError(Form("Could not get cell index for %d", absID)); | |
770 | continue; | |
771 | } | |
772 | ++cellModCount[iSM]; | |
773 | Int_t iPhi=-1, iEta=-1; | |
774 | fGeom->GetCellPhiEtaIndexInSModule(iSM, iTower, nIphi, nIeta, iPhi, iEta); | |
775 | fHColuRow[iSM]->Fill(iEta,iPhi,1); | |
776 | fHColuRowE[iSM]->Fill(iEta,iPhi,cellE); | |
777 | fHCellFreqNoCut[iSM]->Fill(absID); | |
778 | if (cellE > 0.1) fHCellFrequCut100M[iSM]->Fill(absID); | |
779 | if (cellE > 0.3) fHCellFrequCut300M[iSM]->Fill(absID); | |
780 | if (fHCellCheckE && fHCellCheckE[absID]) | |
781 | fHCellCheckE[absID]->Fill(cellE); | |
782 | } | |
783 | fHCellH->Fill(cellMaxE); | |
784 | cellMeanE /= ncells; | |
785 | fHCellM->Fill(cellMeanE); | |
786 | fHCellM2->Fill(cellMeanE*ncells/24/48/nsm); | |
787 | for (Int_t i=0; i<nsm; ++i) | |
788 | fHCellMult[i]->Fill(cellModCount[i]); | |
286b47a5 | 789 | } |
790 | ||
791 | //________________________________________________________________________ | |
792 | void AliAnalysisTaskEMCALPi0PbPb::FillClusHists() | |
793 | { | |
90d5b88b | 794 | // Fill histograms related to cluster properties. |
fa443410 | 795 | |
90d5b88b | 796 | TObjArray *clusters = fEsdClusters; |
797 | if (!clusters) | |
798 | clusters = fAodClusters; | |
296ea9b4 | 799 | if (!clusters) |
800 | return; | |
90d5b88b | 801 | |
296ea9b4 | 802 | Double_t vertex[3] = {0}; |
803 | InputEvent()->GetPrimaryVertex()->GetXYZ(vertex); | |
804 | ||
805 | Int_t nclus = clusters->GetEntries(); | |
806 | for(Int_t i = 0; i<nclus; ++i) { | |
807 | AliVCluster *clus = static_cast<AliVCluster*>(clusters->At(i)); | |
808 | if (!clus) | |
809 | continue; | |
810 | if (!clus->IsEMCAL()) | |
811 | continue; | |
90d5b88b | 812 | TLorentzVector clusterVec; |
296ea9b4 | 813 | clus->GetMomentum(clusterVec,vertex); |
814 | Double_t maxAxis = 0, minAxis = 0; | |
815 | GetSigma(clus,maxAxis,minAxis); | |
816 | Double_t clusterEcc = 0; | |
817 | if (maxAxis > 0) | |
818 | clusterEcc = TMath::Sqrt(1.0 - minAxis*minAxis/(maxAxis*maxAxis)); | |
819 | clus->SetChi2(clusterEcc); // store ecc in chi2 | |
820 | fHClustEccentricity->Fill(clusterEcc); | |
821 | fHClustEtaPhi->Fill(clusterVec.Eta(),clusterVec.Phi()); | |
822 | fHClustEnergyPt->Fill(clusterVec.E(),clusterVec.Pt()); | |
823 | fHClustEnergySigma->Fill(clus->E()*maxAxis,clus->E()); | |
824 | fHClustSigmaSigma->Fill(max(clus->GetM02(),clus->GetM20()),clus->E()*maxAxis); | |
825 | fHClustNCellEnergyRatio->Fill(clus->GetNCells(),GetMaxCellEnergy(clus)/clus->E()); | |
826 | if (fNtuple) { | |
827 | if (clus->E()<fMinE) | |
fa443410 | 828 | continue; |
c4236a58 | 829 | Float_t vals[22]; |
296ea9b4 | 830 | vals[0] = InputEvent()->GetRunNumber(); |
831 | vals[1] = (((UInt_t)InputEvent()->GetOrbitNumber() << 12) | (UInt_t)InputEvent()->GetBunchCrossNumber()); | |
832 | if (vals[1]<=0) | |
833 | vals[1] = fNEvs; | |
834 | AliESDHeader *h = dynamic_cast<AliESDHeader*>(InputEvent()->GetHeader()); | |
835 | if (h) | |
836 | vals[2] = h->GetL0TriggerInputs(); | |
837 | else { | |
838 | AliAODHeader *h2 = dynamic_cast<AliAODHeader*>(InputEvent()->GetHeader()); | |
839 | if (h2) | |
840 | vals[2] = h2->GetL0TriggerInputs(); | |
841 | else | |
842 | vals[2] = 0; | |
a49742b5 | 843 | } |
296ea9b4 | 844 | vals[3] = InputEvent()->GetCentrality()->GetCentralityPercentileUnchecked(fCentVar); |
845 | vals[4] = clusterVec.Pt(); | |
846 | vals[5] = clusterVec.Eta(); | |
847 | vals[6] = clusterVec.Phi(); | |
848 | vals[7] = clusterVec.E(); | |
849 | vals[8] = GetMaxCellEnergy(clus); | |
850 | vals[9] = clus->GetNCells(); | |
851 | vals[10] = GetNCells(clus,0.100); | |
852 | vals[11] = clus->GetDistanceToBadChannel(); | |
853 | vals[12] = clus->GetDispersion(); | |
854 | vals[13] = clus->GetM20(); | |
855 | vals[14] = clus->GetM02(); | |
856 | vals[15] = clusterEcc; | |
857 | vals[16] = maxAxis; | |
858 | vals[17] = fClusProps[i].fTrDz; | |
859 | vals[18] = fClusProps[i].fTrDr; | |
c4236a58 | 860 | vals[19] = fClusProps[i].fTrEp; |
861 | vals[20] = fClusProps[i].fTrIso; | |
862 | vals[21] = fClusProps[i].fCellIso; | |
296ea9b4 | 863 | fNtuple->Fill(vals); |
fa443410 | 864 | } |
865 | } | |
286b47a5 | 866 | } |
867 | ||
868 | //________________________________________________________________________ | |
869 | void AliAnalysisTaskEMCALPi0PbPb::FillPionHists() | |
870 | { | |
871 | // Fill histograms related to pions. | |
286b47a5 | 872 | |
296ea9b4 | 873 | Double_t vertex[3] = {0}; |
fa443410 | 874 | InputEvent()->GetPrimaryVertex()->GetXYZ(vertex); |
875 | ||
90d5b88b | 876 | TObjArray *clusters = fEsdClusters; |
877 | if (!clusters) | |
878 | clusters = fAodClusters; | |
fa443410 | 879 | |
90d5b88b | 880 | if (clusters) { |
881 | TLorentzVector clusterVec1; | |
882 | TLorentzVector clusterVec2; | |
883 | TLorentzVector pionVec; | |
884 | ||
885 | Int_t nclus = clusters->GetEntries(); | |
fa443410 | 886 | for (Int_t i = 0; i<nclus; ++i) { |
90d5b88b | 887 | AliVCluster *clus1 = static_cast<AliVCluster*>(clusters->At(i)); |
fa443410 | 888 | if (!clus1) |
889 | continue; | |
890 | if (!clus1->IsEMCAL()) | |
891 | continue; | |
3c661da5 | 892 | if (clus1->E()<fMinE) |
6eb6260e | 893 | continue; |
a49742b5 | 894 | if (clus1->GetNCells()<fNminCells) |
895 | continue; | |
f224d35b | 896 | if (GetMaxCellEnergy(clus1)/clus1->E()<fMinErat) |
897 | continue; | |
3c661da5 | 898 | if (clus1->Chi2()<fMinEcc) // eccentricity cut |
f224d35b | 899 | continue; |
fa443410 | 900 | clus1->GetMomentum(clusterVec1,vertex); |
901 | for (Int_t j = i+1; j<nclus; ++j) { | |
90d5b88b | 902 | AliVCluster *clus2 = static_cast<AliVCluster*>(clusters->At(j)); |
fa443410 | 903 | if (!clus2) |
904 | continue; | |
905 | if (!clus2->IsEMCAL()) | |
906 | continue; | |
3c661da5 | 907 | if (clus2->E()<fMinE) |
6eb6260e | 908 | continue; |
a49742b5 | 909 | if (clus2->GetNCells()<fNminCells) |
910 | continue; | |
f224d35b | 911 | if (GetMaxCellEnergy(clus2)/clus2->E()<fMinErat) |
912 | continue; | |
3c661da5 | 913 | if (clus2->Chi2()<fMinEcc) // eccentricity cut |
f224d35b | 914 | continue; |
fa443410 | 915 | clus2->GetMomentum(clusterVec2,vertex); |
916 | pionVec = clusterVec1 + clusterVec2; | |
917 | Double_t pionZgg = TMath::Abs(clusterVec1.E()-clusterVec2.E())/pionVec.E(); | |
6eb6260e | 918 | Double_t pionOpeningAngle = clusterVec1.Angle(clusterVec2.Vect()); |
d595acbb | 919 | if (pionZgg < fAsymMax) { |
920 | fHPionEtaPhi->Fill(pionVec.Eta(),pionVec.Phi()); | |
921 | fHPionMggPt->Fill(pionVec.M(),pionVec.Pt()); | |
922 | fHPionMggAsym->Fill(pionVec.M(),pionZgg); | |
6eb6260e | 923 | fHPionMggDgg->Fill(pionVec.M(),pionOpeningAngle); |
d595acbb | 924 | Int_t bin = fPtRanges->FindBin(pionVec.Pt()); |
925 | fHPionInvMasses[bin]->Fill(pionVec.M()); | |
926 | } | |
fa443410 | 927 | } |
928 | } | |
90d5b88b | 929 | } |
fa443410 | 930 | } |
d595acbb | 931 | |
6eb6260e | 932 | //________________________________________________________________________ |
323834f0 | 933 | void AliAnalysisTaskEMCALPi0PbPb::FillOtherHists() |
6eb6260e | 934 | { |
323834f0 | 935 | // Fill histograms related to cell properties. |
6eb6260e | 936 | } |
937 | ||
d595acbb | 938 | //________________________________________________________________________ |
296ea9b4 | 939 | Double_t AliAnalysisTaskEMCALPi0PbPb::GetCellIsolation(Double_t cEta, Double_t cPhi, Double_t radius) const |
940 | { | |
941 | // Compute isolation based on cell content. | |
942 | ||
943 | AliVCaloCells *cells = fEsdCells; | |
944 | if (!cells) | |
945 | cells = fAodCells; | |
946 | if (!cells) | |
947 | return 0; | |
948 | ||
949 | Double_t cellIsolation = 0; | |
950 | Double_t rad2 = radius*radius; | |
951 | Int_t ncells = cells->GetNumberOfCells(); | |
952 | for (Int_t i = 0; i<ncells; ++i) { | |
953 | Int_t absID = TMath::Abs(cells->GetCellNumber(i)); | |
954 | Double_t cellE = cells->GetAmplitude(i); | |
955 | Float_t eta, phi; | |
956 | fGeom->EtaPhiFromIndex(absID,eta,phi); | |
957 | Double_t phidiff = TVector2::Phi_0_2pi(phi-cPhi); | |
958 | Double_t dist = (eta-cEta)*(eta-cEta)+phidiff*phidiff; | |
959 | if(dist>rad2) | |
960 | continue; | |
961 | cellIsolation += cellE; | |
962 | } | |
963 | return cellIsolation; | |
964 | } | |
965 | ||
966 | //________________________________________________________________________ | |
967 | Double_t AliAnalysisTaskEMCALPi0PbPb::GetMaxCellEnergy(AliVCluster *cluster) const | |
d595acbb | 968 | { |
90d5b88b | 969 | // Get maximum energy of attached cell. |
970 | ||
971 | Double_t maxe = 0; | |
90d5b88b | 972 | Int_t ncells = cluster->GetNCells(); |
973 | if (fEsdCells) { | |
974 | for (Int_t i=0; i<ncells; i++) { | |
27422847 | 975 | Double_t e = fEsdCells->GetCellAmplitude(TMath::Abs(cluster->GetCellAbsId(i))); |
90d5b88b | 976 | if (e>maxe) |
977 | maxe = e; | |
978 | } | |
979 | } else { | |
980 | for (Int_t i=0; i<ncells; i++) { | |
27422847 | 981 | Double_t e = fAodCells->GetCellAmplitude(TMath::Abs(cluster->GetCellAbsId(i))); |
90d5b88b | 982 | if (e>maxe) |
983 | maxe = e; | |
984 | } | |
985 | } | |
6eb6260e | 986 | return maxe; |
d595acbb | 987 | } |
988 | ||
989 | //________________________________________________________________________ | |
296ea9b4 | 990 | void AliAnalysisTaskEMCALPi0PbPb::GetSigma(AliVCluster *c, Double_t& sigmaMax, Double_t &sigmaMin) const |
d595acbb | 991 | { |
90d5b88b | 992 | // Calculate the (E) weighted variance along the longer (eigen) axis. |
993 | ||
6bf90832 | 994 | sigmaMax = 0; // cluster variance along its longer axis |
995 | sigmaMin = 0; // cluster variance along its shorter axis | |
996 | Double_t Ec = c->E(); // cluster energy | |
296ea9b4 | 997 | if(Ec<=0) |
998 | return; | |
6bf90832 | 999 | Double_t Xc = 0 ; // cluster first moment along X |
1000 | Double_t Yc = 0 ; // cluster first moment along Y | |
1001 | Double_t Sxx = 0 ; // cluster second central moment along X (variance_X^2) | |
1002 | Double_t Sxy = 0 ; // cluster second central moment along Y (variance_Y^2) | |
1003 | Double_t Syy = 0 ; // cluster covariance^2 | |
90d5b88b | 1004 | |
1005 | AliVCaloCells *cells = fEsdCells; | |
1006 | if (!cells) | |
1007 | cells = fAodCells; | |
1008 | ||
6eb6260e | 1009 | if (!cells) |
1010 | return; | |
1011 | ||
6bf90832 | 1012 | Int_t ncells = c->GetNCells(); |
6eb6260e | 1013 | if (ncells==1) |
1014 | return; | |
1015 | ||
1016 | TVector3 pos; | |
1017 | for(Int_t j=0; j<ncells; ++j) { | |
6bf90832 | 1018 | Int_t id = TMath::Abs(c->GetCellAbsId(j)); |
27422847 | 1019 | fGeom->GetGlobal(id,pos); |
6eb6260e | 1020 | Double_t cellen = cells->GetCellAmplitude(id); |
1021 | Xc += cellen*pos.X(); | |
1022 | Yc += cellen*pos.Y(); | |
1023 | Sxx += cellen*pos.X()*pos.X(); | |
1024 | Syy += cellen*pos.Y()*pos.Y(); | |
1025 | Sxy += cellen*pos.X()*pos.Y(); | |
1026 | } | |
1027 | Xc /= Ec; | |
1028 | Yc /= Ec; | |
1029 | Sxx /= Ec; | |
1030 | Syy /= Ec; | |
1031 | Sxy /= Ec; | |
1032 | Sxx -= Xc*Xc; | |
1033 | Syy -= Yc*Yc; | |
1034 | Sxy -= Xc*Yc; | |
296ea9b4 | 1035 | sigmaMax = (Sxx + Syy + TMath::Sqrt(TMath::Abs((Sxx-Syy)*(Sxx-Syy)+4.0*Sxy*Sxy)))/2.0; |
1036 | sigmaMax = TMath::Sqrt(TMath::Abs(sigmaMax)); | |
1037 | sigmaMin = TMath::Abs(Sxx + Syy - TMath::Sqrt(TMath::Abs((Sxx-Syy)*(Sxx-Syy)+4.0*Sxy*Sxy)))/2.0; | |
1038 | sigmaMin = TMath::Sqrt(TMath::Abs(sigmaMin)); | |
d595acbb | 1039 | } |
90d5b88b | 1040 | |
6bf90832 | 1041 | //________________________________________________________________________ |
296ea9b4 | 1042 | Int_t AliAnalysisTaskEMCALPi0PbPb::GetNCells(AliVCluster *c, Double_t emin) const |
6bf90832 | 1043 | { |
1044 | // Calculate number of attached cells above emin. | |
1045 | ||
6bf90832 | 1046 | AliVCaloCells *cells = fEsdCells; |
1047 | if (!cells) | |
1048 | cells = fAodCells; | |
6bf90832 | 1049 | if (!cells) |
296ea9b4 | 1050 | return 0; |
6bf90832 | 1051 | |
296ea9b4 | 1052 | Int_t n = 0; |
6bf90832 | 1053 | Int_t ncells = c->GetNCells(); |
1054 | for(Int_t j=0; j<ncells; ++j) { | |
1055 | Int_t id = TMath::Abs(c->GetCellAbsId(j)); | |
1056 | Double_t cellen = cells->GetCellAmplitude(id); | |
1057 | if (cellen>=emin) | |
1058 | ++n; | |
1059 | } | |
1060 | return n; | |
1061 | } | |
1062 | ||
296ea9b4 | 1063 | //________________________________________________________________________ |
1064 | Double_t AliAnalysisTaskEMCALPi0PbPb::GetTrackIsolation(Double_t cEta, Double_t cPhi, Double_t radius) const | |
1065 | { | |
1066 | // Compute isolation based on tracks. | |
1067 | ||
1068 | Double_t trkIsolation = 0; | |
1069 | Double_t rad2 = radius*radius; | |
1070 | Int_t ntrks = fSelTracks->GetEntries(); | |
1071 | for(Int_t j = 0; j<ntrks; ++j) { | |
1072 | AliVTrack *track = static_cast<AliVTrack*>(fSelTracks->At(j)); | |
1073 | if (!track) | |
1074 | continue; | |
1075 | Float_t eta = track->Eta(); | |
1076 | Float_t phi = track->Phi(); | |
1077 | Double_t phidiff = TVector2::Phi_0_2pi(phi-cPhi); | |
1078 | Double_t dist = (eta-cEta)*(eta-cEta)+phidiff*phidiff; | |
1079 | if(dist>rad2) | |
1080 | continue; | |
1081 | trkIsolation += track->Pt(); | |
1082 | } | |
1083 | return trkIsolation; | |
1084 | } |