1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 /* $Id: AliUEHistograms.cxx 20164 2007-08-14 15:31:50Z morsch $ */
20 // encapsulates several AliUEHist objects for a full UE analysis plus additional control histograms
23 // Author: Jan Fiete Grosse-Oetringhaus, Sara Vallero
25 #include "AliUEHistograms.h"
27 #include "AliCFContainer.h"
28 #include "AliVParticle.h"
36 ClassImp(AliUEHistograms)
38 AliUEHistograms::AliUEHistograms() :
46 fCorrelationLeading2Phi(0),
47 fCorrelationMultiplicity(0),
49 fEventCountDifferential(0),
50 fVertexContributors(0)
54 fNumberDensitypT = new AliUEHist("NumberDensitypT");
55 fSumpT = new AliUEHist("SumpT");
56 fNumberDensityPhi = new AliUEHist("NumberDensityPhi");
58 // do not add this hists to the directory
59 Bool_t oldStatus = TH1::AddDirectoryStatus();
60 TH1::AddDirectory(kFALSE);
62 fCorrelationpT = new TH2F("fCorrelationpT", ";p_{T,lead} (MC);p_{T,lead} (RECO)", 200, 0, 50, 200, 0, 50);
63 fCorrelationEta = new TH2F("fCorrelationEta", ";#eta_{T,lead} (MC);#eta_{T,lead} (RECO)", 200, -1, 1, 200, -1, 1);
64 fCorrelationPhi = new TH2F("fCorrelationPhi", ";#phi_{T,lead} (MC);#phi_{T,lead} (RECO)", 200, 0, TMath::TwoPi(), 200, 0, TMath::TwoPi());
65 fCorrelationR = new TH2F("fCorrelationR", ";R;p_{T,lead} (MC)", 200, 0, 2, 200, 0, 50);
66 fCorrelationLeading2Phi = new TH2F("fCorrelationLeading2Phi", ";#Delta #phi;p_{T,lead} (MC)", 200, -TMath::Pi(), TMath::Pi(), 200, 0, 50);
67 fCorrelationMultiplicity = new TH2F("fCorrelationMultiplicity", ";MC tracks;Reco tracks", 100, -0.5, 99.5, 100, -0.5, 99.5);
69 fEventCount = new TH2F("fEventCount", ";step;event type;count", AliUEHist::fgkCFSteps+1, -1.5, -0.5 + AliUEHist::fgkCFSteps, 3, -0.5, 2.5);
70 fEventCount->GetYaxis()->SetBinLabel(1, "ND");
71 fEventCount->GetYaxis()->SetBinLabel(2, "SD");
72 fEventCount->GetYaxis()->SetBinLabel(3, "DD");
74 fEventCountDifferential = new TH3F("fEventCountDifferential", ";p_{T,lead};step;event type", 100, 0, 50, AliUEHist::fgkCFSteps, -0.5, -0.5 + AliUEHist::fgkCFSteps, 3, -0.5, 2.5);
75 fEventCountDifferential->GetZaxis()->SetBinLabel(1, "ND");
76 fEventCountDifferential->GetZaxis()->SetBinLabel(2, "SD");
77 fEventCountDifferential->GetZaxis()->SetBinLabel(3, "DD");
79 fVertexContributors = new TH1F("fVertexContributors", ";contributors;count", 100, -0.5, 99.5);
81 TH1::AddDirectory(oldStatus);
84 //____________________________________________________________________
85 AliUEHistograms::~AliUEHistograms()
91 delete fNumberDensitypT;
101 if (fNumberDensityPhi)
103 delete fNumberDensityPhi;
104 fNumberDensityPhi = 0;
109 delete fCorrelationpT;
115 delete fCorrelationEta;
121 delete fCorrelationPhi;
127 delete fCorrelationR;
131 if (fCorrelationLeading2Phi)
133 delete fCorrelationLeading2Phi;
134 fCorrelationLeading2Phi = 0;
137 if (fCorrelationMultiplicity)
139 delete fCorrelationMultiplicity;
140 fCorrelationMultiplicity = 0;
149 if (fEventCountDifferential)
151 delete fEventCountDifferential;
152 fEventCountDifferential = 0;
155 if (fVertexContributors)
157 delete fVertexContributors;
158 fVertexContributors = 0;
162 //____________________________________________________________________
163 Int_t AliUEHistograms::CountParticles(TList* list, Float_t ptMin)
165 // counts the number of particles in the list with a pT above ptMin
166 // TODO eta cut needed here?
169 for (Int_t j=0; j<list->GetEntries(); j++)
170 if (((AliVParticle*) list->At(j))->Pt() > ptMin)
176 //____________________________________________________________________
177 void AliUEHistograms::Fill(Int_t eventType, AliUEHist::CFStep step, AliVParticle* leading, TList* toward, TList* away, TList* min, TList* max)
179 // fills the UE event histograms
181 // this function needs the leading (track or jet or ...) and four lists of AliVParticles which contain the particles/tracks to be filled in the four regions
183 // if leading is not set, just fill event statistics
186 Int_t multiplicity = 0;
188 // TODO configurable?
189 Float_t ptMin = 0.15;
190 if (leading->Pt() > ptMin)
193 multiplicity += CountParticles(toward, ptMin);
194 multiplicity += CountParticles(away, ptMin);
195 multiplicity += CountParticles(min, ptMin);
196 multiplicity += CountParticles(max, ptMin);
198 FillRegion(AliUEHist::kToward, step, leading, toward, multiplicity);
199 FillRegion(AliUEHist::kAway, step, leading, away, multiplicity);
200 FillRegion(AliUEHist::kMin, step, leading, min, multiplicity);
201 FillRegion(AliUEHist::kMax, step, leading, max, multiplicity);
204 vars[0] = leading->Pt();
205 vars[1] = multiplicity;
206 fNumberDensitypT->GetEventHist()->Fill(vars, step);
207 fSumpT->GetEventHist()->Fill(vars, step);
208 fNumberDensityPhi->GetEventHist()->Fill(vars, step);
210 fEventCountDifferential->Fill(leading->Pt(), step, eventType);
213 FillEvent(eventType, step);
216 //____________________________________________________________________
217 void AliUEHistograms::FillRegion(AliUEHist::Region region, AliUEHist::CFStep step, AliVParticle* leading, TList* list, Int_t multiplicity)
219 // loops over AliVParticles in list and fills the given region at the given step
221 // See also Fill(...)
223 for (Int_t i=0; i<list->GetEntries(); i++)
225 AliVParticle* particle = (AliVParticle*) list->At(i);
228 vars[0] = particle->Eta();
229 vars[1] = particle->Pt();
230 vars[2] = leading->Pt();
231 vars[3] = multiplicity;
232 vars[4] = leading->Phi() - particle->Phi();
234 fNumberDensitypT->GetTrackHist(region)->Fill(vars, step);
235 fSumpT->GetTrackHist(region)->Fill(vars, step, particle->Pt());
237 // fill all in toward region (is anyway as function of delta phi!)
238 fNumberDensityPhi->GetTrackHist(AliUEHist::kToward)->Fill(vars, step);
242 //____________________________________________________________________
243 void AliUEHistograms::Fill(AliVParticle* leadingMC, AliVParticle* leadingReco)
245 // fills the correlation histograms
249 fCorrelationpT->Fill(leadingMC->Pt(), leadingReco->Pt());
250 if (leadingMC->Pt() > 0.5)
252 fCorrelationEta->Fill(leadingMC->Eta(), leadingReco->Eta());
253 fCorrelationPhi->Fill(leadingMC->Phi(), leadingReco->Phi());
256 Float_t phiDiff = leadingMC->Phi() - leadingReco->Phi();
257 if (phiDiff > TMath::Pi())
258 phiDiff -= TMath::TwoPi();
259 if (phiDiff < -TMath::Pi())
260 phiDiff += TMath::TwoPi();
262 Float_t etaDiff = leadingMC->Eta() - leadingReco->Eta();
264 fCorrelationR->Fill(TMath::Sqrt(phiDiff * phiDiff + etaDiff * etaDiff), leadingMC->Pt());
265 fCorrelationLeading2Phi->Fill(phiDiff, leadingMC->Pt());
269 fCorrelationpT->Fill(1.0, leadingReco->Pt());
270 if (leadingReco->Pt() > 0.5)
272 fCorrelationEta->Fill(0.0, leadingReco->Eta());
273 fCorrelationPhi->Fill(0.0, leadingReco->Phi());
278 //____________________________________________________________________
279 void AliUEHistograms::FillEvent(Int_t eventType, Int_t step)
281 // fills the number of events at the given step and the given enty type
283 // WARNING: This function is called from Fill, so only call it for steps where Fill is not called
285 fEventCount->Fill(step, eventType);
288 //____________________________________________________________________
289 void AliUEHistograms::SetEtaRange(Float_t etaMin, Float_t etaMax)
291 // sets eta min and max for all contained AliUEHist classes
293 fNumberDensitypT->SetEtaRange(etaMin, etaMax);
294 fSumpT->SetEtaRange(etaMin, etaMax);
295 fNumberDensityPhi->SetEtaRange(etaMin, etaMax);
298 //____________________________________________________________________
299 void AliUEHistograms::SetPtRange(Float_t ptMin, Float_t ptMax)
301 // sets pT min and max for all contained AliUEHist classes
303 fNumberDensitypT->SetPtRange(ptMin, ptMax);
304 fSumpT->SetPtRange(ptMin, ptMax);
305 fNumberDensityPhi->SetPtRange(ptMin, ptMax);
308 //____________________________________________________________________
309 void AliUEHistograms::SetCombineMinMax(Bool_t flag)
311 // sets pT min and max for all contained AliUEHist classes
313 fNumberDensitypT->SetCombineMinMax(flag);
314 fSumpT->SetCombineMinMax(flag);
315 fNumberDensityPhi->SetCombineMinMax(flag);
318 //____________________________________________________________________
319 void AliUEHistograms::Correct(AliUEHistograms* corrections)
321 // corrects the contained histograms by calling AliUEHist::Correct
323 fNumberDensitypT->Correct(corrections->fNumberDensitypT);
324 fSumpT->Correct(corrections->fSumpT);
325 fNumberDensityPhi->Correct(corrections->fNumberDensityPhi);
328 //____________________________________________________________________
329 AliUEHistograms &AliUEHistograms::operator=(const AliUEHistograms &c)
331 // assigment operator
334 ((AliUEHistograms &) c).Copy(*this);
339 //____________________________________________________________________
340 void AliUEHistograms::Copy(TObject& c) const
344 AliUEHistograms& target = (AliUEHistograms &) c;
346 if (fNumberDensitypT)
347 target.fNumberDensitypT = dynamic_cast<AliUEHist*> (fNumberDensitypT->Clone());
350 target.fSumpT = dynamic_cast<AliUEHist*> (fSumpT->Clone());
352 if (fNumberDensityPhi)
353 target.fNumberDensityPhi = dynamic_cast<AliUEHist*> (fNumberDensityPhi->Clone());
356 target.fCorrelationpT = dynamic_cast<TH2F*> (fCorrelationpT->Clone());
359 target.fCorrelationEta = dynamic_cast<TH2F*> (fCorrelationEta->Clone());
362 target.fCorrelationPhi = dynamic_cast<TH2F*> (fCorrelationPhi->Clone());
365 target.fCorrelationR = dynamic_cast<TH2F*> (fCorrelationR->Clone());
367 if (fCorrelationLeading2Phi)
368 target.fCorrelationLeading2Phi = dynamic_cast<TH2F*> (fCorrelationLeading2Phi->Clone());
370 if (fCorrelationMultiplicity)
371 target.fCorrelationMultiplicity = dynamic_cast<TH2F*> (fCorrelationMultiplicity->Clone());
374 target.fEventCount = dynamic_cast<TH2F*> (fEventCount->Clone());
376 if (fEventCountDifferential)
377 target.fEventCountDifferential = dynamic_cast<TH3F*> (fEventCountDifferential->Clone());
379 if (fVertexContributors)
380 target.fVertexContributors = dynamic_cast<TH1F*> (fVertexContributors->Clone());
383 //____________________________________________________________________
384 Long64_t AliUEHistograms::Merge(TCollection* list)
386 // Merge a list of AliUEHistograms objects with this (needed for
388 // Returns the number of merged objects (including this).
396 TIterator* iter = list->MakeIterator();
399 // collections of objects
400 const Int_t kMaxLists = 12;
401 TList* lists[kMaxLists];
403 for (Int_t i=0; i<kMaxLists; i++)
404 lists[i] = new TList;
407 while ((obj = iter->Next())) {
409 AliUEHistograms* entry = dynamic_cast<AliUEHistograms*> (obj);
413 lists[0]->Add(entry->fNumberDensitypT);
414 lists[1]->Add(entry->fSumpT);
415 lists[2]->Add(entry->fNumberDensityPhi);
416 lists[3]->Add(entry->fCorrelationpT);
417 lists[4]->Add(entry->fCorrelationEta);
418 lists[5]->Add(entry->fCorrelationPhi);
419 lists[6]->Add(entry->fCorrelationR);
420 lists[7]->Add(entry->fCorrelationLeading2Phi);
421 lists[8]->Add(entry->fCorrelationMultiplicity);
422 lists[9]->Add(entry->fEventCount);
423 lists[10]->Add(entry->fEventCountDifferential);
424 lists[11]->Add(entry->fVertexContributors);
429 fNumberDensitypT->Merge(lists[0]);
430 fSumpT->Merge(lists[1]);
431 fNumberDensityPhi->Merge(lists[2]);
432 fCorrelationpT->Merge(lists[3]);
433 fCorrelationEta->Merge(lists[4]);
434 fCorrelationPhi->Merge(lists[5]);
435 fCorrelationR->Merge(lists[6]);
436 fCorrelationLeading2Phi->Merge(lists[7]);
437 fCorrelationMultiplicity->Merge(lists[8]);
438 fEventCount->Merge(lists[9]);
439 fEventCountDifferential->Merge(lists[10]);
440 fVertexContributors->Merge(lists[11]);
442 for (Int_t i=0; i<kMaxLists; i++)