]>
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> |
b3ee6797 | 15 | #include <TString.h> |
296ea9b4 | 16 | #include <TVector2.h> |
717fe7de | 17 | #include "AliAODEvent.h" |
18 | #include "AliAODVertex.h" | |
19 | #include "AliAnalysisManager.h" | |
20 | #include "AliAnalysisTaskEMCALClusterizeFast.h" | |
296ea9b4 | 21 | #include "AliCDBManager.h" |
ea3fd2d5 | 22 | #include "AliCentrality.h" |
ea3fd2d5 | 23 | #include "AliEMCALGeoUtils.h" |
0ec74551 | 24 | #include "AliEMCALGeometry.h" |
296ea9b4 | 25 | #include "AliEMCALRecoUtils.h" |
717fe7de | 26 | #include "AliESDEvent.h" |
27 | #include "AliESDVertex.h" | |
296ea9b4 | 28 | #include "AliESDtrack.h" |
0ec74551 | 29 | #include "AliESDtrackCuts.h" |
296ea9b4 | 30 | #include "AliGeomManager.h" |
b3ee6797 | 31 | #include "AliInputEventHandler.h" |
43cfaa06 | 32 | #include "AliLog.h" |
296ea9b4 | 33 | #include "AliMagF.h" |
0ec74551 | 34 | #include "AliTrackerBase.h" |
ea3fd2d5 | 35 | |
36 | ClassImp(AliAnalysisTaskEMCALPi0PbPb) | |
717fe7de | 37 | |
ea3fd2d5 | 38 | //________________________________________________________________________ |
39 | AliAnalysisTaskEMCALPi0PbPb::AliAnalysisTaskEMCALPi0PbPb(const char *name) | |
40 | : AliAnalysisTaskSE(name), | |
717fe7de | 41 | fCentVar("V0M"), |
42 | fCentFrom(0), | |
43 | fCentTo(100), | |
76332037 | 44 | fVtxZMin(-10), |
45 | fVtxZMax(+10), | |
43cfaa06 | 46 | fUseQualFlag(1), |
717fe7de | 47 | fClusName(), |
f5d4ab70 | 48 | fDoNtuple(0), |
a49742b5 | 49 | fDoAfterburner(0), |
f224d35b | 50 | fAsymMax(1), |
a49742b5 | 51 | fNminCells(1), |
3c661da5 | 52 | fMinE(0.100), |
f224d35b | 53 | fMinErat(0), |
54 | fMinEcc(0), | |
6bf90832 | 55 | fGeoName("EMCAL_FIRSTYEARV1"), |
296ea9b4 | 56 | fMinNClustPerTrack(50), |
0ec74551 | 57 | fMinPtPerTrack(1.0), |
296ea9b4 | 58 | fIsoDist(0.2), |
b3ee6797 | 59 | fTrClassNames(""), |
0ec74551 | 60 | fTrCuts(0), |
2e4d8148 | 61 | fDoTrackMatWithGeom(0), |
62 | fDoConstrain(0), | |
27c2e3d9 | 63 | fIsGeoMatsSet(0), |
d9f26424 | 64 | fNEvs(0), |
d595acbb | 65 | fGeom(0), |
296ea9b4 | 66 | fReco(0), |
717fe7de | 67 | fOutput(0), |
b3ee6797 | 68 | fTrClassNamesArr(0), |
717fe7de | 69 | fEsdEv(0), |
70 | fAodEv(0), | |
43cfaa06 | 71 | fRecPoints(0), |
717fe7de | 72 | fEsdClusters(0), |
73 | fEsdCells(0), | |
74 | fAodClusters(0), | |
286b47a5 | 75 | fAodCells(0), |
fa443410 | 76 | fPtRanges(0), |
296ea9b4 | 77 | fSelTracks(0), |
788ca675 | 78 | fNtuple(0), |
79 | fHeader(0), | |
80 | fPrimVert(0), | |
81 | fSpdVert(0), | |
82 | fTpcVert(0), | |
83 | fClusters(0), | |
fa443410 | 84 | fHCuts(0x0), |
85 | fHVertexZ(0x0), | |
76332037 | 86 | fHVertexZ2(0x0), |
fa443410 | 87 | fHCent(0x0), |
88 | fHCentQual(0x0), | |
b3ee6797 | 89 | fHTclsBeforeCuts(0x0), |
90 | fHTclsAfterCuts(0x0), | |
d595acbb | 91 | fHColuRow(0x0), |
92 | fHColuRowE(0x0), | |
93 | fHCellMult(0x0), | |
94 | fHCellE(0x0), | |
95 | fHCellH(0x0), | |
6eb6260e | 96 | fHCellM(0x0), |
a49742b5 | 97 | fHCellM2(0x0), |
296ea9b4 | 98 | fHCellFreqNoCut(0x0), |
2e4d8148 | 99 | fHCellFreqCut100M(0x0), |
100 | fHCellFreqCut300M(0x0), | |
101 | fHCellFreqE(0x0), | |
296ea9b4 | 102 | fHCellCheckE(0x0), |
6eb6260e | 103 | fHClustEccentricity(0), |
fa443410 | 104 | fHClustEtaPhi(0x0), |
105 | fHClustEnergyPt(0x0), | |
106 | fHClustEnergySigma(0x0), | |
d595acbb | 107 | fHClustSigmaSigma(0x0), |
6eb6260e | 108 | fHClustNCellEnergyRatio(0x0), |
fa443410 | 109 | fHPionEtaPhi(0x0), |
110 | fHPionMggPt(0x0), | |
6eb6260e | 111 | fHPionMggAsym(0x0), |
112 | fHPionMggDgg(0x0) | |
ea3fd2d5 | 113 | { |
717fe7de | 114 | // Constructor. |
ea3fd2d5 | 115 | |
d595acbb | 116 | if (!name) |
117 | return; | |
118 | SetName(name); | |
ea3fd2d5 | 119 | DefineInput(0, TChain::Class()); |
ea3fd2d5 | 120 | DefineOutput(1, TList::Class()); |
296ea9b4 | 121 | fBranchNames="ESD:AliESDRun.,AliESDHeader.,PrimaryVertex.,SPDVertex.,TPCVertex.,EMCALCells.,Tracks " |
122 | "AOD:header,vertices,emcalCells,tracks"; | |
ea3fd2d5 | 123 | } |
ea3fd2d5 | 124 | |
717fe7de | 125 | //________________________________________________________________________ |
126 | AliAnalysisTaskEMCALPi0PbPb::~AliAnalysisTaskEMCALPi0PbPb() | |
127 | { | |
128 | // Destructor. | |
ea3fd2d5 | 129 | |
b3ee6797 | 130 | if (!AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { |
131 | delete fOutput; fOutput = 0; | |
132 | } | |
fa443410 | 133 | delete fPtRanges; fPtRanges = 0; |
d595acbb | 134 | delete fGeom; fGeom = 0; |
296ea9b4 | 135 | delete fReco; fReco = 0; |
b3ee6797 | 136 | delete fTrClassNamesArr; |
296ea9b4 | 137 | delete fSelTracks; |
d595acbb | 138 | delete [] fHColuRow; |
139 | delete [] fHColuRowE; | |
140 | delete [] fHCellMult; | |
296ea9b4 | 141 | delete [] fHCellFreqNoCut; |
2e4d8148 | 142 | delete [] fHCellFreqCut100M; |
143 | delete [] fHCellFreqCut300M; | |
ea3fd2d5 | 144 | } |
717fe7de | 145 | |
ea3fd2d5 | 146 | //________________________________________________________________________ |
147 | void AliAnalysisTaskEMCALPi0PbPb::UserCreateOutputObjects() | |
148 | { | |
717fe7de | 149 | // Create user objects here. |
ea3fd2d5 | 150 | |
296ea9b4 | 151 | fGeom = new AliEMCALGeoUtils(fGeoName,"EMCAL"); |
152 | fReco = new AliEMCALRecoUtils(); | |
b3ee6797 | 153 | fTrClassNamesArr = fTrClassNames.Tokenize(" "); |
717fe7de | 154 | fOutput = new TList(); |
155 | fOutput->SetOwner(); | |
296ea9b4 | 156 | fSelTracks = new TObjArray; |
ea3fd2d5 | 157 | |
f5d4ab70 | 158 | if (fDoNtuple) { |
159 | TFile *f = OpenFile(1); | |
6bf90832 | 160 | if (f) { |
161 | f->SetCompressionLevel(2); | |
788ca675 | 162 | fNtuple = new TTree(Form("tree%.0fto%.0f",fCentFrom,fCentTo), "StandaloneTree"); |
6bf90832 | 163 | fNtuple->SetDirectory(f); |
164 | fNtuple->SetAutoFlush(-1024*1024*1024); | |
165 | fNtuple->SetAutoSave(-1024*1024*1024); | |
788ca675 | 166 | fHeader = new AliStaHeader; |
167 | fNtuple->Branch("header", &fHeader, 16*1024, 99); | |
168 | fPrimVert = new AliStaVertex; | |
169 | fNtuple->Branch("primv", &fPrimVert, 16*1024, 99); | |
170 | fSpdVert = new AliStaVertex; | |
171 | fNtuple->Branch("spdv", &fSpdVert, 16*1024, 99); | |
172 | fTpcVert = new AliStaVertex; | |
173 | fNtuple->Branch("tpcv", &fTpcVert, 16*1024, 99); | |
174 | if (TClass::GetClass("AliStaCluster")) | |
175 | TClass::GetClass("AliStaCluster")->IgnoreTObjectStreamer(); | |
176 | fClusters = new TClonesArray("AliStaCluster",1000); | |
177 | fNtuple->Branch("clusters", &fClusters, 8*16*1024, 99); | |
6bf90832 | 178 | } |
f5d4ab70 | 179 | } |
180 | ||
002dcebe | 181 | AliEMCALEMCGeometry *emc = fGeom->GetEMCGeometry(); |
182 | Double_t phimin = emc->GetArm1PhiMin()*TMath::DegToRad()-0.25; | |
183 | Double_t phimax = emc->GetArm1PhiMax()*TMath::DegToRad()+0.25; | |
184 | ||
d595acbb | 185 | // histograms |
a49742b5 | 186 | TH1::SetDefaultSumw2(kTRUE); |
187 | TH2::SetDefaultSumw2(kTRUE); | |
b3ee6797 | 188 | fHCuts = new TH1F("hEventCuts","",5,0.5,5.5); |
189 | fHCuts->GetXaxis()->SetBinLabel(1,"All"); | |
190 | fHCuts->GetXaxis()->SetBinLabel(2,"PS"); | |
191 | fHCuts->GetXaxis()->SetBinLabel(3,Form("%s: %.0f-%.0f",fCentVar.Data(),fCentFrom,fCentTo)); | |
192 | fHCuts->GetXaxis()->SetBinLabel(4,"QFlag"); | |
193 | fHCuts->GetXaxis()->SetBinLabel(5,Form("zvtx: %.0f-%.0f",fVtxZMin,fVtxZMax)); | |
fa443410 | 194 | fOutput->Add(fHCuts); |
195 | fHVertexZ = new TH1F("hVertexZBeforeCut","",100,-25,25); | |
196 | fHVertexZ->SetXTitle("z [cm]"); | |
197 | fOutput->Add(fHVertexZ); | |
76332037 | 198 | fHVertexZ2 = new TH1F("hVertexZAfterCut","",100,-25,25); |
199 | fHVertexZ2->SetXTitle("z [cm]"); | |
200 | fOutput->Add(fHVertexZ2); | |
fa443410 | 201 | fHCent = new TH1F("hCentBeforeCut","",101,-1,100); |
202 | fHCent->SetXTitle(fCentVar.Data()); | |
76332037 | 203 | fOutput->Add(fHCent); |
fa443410 | 204 | fHCentQual = new TH1F("hCentAfterCut","",101,-1,100); |
205 | fHCentQual->SetXTitle(fCentVar.Data()); | |
206 | fOutput->Add(fHCentQual); | |
2e4d8148 | 207 | fHTclsBeforeCuts = new TH1F("hTclsBeforeCuts","",fTrClassNamesArr->GetEntries(),0.5,0.5+fTrClassNamesArr->GetEntries()); |
208 | fHTclsAfterCuts = new TH1F("hTclsAfterCuts","",fTrClassNamesArr->GetEntries(),0.5,0.5+fTrClassNamesArr->GetEntries()); | |
b3ee6797 | 209 | for (Int_t i = 0; i<fTrClassNamesArr->GetEntries(); ++i) { |
210 | const char *name = fTrClassNamesArr->At(i)->GetName(); | |
211 | fHTclsBeforeCuts->GetXaxis()->SetBinLabel(1+i,name); | |
212 | fHTclsAfterCuts->GetXaxis()->SetBinLabel(1+i,name); | |
213 | } | |
214 | fOutput->Add(fHTclsBeforeCuts); | |
215 | fOutput->Add(fHTclsAfterCuts); | |
90d5b88b | 216 | |
d595acbb | 217 | // histograms for cells |
296ea9b4 | 218 | Int_t nsm = fGeom->GetEMCGeometry()->GetNumberOfSuperModules(); |
219 | fHColuRow = new TH2*[nsm]; | |
220 | fHColuRowE = new TH2*[nsm]; | |
221 | fHCellMult = new TH1*[nsm]; | |
222 | for (Int_t i = 0; i<nsm; ++i) { | |
2e4d8148 | 223 | fHColuRow[i] = new TH2F(Form("hColRow_Mod%d",i),"",48,0,48,24,0.,24); |
d595acbb | 224 | fHColuRow[i]->SetTitle(Form("Module %d: Occupancy", i)); |
225 | fHColuRow[i]->SetXTitle("col (i#eta)"); | |
226 | fHColuRow[i]->SetYTitle("row (i#phi)"); | |
2e4d8148 | 227 | fHColuRowE[i] = new TH2F(Form("hColRowE_Mod%d", i),"",48,0,48,24,0,24); |
90d5b88b | 228 | fHColuRowE[i]->SetTitle(Form("Module %d: Cell energy",i)); |
d595acbb | 229 | fHColuRowE[i]->SetXTitle("col (i#eta)"); |
230 | fHColuRowE[i]->SetYTitle("row (i#phi)"); | |
231 | fHCellMult[i] = new TH1F(Form("hCellMult_Mod%d",i),"",1000,0,1000); | |
232 | fHCellMult[i]->SetTitle(Form("Module %d: Cell multiplicity",i)); | |
90d5b88b | 233 | fHCellMult[i]->SetXTitle("# of cells"); |
d595acbb | 234 | fOutput->Add(fHColuRow[i]); |
235 | fOutput->Add(fHColuRowE[i]); | |
236 | fOutput->Add(fHCellMult[i]); | |
237 | } | |
2e4d8148 | 238 | fHCellE = new TH1F("hCellE","",250,0.,25.); |
d595acbb | 239 | fHCellE->SetXTitle("E_{cell} [GeV]"); |
240 | fOutput->Add(fHCellE); | |
fb5a0b69 | 241 | fHCellH = new TH1F ("hCellHighestE","",250,0.,25.); |
6eb6260e | 242 | fHCellH->SetXTitle("E^{max}_{cell} [GeV]"); |
d595acbb | 243 | fOutput->Add(fHCellH); |
fb5a0b69 | 244 | fHCellM = new TH1F ("hCellMeanEperHitCell","",250,0.,2.5); |
6eb6260e | 245 | fHCellM->SetXTitle("#LT E_{cell}#GT [GeV]"); |
246 | fOutput->Add(fHCellM); | |
fb5a0b69 | 247 | fHCellM2 = new TH1F ("hCellMeanEperAllCells","",250,0.,1); |
f4ec884e | 248 | fHCellM2->SetXTitle("1/N_{cells} #Sigma E_{cell} [GeV]"); |
a49742b5 | 249 | fOutput->Add(fHCellM2); |
90d5b88b | 250 | |
2e4d8148 | 251 | fHCellFreqNoCut = new TH1*[nsm]; |
252 | fHCellFreqCut100M = new TH1*[nsm]; | |
253 | fHCellFreqCut300M = new TH1*[nsm]; | |
254 | fHCellFreqE = new TH1*[nsm]; | |
296ea9b4 | 255 | for (Int_t i = 0; i<nsm; ++i){ |
256 | Double_t lbin = i*24*48-0.5; | |
257 | Double_t hbin = lbin+24*48; | |
2e4d8148 | 258 | fHCellFreqNoCut[i] = new TH1F(Form("hCellFreqNoCut_SM%d",i), |
259 | Form("Frequency SM%d (no cut);id;#",i), 1152, lbin, hbin); | |
260 | fHCellFreqCut100M[i] = new TH1F(Form("hCellFreqCut100M_SM%d",i), | |
261 | Form("Frequency SM%d (>0.1GeV);id;#",i), 1152, lbin, hbin); | |
262 | fHCellFreqCut300M[i] = new TH1F(Form("hCellFreqCut300M_SM%d",i), | |
263 | Form("Frequency SM%d (>0.3GeV);id;#",i), 1152, lbin, hbin); | |
264 | fHCellFreqE[i] = new TH1F(Form("hCellFreqE_SM%d",i), | |
265 | Form("Frequency SM%d (E weighted);id;#",i), 1152, lbin, hbin); | |
296ea9b4 | 266 | fOutput->Add(fHCellFreqNoCut[i]); |
2e4d8148 | 267 | fOutput->Add(fHCellFreqCut100M[i]); |
268 | fOutput->Add(fHCellFreqCut300M[i]); | |
269 | fOutput->Add(fHCellFreqE[i]); | |
296ea9b4 | 270 | } |
271 | if (1) { | |
272 | fHCellCheckE = new TH1*[24*48*nsm]; | |
408dc04c | 273 | memset(fHCellCheckE,0,24*48*nsm*sizeof(TH1*)); |
296ea9b4 | 274 | Int_t tcs[1] = {4102}; |
275 | for (UInt_t i = 0; i<sizeof(tcs)/sizeof(Int_t); ++i){ | |
276 | Int_t c=tcs[i]; | |
277 | if (c<24*48*nsm) { | |
fb5a0b69 | 278 | fHCellCheckE[i] = new TH1F(Form("hCellE_id%d",c), Form("Cell %d;E [GeV/c];#",c), 500, 0, 8); |
296ea9b4 | 279 | fOutput->Add(fHCellCheckE[i]); |
280 | } | |
281 | } | |
282 | } | |
283 | ||
d595acbb | 284 | // histograms for clusters |
6eb6260e | 285 | fHClustEccentricity = new TH1F("hClustEccentricity","",100,-0.1,1.1); |
286 | fHClustEccentricity->SetXTitle("#epsilon_{C}"); | |
287 | fOutput->Add(fHClustEccentricity); | |
002dcebe | 288 | fHClustEtaPhi = new TH2F("hClustEtaPhi","",500,-0.8,0.8,100*nsm,phimin,phimax); |
fa443410 | 289 | fHClustEtaPhi->SetXTitle("#eta"); |
290 | fHClustEtaPhi->SetYTitle("#varphi"); | |
291 | fOutput->Add(fHClustEtaPhi); | |
292 | fHClustEnergyPt = new TH2F("hClustEnergyPt","",250,0,50,250,0,50); | |
293 | fHClustEnergyPt->SetXTitle("E [GeV]"); | |
6eb6260e | 294 | fHClustEnergyPt->SetYTitle("p_{T} [GeV/c]"); |
fa443410 | 295 | fOutput->Add(fHClustEnergyPt); |
a49742b5 | 296 | fHClustEnergySigma = new TH2F("hClustEnergySigma","",100,0,100,500,0,50); |
297 | fHClustEnergySigma->SetXTitle("E_{C} * #sigma_{max} [GeV*cm]"); | |
6eb6260e | 298 | fHClustEnergySigma->SetYTitle("E_{C} [GeV]"); |
d595acbb | 299 | fOutput->Add(fHClustEnergySigma); |
a49742b5 | 300 | fHClustSigmaSigma = new TH2F("hClustSigmaSigma","",500,0,50,500,0,50); |
6eb6260e | 301 | fHClustSigmaSigma->SetXTitle("#lambda_{0} [cm]"); |
302 | fHClustSigmaSigma->SetYTitle("#sigma_{max} [cm]"); | |
d595acbb | 303 | fOutput->Add(fHClustSigmaSigma); |
6eb6260e | 304 | fHClustNCellEnergyRatio = new TH2F("hClustNCellEnergyRatio","",27,-0.5,26.5,101,-0.05,1.05); |
305 | fHClustNCellEnergyRatio->SetXTitle("N_{cells}"); | |
306 | fHClustNCellEnergyRatio->SetYTitle("E^{max}_{cell}/E_{clus}"); | |
307 | fOutput->Add(fHClustNCellEnergyRatio); | |
90d5b88b | 308 | |
d595acbb | 309 | // histograms for pion candidates |
002dcebe | 310 | fHPionEtaPhi = new TH2F("hPionEtaPhi","",100,-0.8,0.8,100*nsm,phimin,phimax); |
a49742b5 | 311 | fHPionEtaPhi->SetXTitle("#eta_{#gamma#gamma}"); |
312 | fHPionEtaPhi->SetYTitle("#varphi_{#gamma#gamma}"); | |
fa443410 | 313 | fOutput->Add(fHPionEtaPhi); |
a49742b5 | 314 | fHPionMggPt = new TH2F("hPionMggPt","",1000,0,2,100,0,20.0); |
fa443410 | 315 | fHPionMggPt->SetXTitle("M_{#gamma#gamma} [GeV/c^{2}]"); |
316 | fHPionMggPt->SetYTitle("p_{T}^{#gamma#gamma} [GeV/c]"); | |
317 | fOutput->Add(fHPionMggPt); | |
a49742b5 | 318 | fHPionMggAsym = new TH2F("hPionMggAsym","",1000,0,2,100,0,1); |
fa443410 | 319 | fHPionMggAsym->SetXTitle("M_{#gamma#gamma} [GeV/c^{2}]"); |
320 | fHPionMggAsym->SetYTitle("Z_{#gamma#gamma} [GeV]"); | |
321 | fOutput->Add(fHPionMggAsym); | |
a49742b5 | 322 | fHPionMggDgg = new TH2F("hPionMggDgg","",1000,0,2,100,0,10); |
6eb6260e | 323 | fHPionMggDgg->SetXTitle("M_{#gamma#gamma} [GeV/c^{2}]"); |
324 | fHPionMggDgg->SetYTitle("opening angle [grad]"); | |
325 | fOutput->Add(fHPionMggDgg); | |
78204d3d | 326 | const Int_t nbins = 20; |
327 | 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 | 328 | fPtRanges = new TAxis(nbins-1,xbins); |
329 | for (Int_t i = 0; i<=nbins; ++i) { | |
a49742b5 | 330 | fHPionInvMasses[i] = new TH1F(Form("hPionInvMass%d",i),"",1000,0,2); |
fa443410 | 331 | fHPionInvMasses[i]->SetXTitle("M_{#gamma#gamma} [GeV/c^{2}]"); |
332 | if (i==0) | |
333 | fHPionInvMasses[i]->SetTitle(Form("0 < p_{T}^{#gamma#gamma} <%.1f",xbins[0])); | |
334 | else if (i==nbins) | |
335 | fHPionInvMasses[i]->SetTitle(Form("p_{T}^{#gamma#gamma} > 50")); | |
336 | else | |
337 | fHPionInvMasses[i]->SetTitle(Form("%.1f < p_{T}^{#gamma#gamma} <%.1f",xbins[i-1],xbins[i])); | |
fa443410 | 338 | fOutput->Add(fHPionInvMasses[i]); |
339 | } | |
296ea9b4 | 340 | |
717fe7de | 341 | PostData(1, fOutput); |
ea3fd2d5 | 342 | } |
343 | ||
344 | //________________________________________________________________________ | |
345 | void AliAnalysisTaskEMCALPi0PbPb::UserExec(Option_t *) | |
346 | { | |
717fe7de | 347 | // Called for each event. |
348 | ||
349 | if (!InputEvent()) | |
350 | return; | |
351 | ||
43cfaa06 | 352 | AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager(); |
353 | fEsdEv = dynamic_cast<AliESDEvent*>(InputEvent()); | |
354 | if (fEsdEv) { | |
355 | am->LoadBranch("AliESDRun."); | |
356 | am->LoadBranch("AliESDHeader."); | |
357 | } else { | |
358 | fAodEv = dynamic_cast<AliAODEvent*>(InputEvent()); | |
408dc04c | 359 | if (!fAodEv) { |
360 | AliFatal("Neither ESD nor AOD event found"); | |
361 | return; | |
362 | } | |
43cfaa06 | 363 | am->LoadBranch("header"); |
364 | } | |
365 | ||
27c2e3d9 | 366 | if (fDoTrackMatWithGeom && !AliGeomManager::GetGeometry()) { // get geometry |
367 | AliWarning("Accessing geometry from OCDB, this is not very efficient!"); | |
368 | AliCDBManager *cdb = AliCDBManager::Instance(); | |
369 | if (!cdb->IsDefaultStorageSet()) | |
370 | cdb->SetDefaultStorage("raw://"); | |
371 | Int_t runno = InputEvent()->GetRunNumber(); | |
372 | if (runno != cdb->GetRun()) | |
373 | cdb->SetRun(runno); | |
374 | AliGeomManager::LoadGeometry(); | |
375 | } | |
376 | ||
377 | if (!AliGeomManager::GetGeometry()&&!fIsGeoMatsSet) { // set misalignment matrices (stored in first event) | |
378 | Int_t nsm = fGeom->GetEMCGeometry()->GetNumberOfSuperModules(); | |
379 | if (fEsdEv) { | |
380 | for (Int_t i=0; i<nsm; ++i) | |
381 | fGeom->SetMisalMatrix(fEsdEv->GetESDRun()->GetEMCALMatrix(i),i); | |
382 | } else { | |
383 | for (Int_t i=0; i<nsm; ++i) | |
384 | fGeom->SetMisalMatrix(fAodEv->GetHeader()->GetEMCALMatrix(i),i); | |
385 | } | |
386 | fIsGeoMatsSet = kTRUE; | |
387 | } | |
388 | ||
389 | if (!TGeoGlobalMagField::Instance()->GetField()) { // construct field map | |
390 | if (fEsdEv) { | |
391 | const AliESDRun *erun = fEsdEv->GetESDRun(); | |
392 | AliMagF *field = AliMagF::CreateFieldMap(erun->GetCurrentL3(), | |
393 | erun->GetCurrentDip(), | |
394 | AliMagF::kConvLHC, | |
395 | kFALSE, | |
396 | erun->GetBeamEnergy(), | |
397 | erun->GetBeamType()); | |
398 | TGeoGlobalMagField::Instance()->SetField(field); | |
399 | } else { | |
400 | Double_t pol = -1; //polarity | |
401 | Double_t be = -1; //beam energy | |
402 | AliMagF::BeamType_t btype = AliMagF::kBeamTypepp; | |
403 | Int_t runno = fAodEv->GetRunNumber(); | |
404 | if (runno>=136851 && runno<138275) { | |
405 | pol = -1; | |
406 | be = 2760; | |
407 | btype = AliMagF::kBeamTypeAA; | |
408 | } else if (runno>=138275 && runno<=139517) { | |
409 | pol = +1; | |
410 | be = 2760; | |
411 | btype = AliMagF::kBeamTypeAA; | |
412 | } else { | |
413 | AliError(Form("Do not know the bfield parameters for run %d! Using defaults!!!", runno)); | |
414 | } | |
415 | TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", pol, pol, AliMagF::k5kG, btype, be)); | |
416 | } | |
417 | } | |
418 | ||
b3ee6797 | 419 | Int_t cut = 1; |
420 | fHCuts->Fill(cut++); | |
421 | ||
422 | TString trgclasses; | |
423 | AliESDHeader *h = dynamic_cast<AliESDHeader*>(InputEvent()->GetHeader()); | |
424 | if (h) { | |
425 | trgclasses = fEsdEv->GetFiredTriggerClasses(); | |
426 | } else { | |
427 | AliAODHeader *h2 = dynamic_cast<AliAODHeader*>(InputEvent()->GetHeader()); | |
428 | if (h2) | |
429 | trgclasses = h2->GetFiredTriggerClasses(); | |
430 | } | |
431 | for (Int_t i = 0; i<fTrClassNamesArr->GetEntries(); ++i) { | |
432 | const char *name = fTrClassNamesArr->At(i)->GetName(); | |
433 | if (trgclasses.Contains(name)) | |
434 | fHTclsBeforeCuts->Fill(1+i); | |
435 | } | |
436 | ||
437 | UInt_t res = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected(); | |
438 | if (res==0) | |
439 | return; | |
440 | ||
fa443410 | 441 | fHCuts->Fill(cut++); |
286b47a5 | 442 | |
717fe7de | 443 | const AliCentrality *centP = InputEvent()->GetCentrality(); |
444 | Double_t cent = centP->GetCentralityPercentileUnchecked(fCentVar); | |
fa443410 | 445 | fHCent->Fill(cent); |
717fe7de | 446 | if (cent<fCentFrom||cent>fCentTo) |
286b47a5 | 447 | return; |
43cfaa06 | 448 | |
fa443410 | 449 | fHCuts->Fill(cut++); |
286b47a5 | 450 | |
43cfaa06 | 451 | if (fUseQualFlag) { |
452 | if (centP->GetQuality()>0) | |
453 | return; | |
454 | } | |
286b47a5 | 455 | |
fa443410 | 456 | fHCentQual->Fill(cent); |
457 | fHCuts->Fill(cut++); | |
717fe7de | 458 | |
43cfaa06 | 459 | if (fEsdEv) { |
fa443410 | 460 | am->LoadBranch("PrimaryVertex."); |
461 | am->LoadBranch("SPDVertex."); | |
462 | am->LoadBranch("TPCVertex."); | |
43cfaa06 | 463 | } else { |
464 | fAodEv = dynamic_cast<AliAODEvent*>(InputEvent()); | |
465 | am->LoadBranch("vertices"); | |
3c661da5 | 466 | if (!fAodEv) return; |
43cfaa06 | 467 | } |
468 | ||
469 | const AliVVertex *vertex = InputEvent()->GetPrimaryVertex(); | |
717fe7de | 470 | if (!vertex) |
471 | return; | |
472 | ||
fa443410 | 473 | fHVertexZ->Fill(vertex->GetZ()); |
286b47a5 | 474 | |
717fe7de | 475 | if(vertex->GetZ()<fVtxZMin||vertex->GetZ()>fVtxZMax) |
476 | return; | |
286b47a5 | 477 | |
fa443410 | 478 | fHCuts->Fill(cut++); |
76332037 | 479 | fHVertexZ2->Fill(vertex->GetZ()); |
717fe7de | 480 | |
b3ee6797 | 481 | // count number of accepted events |
482 | ++fNEvs; | |
483 | ||
484 | for (Int_t i = 0; i<fTrClassNamesArr->GetEntries(); ++i) { | |
485 | const char *name = fTrClassNamesArr->At(i)->GetName(); | |
486 | if (trgclasses.Contains(name)) | |
487 | fHTclsAfterCuts->Fill(1+i); | |
488 | } | |
489 | ||
43cfaa06 | 490 | fRecPoints = 0; // will be set if fClusName is given and AliAnalysisTaskEMCALClusterizeFast is used |
491 | fEsdClusters = 0; // will be set if ESD input used and if fRecPoints are not set of if clusters are attached | |
492 | fEsdCells = 0; // will be set if ESD input used | |
493 | fAodClusters = 0; // will be set if AOD input used and if fRecPoints are not set of if clusters are attached | |
494 | // or if fClusName is given and AliAnalysisTaskEMCALClusterizeFast in AOD output mode | |
495 | fAodCells = 0; // will be set if AOD input used | |
717fe7de | 496 | |
43cfaa06 | 497 | // deal with special output from AliAnalysisTaskEMCALClusterizeFast first |
498 | Bool_t clusattached = 0; | |
499 | Bool_t recalibrated = 0; | |
500 | if (1 && !fClusName.IsNull()) { | |
501 | AliAnalysisTaskEMCALClusterizeFast *cltask = 0; | |
502 | TObjArray *ts = am->GetTasks(); | |
503 | cltask = dynamic_cast<AliAnalysisTaskEMCALClusterizeFast*>(ts->FindObject(fClusName)); | |
504 | if (cltask && cltask->GetClusters()) { | |
d595acbb | 505 | fRecPoints = const_cast<TObjArray*>(cltask->GetClusters()); |
43cfaa06 | 506 | clusattached = cltask->GetAttachClusters(); |
507 | if (cltask->GetCalibData()!=0) | |
508 | recalibrated = kTRUE; | |
509 | } | |
510 | } | |
511 | if (1 && AODEvent() && !fClusName.IsNull()) { | |
717fe7de | 512 | TList *l = AODEvent()->GetList(); |
513 | TClonesArray *clus = 0; | |
514 | if (l) { | |
515 | clus = dynamic_cast<TClonesArray*>(l->FindObject(fClusName)); | |
516 | fAodClusters = clus; | |
517 | } | |
ea3fd2d5 | 518 | } |
717fe7de | 519 | |
520 | if (fEsdEv) { // ESD input mode | |
43cfaa06 | 521 | if (1 && (!fRecPoints||clusattached)) { |
522 | if (!clusattached) | |
523 | am->LoadBranch("CaloClusters"); | |
717fe7de | 524 | TList *l = fEsdEv->GetList(); |
525 | TClonesArray *clus = 0; | |
526 | if (l) { | |
527 | clus = dynamic_cast<TClonesArray*>(l->FindObject("CaloClusters")); | |
528 | fEsdClusters = clus; | |
ea3fd2d5 | 529 | } |
530 | } | |
43cfaa06 | 531 | if (1) { |
532 | if (!recalibrated) | |
533 | am->LoadBranch("EMCALCells."); | |
717fe7de | 534 | fEsdCells = fEsdEv->GetEMCALCells(); |
535 | } | |
536 | } else if (fAodEv) { // AOD input mode | |
43cfaa06 | 537 | if (1 && (!fAodClusters || clusattached)) { |
538 | if (!clusattached) | |
539 | am->LoadBranch("caloClusters"); | |
717fe7de | 540 | TList *l = fAodEv->GetList(); |
541 | TClonesArray *clus = 0; | |
542 | if (l) { | |
543 | clus = dynamic_cast<TClonesArray*>(l->FindObject("caloClusters")); | |
544 | fAodClusters = clus; | |
ea3fd2d5 | 545 | } |
546 | } | |
43cfaa06 | 547 | if (1) { |
548 | if (!recalibrated) | |
549 | am->LoadBranch("emcalCells"); | |
717fe7de | 550 | fAodCells = fAodEv->GetEMCALCells(); |
551 | } | |
552 | } else { | |
553 | AliFatal("Impossible to not have either pointer to ESD or AOD event"); | |
554 | } | |
ea3fd2d5 | 555 | |
43cfaa06 | 556 | if (1) { |
557 | AliDebug(2,Form("fRecPoints set: %p", fRecPoints)); | |
558 | AliDebug(2,Form("fEsdClusters set: %p", fEsdClusters)); | |
559 | AliDebug(2,Form("fEsdCells set: %p", fEsdCells)); | |
560 | AliDebug(2,Form("fAodClusters set: %p", fAodClusters)); | |
561 | AliDebug(2,Form("fAodCells set: %p", fAodCells)); | |
562 | } | |
563 | ||
a49742b5 | 564 | if (fDoAfterburner) |
565 | ClusterAfterburner(); | |
6eb6260e | 566 | |
296ea9b4 | 567 | CalcTracks(); |
568 | CalcClusterProps(); | |
569 | ||
286b47a5 | 570 | FillCellHists(); |
571 | FillClusHists(); | |
572 | FillPionHists(); | |
323834f0 | 573 | FillOtherHists(); |
788ca675 | 574 | FillNtuple(); |
ea3fd2d5 | 575 | |
717fe7de | 576 | PostData(1, fOutput); |
ea3fd2d5 | 577 | } |
578 | ||
579 | //________________________________________________________________________ | |
580 | void AliAnalysisTaskEMCALPi0PbPb::Terminate(Option_t *) | |
581 | { | |
717fe7de | 582 | // Terminate called at the end of analysis. |
f5d4ab70 | 583 | |
584 | if (fNtuple) { | |
585 | TFile *f = OpenFile(1); | |
586 | if (f) | |
587 | fNtuple->Write(); | |
588 | } | |
d9f26424 | 589 | |
b3ee6797 | 590 | AliInfo(Form("%s: Accepted %lld events", GetName(), fNEvs)); |
ea3fd2d5 | 591 | } |
ea3fd2d5 | 592 | |
296ea9b4 | 593 | //________________________________________________________________________ |
594 | void AliAnalysisTaskEMCALPi0PbPb::CalcTracks() | |
595 | { | |
596 | // Calculate track properties. | |
597 | ||
598 | fSelTracks->Clear(); | |
599 | ||
600 | AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager(); | |
601 | TClonesArray *tracks = 0; | |
602 | if (fEsdEv) { | |
603 | am->LoadBranch("Tracks"); | |
604 | TList *l = fEsdEv->GetList(); | |
605 | tracks = dynamic_cast<TClonesArray*>(l->FindObject("Tracks")); | |
606 | } else { | |
607 | am->LoadBranch("tracks"); | |
608 | TList *l = fAodEv->GetList(); | |
609 | tracks = dynamic_cast<TClonesArray*>(l->FindObject("tracks")); | |
610 | } | |
611 | ||
612 | if (!tracks) | |
613 | return; | |
614 | ||
0ec74551 | 615 | AliEMCALEMCGeometry *emc = fGeom->GetEMCGeometry(); |
616 | Double_t phimin = emc->GetArm1PhiMin()*TMath::DegToRad()-0.25; | |
617 | Double_t phimax = emc->GetArm1PhiMax()*TMath::DegToRad()+0.25; | |
618 | ||
296ea9b4 | 619 | if (fEsdEv) { |
2e4d8148 | 620 | if (fDoConstrain) |
621 | fSelTracks->SetOwner(kTRUE); | |
0ec74551 | 622 | am->LoadBranch("PrimaryVertex."); |
623 | const AliESDVertex *vtx = fEsdEv->GetPrimaryVertexSPD(); | |
624 | am->LoadBranch("SPDVertex."); | |
625 | const AliESDVertex *vtxSPD = fEsdEv->GetPrimaryVertexSPD(); | |
626 | am->LoadBranch("Tracks"); | |
627 | const Int_t Ntracks = tracks->GetEntries(); | |
628 | for (Int_t iTracks = 0; iTracks < Ntracks; ++iTracks) { | |
629 | AliESDtrack *track = static_cast<AliESDtrack*>(tracks->At(iTracks)); | |
630 | if (!track) { | |
631 | AliWarning(Form("Could not receive track %d\n", iTracks)); | |
632 | continue; | |
633 | } | |
634 | if (fTrCuts && !fTrCuts->IsSelected(track)) | |
296ea9b4 | 635 | continue; |
636 | Double_t eta = track->Eta(); | |
637 | if (eta<-1||eta>1) | |
638 | continue; | |
0ec74551 | 639 | if (track->Phi()<phimin||track->Phi()>phimax) |
640 | continue; | |
296ea9b4 | 641 | if(track->GetTPCNcls()<fMinNClustPerTrack) |
642 | continue; | |
2e4d8148 | 643 | |
644 | if (!fDoConstrain) { | |
645 | fSelTracks->Add(track); | |
646 | continue; | |
647 | } | |
648 | ||
0ec74551 | 649 | AliESDtrack copyt(*track); |
650 | Double_t bfield[3]; | |
651 | copyt.GetBxByBz(bfield); | |
652 | AliExternalTrackParam tParam; | |
653 | Bool_t relate = copyt.RelateToVertexBxByBz(vtxSPD,bfield,kVeryBig,&tParam); | |
654 | if (!relate) | |
655 | continue; | |
656 | copyt.Set(tParam.GetX(),tParam.GetAlpha(),tParam.GetParameter(),tParam.GetCovariance()); | |
2e4d8148 | 657 | |
0ec74551 | 658 | Double_t p[3] = { 0. }; |
659 | copyt.GetPxPyPz(p); | |
660 | Double_t pos[3] = { 0. }; | |
661 | copyt.GetXYZ(pos); | |
662 | Double_t covTr[21] = { 0. }; | |
663 | copyt.GetCovarianceXYZPxPyPz(covTr); | |
664 | Double_t pid[10] = { 0. }; | |
665 | copyt.GetESDpid(pid); | |
666 | AliAODTrack *aTrack = new AliAODTrack(copyt.GetID(), | |
667 | copyt.GetLabel(), | |
668 | p, | |
669 | kTRUE, | |
670 | pos, | |
671 | kFALSE, | |
672 | covTr, | |
673 | (Short_t)copyt.GetSign(), | |
674 | copyt.GetITSClusterMap(), | |
675 | pid, | |
676 | 0,/*fPrimaryVertex,*/ | |
677 | kTRUE, // check if this is right | |
678 | vtx->UsesTrack(copyt.GetID())); | |
679 | aTrack->SetTPCClusterMap(copyt.GetTPCClusterMap()); | |
680 | aTrack->SetTPCSharedMap (copyt.GetTPCSharedMap()); | |
681 | Float_t ndf = copyt.GetTPCNcls() + 1 - 5 ; | |
682 | if(ndf>0) | |
683 | aTrack->SetChi2perNDF(copyt.GetTPCchi2()/ndf); | |
684 | else | |
685 | aTrack->SetChi2perNDF(-1); | |
686 | aTrack->SetFlags(copyt.GetStatus()); | |
687 | aTrack->SetTPCPointsF(copyt.GetTPCNclsF()); | |
688 | fSelTracks->Add(aTrack); | |
296ea9b4 | 689 | } |
690 | } else { | |
691 | Int_t ntracks = tracks->GetEntries(); | |
692 | for (Int_t i=0; i<ntracks; ++i) { | |
693 | AliAODTrack *track = static_cast<AliAODTrack*>(tracks->At(i)); | |
694 | if (!track) | |
695 | continue; | |
696 | Double_t eta = track->Eta(); | |
697 | if (eta<-1||eta>1) | |
698 | continue; | |
0ec74551 | 699 | if (track->Phi()<phimin||track->Phi()>phimax) |
700 | continue; | |
296ea9b4 | 701 | if(track->GetTPCNcls()<fMinNClustPerTrack) |
702 | continue; | |
c4236a58 | 703 | |
71fed3bd | 704 | if (0 && (track->Pt()>=0.6) && (track->PxAtDCA()==-999)) { // compute position on EMCAL |
c4236a58 | 705 | AliExternalTrackParam tParam(track); |
706 | if (AliTrackerBase::PropagateTrackToBxByBz(&tParam, 438, 0.139, 1, kTRUE)) { | |
707 | Double_t trkPos[3]; | |
708 | tParam.GetXYZ(trkPos); | |
709 | track->SetPxPyPzAtDCA(trkPos[0],trkPos[1],trkPos[2]); | |
710 | } | |
711 | } | |
296ea9b4 | 712 | fSelTracks->Add(track); |
713 | } | |
714 | } | |
715 | } | |
716 | ||
717 | //________________________________________________________________________ | |
718 | void AliAnalysisTaskEMCALPi0PbPb::CalcClusterProps() | |
719 | { | |
720 | // Calculate cluster properties | |
721 | ||
722 | TObjArray *clusters = fEsdClusters; | |
723 | if (!clusters) | |
724 | clusters = fAodClusters; | |
725 | if (!clusters) | |
726 | return; | |
727 | ||
728 | Int_t nclus = clusters->GetEntries(); | |
c4236a58 | 729 | Int_t ntrks = fSelTracks->GetEntries(); |
730 | ||
296ea9b4 | 731 | for(Int_t i = 0; i<nclus; ++i) { |
732 | fClusProps[i].Reset(); | |
733 | ||
734 | AliVCluster *clus = static_cast<AliVCluster*>(clusters->At(i)); | |
735 | if (!clus) | |
736 | continue; | |
737 | if (!clus->IsEMCAL()) | |
738 | continue; | |
739 | if (clus->E()<fMinE) | |
740 | continue; | |
741 | ||
742 | Float_t clsPos[3] = {0}; | |
743 | clus->GetPosition(clsPos); | |
04785f50 | 744 | TVector3 clsVec(clsPos); |
c4236a58 | 745 | Double_t vertex[3] = {0}; |
746 | InputEvent()->GetPrimaryVertex()->GetXYZ(vertex); | |
747 | TLorentzVector clusterVec; | |
748 | clus->GetMomentum(clusterVec,vertex); | |
749 | Double_t clsEta = clusterVec.Eta(); | |
296ea9b4 | 750 | |
296ea9b4 | 751 | Double_t mind2 = 1e10; |
752 | for(Int_t j = 0; j<ntrks; ++j) { | |
753 | AliVTrack *track = static_cast<AliVTrack*>(fSelTracks->At(j)); | |
754 | if (!track) | |
755 | continue; | |
71fed3bd | 756 | Double_t pt = track->Pt(); |
757 | if (pt<fMinPtPerTrack) | |
296ea9b4 | 758 | continue; |
2e4d8148 | 759 | if (TMath::Abs(clsEta-track->Eta())>0.5) |
c4236a58 | 760 | continue; |
761 | ||
296ea9b4 | 762 | Float_t tmpR=-1, tmpZ=-1; |
2e4d8148 | 763 | if (!fDoTrackMatWithGeom) { |
764 | ||
765 | AliExternalTrackParam *tParam = 0; | |
766 | if (fEsdEv) { | |
767 | AliESDtrack *esdTrack = static_cast<AliESDtrack*>(track); | |
768 | tParam = new AliExternalTrackParam(*esdTrack->GetTPCInnerParam()); | |
769 | } else | |
770 | tParam = new AliExternalTrackParam(track); | |
771 | ||
772 | Double_t bfield[3]; | |
773 | track->GetBxByBz(bfield); | |
04785f50 | 774 | TVector3 vec(clsPos); |
775 | Double_t alpha = ((int)(vec.Phi()*TMath::RadToDeg()/20)+0.5)*20*TMath::DegToRad(); | |
776 | vec.RotateZ(-alpha); //Rotate the cluster to the local extrapolation coordinate system | |
2e4d8148 | 777 | tParam->Rotate(alpha); //Rotate the track to the same local extrapolation system |
778 | Bool_t ret = tParam->PropagateToBxByBz(vec.X(), bfield); | |
779 | if (!ret) { | |
780 | delete tParam; | |
04785f50 | 781 | continue; |
2e4d8148 | 782 | } |
04785f50 | 783 | Double_t trkPos[3]; |
2e4d8148 | 784 | tParam->GetXYZ(trkPos); //Get the extrapolated global position |
04785f50 | 785 | tmpR = TMath::Sqrt( TMath::Power(clsPos[0]-trkPos[0],2)+TMath::Power(clsPos[1]-trkPos[1],2)+TMath::Power(clsPos[2]-trkPos[2],2) ); |
786 | tmpZ = clsPos[2]-trkPos[2]; | |
2e4d8148 | 787 | delete tParam; |
788 | } else { | |
789 | if (TMath::Abs(clsEta-track->Eta())>fIsoDist) | |
790 | continue; | |
791 | AliExternalTrackParam tParam(track); | |
792 | if (!fReco->ExtrapolateTrackToCluster(&tParam, clus, tmpR, tmpZ)) | |
793 | continue; | |
04785f50 | 794 | } |
2e4d8148 | 795 | |
c4236a58 | 796 | Double_t d2 = tmpR; |
296ea9b4 | 797 | if (mind2>d2) { |
798 | mind2=d2; | |
799 | fClusProps[i].fTrIndex = j; | |
800 | fClusProps[i].fTrDz = tmpZ; | |
c4236a58 | 801 | fClusProps[i].fTrDr = TMath::Sqrt(tmpR*tmpR-tmpZ*tmpZ); |
296ea9b4 | 802 | fClusProps[i].fTrDist = d2; |
803 | fClusProps[i].fTrEp = clus->E()/track->P(); | |
804 | } | |
805 | } | |
806 | ||
c4236a58 | 807 | if (0 && (fClusProps[i].fTrIndex>=0)) { |
808 | cout << i << " " << fClusProps[i].fTrIndex << ": Dr " << fClusProps[i].fTrDr << " " << " Dz " << fClusProps[i].fTrDz << endl; | |
809 | } | |
2e4d8148 | 810 | |
04785f50 | 811 | fClusProps[i].fTrIso = GetTrackIsolation(clusterVec.Eta(),clusterVec.Phi(),fIsoDist); |
812 | fClusProps[i].fTrLowPtIso = 0; | |
813 | fClusProps[i].fCellIso = GetCellIsolation(clsVec.Eta(),clsVec.Phi(),fIsoDist); | |
296ea9b4 | 814 | } |
815 | } | |
816 | ||
323834f0 | 817 | //________________________________________________________________________ |
818 | void AliAnalysisTaskEMCALPi0PbPb::ClusterAfterburner() | |
819 | { | |
296ea9b4 | 820 | // Run custer reconstruction afterburner. |
323834f0 | 821 | |
822 | AliVCaloCells *cells = fEsdCells; | |
823 | if (!cells) | |
824 | cells = fAodCells; | |
825 | ||
826 | if (!cells) | |
827 | return; | |
828 | ||
829 | Int_t ncells = cells->GetNumberOfCells(); | |
830 | if (ncells<=0) | |
831 | return; | |
832 | ||
833 | Double_t cellMeanE = 0, cellSigE = 0; | |
834 | for (Int_t i = 0; i<ncells; ++i) { | |
835 | Double_t cellE = cells->GetAmplitude(i); | |
836 | cellMeanE += cellE; | |
837 | cellSigE += cellE*cellE; | |
838 | } | |
839 | cellMeanE /= ncells; | |
840 | cellSigE /= ncells; | |
841 | cellSigE -= cellMeanE*cellMeanE; | |
842 | if (cellSigE<0) | |
843 | cellSigE = 0; | |
844 | cellSigE = TMath::Sqrt(cellSigE / ncells); | |
845 | ||
846 | Double_t subE = cellMeanE - 7*cellSigE; | |
847 | if (subE<0) | |
848 | return; | |
849 | ||
850 | for (Int_t i = 0; i<ncells; ++i) { | |
851 | Short_t id=-1; | |
852 | Double_t amp=0,time=0; | |
853 | if (!cells->GetCell(i, id, amp, time)) | |
854 | continue; | |
855 | amp -= cellMeanE; | |
856 | if (amp<0.001) | |
857 | amp = 0; | |
858 | cells->SetCell(i, id, amp, time); | |
859 | } | |
860 | ||
861 | TObjArray *clusters = fEsdClusters; | |
862 | if (!clusters) | |
863 | clusters = fAodClusters; | |
323834f0 | 864 | if (!clusters) |
865 | return; | |
866 | ||
867 | Int_t nclus = clusters->GetEntries(); | |
868 | for (Int_t i = 0; i<nclus; ++i) { | |
869 | AliVCluster *clus = static_cast<AliVCluster*>(clusters->At(i)); | |
870 | if (!clus->IsEMCAL()) | |
871 | continue; | |
872 | Int_t nc = clus->GetNCells(); | |
873 | Double_t clusE = 0; | |
874 | UShort_t ids[100] = {0}; | |
875 | Double_t fra[100] = {0}; | |
876 | for (Int_t j = 0; j<nc; ++j) { | |
877 | Short_t id = TMath::Abs(clus->GetCellAbsId(j)); | |
878 | Double_t cen = cells->GetCellAmplitude(id); | |
879 | clusE += cen; | |
880 | if (cen>0) { | |
881 | ids[nc] = id; | |
882 | ++nc; | |
883 | } | |
884 | } | |
885 | if (clusE<=0) { | |
886 | clusters->RemoveAt(i); | |
887 | continue; | |
888 | } | |
889 | ||
890 | for (Int_t j = 0; j<nc; ++j) { | |
891 | Short_t id = ids[j]; | |
892 | Double_t cen = cells->GetCellAmplitude(id); | |
893 | fra[j] = cen/clusE; | |
894 | } | |
895 | clus->SetE(clusE); | |
896 | AliAODCaloCluster *aodclus = dynamic_cast<AliAODCaloCluster*>(clus); | |
897 | if (aodclus) { | |
898 | aodclus->Clear(""); | |
899 | aodclus->SetNCells(nc); | |
900 | aodclus->SetCellsAmplitudeFraction(fra); | |
901 | aodclus->SetCellsAbsId(ids); | |
902 | } | |
903 | } | |
904 | clusters->Compress(); | |
905 | } | |
906 | ||
286b47a5 | 907 | //________________________________________________________________________ |
908 | void AliAnalysisTaskEMCALPi0PbPb::FillCellHists() | |
909 | { | |
910 | // Fill histograms related to cell properties. | |
d595acbb | 911 | |
90d5b88b | 912 | AliVCaloCells *cells = fEsdCells; |
913 | if (!cells) | |
914 | cells = fAodCells; | |
915 | ||
296ea9b4 | 916 | if (!cells) |
917 | return; | |
90d5b88b | 918 | |
296ea9b4 | 919 | Int_t cellModCount[12] = {0}; |
920 | Double_t cellMaxE = 0; | |
921 | Double_t cellMeanE = 0; | |
922 | Int_t ncells = cells->GetNumberOfCells(); | |
923 | if (ncells==0) | |
924 | return; | |
925 | ||
926 | Int_t nsm = fGeom->GetEMCGeometry()->GetNumberOfSuperModules(); | |
927 | ||
928 | for (Int_t i = 0; i<ncells; ++i) { | |
929 | Int_t absID = TMath::Abs(cells->GetCellNumber(i)); | |
930 | Double_t cellE = cells->GetAmplitude(i); | |
931 | fHCellE->Fill(cellE); | |
932 | if (cellE>cellMaxE) | |
933 | cellMaxE = cellE; | |
934 | cellMeanE += cellE; | |
935 | ||
936 | Int_t iSM=-1, iTower=-1, nIphi=-1, nIeta=-1; | |
937 | Bool_t ret = fGeom->GetCellIndex(absID, iSM, iTower, nIphi, nIeta); | |
938 | if (!ret) { | |
939 | AliError(Form("Could not get cell index for %d", absID)); | |
940 | continue; | |
941 | } | |
942 | ++cellModCount[iSM]; | |
943 | Int_t iPhi=-1, iEta=-1; | |
944 | fGeom->GetCellPhiEtaIndexInSModule(iSM, iTower, nIphi, nIeta, iPhi, iEta); | |
945 | fHColuRow[iSM]->Fill(iEta,iPhi,1); | |
946 | fHColuRowE[iSM]->Fill(iEta,iPhi,cellE); | |
947 | fHCellFreqNoCut[iSM]->Fill(absID); | |
2e4d8148 | 948 | if (cellE > 0.1) fHCellFreqCut100M[iSM]->Fill(absID); |
949 | if (cellE > 0.3) fHCellFreqCut300M[iSM]->Fill(absID); | |
296ea9b4 | 950 | if (fHCellCheckE && fHCellCheckE[absID]) |
951 | fHCellCheckE[absID]->Fill(cellE); | |
2e4d8148 | 952 | fHCellFreqE[iSM]->Fill(absID, cellE); |
296ea9b4 | 953 | } |
954 | fHCellH->Fill(cellMaxE); | |
955 | cellMeanE /= ncells; | |
956 | fHCellM->Fill(cellMeanE); | |
957 | fHCellM2->Fill(cellMeanE*ncells/24/48/nsm); | |
958 | for (Int_t i=0; i<nsm; ++i) | |
959 | fHCellMult[i]->Fill(cellModCount[i]); | |
286b47a5 | 960 | } |
961 | ||
962 | //________________________________________________________________________ | |
963 | void AliAnalysisTaskEMCALPi0PbPb::FillClusHists() | |
964 | { | |
90d5b88b | 965 | // Fill histograms related to cluster properties. |
fa443410 | 966 | |
90d5b88b | 967 | TObjArray *clusters = fEsdClusters; |
968 | if (!clusters) | |
969 | clusters = fAodClusters; | |
296ea9b4 | 970 | if (!clusters) |
971 | return; | |
90d5b88b | 972 | |
296ea9b4 | 973 | Double_t vertex[3] = {0}; |
974 | InputEvent()->GetPrimaryVertex()->GetXYZ(vertex); | |
975 | ||
976 | Int_t nclus = clusters->GetEntries(); | |
977 | for(Int_t i = 0; i<nclus; ++i) { | |
978 | AliVCluster *clus = static_cast<AliVCluster*>(clusters->At(i)); | |
979 | if (!clus) | |
980 | continue; | |
981 | if (!clus->IsEMCAL()) | |
982 | continue; | |
90d5b88b | 983 | TLorentzVector clusterVec; |
296ea9b4 | 984 | clus->GetMomentum(clusterVec,vertex); |
985 | Double_t maxAxis = 0, minAxis = 0; | |
986 | GetSigma(clus,maxAxis,minAxis); | |
788ca675 | 987 | clus->SetTOF(maxAxis); // store sigma in TOF |
296ea9b4 | 988 | Double_t clusterEcc = 0; |
989 | if (maxAxis > 0) | |
990 | clusterEcc = TMath::Sqrt(1.0 - minAxis*minAxis/(maxAxis*maxAxis)); | |
991 | clus->SetChi2(clusterEcc); // store ecc in chi2 | |
992 | fHClustEccentricity->Fill(clusterEcc); | |
993 | fHClustEtaPhi->Fill(clusterVec.Eta(),clusterVec.Phi()); | |
994 | fHClustEnergyPt->Fill(clusterVec.E(),clusterVec.Pt()); | |
995 | fHClustEnergySigma->Fill(clus->E()*maxAxis,clus->E()); | |
996 | fHClustSigmaSigma->Fill(max(clus->GetM02(),clus->GetM20()),clus->E()*maxAxis); | |
997 | fHClustNCellEnergyRatio->Fill(clus->GetNCells(),GetMaxCellEnergy(clus)/clus->E()); | |
788ca675 | 998 | } |
999 | } | |
b3ee6797 | 1000 | |
788ca675 | 1001 | //________________________________________________________________________ |
1002 | void AliAnalysisTaskEMCALPi0PbPb::FillNtuple() | |
1003 | { | |
1004 | // Fill ntuple. | |
1005 | ||
1006 | if (!fNtuple) | |
1007 | return; | |
1008 | ||
1009 | AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager(); | |
1010 | if (fAodEv) { | |
1011 | fHeader->fRun = fAodEv->GetRunNumber(); | |
1012 | fHeader->fOrbit = fAodEv->GetHeader()->GetOrbitNumber(); | |
1013 | fHeader->fPeriod = fAodEv->GetHeader()->GetPeriodNumber(); | |
1014 | fHeader->fBx = fAodEv->GetHeader()->GetBunchCrossNumber(); | |
1015 | fHeader->fL0 = fAodEv->GetHeader()->GetL0TriggerInputs(); | |
1016 | fHeader->fL1 = fAodEv->GetHeader()->GetL1TriggerInputs(); | |
1017 | fHeader->fL2 = fAodEv->GetHeader()->GetL2TriggerInputs(); | |
1018 | fHeader->fTrClassMask = fAodEv->GetHeader()->GetTriggerMask(); | |
1019 | fHeader->fTrCluster = fAodEv->GetHeader()->GetTriggerCluster(); | |
1020 | fHeader->fOffTriggers = fAodEv->GetHeader()->GetOfflineTrigger(); | |
1021 | fHeader->fFiredTriggers = fAodEv->GetHeader()->GetFiredTriggerClasses(); | |
1022 | } else { | |
1023 | fHeader->fRun = fEsdEv->GetRunNumber(); | |
1024 | fHeader->fOrbit = fEsdEv->GetHeader()->GetOrbitNumber(); | |
1025 | fHeader->fPeriod = fEsdEv->GetESDRun()->GetPeriodNumber(); | |
1026 | fHeader->fBx = fEsdEv->GetHeader()->GetBunchCrossNumber(); | |
1027 | fHeader->fL0 = fEsdEv->GetHeader()->GetL0TriggerInputs(); | |
1028 | fHeader->fL1 = fEsdEv->GetHeader()->GetL1TriggerInputs(); | |
1029 | fHeader->fL2 = fEsdEv->GetHeader()->GetL2TriggerInputs(); | |
1030 | fHeader->fTrClassMask = fEsdEv->GetHeader()->GetTriggerMask(); | |
1031 | fHeader->fTrCluster = fEsdEv->GetHeader()->GetTriggerCluster(); | |
1032 | fHeader->fOffTriggers = ((AliInputEventHandler*)(am->GetInputEventHandler()))->IsEventSelected(); | |
1033 | fHeader->fFiredTriggers = fEsdEv->GetFiredTriggerClasses(); | |
1034 | } | |
1035 | AliCentrality *cent = InputEvent()->GetCentrality(); | |
1036 | fHeader->fV0Cent = cent->GetCentralityPercentileUnchecked("V0M"); | |
1037 | fHeader->fCl1Cent = cent->GetCentralityPercentileUnchecked("CL1"); | |
1038 | fHeader->fTrCent = cent->GetCentralityPercentileUnchecked("TRK"); | |
1039 | fHeader->fCqual = cent->GetQuality(); | |
1040 | ||
1041 | Double_t val = 0; | |
1042 | TString trgclasses(fHeader->fFiredTriggers); | |
1043 | for (Int_t j = 0; j<fTrClassNamesArr->GetEntries(); ++j) { | |
1044 | const char *name = fTrClassNamesArr->At(j)->GetName(); | |
1045 | if (trgclasses.Contains(name)) | |
1046 | val += TMath::Power(2,j); | |
1047 | } | |
1048 | fHeader->fTcls = (UInt_t)val; | |
1049 | ||
1050 | if (fAodEv) { | |
1051 | am->LoadBranch("vertices"); | |
1052 | AliAODVertex *pv = fAodEv->GetPrimaryVertex(); | |
1053 | FillVertex(fPrimVert, pv); | |
1054 | AliAODVertex *sv = fAodEv->GetPrimaryVertexSPD(); | |
1055 | FillVertex(fSpdVert, sv); | |
1056 | } else { | |
1057 | am->LoadBranch("PrimaryVertex."); | |
1058 | const AliESDVertex *pv = fEsdEv->GetPrimaryVertexTracks(); | |
1059 | FillVertex(fPrimVert, pv); | |
1060 | am->LoadBranch("SPDVertex."); | |
1061 | const AliESDVertex *sv = fEsdEv->GetPrimaryVertexSPD(); | |
1062 | FillVertex(fSpdVert, sv); | |
1063 | am->LoadBranch("TPCVertex."); | |
1064 | const AliESDVertex *tv = fEsdEv->GetPrimaryVertexTPC(); | |
1065 | FillVertex(fTpcVert, tv); | |
fa443410 | 1066 | } |
788ca675 | 1067 | |
1068 | TObjArray *clusters = fEsdClusters; | |
1069 | if (!clusters) | |
1070 | clusters = fAodClusters; | |
1071 | if (!clusters) | |
1072 | return; | |
1073 | ||
1074 | fClusters->Clear(); | |
1075 | Int_t nclus = clusters->GetEntries(); | |
1076 | for(Int_t i=0,ncl=0; i<nclus; ++i) { | |
1077 | AliVCluster *clus = static_cast<AliVCluster*>(clusters->At(i)); | |
1078 | if (!clus) | |
1079 | continue; | |
1080 | if (!clus->IsEMCAL()) | |
1081 | continue; | |
1082 | if (clus->E()<fMinE) | |
1083 | continue; | |
1084 | ||
1085 | AliStaCluster *cl = static_cast<AliStaCluster*>(fClusters->New(ncl++)); | |
1086 | cl->fE = clus->E(); | |
1087 | Float_t pos[3]; | |
1088 | clus->GetPosition(pos); | |
1089 | TVector3 vpos(pos); | |
1090 | cl->fR = vpos.Perp(); | |
1091 | cl->fEta = vpos.Eta(); | |
1092 | cl->fPhi = vpos.Phi(); | |
1093 | cl->fN = clus->GetNCells(); | |
1094 | cl->fN1 = GetNCells(clus,0.100); | |
1095 | cl->fN3 = GetNCells(clus,0.300); | |
1096 | Short_t id = -1; | |
1097 | Double_t emax = GetMaxCellEnergy(clus, id); | |
1098 | cl->fIdMax = id; | |
1099 | cl->fEmax = emax; | |
1100 | cl->fDbc = clus->GetDistanceToBadChannel();; | |
1101 | cl->fDisp = clus->GetDispersion(); | |
1102 | cl->fM20 = clus->GetM20(); | |
1103 | cl->fM02 = clus->GetM02(); | |
1104 | cl->fEcc = clus->Chi2(); //eccentricity | |
1105 | cl->fSig = clus->GetTOF(); //sigma | |
1106 | cl->fTrDz = fClusProps[i].fTrDz; | |
1107 | cl->fTrDr = fClusProps[i].fTrDr;; | |
1108 | cl->fTrEp = fClusProps[i].fTrEp;; | |
1109 | cl->fTrIso = fClusProps[i].fTrIso; | |
1110 | cl->fCeIso = fClusProps[i].fCellIso; | |
1111 | } | |
1112 | fNtuple->Fill(); | |
286b47a5 | 1113 | } |
1114 | ||
1115 | //________________________________________________________________________ | |
1116 | void AliAnalysisTaskEMCALPi0PbPb::FillPionHists() | |
1117 | { | |
1118 | // Fill histograms related to pions. | |
286b47a5 | 1119 | |
296ea9b4 | 1120 | Double_t vertex[3] = {0}; |
fa443410 | 1121 | InputEvent()->GetPrimaryVertex()->GetXYZ(vertex); |
1122 | ||
90d5b88b | 1123 | TObjArray *clusters = fEsdClusters; |
1124 | if (!clusters) | |
1125 | clusters = fAodClusters; | |
fa443410 | 1126 | |
90d5b88b | 1127 | if (clusters) { |
1128 | TLorentzVector clusterVec1; | |
1129 | TLorentzVector clusterVec2; | |
1130 | TLorentzVector pionVec; | |
1131 | ||
1132 | Int_t nclus = clusters->GetEntries(); | |
fa443410 | 1133 | for (Int_t i = 0; i<nclus; ++i) { |
90d5b88b | 1134 | AliVCluster *clus1 = static_cast<AliVCluster*>(clusters->At(i)); |
fa443410 | 1135 | if (!clus1) |
1136 | continue; | |
1137 | if (!clus1->IsEMCAL()) | |
1138 | continue; | |
3c661da5 | 1139 | if (clus1->E()<fMinE) |
6eb6260e | 1140 | continue; |
a49742b5 | 1141 | if (clus1->GetNCells()<fNminCells) |
1142 | continue; | |
f224d35b | 1143 | if (GetMaxCellEnergy(clus1)/clus1->E()<fMinErat) |
1144 | continue; | |
3c661da5 | 1145 | if (clus1->Chi2()<fMinEcc) // eccentricity cut |
f224d35b | 1146 | continue; |
fa443410 | 1147 | clus1->GetMomentum(clusterVec1,vertex); |
1148 | for (Int_t j = i+1; j<nclus; ++j) { | |
90d5b88b | 1149 | AliVCluster *clus2 = static_cast<AliVCluster*>(clusters->At(j)); |
fa443410 | 1150 | if (!clus2) |
1151 | continue; | |
1152 | if (!clus2->IsEMCAL()) | |
1153 | continue; | |
3c661da5 | 1154 | if (clus2->E()<fMinE) |
6eb6260e | 1155 | continue; |
a49742b5 | 1156 | if (clus2->GetNCells()<fNminCells) |
1157 | continue; | |
f224d35b | 1158 | if (GetMaxCellEnergy(clus2)/clus2->E()<fMinErat) |
1159 | continue; | |
3c661da5 | 1160 | if (clus2->Chi2()<fMinEcc) // eccentricity cut |
f224d35b | 1161 | continue; |
fa443410 | 1162 | clus2->GetMomentum(clusterVec2,vertex); |
1163 | pionVec = clusterVec1 + clusterVec2; | |
1164 | Double_t pionZgg = TMath::Abs(clusterVec1.E()-clusterVec2.E())/pionVec.E(); | |
6eb6260e | 1165 | Double_t pionOpeningAngle = clusterVec1.Angle(clusterVec2.Vect()); |
d595acbb | 1166 | if (pionZgg < fAsymMax) { |
1167 | fHPionEtaPhi->Fill(pionVec.Eta(),pionVec.Phi()); | |
1168 | fHPionMggPt->Fill(pionVec.M(),pionVec.Pt()); | |
1169 | fHPionMggAsym->Fill(pionVec.M(),pionZgg); | |
6eb6260e | 1170 | fHPionMggDgg->Fill(pionVec.M(),pionOpeningAngle); |
d595acbb | 1171 | Int_t bin = fPtRanges->FindBin(pionVec.Pt()); |
1172 | fHPionInvMasses[bin]->Fill(pionVec.M()); | |
1173 | } | |
fa443410 | 1174 | } |
1175 | } | |
90d5b88b | 1176 | } |
fa443410 | 1177 | } |
d595acbb | 1178 | |
6eb6260e | 1179 | //________________________________________________________________________ |
323834f0 | 1180 | void AliAnalysisTaskEMCALPi0PbPb::FillOtherHists() |
6eb6260e | 1181 | { |
788ca675 | 1182 | // Fill other histograms. |
1183 | } | |
1184 | ||
1185 | //__________________________________________________________________________________________________ | |
1186 | void AliAnalysisTaskEMCALPi0PbPb::FillVertex(AliStaVertex *v, const AliESDVertex *esdv) | |
1187 | { | |
1188 | // Fill vertex from ESD vertex info. | |
1189 | ||
1190 | v->fVx = esdv->GetX(); | |
1191 | v->fVy = esdv->GetY(); | |
1192 | v->fVz = esdv->GetZ(); | |
1193 | v->fVc = esdv->GetNContributors(); | |
1194 | v->fDisp = esdv->GetDispersion(); | |
1195 | v->fZres = esdv->GetZRes(); | |
1196 | v->fChi2 = esdv->GetChi2(); | |
1197 | v->fSt = esdv->GetStatus(); | |
1198 | v->fIs3D = esdv->IsFromVertexer3D(); | |
1199 | v->fIsZ = esdv->IsFromVertexerZ(); | |
1200 | } | |
1201 | ||
1202 | //__________________________________________________________________________________________________ | |
1203 | void AliAnalysisTaskEMCALPi0PbPb::FillVertex(AliStaVertex *v, const AliAODVertex *aodv) | |
1204 | { | |
1205 | // Fill vertex from AOD vertex info. | |
1206 | ||
1207 | v->fVx = aodv->GetX(); | |
1208 | v->fVy = aodv->GetY(); | |
1209 | v->fVz = aodv->GetZ(); | |
1210 | v->fVc = aodv->GetNContributors(); | |
1211 | v->fChi2 = aodv->GetChi2(); | |
6eb6260e | 1212 | } |
1213 | ||
d595acbb | 1214 | //________________________________________________________________________ |
296ea9b4 | 1215 | Double_t AliAnalysisTaskEMCALPi0PbPb::GetCellIsolation(Double_t cEta, Double_t cPhi, Double_t radius) const |
1216 | { | |
1217 | // Compute isolation based on cell content. | |
1218 | ||
1219 | AliVCaloCells *cells = fEsdCells; | |
1220 | if (!cells) | |
1221 | cells = fAodCells; | |
1222 | if (!cells) | |
1223 | return 0; | |
1224 | ||
1225 | Double_t cellIsolation = 0; | |
1226 | Double_t rad2 = radius*radius; | |
1227 | Int_t ncells = cells->GetNumberOfCells(); | |
1228 | for (Int_t i = 0; i<ncells; ++i) { | |
1229 | Int_t absID = TMath::Abs(cells->GetCellNumber(i)); | |
1230 | Double_t cellE = cells->GetAmplitude(i); | |
1231 | Float_t eta, phi; | |
1232 | fGeom->EtaPhiFromIndex(absID,eta,phi); | |
1233 | Double_t phidiff = TVector2::Phi_0_2pi(phi-cPhi); | |
1234 | Double_t dist = (eta-cEta)*(eta-cEta)+phidiff*phidiff; | |
1235 | if(dist>rad2) | |
1236 | continue; | |
1237 | cellIsolation += cellE; | |
1238 | } | |
1239 | return cellIsolation; | |
1240 | } | |
1241 | ||
1242 | //________________________________________________________________________ | |
788ca675 | 1243 | Double_t AliAnalysisTaskEMCALPi0PbPb::GetMaxCellEnergy(AliVCluster *cluster, Short_t &id) const |
d595acbb | 1244 | { |
90d5b88b | 1245 | // Get maximum energy of attached cell. |
1246 | ||
788ca675 | 1247 | id = -1; |
90d5b88b | 1248 | Double_t maxe = 0; |
90d5b88b | 1249 | Int_t ncells = cluster->GetNCells(); |
1250 | if (fEsdCells) { | |
1251 | for (Int_t i=0; i<ncells; i++) { | |
27422847 | 1252 | Double_t e = fEsdCells->GetCellAmplitude(TMath::Abs(cluster->GetCellAbsId(i))); |
f0897c18 | 1253 | if (e>maxe) { |
90d5b88b | 1254 | maxe = e; |
788ca675 | 1255 | id = cluster->GetCellAbsId(i); |
f0897c18 | 1256 | } |
90d5b88b | 1257 | } |
1258 | } else { | |
1259 | for (Int_t i=0; i<ncells; i++) { | |
27422847 | 1260 | Double_t e = fAodCells->GetCellAmplitude(TMath::Abs(cluster->GetCellAbsId(i))); |
90d5b88b | 1261 | if (e>maxe) |
1262 | maxe = e; | |
788ca675 | 1263 | id = cluster->GetCellAbsId(i); |
90d5b88b | 1264 | } |
1265 | } | |
6eb6260e | 1266 | return maxe; |
d595acbb | 1267 | } |
1268 | ||
1269 | //________________________________________________________________________ | |
296ea9b4 | 1270 | void AliAnalysisTaskEMCALPi0PbPb::GetSigma(AliVCluster *c, Double_t& sigmaMax, Double_t &sigmaMin) const |
d595acbb | 1271 | { |
90d5b88b | 1272 | // Calculate the (E) weighted variance along the longer (eigen) axis. |
1273 | ||
6bf90832 | 1274 | sigmaMax = 0; // cluster variance along its longer axis |
1275 | sigmaMin = 0; // cluster variance along its shorter axis | |
1276 | Double_t Ec = c->E(); // cluster energy | |
296ea9b4 | 1277 | if(Ec<=0) |
1278 | return; | |
6bf90832 | 1279 | Double_t Xc = 0 ; // cluster first moment along X |
1280 | Double_t Yc = 0 ; // cluster first moment along Y | |
1281 | Double_t Sxx = 0 ; // cluster second central moment along X (variance_X^2) | |
1282 | Double_t Sxy = 0 ; // cluster second central moment along Y (variance_Y^2) | |
1283 | Double_t Syy = 0 ; // cluster covariance^2 | |
90d5b88b | 1284 | |
1285 | AliVCaloCells *cells = fEsdCells; | |
1286 | if (!cells) | |
1287 | cells = fAodCells; | |
1288 | ||
6eb6260e | 1289 | if (!cells) |
1290 | return; | |
1291 | ||
6bf90832 | 1292 | Int_t ncells = c->GetNCells(); |
6eb6260e | 1293 | if (ncells==1) |
1294 | return; | |
1295 | ||
1296 | TVector3 pos; | |
1297 | for(Int_t j=0; j<ncells; ++j) { | |
6bf90832 | 1298 | Int_t id = TMath::Abs(c->GetCellAbsId(j)); |
27422847 | 1299 | fGeom->GetGlobal(id,pos); |
6eb6260e | 1300 | Double_t cellen = cells->GetCellAmplitude(id); |
1301 | Xc += cellen*pos.X(); | |
1302 | Yc += cellen*pos.Y(); | |
1303 | Sxx += cellen*pos.X()*pos.X(); | |
1304 | Syy += cellen*pos.Y()*pos.Y(); | |
1305 | Sxy += cellen*pos.X()*pos.Y(); | |
1306 | } | |
1307 | Xc /= Ec; | |
1308 | Yc /= Ec; | |
1309 | Sxx /= Ec; | |
1310 | Syy /= Ec; | |
1311 | Sxy /= Ec; | |
1312 | Sxx -= Xc*Xc; | |
1313 | Syy -= Yc*Yc; | |
1314 | Sxy -= Xc*Yc; | |
f0897c18 | 1315 | Sxx = TMath::Abs(Sxx); |
1316 | Syy = TMath::Abs(Syy); | |
296ea9b4 | 1317 | sigmaMax = (Sxx + Syy + TMath::Sqrt(TMath::Abs((Sxx-Syy)*(Sxx-Syy)+4.0*Sxy*Sxy)))/2.0; |
1318 | sigmaMax = TMath::Sqrt(TMath::Abs(sigmaMax)); | |
1319 | sigmaMin = TMath::Abs(Sxx + Syy - TMath::Sqrt(TMath::Abs((Sxx-Syy)*(Sxx-Syy)+4.0*Sxy*Sxy)))/2.0; | |
1320 | sigmaMin = TMath::Sqrt(TMath::Abs(sigmaMin)); | |
d595acbb | 1321 | } |
90d5b88b | 1322 | |
6bf90832 | 1323 | //________________________________________________________________________ |
296ea9b4 | 1324 | Int_t AliAnalysisTaskEMCALPi0PbPb::GetNCells(AliVCluster *c, Double_t emin) const |
6bf90832 | 1325 | { |
1326 | // Calculate number of attached cells above emin. | |
1327 | ||
6bf90832 | 1328 | AliVCaloCells *cells = fEsdCells; |
1329 | if (!cells) | |
1330 | cells = fAodCells; | |
6bf90832 | 1331 | if (!cells) |
296ea9b4 | 1332 | return 0; |
6bf90832 | 1333 | |
296ea9b4 | 1334 | Int_t n = 0; |
6bf90832 | 1335 | Int_t ncells = c->GetNCells(); |
1336 | for(Int_t j=0; j<ncells; ++j) { | |
1337 | Int_t id = TMath::Abs(c->GetCellAbsId(j)); | |
1338 | Double_t cellen = cells->GetCellAmplitude(id); | |
1339 | if (cellen>=emin) | |
1340 | ++n; | |
1341 | } | |
1342 | return n; | |
1343 | } | |
1344 | ||
296ea9b4 | 1345 | //________________________________________________________________________ |
1346 | Double_t AliAnalysisTaskEMCALPi0PbPb::GetTrackIsolation(Double_t cEta, Double_t cPhi, Double_t radius) const | |
1347 | { | |
1348 | // Compute isolation based on tracks. | |
1349 | ||
1350 | Double_t trkIsolation = 0; | |
1351 | Double_t rad2 = radius*radius; | |
1352 | Int_t ntrks = fSelTracks->GetEntries(); | |
1353 | for(Int_t j = 0; j<ntrks; ++j) { | |
1354 | AliVTrack *track = static_cast<AliVTrack*>(fSelTracks->At(j)); | |
1355 | if (!track) | |
1356 | continue; | |
1357 | Float_t eta = track->Eta(); | |
1358 | Float_t phi = track->Phi(); | |
1359 | Double_t phidiff = TVector2::Phi_0_2pi(phi-cPhi); | |
1360 | Double_t dist = (eta-cEta)*(eta-cEta)+phidiff*phidiff; | |
1361 | if(dist>rad2) | |
1362 | continue; | |
1363 | trkIsolation += track->Pt(); | |
1364 | } | |
1365 | return trkIsolation; | |
1366 | } |