AliPhysics  9b6b435 (9b6b435)
AliForwardUtil.h
Go to the documentation of this file.
1 //
2 // Utilities used in the forward multiplcity analysis
3 //
4 //
5 #ifndef ALIFORWARDUTIL_H
6 #define ALIFORWARDUTIL_H
7 
16 #include <TObject.h>
17 #include <TString.h>
18 #include <TObjArray.h>
19 class TH2D;
20 class TH1I;
21 class TH1;
22 class TF1;
23 class TAxis;
24 class TArrayD;
25 class TVector3;
26 class AliVEvent;
27 class AliESDEvent;
28 class AliAODEvent;
29 class AliAnalysisTaskSE;
30 
36 class AliForwardUtil : public TObject
37 {
38 public:
39  enum {
41  kInvalidValue = -9999
42  };
43  enum {
44  kSkipRing = (1 << 19) // Bit for skipping a histogram
45  };
54  static Color_t RingColor(UShort_t d, Char_t r)
55  {
56 #if 0
57  return ((d == 1 ? kRed : (d == 2 ? kGreen : kBlue))
58  + ((r == 'I' || r == 'i') ? 2 : -3));
59 #else
60  // Brigher colours that look better in print
61  return ((d == 1 ? kRed : (d == 2 ? kGreen : kBlue))
62  + ((r == 'I' || r == 'i') ? -3 : -9));
63 #endif
64  }
65  //==================================================================
75  static ULong_t AliROOTRevision();
87  static ULong_t AliROOTBranch();
88  /* @} */
89  //==================================================================
99  kPP,
104  };
105  //__________________________________________________________________
117  static Float_t BeamRapidity(Float_t beam, UShort_t z, UShort_t a);
130  static Float_t CenterOfMassEnergy(Float_t beam, UShort_t z1, UShort_t a1,
131  Short_t z2=-1, Short_t a2=-1);
143  Short_t z2=-1, Short_t a2=-1);
156  static UShort_t ParseCollisionSystem(const char* sys);
169  static UShort_t ParseCollisionSystem(Int_t b1a, Int_t b1z,
170  Int_t b2a, Int_t b2z,
171  const char* sys);
183  static const char* CollisionSystemString(UShort_t sys);
184  //__________________________________________________________________
202  static const char* CenterOfMassEnergyString(UShort_t cms);
203  //__________________________________________________________________
211  static Short_t ParseMagneticField(Float_t field);
219  static const char* MagneticFieldString(Short_t field);
220  /* @} */
221 
222  //==================================================================
235  static Double_t GetStripR(Char_t ring, UShort_t strip);
245  static Double_t GetSectorZ(UShort_t det, Char_t ring, UShort_t sec);
255  static Double_t GetSectorPhi(UShort_t det, Char_t ring, UShort_t sec);
268  static Bool_t GetXYZ(UShort_t det, Char_t ring, UShort_t sec,
269  UShort_t str, const TVector3& ip,
270  TVector3& pos);
284  static Bool_t GetEtaPhi(UShort_t det, Char_t ring, UShort_t sec,
285  UShort_t str, const TVector3& ip,
286  Double_t& eta, Double_t& phi);
294  static Double_t GetEtaFromStrip(UShort_t det, Char_t ring,
295  UShort_t sec, UShort_t strip, Double_t zvtx);
308  static Bool_t GetEtaPhiFromStrip(Char_t r, UShort_t strip,
309  Double_t& eta, Double_t& phi ,
310  Double_t ipX, Double_t ipY);
322  static Double_t GetPhiFromStrip(Char_t ring, UShort_t strip,
323  Double_t phi, Double_t xvtx, Double_t yvtx);
324  /* @} */
325 
326  //==================================================================
347  static UShort_t CheckForAOD();
357  static Bool_t CheckForTask(const char* clsOrName, Bool_t cls=true);
358  /* @} */
359 
360  //==================================================================
373  static TObject* MakeParameter(const char* name, UShort_t value);
382  static TObject* MakeParameter(const char* name, Int_t value);
391  static TObject* MakeParameter(const char* name, Double_t value);
400  static TObject* MakeParameter(const char* name, Bool_t value);
409  static TObject* MakeParameter(const char* name, ULong_t value);
416  static void GetParameter(TObject* o, UShort_t& value);
423  static void GetParameter(TObject* o, Int_t& value);
430  static void GetParameter(TObject* o, Double_t& value);
437  static void GetParameter(TObject* o, Bool_t& value);
444  static void GetParameter(TObject* o, ULong_t& value);
445  /* @} */
446 
447  //==================================================================
459  static TAxis* MakeFullIpZAxis(Int_t nCenter=20);
466  static void MakeFullIpZAxis(Int_t nCenter, TArrayD& bins);
476  static void MakeLogScale(Int_t nBins, Int_t minOrder, Int_t maxOrder,
477  TArrayD& bins);
478  /* @} */
479 
480  //==================================================================
511  static Float_t GetCentrality(const AliVEvent& event,
512  const TString& method,
513  Int_t& qual,
514  Bool_t verbose=false);
515  //____________________________________________________________________
527  static Float_t GetCentralityMult(const AliVEvent& event,
528  const TString& method,
529  Int_t& qual,
530  Bool_t verbose=false);
541  static Float_t GetCentralityCompat(const AliVEvent& event,
542  const TString& method,
543  Int_t& qual,
544  Bool_t verbose);
545  //____________________________________________________________________
556  static Float_t GetCentralityCompat(const AliESDEvent& event,
557  const TString& method,
558  Int_t& qual,
559  Bool_t verbose);
560  //____________________________________________________________________
571  static Float_t GetCentralityCompat(const AliAODEvent& event,
572  const TString& method,
573  Int_t& qual,
574  Bool_t verbose);
575 
576  //==================================================================
586  static void PrintTask(const TObject& o);
592  static void PrintName(const char* name);
599  static void PrintField(const char* name, const char* value, ...);
600  /* @} */
601 
602  //==================================================================
612  struct Histos : public TObject
613  {
617  Histos() : fFMD1i(0), fFMD2i(0), fFMD2o(0), fFMD3i(0), fFMD3o(0) {}
623  Histos(const Histos& o)
624  : TObject(o),
625  fFMD1i(o.fFMD1i),
626  fFMD2i(o.fFMD2i),
627  fFMD2o(o.fFMD2o),
628  fFMD3i(o.fFMD3i),
629  fFMD3o(o.fFMD3o)
630  {}
636  Histos& operator=(const Histos&) { return *this;}
641  ~Histos();
647  void Delete(Option_t* opt="");
653  void Init(const TAxis& etaAxis);
659  void ReInit(const TAxis& etaAxis);
669  static TH2D* Make(UShort_t d, Char_t r, const TAxis& etaAxis);
676  static void RebinEta(TH2D* hist, const TAxis& etaAxis);
682  void Clear(Option_t* option="");
691  TH2D* Get(UShort_t d, Char_t r) const;
692  TH2D* fFMD1i; // Histogram for FMD1i
693  TH2D* fFMD2i; // Histogram for FMD2i
694  TH2D* fFMD2o; // Histogram for FMD2o
695  TH2D* fFMD3i; // Histogram for FMD3i
696  TH2D* fFMD3o; // Histogram for FMD3o
697 
698  ClassDef(Histos,2);
699  };
700 
701  //__________________________________________________________________
707  struct RingHistos : public TObject
708  {
712  RingHistos() : fDet(0), fRing('\0'), fName(""), fkNSector(0), fkNStrip(0) {}
720  : fDet(d), fRing(r), fName(TString::Format("FMD%d%c", d, r)),
721  fkNSector(r == 'i' || r == 'I' ? 20 : 40),
722  fkNStrip(r == 'i' || r == 'I' ? 512 : 256)
723  {}
730  : TObject(o), fDet(o.fDet), fRing(o.fRing), fName(o.fName),
731  fkNSector(o.fkNSector), fkNStrip(o.fkNStrip)
732  {}
736  virtual ~RingHistos() {}
745  {
746  if (&o == this) return *this;
747  TObject::operator=(o);
748  fDet = o.fDet;
749  fRing = o.fRing;
750  fName = o.fName;
751  fkNSector = o.fkNSector;
752  fkNStrip = o.fkNStrip;
753  return *this;
754  }
762  TList* DefineOutputList(TList* d) const;
770  TList* GetOutputList(const TList* d) const;
779  TH1* GetOutputHist(const TList* d, const char* name) const;
785  Color_t Color() const
786  {
787  return AliForwardUtil::RingColor(fDet, fRing);
788  }
794  const char* GetName() const { return fName.Data(); }
798  const UShort_t& NSector() const { return fkNSector; }
802  const UShort_t& NStrip() const { return fkNStrip; }
803  UShort_t fDet; // Detector
804  Char_t fRing; // Ring
805  TString fName; // Name
806  UShort_t fkNSector; // Number of sectors
807  UShort_t fkNStrip; // Number of strips
808 
809  ClassDef(RingHistos,1);
810  };
811  /* @} */
812 
813  //__________________________________________________________________
818  struct DebugGuard
819  {
829  DebugGuard(Int_t lvl, Int_t msgLvl, const char* format, ...);
833  ~DebugGuard();
841  static void Message(Int_t lvl, Int_t msgLvl, const char* format, ...);
842  private:
849  static void Output(int in, TString& msg);
857  static void Format(TString& out, const char* format, va_list ap);
859  };
860  //__________________________________________________________________
865  {
873  SuppressGuard(Int_t lvl=2000);
877  ~SuppressGuard();
878  };
879 private:
896  AliForwardUtil& operator=(const AliForwardUtil&) { return *this; }
901 
902 
903  ClassDef(AliForwardUtil,1);// Utilities - do not make object
904 };
905 
906 // #ifdef LOG_NO_DEBUG
907 // # define DGUARD(L,N,F,...) do {} while(false)
908 // #else
916 # define DGUARD(L,N,F,...) \
917  AliForwardUtil::DebugGuard _GUARD(L,N,F, ## __VA_ARGS__)
918 
925 # define DMSG(L,N,F,...) \
926  AliForwardUtil::DebugGuard::Message(L,N,F, ## __VA_ARGS__)
927 // #endif
928 #endif
929 // Local Variables:
930 // mode: C++
931 // End:
932 
AliForwardUtil & operator=(const AliForwardUtil &)
RingHistos & operator=(const RingHistos &o)
static Short_t ParseMagneticField(Float_t field)
void Clear(Option_t *option="")
double Double_t
Definition: External.C:58
static TAxis * MakeFullIpZAxis(Int_t nCenter=20)
static const char * CenterOfMassEnergyString(UShort_t cms)
static Double_t GetPhiFromStrip(Char_t ring, UShort_t strip, Double_t phi, Double_t xvtx, Double_t yvtx)
static UShort_t ParseCenterOfMassEnergy(UShort_t sys, Float_t cms)
void ReInit(const TAxis &etaAxis)
TString format
file names tag, basically the trigger and calorimeter combination
Histos(const Histos &o)
static Bool_t GetEtaPhi(UShort_t det, Char_t ring, UShort_t sec, UShort_t str, const TVector3 &ip, Double_t &eta, Double_t &phi)
const UShort_t & NStrip() const
static Double_t GetSectorZ(UShort_t det, Char_t ring, UShort_t sec)
char Char_t
Definition: External.C:18
AliForwardUtil(const AliForwardUtil &o)
const char * GetName() const
static Bool_t GetXYZ(UShort_t det, Char_t ring, UShort_t sec, UShort_t str, const TVector3 &ip, TVector3 &pos)
static Bool_t GetEtaPhiFromStrip(Char_t r, UShort_t strip, Double_t &eta, Double_t &phi, Double_t ipX, Double_t ipY)
static AliAODEvent * GetAODEvent(AliAnalysisTaskSE *task)
static void PrintName(const char *name)
static const char * MagneticFieldString(Short_t field)
static TH2D * Make(UShort_t d, Char_t r, const TAxis &etaAxis)
int Int_t
Definition: External.C:63
static Color_t RingColor(UShort_t d, Char_t r)
Definition: External.C:204
static Double_t GetSectorPhi(UShort_t det, Char_t ring, UShort_t sec)
float Float_t
Definition: External.C:68
static Float_t GetCentralityCompat(const AliVEvent &event, const TString &method, Int_t &qual, Bool_t verbose)
Int_t method
static Double_t GetEtaFromStrip(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip, Double_t zvtx)
Definition: External.C:228
RingHistos(UShort_t d, Char_t r)
static void GetParameter(TObject *o, UShort_t &value)
RingHistos(const RingHistos &o)
unsigned long ULong_t
Definition: External.C:38
static void PrintTask(const TObject &o)
TH2D * Get(UShort_t d, Char_t r) const
short Short_t
Definition: External.C:23
static TObject * MakeParameter(const char *name, UShort_t value)
static Float_t BeamRapidity(Float_t beam, UShort_t z, UShort_t a)
Histos & operator=(const Histos &)
const UShort_t & NSector() const
static UShort_t ParseCollisionSystem(const char *sys)
static Double_t GetStripR(Char_t ring, UShort_t strip)
static UShort_t CheckForAOD()
static Float_t GetCentrality(const AliVEvent &event, const TString &method, Int_t &qual, Bool_t verbose=false)
void Init(const TAxis &etaAxis)
static ULong_t AliROOTBranch()
static void MakeLogScale(Int_t nBins, Int_t minOrder, Int_t maxOrder, TArrayD &bins)
static void PrintField(const char *name, const char *value,...)
unsigned short UShort_t
Definition: External.C:28
const char Option_t
Definition: External.C:48
void Delete(Option_t *opt="")
static Float_t CenterOfMassEnergy(Float_t beam, UShort_t z1, UShort_t a1, Short_t z2=-1, Short_t a2=-1)
static Float_t CenterOfMassRapidity(UShort_t z1, UShort_t a1, Short_t z2=-1, Short_t a2=-1)
static const char * CollisionSystemString(UShort_t sys)
bool Bool_t
Definition: External.C:53
static Bool_t CheckForTask(const char *clsOrName, Bool_t cls=true)
static ULong_t AliROOTRevision()
static Float_t GetCentralityMult(const AliVEvent &event, const TString &method, Int_t &qual, Bool_t verbose=false)
static void RebinEta(TH2D *hist, const TAxis &etaAxis)
Definition: External.C:196