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() :
47 fCorrelationLeading2Phi(0),
48 fCorrelationMultiplicity(0),
50 fEventCountDifferential(0),
51 fVertexContributors(0)
55 fNumberDensitypT = new AliUEHist("NumberDensitypT");
56 fSumpT = new AliUEHist("SumpT");
57 fNumberDensityPhi = new AliUEHist("NumberDensityPhi");
59 // do not add this hists to the directory
60 Bool_t oldStatus = TH1::AddDirectoryStatus();
61 TH1::AddDirectory(kFALSE);
63 fCorrelationpT = new TH2F("fCorrelationpT", ";p_{T,lead} (MC);p_{T,lead} (RECO)", 200, 0, 50, 200, 0, 50);
64 fCorrelationEta = new TH2F("fCorrelationEta", ";#eta_{T,lead} (MC);#eta_{T,lead} (RECO)", 200, -1, 1, 200, -1, 1);
65 fCorrelationPhi = new TH2F("fCorrelationPhi", ";#phi_{T,lead} (MC);#phi_{T,lead} (RECO)", 200, 0, TMath::TwoPi(), 200, 0, TMath::TwoPi());
66 fCorrelationR = new TH2F("fCorrelationR", ";R;p_{T,lead} (MC)", 200, 0, 2, 200, 0, 50);
67 fCorrelationLeading2Phi = new TH2F("fCorrelationLeading2Phi", ";#Delta #phi;p_{T,lead} (MC)", 200, -TMath::Pi(), TMath::Pi(), 200, 0, 50);
68 fCorrelationMultiplicity = new TH2F("fCorrelationMultiplicity", ";MC tracks;Reco tracks", 100, -0.5, 99.5, 100, -0.5, 99.5);
70 fEventCount = new TH2F("fEventCount", ";step;event type;count", AliUEHist::fgkCFSteps+1, -1.5, -0.5 + AliUEHist::fgkCFSteps, 3, -0.5, 2.5);
71 fEventCount->GetYaxis()->SetBinLabel(1, "ND");
72 fEventCount->GetYaxis()->SetBinLabel(2, "SD");
73 fEventCount->GetYaxis()->SetBinLabel(3, "DD");
75 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);
76 fEventCountDifferential->GetZaxis()->SetBinLabel(1, "ND");
77 fEventCountDifferential->GetZaxis()->SetBinLabel(2, "SD");
78 fEventCountDifferential->GetZaxis()->SetBinLabel(3, "DD");
80 fVertexContributors = new TH1F("fVertexContributors", ";contributors;count", 100, -0.5, 99.5);
82 TH1::AddDirectory(oldStatus);
85 //_____________________________________________________________________________
86 AliUEHistograms::AliUEHistograms(const AliUEHistograms &c) :
95 fCorrelationLeading2Phi(0),
96 fCorrelationMultiplicity(0),
98 fEventCountDifferential(0),
99 fVertexContributors(0)
102 // AliUEHistograms copy constructor
105 ((AliUEHistograms &) c).Copy(*this);
108 //____________________________________________________________________
109 AliUEHistograms::~AliUEHistograms()
113 if (fNumberDensitypT)
115 delete fNumberDensitypT;
116 fNumberDensitypT = 0;
125 if (fNumberDensityPhi)
127 delete fNumberDensityPhi;
128 fNumberDensityPhi = 0;
133 delete fCorrelationpT;
139 delete fCorrelationEta;
145 delete fCorrelationPhi;
151 delete fCorrelationR;
155 if (fCorrelationLeading2Phi)
157 delete fCorrelationLeading2Phi;
158 fCorrelationLeading2Phi = 0;
161 if (fCorrelationMultiplicity)
163 delete fCorrelationMultiplicity;
164 fCorrelationMultiplicity = 0;
173 if (fEventCountDifferential)
175 delete fEventCountDifferential;
176 fEventCountDifferential = 0;
179 if (fVertexContributors)
181 delete fVertexContributors;
182 fVertexContributors = 0;
186 //____________________________________________________________________
187 Int_t AliUEHistograms::CountParticles(TList* list, Float_t ptMin)
189 // counts the number of particles in the list with a pT above ptMin
190 // TODO eta cut needed here?
193 for (Int_t j=0; j<list->GetEntries(); j++)
194 if (((AliVParticle*) list->At(j))->Pt() > ptMin)
200 //____________________________________________________________________
201 void AliUEHistograms::Fill(Int_t eventType, AliUEHist::CFStep step, AliVParticle* leading, TList* toward, TList* away, TList* min, TList* max)
203 // fills the UE event histograms
205 // 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
207 // if leading is not set, just fill event statistics
210 Int_t multiplicity = 0;
212 // TODO configurable?
213 Float_t ptMin = 0.15;
214 if (leading->Pt() > ptMin)
217 multiplicity += CountParticles(toward, ptMin);
218 multiplicity += CountParticles(away, ptMin);
219 multiplicity += CountParticles(min, ptMin);
220 multiplicity += CountParticles(max, ptMin);
222 FillRegion(AliUEHist::kToward, step, leading, toward, multiplicity);
223 FillRegion(AliUEHist::kAway, step, leading, away, multiplicity);
224 FillRegion(AliUEHist::kMin, step, leading, min, multiplicity);
225 FillRegion(AliUEHist::kMax, step, leading, max, multiplicity);
228 vars[0] = leading->Pt();
229 vars[1] = multiplicity;
230 fNumberDensitypT->GetEventHist()->Fill(vars, step);
231 fSumpT->GetEventHist()->Fill(vars, step);
232 fNumberDensityPhi->GetEventHist()->Fill(vars, step);
234 fEventCountDifferential->Fill(leading->Pt(), step, eventType);
237 FillEvent(eventType, step);
240 //____________________________________________________________________
241 void AliUEHistograms::FillRegion(AliUEHist::Region region, AliUEHist::CFStep step, AliVParticle* leading, TList* list, Int_t multiplicity)
243 // loops over AliVParticles in list and fills the given region at the given step
245 // See also Fill(...)
247 for (Int_t i=0; i<list->GetEntries(); i++)
249 AliVParticle* particle = (AliVParticle*) list->At(i);
252 vars[0] = particle->Eta();
253 vars[1] = particle->Pt();
254 vars[2] = leading->Pt();
255 vars[3] = multiplicity;
256 vars[4] = leading->Phi() - particle->Phi();
257 if (vars[4]>TMath::Pi()/2.)vars[4]-=TMath::TwoPi();
258 if (vars[4]< - 3.*TMath::Pi()/2.)vars[4]+=TMath::TwoPi();
260 fNumberDensitypT->GetTrackHist(region)->Fill(vars, step);
261 fSumpT->GetTrackHist(region)->Fill(vars, step, particle->Pt());
263 // fill all in toward region (is anyway as function of delta phi!)
264 fNumberDensityPhi->GetTrackHist(AliUEHist::kToward)->Fill(vars, step);
268 //____________________________________________________________________
269 void AliUEHistograms::Fill(AliVParticle* leadingMC, AliVParticle* leadingReco)
271 // fills the correlation histograms
275 fCorrelationpT->Fill(leadingMC->Pt(), leadingReco->Pt());
276 if (leadingMC->Pt() > 0.5)
278 fCorrelationEta->Fill(leadingMC->Eta(), leadingReco->Eta());
279 fCorrelationPhi->Fill(leadingMC->Phi(), leadingReco->Phi());
282 Float_t phiDiff = leadingMC->Phi() - leadingReco->Phi();
283 if (phiDiff > TMath::Pi())
284 phiDiff -= TMath::TwoPi();
285 if (phiDiff < -TMath::Pi())
286 phiDiff += TMath::TwoPi();
288 Float_t etaDiff = leadingMC->Eta() - leadingReco->Eta();
290 fCorrelationR->Fill(TMath::Sqrt(phiDiff * phiDiff + etaDiff * etaDiff), leadingMC->Pt());
291 fCorrelationLeading2Phi->Fill(phiDiff, leadingMC->Pt());
295 fCorrelationpT->Fill(1.0, leadingReco->Pt());
296 if (leadingReco->Pt() > 0.5)
298 fCorrelationEta->Fill(0.0, leadingReco->Eta());
299 fCorrelationPhi->Fill(0.0, leadingReco->Phi());
304 //____________________________________________________________________
305 void AliUEHistograms::FillEvent(Int_t eventType, Int_t step)
307 // fills the number of events at the given step and the given enty type
309 // WARNING: This function is called from Fill, so only call it for steps where Fill is not called
311 fEventCount->Fill(step, eventType);
314 //____________________________________________________________________
315 void AliUEHistograms::SetEtaRange(Float_t etaMin, Float_t etaMax)
317 // sets eta min and max for all contained AliUEHist classes
319 fNumberDensitypT->SetEtaRange(etaMin, etaMax);
320 fSumpT->SetEtaRange(etaMin, etaMax);
321 fNumberDensityPhi->SetEtaRange(etaMin, etaMax);
324 //____________________________________________________________________
325 void AliUEHistograms::SetPtRange(Float_t ptMin, Float_t ptMax)
327 // sets pT min and max for all contained AliUEHist classes
329 fNumberDensitypT->SetPtRange(ptMin, ptMax);
330 fSumpT->SetPtRange(ptMin, ptMax);
331 fNumberDensityPhi->SetPtRange(ptMin, ptMax);
334 //____________________________________________________________________
335 void AliUEHistograms::SetCombineMinMax(Bool_t flag)
337 // sets pT min and max for all contained AliUEHist classes
339 fNumberDensitypT->SetCombineMinMax(flag);
340 fSumpT->SetCombineMinMax(flag);
341 fNumberDensityPhi->SetCombineMinMax(flag);
344 //____________________________________________________________________
345 void AliUEHistograms::Correct(AliUEHistograms* corrections)
347 // corrects the contained histograms by calling AliUEHist::Correct
349 fNumberDensitypT->Correct(corrections->fNumberDensitypT);
350 fSumpT->Correct(corrections->fSumpT);
351 fNumberDensityPhi->Correct(corrections->fNumberDensityPhi);
354 //____________________________________________________________________
355 AliUEHistograms &AliUEHistograms::operator=(const AliUEHistograms &c)
357 // assigment operator
360 ((AliUEHistograms &) c).Copy(*this);
365 //____________________________________________________________________
366 void AliUEHistograms::Copy(TObject& c) const
370 AliUEHistograms& target = (AliUEHistograms &) c;
372 if (fNumberDensitypT)
373 target.fNumberDensitypT = dynamic_cast<AliUEHist*> (fNumberDensitypT->Clone());
376 target.fSumpT = dynamic_cast<AliUEHist*> (fSumpT->Clone());
378 if (fNumberDensityPhi)
379 target.fNumberDensityPhi = dynamic_cast<AliUEHist*> (fNumberDensityPhi->Clone());
382 target.fCorrelationpT = dynamic_cast<TH2F*> (fCorrelationpT->Clone());
385 target.fCorrelationEta = dynamic_cast<TH2F*> (fCorrelationEta->Clone());
388 target.fCorrelationPhi = dynamic_cast<TH2F*> (fCorrelationPhi->Clone());
391 target.fCorrelationR = dynamic_cast<TH2F*> (fCorrelationR->Clone());
393 if (fCorrelationLeading2Phi)
394 target.fCorrelationLeading2Phi = dynamic_cast<TH2F*> (fCorrelationLeading2Phi->Clone());
396 if (fCorrelationMultiplicity)
397 target.fCorrelationMultiplicity = dynamic_cast<TH2F*> (fCorrelationMultiplicity->Clone());
400 target.fEventCount = dynamic_cast<TH2F*> (fEventCount->Clone());
402 if (fEventCountDifferential)
403 target.fEventCountDifferential = dynamic_cast<TH3F*> (fEventCountDifferential->Clone());
405 if (fVertexContributors)
406 target.fVertexContributors = dynamic_cast<TH1F*> (fVertexContributors->Clone());
409 //____________________________________________________________________
410 Long64_t AliUEHistograms::Merge(TCollection* list)
412 // Merge a list of AliUEHistograms objects with this (needed for
414 // Returns the number of merged objects (including this).
422 TIterator* iter = list->MakeIterator();
425 // collections of objects
426 const Int_t kMaxLists = 12;
427 TList* lists[kMaxLists];
429 for (Int_t i=0; i<kMaxLists; i++)
430 lists[i] = new TList;
433 while ((obj = iter->Next())) {
435 AliUEHistograms* entry = dynamic_cast<AliUEHistograms*> (obj);
439 lists[0]->Add(entry->fNumberDensitypT);
440 lists[1]->Add(entry->fSumpT);
441 lists[2]->Add(entry->fNumberDensityPhi);
442 lists[3]->Add(entry->fCorrelationpT);
443 lists[4]->Add(entry->fCorrelationEta);
444 lists[5]->Add(entry->fCorrelationPhi);
445 lists[6]->Add(entry->fCorrelationR);
446 lists[7]->Add(entry->fCorrelationLeading2Phi);
447 lists[8]->Add(entry->fCorrelationMultiplicity);
448 lists[9]->Add(entry->fEventCount);
449 lists[10]->Add(entry->fEventCountDifferential);
450 lists[11]->Add(entry->fVertexContributors);
455 fNumberDensitypT->Merge(lists[0]);
456 fSumpT->Merge(lists[1]);
457 fNumberDensityPhi->Merge(lists[2]);
458 fCorrelationpT->Merge(lists[3]);
459 fCorrelationEta->Merge(lists[4]);
460 fCorrelationPhi->Merge(lists[5]);
461 fCorrelationR->Merge(lists[6]);
462 fCorrelationLeading2Phi->Merge(lists[7]);
463 fCorrelationMultiplicity->Merge(lists[8]);
464 fEventCount->Merge(lists[9]);
465 fEventCountDifferential->Merge(lists[10]);
466 fVertexContributors->Merge(lists[11]);
468 for (Int_t i=0; i<kMaxLists; i++)