AliPhysics  8417398 (8417398)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliNormalizationCounter.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
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  **************************************************************************/
15 
16 /* $Id$ */
17 
18 //*************************************************************************
19 // Class AliNormalizationCounter
20 // Class to store the informations relevant for the normalization in the
21 // barrel for each run
22 // Authors: G. Ortona, ortona@to.infn.it
23 // D. Caffarri, davide.caffarri@pd.to.infn.it
24 // with many thanks to P. Pillot
26 
27 #include "AliLog.h"
29 #include <AliESDEvent.h>
30 #include <AliESDtrack.h>
31 #include <AliAODEvent.h>
32 #include <AliAODVZERO.h>
33 #include <AliVParticle.h>
34 #include <AliTriggerAnalysis.h>
35 #include <TH1F.h>
36 #include <TH2F.h>
37 #include <TList.h>
38 #include <TObjArray.h>
39 #include <TString.h>
40 #include <TCanvas.h>
41 #include <AliPhysicsSelection.h>
42 #include <AliMultiplicity.h>
43 
47 
48 //____________________________________________
50 TNamed(),
51 fCounters(),
52 fESD(kFALSE),
53 fMultiplicity(kFALSE),
54 fMultiplicityEtaRange(1.0),
55 fSpherocity(kFALSE),
56 fSpherocitySteps(100.),
57 fHistTrackFilterEvMult(0),
58 fHistTrackAnaEvMult(0),
59 fHistTrackFilterSpdMult(0),
60 fHistTrackAnaSpdMult(0)
61 {
62  // empty constructor
63 }
64 
65 //__________________________________________________
67 TNamed(name,name),
68 fCounters(name),
69 fESD(kFALSE),
70 fMultiplicity(kFALSE),
71 fMultiplicityEtaRange(1.0),
72 fSpherocity(kFALSE),
73 fSpherocitySteps(100.),
74 fHistTrackFilterEvMult(0),
75 fHistTrackAnaEvMult(0),
76 fHistTrackFilterSpdMult(0),
77 fHistTrackAnaSpdMult(0)
78 {
79  ;
80 }
81 
82 //______________________________________________
84 {
85  //destructor
89  }
91  delete fHistTrackAnaEvMult;
93  }
97  }
99  delete fHistTrackAnaSpdMult;
101  }
102 }
103 
104 //______________________________________________
106 {
107  //variables initialization
108  fCounters.AddRubric("Event","triggered/V0AND/PileUp/PbPbC0SMH-B-NOPF-ALLNOTRD/Candles0.3/PrimaryV/countForNorm/noPrimaryV/zvtxGT10/!V0A&Candle03/!V0A&PrimaryV/Candid(Filter)/Candid(Analysis)/NCandid(Filter)/NCandid(Analysis)");
109  if(fMultiplicity) fCounters.AddRubric("Multiplicity", 5000);
110  if(fSpherocity) fCounters.AddRubric("Spherocity", (Int_t)fSpherocitySteps+1);
111  fCounters.AddRubric("Run", 1000000);
112  fCounters.Init();
113  fHistTrackFilterEvMult=new TH2F("FiltCandidvsTracksinEv","FiltCandidvsTracksinEv",10000,-0.5,9999.5,200,-0.5,199.5);
114  fHistTrackFilterEvMult->GetYaxis()->SetTitle("NCandidates");
115  fHistTrackFilterEvMult->GetXaxis()->SetTitle("NTracksinEvent");
116  fHistTrackAnaEvMult=new TH2F("AnaCandidvsTracksinEv","AnaCandidvsTracksinEv",10000,-0.5,9999.5,100,-0.5,99.5);
117  fHistTrackAnaEvMult->GetYaxis()->SetTitle("NCandidates");
118  fHistTrackAnaEvMult->GetXaxis()->SetTitle("NTracksinEvent");
119  fHistTrackFilterSpdMult=new TH2F("FilterCandidvsSpdMult","FilterCandidvsSpdMult",5000,-0.5,4999.5,200,-0.5,199.5);
120  fHistTrackFilterSpdMult->GetYaxis()->SetTitle("NCandidates");
121  fHistTrackFilterSpdMult->GetXaxis()->SetTitle("NSPDTracklets");
122  fHistTrackAnaSpdMult=new TH2F("AnaCandidvsSpdMult","AnaCandidvsSpdMult",5000,-0.5,4999.5,100,-0.5,99.5);
123  fHistTrackAnaSpdMult->GetYaxis()->SetTitle("NCandidates");
124  fHistTrackAnaSpdMult->GetXaxis()->SetTitle("NSPDTracklets");
125 }
126 
127 //______________________________________________
128 Long64_t AliNormalizationCounter::Merge(TCollection* list){
129  if (!list) return 0;
130  if (list->IsEmpty()) return 0;//(Long64_t)fCounters.Merge(list);
131 
132  TIter next(list);
133  const TObject* obj = 0x0;
134  while ((obj = next())) {
135 
136  // check that "obj" is an object of the class AliNormalizationCounter
137  const AliNormalizationCounter* counter = dynamic_cast<const AliNormalizationCounter*>(obj);
138  if (!counter) {
139  AliError(Form("object named %s is not AliNormalizationCounter! Skipping it.", counter->GetName()));
140  continue;
141  }
142 
143  Add(counter);
144 
145  }
146 
147  return (Long64_t)1;//(Long64_t)fCounters->GetEntries();
148 }
149 //_______________________________________
151  fCounters.Add(&(norm->fCounters));
156 }
157 //_______________________________________
158 /*
159 Stores the variables used for normalization as function of run number
160 returns kTRUE if the event is to be counted for normalization
161 (pass event selection cuts OR has no primary vertex)
162  */
163 void AliNormalizationCounter::StoreEvent(AliVEvent *event,AliRDHFCuts *rdCut,Bool_t mc, Int_t multiplicity, Double_t spherocity){
164  //
165 
166  Bool_t isEventSelected = rdCut->IsEventSelected(event);
167 
168  // events not passing physics selection. do nothing
169  if(rdCut->IsEventRejectedDuePhysicsSelection()) return;
170 
171  Bool_t v0A=kFALSE;
172  Bool_t v0B=kFALSE;
173  Bool_t flag03=kFALSE;
174  Bool_t flagPV=kFALSE;
175 
176  //Run Number
177  Int_t runNumber = event->GetRunNumber();
178 
179  // Evaluate the multiplicity
180  if(fMultiplicity && multiplicity==-9999) Multiplicity(event);
181 
182  //Find CINT1B
183  AliESDEvent *eventESD = (AliESDEvent*)event;
184  if(!eventESD){AliError("ESD event not available");return;}
185  if(mc&&event->GetEventType() != 0)return;
186  //event must be either physics or MC
187  if(!(event->GetEventType() == 7||event->GetEventType() == 0))return;
188 
189  FillCounters("triggered",runNumber,multiplicity,spherocity);
190 
191  //Find V0AND
192  AliTriggerAnalysis trAn;
193  AliAODVZERO* aodV0 = (AliAODVZERO*)event->GetVZEROData();
194  Bool_t isPP2012 = kFALSE;
195  if(runNumber>=176326 && runNumber<=193766) isPP2012=kTRUE;
196  if(aodV0 && !isPP2012){
197  v0B = trAn.IsOfflineTriggerFired(eventESD , AliTriggerAnalysis::kV0C);
198  v0A = trAn.IsOfflineTriggerFired(eventESD , AliTriggerAnalysis::kV0A);
199  }
200  if(v0A&&v0B) FillCounters("V0AND",runNumber,multiplicity,spherocity);
201 
202  //FindPrimary vertex
203  // AliVVertex *vtrc = (AliVVertex*)event->GetPrimaryVertex();
204  // if(vtrc && vtrc->GetNContributors()>0){
205  // fCounters.Count(Form("Event:PrimaryV/Run:%d",runNumber));
206  // flagPV=kTRUE;
207  // }
208 
209  //trigger
210  AliAODEvent *eventAOD = (AliAODEvent*)event;
211  TString trigclass=eventAOD->GetFiredTriggerClasses();
212  if(trigclass.Contains("C0SMH-B-NOPF-ALLNOTRD")||trigclass.Contains("C0SMH-B-NOPF-ALL")){
213  FillCounters("PbPbC0SMH-B-NOPF-ALLNOTRD",runNumber,multiplicity,spherocity);
214  }
215 
216  //FindPrimary vertex
217  if(isEventSelected){
218  FillCounters("PrimaryV",runNumber,multiplicity,spherocity);
219  flagPV=kTRUE;
220  }else{
221  if(rdCut->GetWhyRejection()==0){
222  FillCounters("noPrimaryV",runNumber,multiplicity,spherocity);
223  }
224  //find good vtx outside range
225  if(rdCut->GetWhyRejection()==6){
226  FillCounters("zvtxGT10",runNumber,multiplicity,spherocity);
227  FillCounters("PrimaryV",runNumber,multiplicity,spherocity);
228  flagPV=kTRUE;
229  }
230  if(rdCut->GetWhyRejection()==1){
231  FillCounters("PileUp",runNumber,multiplicity,spherocity);
232  }
233  }
234  //to be counted for normalization
235  if(rdCut->CountEventForNormalization()){
236  FillCounters("countForNorm",runNumber,multiplicity,spherocity);
237  }
238 
239 
240  //Find Candle
241  Int_t trkEntries = (Int_t)event->GetNumberOfTracks();
242  for(Int_t i=0;i<trkEntries&&!flag03;i++){
243  AliAODTrack *track=(AliAODTrack*)event->GetTrack(i);
244  if((track->Pt()>0.3)&&(!flag03)){
245  FillCounters("Candles0.3",runNumber,multiplicity,spherocity);
246  flag03=kTRUE;
247  break;
248  }
249  }
250 
251  if(!(v0A&&v0B)&&(flag03)){
252  FillCounters("!V0A&Candle03",runNumber,multiplicity,spherocity);
253  }
254  if(!(v0A&&v0B)&&flagPV){
255  FillCounters("!V0A&PrimaryV",runNumber,multiplicity,spherocity);
256  }
257 
258  return;
259 }
260 //_____________________________________________________________________
261 void AliNormalizationCounter::StoreCandidates(AliVEvent *event,Int_t nCand,Bool_t flagFilter){
262 
263  Int_t ntracks=event->GetNumberOfTracks();
264  if(flagFilter)fHistTrackFilterEvMult->Fill(ntracks,nCand);
265  else fHistTrackAnaEvMult->Fill(ntracks,nCand);
266  Int_t nSPD=0;
267  if(fESD){
268  AliESDEvent *ESDevent=(AliESDEvent*)event;
269  const AliMultiplicity *alimult = ESDevent->GetMultiplicity();
270  nSPD = alimult->GetNumberOfTracklets();
271 
272  }else{
273  AliAODEvent *aodEvent =(AliAODEvent*)event;
274  AliAODTracklets *trklets=aodEvent->GetTracklets();
275  nSPD = trklets->GetNumberOfTracklets();
276  }
277  if(flagFilter)fHistTrackFilterSpdMult->Fill(nSPD,nCand);
278  else fHistTrackAnaSpdMult->Fill(nSPD,nCand);
279 
280  Int_t runNumber = event->GetRunNumber();
281  Int_t multiplicity = Multiplicity(event);
282  if(nCand==0)return;
283  if(flagFilter){
284  if(fMultiplicity)
285  fCounters.Count(Form("Event:Candid(Filter)/Run:%d/Multiplicity:%d",runNumber,multiplicity));
286  else
287  fCounters.Count(Form("Event:Candid(Filter)/Run:%d",runNumber));
288  for(Int_t i=0;i<nCand;i++){
289  if(fMultiplicity)
290  fCounters.Count(Form("Event:NCandid(Filter)/Run:%d/Multiplicity:%d",runNumber,multiplicity));
291  else
292  fCounters.Count(Form("Event:NCandid(Filter)/Run:%d",runNumber));
293  }
294  }else{
295  if(fMultiplicity)
296  fCounters.Count(Form("Event:Candid(Analysis)/Run:%d/Multiplicity:%d",runNumber,multiplicity));
297  else
298  fCounters.Count(Form("Event:Candid(Analysis)/Run:%d",runNumber));
299  for(Int_t i=0;i<nCand;i++){
300  if(fMultiplicity)
301  fCounters.Count(Form("Event:NCandid(Analysis)/Run:%d/Multiplicity:%d",runNumber,multiplicity));
302  else
303  fCounters.Count(Form("Event:NCandid(Analysis)/Run:%d",runNumber));
304  }
305  }
306  return;
307 }
308 //_______________________________________________________________________
309 TH1D* AliNormalizationCounter::DrawAgainstRuns(TString candle,Bool_t drawHist){
310  //
311  fCounters.SortRubric("Run");
312  TString selection;
313  selection.Form("event:%s",candle.Data());
314  TH1D* histoneD = fCounters.Get("run",selection.Data());
315 
316  histoneD->Sumw2();
317  if(drawHist)histoneD->DrawClone();
318  return histoneD;
319 }
320 //___________________________________________________________________________
321 TH1D* AliNormalizationCounter::DrawRatio(TString candle1,TString candle2){
322  //
323  fCounters.SortRubric("Run");
324  TString name;
325 
326  name.Form("%s/%s",candle1.Data(),candle2.Data());
327  TH1D* num=DrawAgainstRuns(candle1.Data(),kFALSE);
328  TH1D* den=DrawAgainstRuns(candle2.Data(),kFALSE);
329 
330  den->SetTitle(candle2.Data());
331  den->SetName(candle2.Data());
332  num->Divide(num,den,1,1,"B");
333  num->SetTitle(name.Data());
334  num->SetName(name.Data());
335  num->DrawClone();
336  return num;
337 }
338 //___________________________________________________________________________
340  fCounters.PrintKeyWords();
341 }
342 //___________________________________________________________________________
343 Double_t AliNormalizationCounter::GetSum(TString candle){
344  TString selection="event:";
345  selection.Append(candle);
346  return fCounters.GetSum(selection.Data());
347 }
348 //___________________________________________________________________________
349 TH2F* AliNormalizationCounter::GetHist(Bool_t filtercuts,Bool_t spdtracklets,Bool_t drawHist){
350  if(filtercuts){
351  if(spdtracklets){
352  if(drawHist)fHistTrackFilterSpdMult->DrawCopy("LEGO2Z 0");
354  }else{
355  if(drawHist)fHistTrackFilterEvMult->DrawCopy("LEGO2Z 0");
356  return fHistTrackFilterEvMult;
357  }
358  }else{
359  if(spdtracklets){
360  if(drawHist)fHistTrackAnaSpdMult->DrawCopy("LEGO2Z 0");
361  return fHistTrackAnaSpdMult;
362  }else{
363  if(drawHist)fHistTrackAnaEvMult->DrawCopy("LEGO2Z 0");
364  return fHistTrackAnaEvMult;
365  }
366  }
367 }
368 //___________________________________________________________________________
370  Double_t noVtxzGT10=GetSum("noPrimaryV")*GetSum("zvtxGT10")/GetSum("PrimaryV");
371  return GetSum("countForNorm")-noVtxzGT10;
372 }
373 //___________________________________________________________________________
375  TString listofruns = fCounters.GetKeyWords("RUN");
376  if(!listofruns.Contains(Form("%d",runnumber))){
377  printf("WARNING: %d is not a valid run number\n",runnumber);
378  fCounters.Print("Run","",kTRUE);
379  return 0.;
380  }
381  TString suffix;suffix.Form("/RUN:%d",runnumber);
382  TString zvtx;zvtx.Form("zvtxGT10%s",suffix.Data());
383  TString noPV;noPV.Form("noPrimaryV%s",suffix.Data());
384  TString pV;pV.Form("PrimaryV%s",suffix.Data());
385  TString tbc;tbc.Form("countForNorm%s",suffix.Data());
386  Double_t noVtxzGT10=GetSum(noPV.Data())*GetSum(zvtx.Data())/GetSum(pV.Data());
387  return GetSum(tbc.Data())-noVtxzGT10;
388 }
389 
390 //___________________________________________________________________________
391 Double_t AliNormalizationCounter::GetNEventsForNorm(Int_t minmultiplicity, Int_t maxmultiplicity){
392 
393  if(!fMultiplicity) {
394  AliInfo("Sorry, you didn't activate the multiplicity in the counter!");
395  return 0.;
396  }
397 
398  TString listofruns = fCounters.GetKeyWords("Multiplicity");
399 
400  Int_t nmultbins = maxmultiplicity - minmultiplicity;
401  Double_t sumnoPV=0., sumZvtx=0., sumPv=0., sumEvtNorm=0.;
402  for (Int_t ibin=0; ibin<=nmultbins; ibin++) {
403  // cout << " Looking at bin "<< ibin+minmultiplicity<<endl;
404  if(!listofruns.Contains(Form("%d",ibin+minmultiplicity))){
405  // AliInfo(Form("WARNING: %d is not a valid multiplicity number. \n",ibin+minmultiplicity));
406  continue;
407  }
408  TString suffix;suffix.Form("/Multiplicity:%d",ibin+minmultiplicity);
409  TString zvtx;zvtx.Form("zvtxGT10%s",suffix.Data());
410  TString noPV;noPV.Form("noPrimaryV%s",suffix.Data());
411  TString pV;pV.Form("PrimaryV%s",suffix.Data());
412  TString tbc;tbc.Form("countForNorm%s",suffix.Data());
413  sumnoPV += GetSum(noPV.Data());
414  sumZvtx += GetSum(zvtx.Data());
415  sumPv += GetSum(pV.Data());
416  sumEvtNorm += GetSum(tbc.Data());
417  }
418  Double_t noVtxzGT10 = sumPv>0. ? sumnoPV * sumZvtx / sumPv : 0.;
419  return sumEvtNorm - noVtxzGT10;
420 }
421 //___________________________________________________________________________
422 Double_t AliNormalizationCounter::GetNEventsForNorm(Int_t minmultiplicity, Int_t maxmultiplicity, Double_t minspherocity, Double_t maxspherocity){
423 
424  if(!fMultiplicity || !fSpherocity) {
425  AliInfo("You must activate both multiplicity and spherocity in the counters to use this method!");
426  return 0.;
427  }
428 
429  TString listofruns = fCounters.GetKeyWords("Multiplicity");
430  TString listofruns2 = fCounters.GetKeyWords("Spherocity");
431  TObjArray* arr=listofruns2.Tokenize(",");
432  Int_t nSphVals=arr->GetEntries();
433 
434  Int_t nmultbins = maxmultiplicity - minmultiplicity;
435  Int_t minSphToInteger=minspherocity*fSpherocitySteps;
436  Int_t maxSphToInteger=maxspherocity*fSpherocitySteps;
437  Int_t nstbins = maxSphToInteger - minSphToInteger;
438  Double_t sumnoPV=0., sumZvtx=0., sumPv=0., sumEvtNorm=0.;
439  for (Int_t ibin=0; ibin<=nmultbins; ibin++) {
440  if(!listofruns.Contains(Form("%d",ibin+minmultiplicity))) continue;
441  for (Int_t ibins=0; ibins<nstbins; ibins++) {
442  Bool_t analyze=kFALSE;
443  for(Int_t j=0; j<nSphVals; j++) if((((TObjString*)arr->At(j))->String()).Atoi()==(ibins+minSphToInteger)) analyze=kTRUE;
444  if(!analyze) continue;
445  if(listofruns2.Contains(",") && !listofruns2.Contains(Form("%d",ibins+minSphToInteger))) continue;
446  TString suffix;suffix.Form("/Multiplicity:%d/Spherocity:%d",ibin+minmultiplicity,ibins+minSphToInteger);
447  TString zvtx;zvtx.Form("zvtxGT10%s",suffix.Data());
448  TString noPV;noPV.Form("noPrimaryV%s",suffix.Data());
449  TString pV;pV.Form("PrimaryV%s",suffix.Data());
450  TString tbc;tbc.Form("countForNorm%s",suffix.Data());
451  sumnoPV += GetSum(noPV.Data());
452  sumZvtx += GetSum(zvtx.Data());
453  sumPv += GetSum(pV.Data());
454  sumEvtNorm += GetSum(tbc.Data());
455  }
456  }
457  delete arr;
458  Double_t noVtxzGT10 = sumPv>0. ? sumnoPV * sumZvtx / sumPv : 0.;
459  return sumEvtNorm - noVtxzGT10;
460 }
461 
462 //___________________________________________________________________________
463 Double_t AliNormalizationCounter::GetNEventsForNormSpheroOnly(Double_t minspherocity, Double_t maxspherocity){
464 
465  if(!fSpherocity) {
466  AliInfo("Sorry, you didn't activate the sphericity in the counter!");
467  return 0.;
468  }
469 
470  TString listofruns = fCounters.GetKeyWords("Spherocity");
471  TObjArray* arr=listofruns.Tokenize(",");
472  Int_t nSphVals=arr->GetEntries();
473 
474  Int_t minSphToInteger=minspherocity*fSpherocitySteps;
475  Int_t maxSphToInteger=maxspherocity*fSpherocitySteps;
476  Int_t nstbins = maxSphToInteger - minSphToInteger;
477  Double_t sumnoPV=0., sumZvtx=0., sumPv=0., sumEvtNorm=0.;
478  for (Int_t ibin=0; ibin<nstbins; ibin++) {
479  Bool_t analyze=kFALSE;
480  for(Int_t j=0; j<nSphVals; j++) if((((TObjString*)arr->At(j))->String()).Atoi()==(ibin+minSphToInteger)) analyze=kTRUE;
481  if(!analyze) continue;
482 
483  TString suffix;suffix.Form("/Spherocity:%d",ibin+minSphToInteger);
484  TString zvtx;zvtx.Form("zvtxGT10%s",suffix.Data());
485  TString noPV;noPV.Form("noPrimaryV%s",suffix.Data());
486  TString pV;pV.Form("PrimaryV%s",suffix.Data());
487  TString tbc;tbc.Form("countForNorm%s",suffix.Data());
488  sumnoPV += GetSum(noPV.Data());
489  sumZvtx += GetSum(zvtx.Data());
490  sumPv += GetSum(pV.Data());
491  sumEvtNorm += GetSum(tbc.Data());
492  }
493  delete arr;
494  Double_t noVtxzGT10 = sumPv>0. ? sumnoPV * sumZvtx / sumPv : 0.;
495  return sumEvtNorm - noVtxzGT10;
496 }
497 //___________________________________________________________________________
498 Double_t AliNormalizationCounter::GetSum(TString candle,Int_t minmultiplicity, Int_t maxmultiplicity){
499  // counts events of given type in a given multiplicity range
500 
501  if(!fMultiplicity) {
502  AliInfo("Sorry, you didn't activate the multiplicity in the counter!");
503  return 0.;
504  }
505 
506  TString listofruns = fCounters.GetKeyWords("Multiplicity");
507  Double_t sum=0.;
508  for (Int_t ibin=minmultiplicity; ibin<=maxmultiplicity; ibin++) {
509  // cout << " Looking at bin "<< ibin+minmultiplicity<<endl;
510  if(!listofruns.Contains(Form("%d",ibin))){
511  // AliInfo(Form("WARNING: %d is not a valid multiplicity number. \n",ibin));
512  continue;
513  }
514  TString suffix=Form("/Multiplicity:%d",ibin);
515  TString name=Form("%s%s",candle.Data(),suffix.Data());
516  sum += GetSum(name.Data());
517  }
518  return sum;
519 }
520 
521 //___________________________________________________________________________
523  //usare algebra histos
524  fCounters.SortRubric("Run");
525  TString selection;
526 
527  selection.Form("event:noPrimaryV");
528  TH1D* hnoPrimV = fCounters.Get("run",selection.Data());
529  hnoPrimV->Sumw2();
530 
531  selection.Form("event:zvtxGT10");
532  TH1D* hzvtx= fCounters.Get("run",selection.Data());
533  hzvtx->Sumw2();
534 
535  selection.Form("event:PrimaryV");
536  TH1D* hPrimV = fCounters.Get("run",selection.Data());
537  hPrimV->Sumw2();
538 
539  hzvtx->Multiply(hnoPrimV);
540  hzvtx->Divide(hPrimV);
541 
542  selection.Form("event:countForNorm");
543  TH1D* hCountForNorm = fCounters.Get("run",selection.Data());
544  hCountForNorm->Sumw2();
545 
546  hCountForNorm->Add(hzvtx,-1.);
547 
548  if(drawRatio){
549  selection.Form("event:triggered");
550  TH1D* htriggered = fCounters.Get("run",selection.Data());
551  htriggered->Sumw2();
552  hCountForNorm->Divide(htriggered);
553  }
554 
555  hCountForNorm->DrawClone();
556  return hCountForNorm;
557 }
558 
559 //___________________________________________________________________________
561 
562  Int_t multiplicity = 0;
563  AliAODEvent *eventAOD = (AliAODEvent*)event;
564  AliAODTracklets * aodTracklets = (AliAODTracklets*)eventAOD->GetTracklets();
565  Int_t ntracklets = (Int_t)aodTracklets->GetNumberOfTracklets();
566  for(Int_t i=0;i<ntracklets; i++){
567  Double_t theta = aodTracklets->GetTheta(i);
568  Double_t eta = -TMath::Log( TMath::Tan(theta/2.) ); // check the formula
569  if(TMath::Abs(eta)<fMultiplicityEtaRange){ // set the proper cut on eta
570  multiplicity++;
571  }
572  }
573 
574  return multiplicity;
575 }
576 
577 //___________________________________________________________________________
578 void AliNormalizationCounter::FillCounters(TString name, Int_t runNumber, Int_t multiplicity, Double_t spherocity){
579 
580 
581  Int_t sphToInteger=spherocity*fSpherocitySteps;
582  if(fMultiplicity && !fSpherocity)
583  fCounters.Count(Form("Event:%s/Run:%d/Multiplicity:%d",name.Data(),runNumber,multiplicity));
584  else if(fMultiplicity && fSpherocity)
585  fCounters.Count(Form("Event:%s/Run:%d/Multiplicity:%d/Spherocity:%d",name.Data(),runNumber,multiplicity,sphToInteger));
586  else if(!fMultiplicity && fSpherocity)
587  fCounters.Count(Form("Event:%s/Run:%d/Spherocity:%d",name.Data(),runNumber,sphToInteger));
588  else
589  fCounters.Count(Form("Event:%s/Run:%d",name.Data(),runNumber));
590  return;
591 }
TH2F * fHistTrackFilterSpdMult
hist to store no of analysis candidates vs no of tracks in the event
void StoreCandidates(AliVEvent *, Int_t nCand=0, Bool_t flagFilter=kTRUE)
Bool_t fESD
internal counter
TH2F * fHistTrackAnaSpdMult
hist to store no of filter candidates vs SPD multiplicity
TList * list
Bool_t fMultiplicity
flag for ESD vs AOD
Int_t GetWhyRejection() const
Definition: AliRDHFCuts.h:294
TH1D * DrawAgainstRuns(TString candle="candid(filter)", Bool_t drawHist=kTRUE)
AliCounterCollection fCounters
void Add(const AliNormalizationCounter *)
TH2F * fHistTrackAnaEvMult
hist to store no of filter candidates vs no of tracks in the event
Int_t Multiplicity(AliVEvent *event)
Bool_t CountEventForNormalization() const
Definition: AliRDHFCuts.h:344
TH1D * DrawNEventsForNorm(Bool_t drawRatio=kFALSE)
TH1D * DrawRatio(TString candle1="candid(filter)", TString candle2="triggered")
Bool_t IsEventRejectedDuePhysicsSelection() const
Definition: AliRDHFCuts.h:320
Long64_t Merge(TCollection *list)
Float_t fMultiplicityEtaRange
flag for multiplicity
Bool_t IsEventSelected(AliVEvent *event)
Double_t GetSum(TString candle="triggered")
void StoreEvent(AliVEvent *, AliRDHFCuts *, Bool_t mc=kFALSE, Int_t multiplicity=-9999, Double_t spherocity=-99.)
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
TH2F * GetHist(Bool_t filtercuts=kTRUE, Bool_t spdtracklets=kTRUE, Bool_t drawHist=kFALSE)
Double_t GetNEventsForNormSpheroOnly(Double_t minspherocity, Double_t maxspherocity)
void FillCounters(TString name, Int_t runNumber, Int_t multiplicity, Double_t spherocity)