2 // See implementation or Doxygen comments for more information
4 #ifndef ALIAODFORWARDHEADER_H
5 #define ALIAODFORWARDHEADER_H
7 * @file AliAODForwardHeader.h
8 * @author Christian Holm Christensen <cholm@nbi.dk>
9 * @date Mon Dec 2 09:31:05 2013
11 * @brief Header for forward data in stand-alone AOD
13 * @ingroup pwglf_forward_aod
18 class AliAODForwardHeader : public TObject
22 * Bits of the trigger pattern
25 /** In-elastic collision */
27 /** In-elastic collision with at least one SPD tracklet */
29 /** Non-single diffractive collision */
31 /** Empty bunch crossing */
35 /** B(arrel) trigger */
41 /** pileup from SPD */
43 /** true NSD from MC */
45 /** Offline MB triggered */
47 /** At least one SPD cluster */
48 kNClusterGt0 = 0x1000,
51 /** Satellite event */
55 * Bin numbers in trigger histograms
77 * Return codes of CheckEvent
80 /** Event accepted by cuts */
82 /** Event centrality not in range */
84 /** Event trigger isn't in the supplied mask */
86 /** Event is a pile-up event */
88 /** Event has no interaction point information */
90 /** Event interaction point is out of range */
97 : fTriggers(0), fIpZ(fgkInvalidIpZ), fCentrality(-1), fNClusters(0)
102 * @name Setters of data
107 * @param option Not used
109 void Clear(Option_t* option="");
111 * Set the trigger mask
113 * @param trg Trigger mask
115 void SetTriggerMask(UInt_t trg) { fTriggers = trg; } // Set triggers
117 * Set bit(s) in trigger mask
119 * @param bits bit(s) to set
121 void SetTriggerBits(UInt_t bits) { fTriggers |= bits; } // Set trigger bits
123 * Set the z coordinate of the interaction point
125 * @param ipZ Interaction point z coordinate
127 void SetIpZ(Float_t ipZ) { fIpZ = ipZ; } // Set Ip's Z coordinate
129 * Set the event centrality
131 * @param c Centrality
133 void SetCentrality(Float_t c) { fCentrality = c; }
135 * Set the number of SPD clusters seen in @f$ |\eta|<1@f$
137 * @param n Number of SPD clusters
139 void SetNClusters(UShort_t n) { fNClusters = n; }
148 * Check if all bit(s) are set in the trigger mask. Note, this is
149 * an @e and between the bits. If you need an @e or you should use
150 * the member function IsTriggerOrBits
152 * @param bits Bits to test for
154 * @return true if all enabled bits in the argument is also set in
157 Bool_t IsTriggerBits(UInt_t bits) const;
159 * Check if any of bit(s) are enabled in the trigger word. This is
160 * an @e or between the selected bits. If you need and @a and you
161 * should use the member function IsTriggerBits;
163 * @param bits Bits to check for
165 * @return true if any of the enabled bits in the arguments are also
166 * enabled in the trigger mask
168 Bool_t IsTriggerOrBits(UInt_t bits) const;
170 * Whether we have any trigger bits
172 * @return true if we have some trigger
174 Bool_t HasTrigger() const { return fTriggers != 0; } // Check for triggers
176 * Check if we have a valid z coordinate of the interaction point
178 * @return True if we have a valid interaction point z coordinate
180 Bool_t HasIpZ() const;
182 * Check if the z coordinate of the interaction point is within the
183 * given limits. Note that the convention used corresponds to the
184 * convention used in ROOTs TAxis.
186 * @param low Lower cut (inclusive)
187 * @param high Upper cut (exclusive)
189 * @return true if @f$ low \ge ipz < high@f$
191 Bool_t InRange(Float_t low, Float_t high) const;
193 * Check if we have a valid centrality
195 * @return True if the centrality is set
197 Bool_t HasCentrality() const { return !(fCentrality < 0); }
199 * Check if event meets the passses requirements.
201 * It returns true if @e all of the following is true
203 * - The trigger is within the bit mask passed.
204 * - The vertex is within the specified limits.
205 * - The centrality is within the specified limits, or if lower
206 * limit is equal to or larger than the upper limit.
208 * Note, for data with out a centrality estimate (e.g., pp), one
209 * must pass equal centrality cuts, or no data will be accepted. In
210 * other words, for pp data, always pass cMin=0, cMax=0
212 * If a histogram is passed in the last parameter, then that
213 * histogram is filled with the trigger bits.
215 * @param triggerMask Trigger mask
216 * @param vzMin Minimum @f$ v_z@f$ (in centimeters)
217 * @param vzMax Maximum @f$ v_z@f$ (in centimeters)
218 * @param cMin Minimum centrality (in percent)
219 * @param cMax Maximum centrality (in percent)
220 * @param hist Histogram to fill
221 * @param status Histogram to fill
224 * @return @c true if the event meets the requirements
226 Bool_t CheckEvent(Int_t triggerMask=kInel,
227 Double_t vzMin=-10, Double_t vzMax=10,
228 UShort_t cMin=0, UShort_t cMax=100,
230 TH1* status=0) const;
235 * @name Getters of data
238 * Get the trigger bits
240 * @return Trigger bits
242 UInt_t GetTriggerBits() const { return fTriggers; } // Get triggers
244 * Set the z coordinate of the interaction point
246 * @return Interaction point z coordinate
248 Float_t GetIpZ() const { return fIpZ; } // Get Ip's Z coordinate
250 * Get the event centrality
252 * @return The event centrality or -1 if not set
254 Float_t GetCentrality() const { return fCentrality; }
256 * Get the number of SPD clusters seen in @f$ |\eta|<1@f$
258 * @return Number of SPD clusters seen
260 UShort_t GetNClusters() const { return fNClusters; }
265 * @name Standard TObject member functions
270 * @param option Passed verbatim to TH2::Print
272 void Print(Option_t* option="") const;
274 * Get the name of the object
276 * @return Name of object
278 const Char_t* GetName() const { return "ForwardHeader"; }
284 void Browse(TBrowser* b);
288 * @return Always true
290 Bool_t IsFolder() const { return kTRUE; } // Always true
294 * @name Utility class functions
297 * Get a string correspondig to the trigger mask
299 * @param mask Trigger mask
301 * @return Static string (copy before use)
303 static const Char_t* GetTriggerString(UInt_t mask);
305 * Make a histogram to record triggers in.
307 * The bins defined by the trigger enumeration in this class. One
308 * can use this enumeration to retrieve the number of triggers for
311 * @param name Name of the histogram
312 * @param mask Trigger mask
314 * @return Newly allocated histogram
316 static TH1I* MakeTriggerHistogram(const char* name="triggers",
319 * Make a histogram to record status in.
321 * The bins defined by the status enumeration in this class.
323 * @param name Name of the histogram
325 * @return Newly allocated histogram
327 static TH1I* MakeStatusHistogram(const char* name="status");
329 * Utility function to make a trigger mask from the passed string.
331 * The string is a comma or space seperated list of case-insensitive
338 * @param what Which triggers to put in the mask.
340 * @return The generated trigger mask.
342 static UInt_t MakeTriggerMask(const char* what);
346 UInt_t fTriggers; // Trigger bit mask
347 /** Interaction point @f$z@f$ coordinate */
348 Float_t fIpZ; // Z coordinate of the interaction point
350 Float_t fCentrality; // Event centrality
351 /** Number of clusters in @f$|\eta|<1@f$ */
352 UShort_t fNClusters; // Number of SPD clusters in |eta|<1
353 /** Invalid value for interaction point @f$z@f$ coordiante */
354 static const Float_t fgkInvalidIpZ; // Invalid IpZ value
355 ClassDef(AliAODForwardHeader,1); // AOD forward header
358 //____________________________________________________________________
360 AliAODForwardHeader::InRange(Float_t low, Float_t high) const
362 return HasIpZ() && fIpZ >= low && fIpZ < high;
365 //____________________________________________________________________
367 AliAODForwardHeader::IsTriggerBits(UInt_t bits) const
369 return HasTrigger() && ((fTriggers & bits) == bits);
371 //____________________________________________________________________
373 AliAODForwardHeader::IsTriggerOrBits(UInt_t bits) const
375 return HasTrigger() && ((fTriggers & bits) != 0);