AliPhysics  608b256 (608b256)
AliBasedNdetaTask.h
Go to the documentation of this file.
1 //
2 // Task to analyse the AOD for for dN/deta in the base regions
3 //
4 #ifndef ALIBASEDNDETATASK_H
5 #define ALIBASEDNDETATASK_H
6 
16 #include "AliBaseAODTask.h"
17 #include <AliAnalysisUtils.h>
18 class TAxis;
19 class TList;
20 class TH2D;
21 class TH2F;
22 class TH1D;
23 class TH1I;
24 class TF1;
25 class TProfile;
26 class AliAODEvent;
27 class AliAODForwardMult;
28 class TObjArray;
29 
50 {
51 public:
55  enum {
57  kNone = 0,
64  kEventLevel = 0x1,
68  kDummy = 0x2,
72  kBackground = 0x4,
84  kZeroBin = 0x10,
89  };
93  enum EPileupMask {
101  kPileupSPD = 0x1,
105  kPileupTrk = 0x2,
109  kPileupBC = 0x4,
113  kPileupFull = 0x8,
121  kPileupUtil = 0x20,
125  kPileupBins = 0x40,
126  };
127 
130  kCentDefault, // What ever stored in AOD
131  kCentV0M, // VZERO multiplcity
132  kCentV0A, // VZERO-A
133  kCentV0A123, // VZERO-A
134  kCentV0C, // VZERO-C
135  kCentFMD, // FMD
136  kCentTrk, // Tracks
137  kCentTkl, // Tracklets
138  kCentCL0, // Clusters in SPD-0
139  kCentCL1, // Clusters in SPD-1
140  kCentCND, // Candle - tracks+tracklets
141  kCentZNA, // ZDC neutrons A-side
142  kCentZNC, // ZDC neutrons C-side
143  kCentZPA, // ZDC protons A-side
144  kCentZPC, // ZDC protons C-side
145  kCentNPA, // ?
146  kCentV0MvsFMD, // V0M vs FMD
147  kCentTklvsV0M, // Tracks vs V0M
148  kCentZEMvsZDC, // ZDC veto vs neutrons
149  kMult, // Reference multiplicity in @f$|\eta|<0.8@f$
150  kMultV0A, // HMTF V0A
151  kMultV0M, // HMTF V0M
152  kMultV0C, // HMTF V0C
153  kCentTrue = 0x100,
154  kCentEq = 0x200
155  };
166  AliBasedNdetaTask(const char* name);
171  virtual ~AliBasedNdetaTask();
172 
182  virtual void SetDebugLevel(Int_t level);
188  void SetCorrEmpty(Bool_t use) { fCorrEmpty = use; }
214  void SetSatelliteVertices(Bool_t satVtx) { fSatelliteVertices = satVtx; }
241  AliAnalysisUtils& GetAnalysisUtils() { return fAnaUtil; }
249  static const Char_t* NormalizationSchemeString(UShort_t scheme);
257  static UShort_t ParseNormalizationScheme(const Char_t* what);
263  void SetNormalizationScheme(UShort_t scheme);
269  void SetNormalizationScheme(const char* what);
275  void SetMCFinalCorrFilename(const char* filename) {
276  fFinalMCCorrFile.Clear();
277  fFinalMCCorrFile.Append(filename);
278  }
285  void Print(Option_t* option="R") const;
296  virtual Bool_t Book();
303  virtual Bool_t PreEvent() {
304  fCacheCent = -10; fCacheQual = 0xFFFF; return true; }
310  virtual Bool_t Event(AliAODEvent& aod);
318  virtual Bool_t Finalize();
319  /* @} */
320 
338  static TH1D* ProjectX(const TH2D* h,
339  const char* name,
340  Int_t firstbin,
341  Int_t lastbin,
342  bool useROOT=false,
343  bool corr=true,
344  bool error=true);
351  static void ScaleToCoverage(TH2D* copy, const TH1D* norm);
358  static void ScaleToCoverage(TH1D* copy, const TH1D* norm);
368  static void SetHistogramAttributes(TH1D* h, Int_t colour, Int_t marker,
369  const char* title,
370  const char* ytitle=0);
376  enum {
377  kSolid = 0x000,
378  kHollow = 0x001,
379  kCircle = 0x002,
380  kSquare = 0x004,
381  kUpTriangle = 0x006,
382  kDownTriangle = 0x008,
383  kDiamond = 0x00a,
384  kCross = 0x00c,
385  kStar = 0x00e
386  };
394  static Int_t GetMarkerStyle(UShort_t bits);
402  static UShort_t GetMarkerBits(Int_t style);
410  static Int_t FlipHollowStyle(Int_t style);
443  void SetIpzReweight(TF1* f) { fIpzReweight = f; }
444 protected:
456  // Forward declaration
457  class CentralityBin;
467  virtual Bool_t CheckEvent(const AliAODForwardMult& forward);
472  virtual void InitializeCentBins();
481  virtual TH2D* GetHistogram(const AliAODEvent& aod, Bool_t mc=false) = 0;
487  virtual Int_t GetColor() const { return kBlack; }
493  virtual Int_t GetMarker() const { return GetMarkerStyle(kCircle); }
501  virtual void CheckEventData(Double_t vtx,
502  TH2* data,
503  TH2* mcData);
511  void AddCentralityBin(UShort_t at, Float_t low, Float_t high);
521  virtual CentralityBin* MakeCentralityBin(const char* name, Float_t low,
522  Float_t high) const;
523 
524  // function which applies empirical correction to the AOD object
534  static TH1* Asymmetry(TH1* h);
543  static Int_t GetCentMethodID(const TString& meth);
551  static const char* GetCentMethod(UShort_t id);
563  AliAODForwardMult* forward,
564  Int_t& qual);
573  AliAODForwardMult* forward);
574  //==================================================================
580  struct Sum : public TNamed
581  {
582  TH2D* fSum; // Sum of non-zero events
583  TH2D* fSum0; // Sum of zero events
584  TH1I* fEvents; // Distribution of events
585  Int_t fDebug; // Debug level
589  Sum() : fSum(0), fSum0(0), fEvents(0), fDebug(0) {}
596  Sum(const char* name, const char* postfix)
597  : TNamed(name,postfix),
598  fSum(0),
599  fSum0(0),
600  fEvents(0),
601  fDebug(0)
602  {}
608  Sum(const Sum& o)
609  : TNamed(o),
610  fSum(o.fSum),
611  fSum0(o.fSum0),
612  fEvents(o.fEvents),
613  fDebug(o.fDebug)
614  {}
622  Sum& operator=(const Sum& o)
623  {
624  if (&o == this) return *this;
625  SetName(o.GetName()); fSum = o.fSum; fSum0 = o.fSum0; fEvents=o.fEvents;
626  return *this;
627  }
631  ~Sum() {}
639  void Init(TList* list, const TH2D* data, Int_t col);
647  void Add(const TH2D* data, Bool_t isZero, Double_t weight);
657  static TString GetHistName(const char* name, Int_t what=0,
658  const char* post=0);
666  TString GetHistName(Int_t what=0) const;
680  TH2D* CalcSum(TList* o, Double_t& ntotal,
681  Double_t zeroEff, Double_t otherEff=1, Int_t marker=20,
682  Bool_t rootXproj=false, Bool_t corrEmpty=true) const;
683 
689  virtual void Print(Option_t* option="") const;
690  // ClassDef(Sum,2); // Summed histograms
691  };
692 
693  //==================================================================
701  class CentralityBin : public TNamed
702  {
703  public:
707  CentralityBin();
715  CentralityBin(const char* name, Float_t low, Float_t high);
721  CentralityBin(const CentralityBin& other);
725  virtual ~CentralityBin();
733  CentralityBin& operator=(const CentralityBin& other);
739  Bool_t IsAllBin() const { return fLow == 0 && fHigh == 0; }
740  Bool_t IsInclusiveBin() const { return fLow == 0 && fHigh == 101; }
746  const char* GetListName() const;
753  virtual void CreateOutputObjects(TList* dir, Int_t mask);
769  virtual Bool_t ProcessEvent(const AliAODForwardMult* forward,
770  UInt_t triggerMask,
771  Bool_t isZero,
772  Double_t vzMin,
773  Double_t vzMax,
774  const TH2D* data,
775  const TH2D* mc,
776  UInt_t filter,
777  Double_t weight);
836  virtual Double_t Normalization(const TH1I& t,
837  UShort_t scheme,
838  Double_t trgEff,
839  Double_t& ntotal,
840  TString* text) const;
854  virtual void MakeResult(const TH2D* sum,
855  const char* postfix,
856  bool rootProj,
857  bool corrEmpty,
858  Double_t scaler,
859  Int_t marker,
860  Int_t color,
861  TList* mclist,
862  TList* truthlist);
881  virtual bool End(TList* sums,
882  TList* results,
883  UShort_t scheme,
884  Double_t trigEff,
885  Double_t trigEff0,
886  Bool_t rootProj,
887  Bool_t corrEmpty,
888  Int_t triggerMask,
889  Int_t marker,
890  Int_t color,
891  TList* mclist,
892  TList* truthlist);
904  const Sum* GetSum(Bool_t mc=false) const { return mc ? fSumMC : fSum; }
912  Sum* GetSum(Bool_t mc=false) { return mc ? fSumMC : fSum; }
918  const TH1I* GetTriggers() const { return fTriggers; }
924  TH1I* GetTriggers() { return fTriggers; }
930  const TH1I* GetStatus() const { return fStatus; }
936  TH1I* GetStatus() { return fStatus; }
946  Int_t GetColor(Int_t fallback=kRed+2) const;
947  void SetColor(Color_t colour) { fColor = colour; }
953  TList* GetResults() const { return fOutput; }
962  const char* GetResultName(const char* postfix="") const;
971  TH1* GetResult(const char* postfix="",
972  Bool_t verbose=true) const;
978  void SetDebugLevel(Int_t lvl);
984  void SetSatelliteVertices(Bool_t satVtx) { fSatelliteVertices = satVtx; }
992  virtual void Print(Option_t* option="") const;
993  protected:
1002  virtual Bool_t ReadSum(TList* list, bool mc=false);
1009  virtual void CreateSums(const TH2D* data, const TH2D* mc);
1021  virtual Bool_t CheckEvent(const AliAODForwardMult* forward,
1022  Int_t triggerMask,
1023  Double_t vzMin,
1024  Double_t vzMax,
1025  Int_t filter);
1026  TList* fSums; // Output list
1027  TList* fOutput; // Output list
1028  Sum* fSum; // Sum histogram
1029  Sum* fSumMC; // MC sum histogram
1030  TH1I* fTriggers; // Trigger histogram
1031  TH1I* fStatus; // Trigger histogram
1032  Float_t fLow; // Lower limit (inclusive)
1033  Float_t fHigh; // Upper limit (exclusive)
1034  Bool_t fDoFinalMCCorrection; //Do final MC correction
1035  Bool_t fSatelliteVertices; // Satellite vertex flag
1036  Int_t fDebug; // Debug level
1037  Color_t fColor; // Colour used
1038 
1039  // ClassDef(CentralityBin,5); // A centrality bin
1040  };
1041  Bool_t fCorrEmpty; // Correct for empty bins
1042  Bool_t fUseROOTProj; // Whether to use ROOT's ProjectionX
1043  Double_t fTriggerEff; // Trigger efficiency for selected trigger(s)
1044  Double_t fTriggerEff0; // Bin-0 Trigger efficiency for sel trigger(s)
1045  TObjArray* fListOfCentralities; // Centrality bins
1046  UShort_t fNormalizationScheme; // Normalization scheme
1047  TString fFinalMCCorrFile; //Filename for final MC corr
1048  Bool_t fSatelliteVertices; // satellite vertex flag
1049  TH2D* fEmpiricalCorrection; // Empirical correction
1050  TProfile* fMeanVsC; //mean signal per event vs cent
1051  TH1D* fSeenCent; // The seen centrality
1052  TH1D* fTakenCent; // The taken centrality
1053  TString fCentMethod; // Centrality estimator
1054  AliAnalysisUtils fAnaUtil; // Analysis utility
1055  Bool_t fUseUtilPileup; // Check for SPD outliers
1056  TF1* fIpzReweight; // Re-weighing function
1057  Double_t fCacheCent; // Stored centrality
1058  Int_t fCacheQual; // Stored centrality quality flag
1059  ClassDef(AliBasedNdetaTask,19); // Determine charged particle density
1060 };
1061 
1062 #endif
1063 //
1064 // Local Variables:
1065 // mode: C++
1066 // End:
1067 //
Int_t color[]
print message on plot with ok/not ok
Sum(const char *name, const char *postfix)
virtual Bool_t PreEvent()
const char * filename
Definition: TestFCM.C:1
AliAnalysisUtils & GetAnalysisUtils()
void Print(Option_t *option="R") const
double Double_t
Definition: External.C:58
static void ScaleToCoverage(TH2D *copy, const TH1D *norm)
Definition: External.C:236
const char * title
Definition: MakeQAPdf.C:27
static UShort_t ParseNormalizationScheme(const Char_t *what)
Double_t GetCentrality(AliAODEvent &event, AliAODForwardMult *forward, Int_t &qual)
virtual Bool_t Event(AliAODEvent &aod)
char Char_t
Definition: External.C:18
virtual void InitializeCentBins()
static TH1 * Asymmetry(TH1 *h)
TH2D * CalcSum(TList *o, Double_t &ntotal, Double_t zeroEff, Double_t otherEff=1, Int_t marker=20, Bool_t rootXproj=false, Bool_t corrEmpty=true) const
virtual void CheckEventData(Double_t vtx, TH2 *data, TH2 *mcData)
virtual void SetDebugLevel(Int_t level)
TLatex * text[5]
option to what and if export to output file
void SetUseUtilPileup(Bool_t use)
static Int_t GetMarkerStyle(UShort_t bits)
static Int_t FlipHollowStyle(Int_t style)
virtual Bool_t Finalize()
AliAnalysisUtils fAnaUtil
void SetTriggerEff0(Double_t e)
int Int_t
Definition: External.C:63
void SetNormalizationScheme(UShort_t scheme)
void Init(TList *list, const TH2D *data, Int_t col)
Definition: External.C:204
unsigned int UInt_t
Definition: External.C:33
float Float_t
Definition: External.C:68
void SetTriggerEff(Double_t e)
Int_t method
Definition: External.C:228
Definition: External.C:212
virtual Int_t GetColor() const
TObjArray * fListOfCentralities
virtual Bool_t Book()
Sum & operator=(const Sum &o)
static Int_t GetCentMethodID(const TString &meth)
static const char * GetCentMethod(UShort_t id)
virtual CentralityBin * MakeCentralityBin(const char *name, Float_t low, Float_t high) const
void SetSatelliteVertices(Bool_t satVtx)
void SetSatelliteVertices(Bool_t satVtx)
virtual TH2D * GetHistogram(const AliAODEvent &aod, Bool_t mc=false)=0
void AddCentralityBin(UShort_t at, Float_t low, Float_t high)
Bool_t ApplyEmpiricalCorrection(const AliAODForwardMult *aod, TH2D *data)
AliBasedNdetaTask & operator=(const AliBasedNdetaTask &)
void SetCorrEmpty(Bool_t use)
Definition: External.C:220
static TH1D * ProjectX(const TH2D *h, const char *name, Int_t firstbin, Int_t lastbin, bool useROOT=false, bool corr=true, bool error=true)
void Add(const TH2D *data, Bool_t isZero, Double_t weight)
const Sum * GetSum(Bool_t mc=false) const
unsigned short UShort_t
Definition: External.C:28
virtual Bool_t CheckEvent(const AliAODForwardMult &forward)
const char Option_t
Definition: External.C:48
static TString GetHistName(const char *name, Int_t what=0, const char *post=0)
void SetIpzReweight(TF1 *f)
virtual Int_t GetMarker() const
bool Bool_t
Definition: External.C:53
void SetUseROOTProjectX(Bool_t use)
virtual void Print(Option_t *option="") const
AliBasedNdetaTask(const AliBasedNdetaTask &)
Definition: External.C:196
static UShort_t GetMarkerBits(Int_t style)
void SetGlobalEmpiricalcorrection(TH2D *h)
void SetMCFinalCorrFilename(const char *filename)
TDirectoryFile * dir
Bool_t SetCentralityMethod(const TString &method)
static const Char_t * NormalizationSchemeString(UShort_t scheme)
static void SetHistogramAttributes(TH1D *h, Int_t colour, Int_t marker, const char *title, const char *ytitle=0)