AliPhysics  34df632 (34df632)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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,
103  };
104  //__________________________________________________________________
116  static Float_t BeamRapidity(Float_t beam, UShort_t z, UShort_t a);
129  static Float_t CenterOfMassEnergy(Float_t beam, UShort_t z1, UShort_t a1,
130  Short_t z2=-1, Short_t a2=-1);
142  Short_t z2=-1, Short_t a2=-1);
155  static UShort_t ParseCollisionSystem(const char* sys);
167  static const char* CollisionSystemString(UShort_t sys);
168  //__________________________________________________________________
186  static const char* CenterOfMassEnergyString(UShort_t cms);
187  //__________________________________________________________________
195  static Short_t ParseMagneticField(Float_t field);
203  static const char* MagneticFieldString(Short_t field);
204  /* @} */
205 
206  //==================================================================
219  static Double_t GetStripR(Char_t ring, UShort_t strip);
229  static Double_t GetSectorZ(UShort_t det, Char_t ring, UShort_t sec);
239  static Double_t GetSectorPhi(UShort_t det, Char_t ring, UShort_t sec);
252  static Bool_t GetXYZ(UShort_t det, Char_t ring, UShort_t sec,
253  UShort_t str, const TVector3& ip,
254  TVector3& pos);
268  static Bool_t GetEtaPhi(UShort_t det, Char_t ring, UShort_t sec,
269  UShort_t str, const TVector3& ip,
270  Double_t& eta, Double_t& phi);
278  static Double_t GetEtaFromStrip(UShort_t det, Char_t ring,
279  UShort_t sec, UShort_t strip, Double_t zvtx);
292  static Bool_t GetEtaPhiFromStrip(Char_t r, UShort_t strip,
293  Double_t& eta, Double_t& phi ,
294  Double_t ipX, Double_t ipY);
306  static Double_t GetPhiFromStrip(Char_t ring, UShort_t strip,
307  Double_t phi, Double_t xvtx, Double_t yvtx);
308  /* @} */
309 
310  //==================================================================
331  static UShort_t CheckForAOD();
341  static Bool_t CheckForTask(const char* clsOrName, Bool_t cls=true);
342  /* @} */
343 
344  //==================================================================
357  static TObject* MakeParameter(const char* name, UShort_t value);
366  static TObject* MakeParameter(const char* name, Int_t value);
375  static TObject* MakeParameter(const char* name, Double_t value);
384  static TObject* MakeParameter(const char* name, Bool_t value);
393  static TObject* MakeParameter(const char* name, ULong_t value);
400  static void GetParameter(TObject* o, UShort_t& value);
407  static void GetParameter(TObject* o, Int_t& value);
414  static void GetParameter(TObject* o, Double_t& value);
421  static void GetParameter(TObject* o, Bool_t& value);
428  static void GetParameter(TObject* o, ULong_t& value);
429  /* @} */
430 
431  //==================================================================
443  static TAxis* MakeFullIpZAxis(Int_t nCenter=20);
450  static void MakeFullIpZAxis(Int_t nCenter, TArrayD& bins);
460  static void MakeLogScale(Int_t nBins, Int_t minOrder, Int_t maxOrder,
461  TArrayD& bins);
462  /* @} */
463 
464  //==================================================================
495  static Float_t GetCentrality(const AliVEvent& event,
496  const TString& method,
497  Int_t& qual,
498  Bool_t verbose=false);
499  //____________________________________________________________________
511  static Float_t GetCentralityMult(const AliVEvent& event,
512  const TString& method,
513  Int_t& qual,
514  Bool_t verbose=false);
525  static Float_t GetCentralityCompat(const AliVEvent& event,
526  const TString& method,
527  Int_t& qual,
528  Bool_t verbose);
529  //____________________________________________________________________
540  static Float_t GetCentralityCompat(const AliESDEvent& event,
541  const TString& method,
542  Int_t& qual,
543  Bool_t verbose);
544  //____________________________________________________________________
555  static Float_t GetCentralityCompat(const AliAODEvent& event,
556  const TString& method,
557  Int_t& qual,
558  Bool_t verbose);
559 
560  //==================================================================
570  static void PrintTask(const TObject& o);
576  static void PrintName(const char* name);
583  static void PrintField(const char* name, const char* value, ...);
584  /* @} */
585 
586  //==================================================================
596  struct Histos : public TObject
597  {
601  Histos() : fFMD1i(0), fFMD2i(0), fFMD2o(0), fFMD3i(0), fFMD3o(0) {}
607  Histos(const Histos& o)
608  : TObject(o),
609  fFMD1i(o.fFMD1i),
610  fFMD2i(o.fFMD2i),
611  fFMD2o(o.fFMD2o),
612  fFMD3i(o.fFMD3i),
613  fFMD3o(o.fFMD3o)
614  {}
620  Histos& operator=(const Histos&) { return *this;}
625  ~Histos();
631  void Delete(Option_t* opt="");
637  void Init(const TAxis& etaAxis);
643  void ReInit(const TAxis& etaAxis);
653  static TH2D* Make(UShort_t d, Char_t r, const TAxis& etaAxis);
660  static void RebinEta(TH2D* hist, const TAxis& etaAxis);
666  void Clear(Option_t* option="");
675  TH2D* Get(UShort_t d, Char_t r) const;
676  TH2D* fFMD1i; // Histogram for FMD1i
677  TH2D* fFMD2i; // Histogram for FMD2i
678  TH2D* fFMD2o; // Histogram for FMD2o
679  TH2D* fFMD3i; // Histogram for FMD3i
680  TH2D* fFMD3o; // Histogram for FMD3o
681 
682  ClassDef(Histos,2);
683  };
684 
685  //__________________________________________________________________
691  struct RingHistos : public TObject
692  {
696  RingHistos() : fDet(0), fRing('\0'), fName(""), fkNSector(0), fkNStrip(0) {}
704  : fDet(d), fRing(r), fName(TString::Format("FMD%d%c", d, r)),
705  fkNSector(r == 'i' || r == 'I' ? 20 : 40),
706  fkNStrip(r == 'i' || r == 'I' ? 512 : 256)
707  {}
714  : TObject(o), fDet(o.fDet), fRing(o.fRing), fName(o.fName),
716  {}
720  virtual ~RingHistos() {}
729  {
730  if (&o == this) return *this;
731  TObject::operator=(o);
732  fDet = o.fDet;
733  fRing = o.fRing;
734  fName = o.fName;
735  fkNSector = o.fkNSector;
736  fkNStrip = o.fkNStrip;
737  return *this;
738  }
746  TList* DefineOutputList(TList* d) const;
754  TList* GetOutputList(const TList* d) const;
763  TH1* GetOutputHist(const TList* d, const char* name) const;
769  Color_t Color() const
770  {
772  }
778  const char* GetName() const { return fName.Data(); }
782  const UShort_t& NSector() const { return fkNSector; }
786  const UShort_t& NStrip() const { return fkNStrip; }
787  UShort_t fDet; // Detector
788  Char_t fRing; // Ring
789  TString fName; // Name
790  UShort_t fkNSector; // Number of sectors
791  UShort_t fkNStrip; // Number of strips
792 
793  ClassDef(RingHistos,1);
794  };
795  /* @} */
796 
797  //__________________________________________________________________
802  struct DebugGuard
803  {
813  DebugGuard(Int_t lvl, Int_t msgLvl, const char* format, ...);
817  ~DebugGuard();
825  static void Message(Int_t lvl, Int_t msgLvl, const char* format, ...);
826  private:
833  static void Output(int in, TString& msg);
841  static void Format(TString& out, const char* format, va_list ap);
843  };
844  //__________________________________________________________________
849  {
857  SuppressGuard(Int_t lvl=2000);
861  ~SuppressGuard();
862  };
863 private:
880  AliForwardUtil& operator=(const AliForwardUtil&) { return *this; }
885 
886 
887  ClassDef(AliForwardUtil,1);// Utilities - do not make object
888 };
889 
890 // #ifdef LOG_NO_DEBUG
891 // # define DGUARD(L,N,F,...) do {} while(false)
892 // #else
900 # define DGUARD(L,N,F,...) \
901  AliForwardUtil::DebugGuard _GUARD(L,N,F, ## __VA_ARGS__)
902 
909 # define DMSG(L,N,F,...) \
910  AliForwardUtil::DebugGuard::Message(L,N,F, ## __VA_ARGS__)
911 // #endif
912 #endif
913 // Local Variables:
914 // mode: C++
915 // End:
916 
AliForwardUtil & operator=(const AliForwardUtil &)
RingHistos & operator=(const RingHistos &o)
return jsonbuilder str().c_str()
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 void Message(Int_t lvl, Int_t msgLvl, const char *format,...)
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)
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)
static void Format(TString &out, const char *format, va_list ap)
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)
ClassDef(AliForwardUtil, 1)
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)
static void Output(int in, TString &msg)
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)
TH1 * GetOutputHist(const TList *d, const char *name) const
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
TList * DefineOutputList(TList *d) const
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)
DebugGuard(Int_t lvl, Int_t msgLvl, const char *format,...)
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
TList * GetOutputList(const TList *d) const