]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/AliForwardUtil.h
First go of energy loss spectrum algorithm.
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AliForwardUtil.h
1 #ifndef ALIROOT_PWG2_FORWARD_ALIFORWARDUTIL_H
2 #define ALIROOT_PWG2_FORWARD_ALIFORWARDUTIL_H
3 #include <TObject.h>
4 #include <TString.h>
5 class TH2D;
6 class TH1I;
7 class TH1;
8 class TAxis;
9 class AliESDEvent;
10
11 /** 
12  * Utilities used in the forward multiplcity analysis 
13  * 
14  * @ingroup pwg2_forward_analysis 
15  */
16 class AliForwardUtil : public TObject
17 {
18 public:
19   /** 
20    * Read the trigger information from the ESD event 
21    * 
22    * @param esd        ESD event 
23    * @param triggers   On return, contains the trigger bits 
24    * @param hTriggers  Histogram to fill 
25    * 
26    * @return @c true on success, @c false otherwise 
27    */
28   static Bool_t ReadTriggers(AliESDEvent* esd, UInt_t& triggers, 
29                              TH1I* hTriggers);
30   /** 
31    * Read the vertex information from the ESD event 
32    * 
33    * @param esd  ESD event 
34    * @param vz   On return, the vertex Z position 
35    * 
36    * @return @c true on success, @c false otherwise 
37    */
38   static Bool_t ReadVertex(AliESDEvent* esd, Double_t& vz,
39                            Double_t maxErr=0.1);
40   //__________________________________________________________________
41   /** 
42    * Structure to hold histograms 
43    *
44    * @ingroup pwg2_forward_analysis 
45    */
46   struct Histos : public TObject
47   {     
48     /** 
49      * Constructor 
50      * 
51      * 
52      */
53     Histos() : fFMD1i(0), fFMD2i(0), fFMD2o(0), fFMD3i(0), fFMD3o(0) {}
54     /** 
55      * Copy constructor 
56      * 
57      * @param o Object to copy from 
58      */
59     Histos(const Histos& o) 
60       : TObject(o), 
61         fFMD1i(o.fFMD1i), 
62         fFMD2i(o.fFMD2i), 
63         fFMD2o(o.fFMD2o), 
64         fFMD3i(o.fFMD3i), 
65         fFMD3o(o.fFMD3o)
66     {}
67     /** 
68      * Assignement operator 
69      * 
70      * @return Reference to this 
71      */
72     Histos& operator=(const Histos&) { return *this;}
73     /** 
74      * Destructor
75      */
76     ~Histos();
77     /** 
78      * Initialize the object 
79      * 
80      * @param etaAxis Eta axis to use 
81      */
82     void Init(const TAxis& etaAxis);
83     /** 
84      * Make a histogram 
85      * 
86      * @param d        Detector
87      * @param r        Ring 
88      * @param etaAxis  Eta axis to use
89      * 
90      * @return Newly allocated histogram 
91      */
92     TH2D* Make(UShort_t d, Char_t r, const TAxis& etaAxis) const;
93     /** 
94      * Clear data 
95      * 
96      * @param option Not used 
97      */
98     void  Clear(Option_t* option="");
99     // const TH2D* Get(UShort_t d, Char_t r) const;
100     /** 
101      * Get the histogram for a particular detector,ring
102      * 
103      * @param d Detector 
104      * @param r Ring 
105      * 
106      * @return Histogram for detector,ring or nul 
107      */
108     TH2D* Get(UShort_t d, Char_t r) const;
109     TH2D* fFMD1i; // Histogram for FMD1i
110     TH2D* fFMD2i; // Histogram for FMD2i
111     TH2D* fFMD2o; // Histogram for FMD2o
112     TH2D* fFMD3i; // Histogram for FMD3i
113     TH2D* fFMD3o; // Histogram for FMD3o
114
115     ClassDef(Histos,1) 
116   };
117
118   //__________________________________________________________________
119   struct RingHistos : public TObject
120   {
121     RingHistos() : fDet(0), fRing('\0'), fName("") {}
122     RingHistos(UShort_t d, Char_t r) 
123       : fDet(d), fRing(r), fName(TString::Format("FMD%d%c", d, r)) 
124     {}
125     RingHistos(const RingHistos& o) 
126       : TObject(o), fDet(o.fDet), fRing(o.fRing), fName(o.fName)
127     {}
128     virtual ~RingHistos() {}
129     RingHistos& operator=(const RingHistos& o) 
130     {
131       TObject::operator=(o);
132       fDet  = o.fDet;
133       fRing = o.fRing;
134       fName = o.fName;
135       return *this;
136     }
137     TList* DefineOutputList(TList* d) const;
138     TList* GetOutputList(TList* d) const;
139     TH1* GetOutputHist(TList* d, const char* name) const;
140     UShort_t fDet; 
141     Char_t   fRing;
142     TString  fName;
143
144     ClassDef(RingHistos,1) 
145   };
146     
147 };
148
149 #endif
150 // Local Variables:
151 //  mode: C++
152 // End:
153