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 #include "Riostream.h" //needed as include
17 #include "AliFlowCommonConstants.h" //needed as include
18 #include "AliFlowCommonHist.h"
19 #include "AliFlowEventSimple.h"
20 #include "AliFlowTrackSimple.h"
24 #include "TMath.h" //needed as include
27 #include "AliFlowVector.h"
35 // Description: Class to organise common histograms for Flow Analysis
37 // authors: N. van der Kolk (kolk@nikhef.nl), A. Bilandzic (anteb@nikhef.nl), RS
40 ClassImp(AliFlowCommonHist)
42 //-----------------------------------------------------------------------
44 AliFlowCommonHist::AliFlowCommonHist():
62 fHistProMeanPtperBin(NULL),
65 fHistAngleQSub0(NULL),
66 fHistAngleQSub1(NULL),
68 fRefMultVsNoOfRPs(NULL),
76 AliFlowCommonHist::AliFlowCommonHist(const AliFlowCommonHist& a):
78 fHistMultRP(new TH1F(*a.fHistMultRP)),
79 fHistMultPOI(new TH1F(*a.fHistMultPOI)),
80 fHistPtRP(new TH1F(*a.fHistPtRP)),
81 fHistPtPOI(new TH1F(*a.fHistPtPOI)),
82 fHistPtSub0(new TH1F(*a.fHistPtSub0)),
83 fHistPtSub1(new TH1F(*a.fHistPtSub1)),
84 fHistPhiRP(new TH1F(*a.fHistPhiRP)),
85 fHistPhiPOI(new TH1F(*a.fHistPhiPOI)),
86 fHistPhiSub0(new TH1F(*a.fHistPhiSub0)),
87 fHistPhiSub1(new TH1F(*a.fHistPhiSub1)),
88 fHistEtaRP(new TH1F(*a.fHistEtaRP)),
89 fHistEtaPOI(new TH1F(*a.fHistEtaPOI)),
90 fHistEtaSub0(new TH1F(*a.fHistEtaSub0)),
91 fHistEtaSub1(new TH1F(*a.fHistEtaSub1)),
92 fHistPhiEtaRP(new TH2F(*a.fHistPhiEtaRP)),
93 fHistPhiEtaPOI(new TH2F(*a.fHistPhiEtaPOI)),
94 fHistProMeanPtperBin(new TProfile(*a.fHistProMeanPtperBin)),
95 fHistQ(new TH1F(*a.fHistQ)),
96 fHistAngleQ(new TH1F(*a.fHistAngleQ)),
97 fHistAngleQSub0(new TH1F(*a.fHistAngleQSub0)),
98 fHistAngleQSub1(new TH1F(*a.fHistAngleQSub1)),
99 fHarmonic(new TProfile(*a.fHarmonic)),
100 fRefMultVsNoOfRPs(new TProfile(*a.fRefMultVsNoOfRPs)),
105 fHistList = new TList();
106 fHistList-> Add(fHistMultRP);
107 fHistList-> Add(fHistMultPOI);
108 fHistList-> Add(fHistPtRP);
109 fHistList-> Add(fHistPtPOI);
110 fHistList-> Add(fHistPtSub0);
111 fHistList-> Add(fHistPtSub1);
112 fHistList-> Add(fHistPhiRP);
113 fHistList-> Add(fHistPhiPOI);
114 fHistList-> Add(fHistPhiSub0);
115 fHistList-> Add(fHistPhiSub1);
116 fHistList-> Add(fHistEtaRP);
117 fHistList-> Add(fHistEtaPOI);
118 fHistList-> Add(fHistEtaSub0);
119 fHistList-> Add(fHistEtaSub1);
120 fHistList-> Add(fHistPhiEtaRP);
121 fHistList-> Add(fHistPhiEtaPOI);
122 fHistList-> Add(fHistProMeanPtperBin);
123 fHistList-> Add(fHarmonic);
124 fHistList-> Add(fRefMultVsNoOfRPs);
125 fHistList-> Add(fHistQ);
126 fHistList-> Add(fHistAngleQ);
127 fHistList-> Add(fHistAngleQSub0);
128 fHistList-> Add(fHistAngleQSub1);
129 // TListIter next = TListIter(a.fHistList);
134 //-----------------------------------------------------------------------
136 AliFlowCommonHist::AliFlowCommonHist(const char *anInput,const char *title):
137 TNamed(anInput,title),
153 fHistPhiEtaPOI(NULL),
154 fHistProMeanPtperBin(NULL),
157 fHistAngleQSub0(NULL),
158 fHistAngleQSub1(NULL),
160 fRefMultVsNoOfRPs(NULL),
164 //constructor creating histograms
165 Int_t iNbinsMult = AliFlowCommonConstants::GetMaster()->GetNbinsMult();
166 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
167 Int_t iNbinsPhi = AliFlowCommonConstants::GetMaster()->GetNbinsPhi();
168 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
169 Int_t iNbinsQ = AliFlowCommonConstants::GetMaster()->GetNbinsQ();
172 Double_t dMultMin = AliFlowCommonConstants::GetMaster()->GetMultMin();
173 Double_t dMultMax = AliFlowCommonConstants::GetMaster()->GetMultMax();
174 Double_t dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();
175 Double_t dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
176 Double_t dPhiMin = AliFlowCommonConstants::GetMaster()->GetPhiMin();
177 Double_t dPhiMax = AliFlowCommonConstants::GetMaster()->GetPhiMax();
178 Double_t dEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();
179 Double_t dEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
180 Double_t dQMin = AliFlowCommonConstants::GetMaster()->GetQMin();
181 Double_t dQMax = AliFlowCommonConstants::GetMaster()->GetQMax();
183 cout<<"The settings for the common histograms are as follows:"<<endl;
184 cout<<"Multiplicity: "<<iNbinsMult<<" bins between "<<dMultMin<<" and "<<dMultMax<<endl;
185 cout<<"Pt: "<<iNbinsPt<<" bins between "<<dPtMin<<" and "<<dPtMax<<endl;
186 cout<<"Phi: "<<iNbinsPhi<<" bins between "<<dPhiMin<<" and "<<dPhiMax<<endl;
187 cout<<"Eta: "<<iNbinsEta<<" bins between "<<dEtaMin<<" and "<<dEtaMax<<endl;
188 cout<<"Q: "<<iNbinsQ<<" bins between "<<dQMin<<" and "<<dQMax<<endl;
191 sName = "Control_Flow_MultRP_";
193 fHistMultRP = new TH1F(sName.Data(), sName.Data(),iNbinsMult, dMultMin, dMultMax);
194 fHistMultRP ->SetXTitle("Multiplicity for RP selection");
195 fHistMultRP ->SetYTitle("Counts");
197 sName = "Control_Flow_MultPOI_";
199 fHistMultPOI = new TH1F(sName.Data(), sName.Data(),iNbinsMult, dMultMin, dMultMax);
200 fHistMultPOI ->SetXTitle("Multiplicity for POI selection");
201 fHistMultPOI ->SetYTitle("Counts");
204 sName = "Control_Flow_PtRP_";
206 fHistPtRP = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax);
207 fHistPtRP ->SetXTitle("P_{t} (GeV/c) for RP selection");
208 fHistPtRP ->SetYTitle("Counts");
210 sName = "Control_Flow_PtPOI_";
212 fHistPtPOI = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax);
213 //binning has to be the same as for fHistProVPt! use to get Nprime!
214 fHistPtPOI ->SetXTitle("P_{t} (GeV/c) for POI selection");
215 fHistPtPOI ->SetYTitle("Counts");
217 sName = "Control_Flow_PtSub0_";
219 fHistPtSub0 = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax);
220 fHistPtSub0 ->SetXTitle("P_{t} (GeV/c) for Subevent 0 selection");
221 fHistPtSub0 ->SetYTitle("Counts");
223 sName = "Control_Flow_PtSub1_";
225 fHistPtSub1 = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax);
226 fHistPtSub1 ->SetXTitle("P_{t} (GeV/c) for Subevent 1 selection");
227 fHistPtSub1 ->SetYTitle("Counts");
230 sName = "Control_Flow_PhiRP_";
232 fHistPhiRP = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
233 fHistPhiRP ->SetXTitle("#phi for RP selection");
234 fHistPhiRP ->SetYTitle("Counts");
236 sName = "Control_Flow_PhiPOI_";
238 fHistPhiPOI = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
239 fHistPhiPOI ->SetXTitle("#phi for POI selection");
240 fHistPhiPOI ->SetYTitle("Counts");
242 sName = "Control_Flow_PhiSub0_";
244 fHistPhiSub0 = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
245 fHistPhiSub0 ->SetXTitle("#phi for Subevent 0 selection");
246 fHistPhiSub0 ->SetYTitle("Counts");
248 sName = "Control_Flow_PhiSub1_";
250 fHistPhiSub1 = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
251 fHistPhiSub1 ->SetXTitle("#phi for Subevent 1 selection");
252 fHistPhiSub1 ->SetYTitle("Counts");
255 sName = "Control_Flow_EtaRP_";
257 fHistEtaRP = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
258 fHistEtaRP ->SetXTitle("#eta for RP selection");
259 fHistEtaRP ->SetYTitle("Counts");
261 sName = "Control_Flow_EtaPOI_";
263 fHistEtaPOI = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
264 fHistEtaPOI ->SetXTitle("#eta for POI selection");
265 fHistEtaPOI ->SetYTitle("Counts");
267 sName = "Control_Flow_EtaSub0_";
269 fHistEtaSub0 = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
270 fHistEtaSub0 ->SetXTitle("#eta for Subevent 0 selection");
271 fHistEtaSub0 ->SetYTitle("Counts");
273 sName = "Control_Flow_EtaSub1_";
275 fHistEtaSub1 = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
276 fHistEtaSub1 ->SetXTitle("#eta for Subevent 1 selection");
277 fHistEtaSub1 ->SetYTitle("Counts");
280 sName = "Control_Flow_PhiEtaRP_";
282 fHistPhiEtaRP = new TH2F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax, iNbinsPhi, dPhiMin, dPhiMax);
283 fHistPhiEtaRP ->SetXTitle("#eta");
284 fHistPhiEtaRP ->SetYTitle("#phi");
286 sName = "Control_Flow_PhiEtaPOI_";
288 fHistPhiEtaPOI = new TH2F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax, iNbinsPhi, dPhiMin, dPhiMax);
289 fHistPhiEtaPOI ->SetXTitle("#eta");
290 fHistPhiEtaPOI ->SetYTitle("#phi");
293 sName = "Control_FlowPro_MeanPtperBin_";
295 fHistProMeanPtperBin = new TProfile(sName.Data(), sName.Data(),iNbinsPt,dPtMin,dPtMax);
296 fHistProMeanPtperBin ->SetXTitle("P_{t} (GeV/c) ");
297 fHistProMeanPtperBin ->SetYTitle("<P_{t}> (GeV/c) ");
300 sName = "Control_Flow_Q_";
302 fHistQ = new TH1F(sName.Data(), sName.Data(),iNbinsQ, dQMin, dQMax);
303 fHistQ ->SetXTitle("Q_{vector}/Mult");
304 fHistQ ->SetYTitle("Counts");
307 sName = "Control_Flow_AngleQ_";
309 fHistAngleQ = new TH1F(sName.Data(), sName.Data(),72, 0., TMath::Pi());
310 fHistAngleQ ->SetXTitle("Angle of Q_{vector}");
311 fHistAngleQ ->SetYTitle("Counts");
313 sName = "Control_Flow_AngleQSub0_";
315 fHistAngleQSub0 = new TH1F(sName.Data(), sName.Data(),72, 0., TMath::Pi());
316 fHistAngleQSub0 ->SetXTitle("Angle of Q_{vector} for Subevent 0");
317 fHistAngleQSub0 ->SetYTitle("Counts");
319 sName = "Control_Flow_AngleQSub1_";
321 fHistAngleQSub1 = new TH1F(sName.Data(), sName.Data(),72, 0., TMath::Pi());
322 fHistAngleQSub1 ->SetXTitle("Angle of Q_{vector} for Subevent 1");
323 fHistAngleQSub1 ->SetYTitle("Counts");
326 sName = "Control_Flow_Harmonic_";
328 fHarmonic = new TProfile(sName.Data(),sName.Data(),1,0,1);
329 fHarmonic ->SetYTitle("harmonic");
331 //<reference multiplicity> versus # of RPs
332 sName = "Reference_Multiplicity_Vs_Number_Of_RPs_";
334 fRefMultVsNoOfRPs = new TProfile(sName.Data(),sName.Data(),iNbinsMult, dMultMin, dMultMax);
335 fRefMultVsNoOfRPs->SetYTitle("<reference multiplicity>");
336 fRefMultVsNoOfRPs->SetXTitle("# of RPs");
338 //list of histograms if added here also add in copy constructor
339 fHistList = new TList();
340 fHistList-> Add(fHistMultRP);
341 fHistList-> Add(fHistMultPOI);
342 fHistList-> Add(fHistPtRP);
343 fHistList-> Add(fHistPtPOI);
344 fHistList-> Add(fHistPtSub0);
345 fHistList-> Add(fHistPtSub1);
346 fHistList-> Add(fHistPhiRP);
347 fHistList-> Add(fHistPhiPOI);
348 fHistList-> Add(fHistPhiSub0);
349 fHistList-> Add(fHistPhiSub1);
350 fHistList-> Add(fHistEtaRP);
351 fHistList-> Add(fHistEtaPOI);
352 fHistList-> Add(fHistEtaSub0);
353 fHistList-> Add(fHistEtaSub1);
354 fHistList-> Add(fHistPhiEtaRP);
355 fHistList-> Add(fHistPhiEtaPOI);
356 fHistList-> Add(fHistProMeanPtperBin);
357 fHistList-> Add(fHarmonic);
358 fHistList-> Add(fRefMultVsNoOfRPs);
359 fHistList-> Add(fHistQ);
360 fHistList-> Add(fHistAngleQ);
361 fHistList-> Add(fHistAngleQSub0);
362 fHistList-> Add(fHistAngleQSub1);
367 //-----------------------------------------------------------------------
369 AliFlowCommonHist::~AliFlowCommonHist()
386 delete fHistPhiEtaRP;
387 delete fHistPhiEtaPOI;
388 delete fHistProMeanPtperBin;
391 delete fHistAngleQSub0;
392 delete fHistAngleQSub1;
394 delete fRefMultVsNoOfRPs;
399 //-----------------------------------------------------------------------
401 Bool_t AliFlowCommonHist::FillControlHistograms(AliFlowEventSimple* anEvent)
403 //Fills the control histograms
405 cout<<"##### FillControlHistograms: FlowEvent pointer null"<<endl;
409 Double_t dPt, dPhi, dEta, dWeight;
411 //fill the histograms
412 AliFlowVector vQ = anEvent->GetQ();
413 //weight by the Multiplicity
416 if (vQ.GetMult()!=0) {
417 dQX = vQ.X()/vQ.GetMult();
418 dQY = vQ.Y()/vQ.GetMult();
421 fHistQ->Fill(vQ.Mod());
422 fHistAngleQ->Fill(vQ.Phi()/2);
424 AliFlowVector* vQSub = new AliFlowVector[2];
425 anEvent->Get2Qsub(vQSub);
426 AliFlowVector vQa = vQSub[0];
427 AliFlowVector vQb = vQSub[1];
428 fHistAngleQSub0->Fill(vQa.Phi()/2);
429 fHistAngleQSub1->Fill(vQb.Phi()/2);
431 Double_t dMultRP = 0.;
432 Double_t dMultPOI = 0.;
434 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
435 AliFlowTrackSimple* pTrack = NULL;
437 for (Int_t i=0;i<iNumberOfTracks;i++) {
438 pTrack = anEvent->GetTrack(i);
440 dWeight = pTrack->Weight();
441 if (pTrack->InRPSelection()){
444 fHistPtRP->Fill(dPt,dWeight);
446 dPhi = pTrack->Phi();
447 if (dPhi<0.) dPhi+=2*TMath::Pi();
448 fHistPhiRP->Fill(dPhi,dWeight);
450 dEta = pTrack->Eta();
451 fHistEtaRP->Fill(dEta,dWeight);
453 fHistPhiEtaRP->Fill(dEta,dPhi,dWeight);
456 if (pTrack->InSubevent(0)){
457 //Fill distributions for the subevent
458 fHistPtSub0 -> Fill(dPt,dWeight);
459 fHistPhiSub0 -> Fill(dPhi,dWeight);
460 fHistEtaSub0 -> Fill(dEta,dWeight);
462 else if (pTrack->InSubevent(1)){
463 //Fill distributions for the subevent
464 fHistPtSub1 -> Fill(dPt,dWeight);
465 fHistPhiSub1 -> Fill(dPhi,dWeight);
466 fHistEtaSub1 -> Fill(dEta,dWeight);
469 if (pTrack->InPOISelection()){
472 fHistPtPOI->Fill(dPt,dWeight);
474 dPhi = pTrack->Phi();
475 if (dPhi<0.) dPhi+=2*TMath::Pi();
476 fHistPhiPOI->Fill(dPhi,dWeight);
478 dEta = pTrack->Eta();
479 fHistEtaPOI->Fill(dEta,dWeight);
481 fHistPhiEtaPOI->Fill(dEta,dPhi,dWeight);
483 fHistProMeanPtperBin->Fill(dPt,dPt,dWeight);
490 fHistMultRP->Fill(dMultRP);
491 fHistMultPOI->Fill(dMultPOI);
493 //<reference multiplicity> versus # of RPs:
494 fRefMultVsNoOfRPs->Fill(dMultRP+0.5,anEvent->GetReferenceMultiplicity(),1.);
499 //-----------------------------------------------------------------------
501 Double_t AliFlowCommonHist::GetEntriesInPtBinRP(Int_t aBin)
503 //get entries in bin aBin from fHistPtRP
504 Double_t dEntries = fHistPtRP->GetBinContent(aBin);
510 //-----------------------------------------------------------------------
512 Double_t AliFlowCommonHist::GetEntriesInPtBinPOI(Int_t aBin)
514 //get entries in bin aBin from fHistPtPOI
515 Double_t dEntries = fHistPtPOI->GetBinContent(aBin);
521 //-----------------------------------------------------------------------
523 Double_t AliFlowCommonHist::GetEntriesInEtaBinRP(Int_t aBin)
525 //get entries in bin aBin from fHistPtRP
526 Double_t dEntries = fHistEtaRP->GetBinContent(aBin);
532 //-----------------------------------------------------------------------
534 Double_t AliFlowCommonHist::GetEntriesInEtaBinPOI(Int_t aBin)
536 //get entries in bin aBin from fHistPtPOI
537 Double_t dEntries = fHistEtaPOI->GetBinContent(aBin);
543 //-----------------------------------------------------------------------
545 Double_t AliFlowCommonHist::GetMeanPt(Int_t aBin)
547 //Get entry from bin aBin from fHistProMeanPtperBin
548 Double_t dMeanPt = fHistProMeanPtperBin->GetBinContent(aBin);
555 //-----------------------------------------------------------------------
556 Double_t AliFlowCommonHist::Merge(TCollection *aList)
559 //cout<<"entering merge function"<<endl;
560 if (!aList) return 0;
561 if (aList->IsEmpty()) return 0; //no merging is needed
564 TIter next(aList); // list is supposed to contain only objects of the same type as this
565 AliFlowCommonHist *toMerge;
566 // make a temporary list
567 TList *pTemp = new TList();
568 while ((toMerge=(AliFlowCommonHist*)next())) {
569 pTemp->Add(toMerge->GetHistList());
572 // Now call merge for fHistList providing temp list
573 fHistList->Merge(pTemp);
577 //cout<<"Merged"<<endl;
578 return (double)iCount;
582 void AliFlowCommonHist::Print(Option_t *option) const
584 // -*-*-*-*-*Print some global quantities for this histogram collection class *-*-*-*-*-*-*-*
585 // ===============================================
586 // printf( "TH1.Print Name = %s, Entries= %d, Total sum= %g\n",GetName(),Int_t(fEntries),GetSumOfWeights());
587 printf( "Class.Print Name = %s, Histogram list:\n",GetName());
590 fHistList->Print(option);
594 printf( "Empty histogram list \n");
598 //-----------------------------------------------------------------------
599 void AliFlowCommonHist::Browse(TBrowser *b)
603 if (fHistList) b->Add(fHistList,"AliFlowCommonHistList");