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