class TH1;
class TF1;
class TAxis;
+class TArrayD;
class AliESDEvent;
+class AliAODEvent;
+class AliAnalysisTaskSE;
/**
* Utilities used in the forward multiplcity analysis
class AliForwardUtil : public TObject
{
public:
+ enum {
+ kSkipRing = (1 << 19) // Bit for skipping a histogram
+ };
/**
* Get the standard color for a ring
*
+ ((r == 'I' || r == 'i') ? 2 : -3));
}
//==================================================================
+ /**
+ * @{
+ * @name AliROOT version
+ */
+ /**
+ * Get the revision number of AliROOT
+ *
+ * @return Subversion revision number of AliROOT used
+ */
+ static ULong_t AliROOTRevision();
+ /**
+ * Get the branch identifier of AliROOT. In case of trunk, return
+ * 0xFFFFFFFF, while for @b vM-N-R{-S}, we get
+ *
+ * @code
+ * ((M & 0xFF) << 12 | (N & 0xFF) << 8 | (R & 0xFF) << 3 | (X))
+ * @endcode
+ * where @c X is 0xAA if @b S is specified (e.g., analysis tag).
+ *
+ * @return branch identifer encoded in bits
+ */
+ static ULong_t AliROOTBranch();
+ //==================================================================
/**
* @{
* @name Collision/run parameters
kPPb
};
//__________________________________________________________________
+ /**
+ * Calculate the beam rapidity.
+ *
+ * @b Note: The beam energy is given in GeV/charge
+ *
+ * @param beam Beam energy in GeV/charge
+ * @param z Charge number of projectile
+ * @param a Mass number of projectile
+ *
+ * @return The rapidity of the beam
+ */
+ static Float_t BeamRapidity(Float_t beam, UShort_t z, UShort_t a);
+ /**
+ * Calculate the center of mass energy from the beam energy per
+ * charge and the nucleus numbers.
+ *
+ * @param beam Beam energy in GeV/charge
+ * @param z1 Charge number of projectile
+ * @param a1 Mass number of projectile
+ * @param z2 Charge number of projectile
+ * @param a2 Mass number of projectile
+ *
+ * @return The center of mass energy in GeV/nucleon
+ */
+ static Float_t CenterOfMassEnergy(Float_t beam, UShort_t z1, UShort_t a1,
+ Short_t z2=-1, Short_t a2=-1);
+ /**
+ * Calculate the center of mass rapidity (shift)
+ *
+ * @param z1 Charge number of projectile
+ * @param a1 Mass number of projectile
+ * @param z2 Charge number of projectile
+ * @param a2 Mass number of projectile
+ * x
+ * @return Rapidity of the center of mass
+ */
+ static Float_t CenterOfMassRapidity(UShort_t z1, UShort_t a1,
+ Short_t z2=-1, Short_t a2=-1);
/**
* Parse a collision system spec given in a string. Known values are
*
* @return Short integer value of magnetic field in kG
*/
static Short_t ParseMagneticField(Float_t field);
+ /**
+ * Get a string representation of the magnetic field
+ *
+ * @param field Magnetic field in kG
+ *
+ * @return String representation of the magnetic field
+ */
+ static const char* MagneticFieldString(Short_t field);
+ /* @} */
+
+ //==================================================================
+ /**
+ * @{
+ * @name Recalculate @f$\eta@f$, @f$\phi@f$, etc.
+ */
+ /**
+ * Get the radius of a strip.
+ *
+ * @param ring Ring identifier 'I' or 'O'
+ * @param strip Strip number
+ *
+ * @return Radial distance from beam of the strip
+ */
+ static Double_t GetStripR(Char_t ring, UShort_t strip);
/**
* Get eta from strip
*
*
* @return eta
*/
- static Double_t GetEtaFromStrip(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip, Double_t zvtx) ;
+ static Double_t GetEtaFromStrip(UShort_t det, Char_t ring,
+ UShort_t sec, UShort_t strip, Double_t zvtx);
/**
- * Get a string representation of the magnetic field
+ * Get the azimuthal angle of a strip
*
- * @param field Magnetic field in kG
+ * @param ring Ring identifier 'I' or 'O'
+ * @param strip Strip number
+ * @param phi Straight forward strip phi
+ * @param xvtx Ip X coordinate
+ * @param yvtx Ip Y coordinate
*
- * @return String representation of the magnetic field
+ * @return The phi angle correctef for (X,Y) off set.
+ */
+ static Double_t GetPhiFromStrip(Char_t ring, UShort_t strip,
+ Double_t phi, Double_t xvtx, Double_t yvtx);
+ /* @} */
+
+ //==================================================================
+ /**
+ * @{
+ * @name Manager related tasks
+ */
+ /**
+ * Get the AOD event - either from the input (AOD analysis) or the
+ * output (ESD analysis)
+ *
+ * @param task Task to do the investigation for
+ *
+ * @return Found AOD event or null
+ */
+ static AliAODEvent* GetAODEvent(AliAnalysisTaskSE* task);
+ /**
+ * Check if we have something that will provide and AOD event
+ *
+ * @return 0 if there's nothing that provide an AOD event, 1 if it
+ * is provided on the input (AOD analysis) or 2 if it is provided on
+ * the output (ESD analysis)
+ */
+ static UShort_t CheckForAOD();
+ /**
+ * Check if we have a particular (kind) of task in our train
+ *
+ * @param clsOrName Class name or name of task
+ * @param cls If true, look for a task of a particular class -
+ * otherwise search for a speficially name task
+ *
+ * @return true if the needed task was found
+ */
+ static Bool_t CheckForTask(const char* clsOrName, Bool_t cls=true);
+ /* @} */
+
+ //==================================================================
+ /**
+ * @{
+ * @name Member functions to store and retrieve analysis parameters
+ */
+ static TObject* MakeParameter(const char* name, UShort_t value);
+ static TObject* MakeParameter(const char* name, Int_t value);
+ static TObject* MakeParameter(const char* name, Double_t value);
+ static TObject* MakeParameter(const char* name, Bool_t value);
+ static TObject* MakeParameter(const char* name, ULong_t value);
+ static void GetParameter(TObject* o, UShort_t& value);
+ static void GetParameter(TObject* o, Int_t& value);
+ static void GetParameter(TObject* o, Double_t& value);
+ static void GetParameter(TObject* o, Bool_t& value);
+ static void GetParameter(TObject* o, ULong_t& value);
+ /* @} */
+
+ //==================================================================
+ /**
+ * @{
+ * @name Axis functions
*/
- static const char* MagneticFieldString(Short_t field);
+ static TAxis* MakeFullIpZAxis(Int_t nCenter=20);
+ static void MakeFullIpZAxis(Int_t nCenter, TArrayD& bins);
+ static void MakeLogScale(Int_t nBins, Int_t minOrder, Int_t maxOrder, TArrayD& bins);
+ static void PrintTask(const TObject& o);
+ static void PrintName(const char* name);
+ static void PrintField(const char* name, const char* value, ...);
/* @} */
+ //==================================================================
+#if 0 // Moved to separate classes
/**
* @{
* @name Energy stragling functions
*
*/
virtual ~ELossFitter();
+ void SetDebug(Bool_t debug=true) { fDebug = debug; }
/**
- * Clear internal arrays
+ * Clear internal arrays
*
*/
void Clear();
* @return The function fitted to the data
*/
TF1* FitNParticle(TH1* dist, UShort_t n, Double_t sigman=-1);
+ /**
+ * Fit a composite distribution of energy loss from both primaries
+ * and secondaries
+ *
+ * @param dist Distribution
+ * @param sigman If larger than zero, the initial guess of the
+ * detector included noise. If zero or less this
+ * parameter is fixed to 0.
+ *
+ * @return Function fitted to the data
+ */
+ TF1* FitComposite(TH1* dist, Double_t sigman);
/**
* Get Lower cut on data
*
const UShort_t fMinusBins; // Number of bins from maximum to fit 1st peak
TObjArray fFitResults; // Array of fit results
TObjArray fFunctions; // Array of functions
+ Bool_t fDebug;
};
/* @} */
-
+#endif
//==================================================================
/**
*/
Histos& operator=(const Histos&) { return *this;}
/**
- * Destructor
+ * Destructor. This does not delete the interally allocated
+ * memory. Use the member function Delete for that.
*/
~Histos();
+ /**
+ * Clear internal memory. Note, if the internal histograms are
+ * added to an output container, then we must not free this
+ * memory.
+ */
+ void Delete(Option_t* opt="");
/**
* Initialize the object
*
* @param etaAxis Eta axis to use
*/
void Init(const TAxis& etaAxis);
+ /**
+ * Re-initialize the object with new @f$\eta@f$ axis
+ *
+ * @param etaAxis Eta axis to use
+ */
+ void ReInit(const TAxis& etaAxis);
/**
* Make a histogram
*
*
* @return Newly allocated histogram
*/
- TH2D* Make(UShort_t d, Char_t r, const TAxis& etaAxis) const;
+ static TH2D* Make(UShort_t d, Char_t r, const TAxis& etaAxis);
+ /**
+ * Set the @f$\eta@f$ axis
+ *
+ * @param hist Histogram
+ * @param etaAxis @f$\eta@f$ axis to use
+ */
+ static void RebinEta(TH2D* hist, const TAxis& etaAxis);
/**
* Clear data
*
TH2D* fFMD3i; // Histogram for FMD3i
TH2D* fFMD3o; // Histogram for FMD3o
- ClassDef(Histos,1)
+ ClassDef(Histos,2)
};
//__________________________________________________________________
* Constructor
*
*/
- RingHistos() : fDet(0), fRing('\0'), fName("") {}
+ RingHistos() : fDet(0), fRing('\0'), fName(""), fkNSector(0), fkNStrip(0) {}
/**
*
*
* @param r Ring
*/
RingHistos(UShort_t d, Char_t r)
- : fDet(d), fRing(r), fName(TString::Format("FMD%d%c", d, r))
+ : fDet(d), fRing(r), fName(TString::Format("FMD%d%c", d, r)),
+ fkNSector(r == 'i' || r == 'I' ? 20 : 40),
+ fkNStrip(r == 'i' || r == 'I' ? 512 : 256)
{}
/**
* Copy constructor
* @param o Object to copy from
*/
RingHistos(const RingHistos& o)
- : TObject(o), fDet(o.fDet), fRing(o.fRing), fName(o.fName)
+ : TObject(o), fDet(o.fDet), fRing(o.fRing), fName(o.fName),
+ fkNSector(o.fkNSector), fkNStrip(o.fkNStrip)
{}
/**
*
fDet = o.fDet;
fRing = o.fRing;
fName = o.fName;
+ fkNSector = o.fkNSector;
+ fkNStrip = o.fkNStrip;
return *this;
}
/**
*/
TH1* GetOutputHist(const TList* d, const char* name) const;
/**
- *
+ * Get the colour of this ring
*
*
* @return
{
return AliForwardUtil::RingColor(fDet, fRing);
}
+ /**
+ * The name of this ring
+ *
+ * @return Name of this ring
+ */
const char* GetName() const { return fName.Data(); }
+ /**
+ * Get number of sectors
+ */
+ const UShort_t& NSector() const { return fkNSector; }
+ /**
+ * Get number of strips
+ */
+ const UShort_t& NStrip() const { return fkNStrip; }
UShort_t fDet; // Detector
Char_t fRing; // Ring
TString fName; // Name
+ UShort_t fkNSector; // Number of sectors
+ UShort_t fkNStrip; // Number of strips
ClassDef(RingHistos,1)
};
/* @} */
//__________________________________________________________________
+ /**
+ * A guard idom for producing debug output
+ *
+ */
struct DebugGuard
{
+ /**
+ * Constructor
+ *
+ * @param lvl Current level
+ * @param msgLvl Target level
+ * @param format @c printf -like format
+ *
+ * @return
+ */
DebugGuard(Int_t lvl, Int_t msgLvl, const char* format, ...);
+ /**
+ * Destructor
+ */
~DebugGuard();
+ /**
+ * Make a message
+ *
+ * @param lvl Current level
+ * @param msgLvl Target level
+ * @param format @c printf -like format
+ */
static void Message(Int_t lvl, Int_t msgLvl, const char* format, ...);
private:
+ /**
+ * Output the message
+ *
+ * @param in Direction
+ * @param msg Message
+ */
static void Output(int in, TString& msg);
+ /**
+ * Format a message
+ *
+ * @param out Output is stored here
+ * @param format @c printf -like format
+ * @param ap List of arguments
+ */
static void Format(TString& out, const char* format, va_list ap);
TString fMsg;
};
private:
+ /**
+ * Constructor
+ */
AliForwardUtil() {}
+ /**
+ * Copy constructor
+ *
+ * @param o Object to copy from
+ */
AliForwardUtil(const AliForwardUtil& o) : TObject(o) {}
+ /**
+ * Assingment operator
+ *
+ *
+ * @return Reference to this object
+ */
AliForwardUtil& operator=(const AliForwardUtil&) { return *this; }
+ /**
+ * Destructor
+ */
~AliForwardUtil() {}
// #ifdef LOG_NO_DEBUG
// # define DGUARD(L,N,F,...) do {} while(false)
// #else
+/**
+ * Macro to declare a DebugGuard
+ *
+ * @param L Current debug level
+ * @param N Target debug level
+ * @param F @c printf -like Format
+ */
# define DGUARD(L,N,F,...) \
AliForwardUtil::DebugGuard _GUARD(L,N,F, ## __VA_ARGS__)
+/**
+ * Macro to make a debug message, using DebugGuard::Message
+ *
+ * @param L Current debug level
+ * @param N Target debug level
+ * @param F @c printf -like Format
+ */
# define DMSG(L,N,F,...) \
AliForwardUtil::DebugGuard::Message(L,N,F, ## __VA_ARGS__)
// #endif