add multiplicity/centrality monitoring
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Dec 2011 14:13:11 +0000 (14:13 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Dec 2011 14:13:11 +0000 (14:13 +0000)
PWG1/TRD/info/AliTRDeventInfo.cxx
PWG1/TRD/info/AliTRDeventInfo.h

index 2acc224..0c4165b 100644 (file)
 #include "AliTRDeventInfo.h"
 
 ClassImp(AliTRDeventInfo)
-
+Int_t const AliTRDeventInfo::fgkMultBin[AliTRDeventInfo::kCentralityClasses] = {
+  700, 1400, 2100, 2800, 3500
+};
+Float_t const AliTRDeventInfo::fgkCentBin[AliTRDeventInfo::kCentralityClasses] = {
+  0.1, 0.2, 0.5, 0.8, 1.
+};
 //____________________________________________________________________
 AliTRDeventInfo::AliTRDeventInfo():
   TObject()
-  ,fHeader(0x0)
-  ,fRun(0x0)
+  ,fHeader(NULL)
+  ,fRun(NULL)
   ,fCentrality(-1)
+  ,fMult(-1)
 {
   //
   // Default Constructor
@@ -36,6 +42,7 @@ AliTRDeventInfo::AliTRDeventInfo(AliESDHeader *header, AliESDRun *run):
   ,fHeader(header)
   ,fRun(run)
   ,fCentrality(-1)
+  ,fMult(-1)
 {
   //
   // Constructor with Arguments
@@ -59,6 +66,7 @@ AliTRDeventInfo::AliTRDeventInfo(const AliTRDeventInfo &info):
   ,fHeader(info.fHeader)
   ,fRun(info.fRun)
   ,fCentrality(info.fCentrality)
+  ,fMult(info.fMult)
 {
   //
   // Copy Constructor
@@ -77,6 +85,7 @@ AliTRDeventInfo& AliTRDeventInfo::operator=(const AliTRDeventInfo& info){
   fHeader     = info.fHeader;
   fRun        = info.fRun;
   fCentrality = info.fCentrality;
+  fMult       = info.fMult;
   SetBit(kOwner, 0);
   return *this;
 }
@@ -100,8 +109,8 @@ void AliTRDeventInfo::Delete(const Option_t *){
     if(fHeader) delete fHeader;
     if(fRun) delete fRun;
   };
-  fHeader = 0x0;
-  fRun = 0x0;
+  fHeader = NULL;
+  fRun = NULL;
 }
 
 //____________________________________________________________________
@@ -122,6 +131,26 @@ UShort_t  AliTRDeventInfo::GetBunchFill() const
 }
 
 //____________________________________________________________________
+Int_t  AliTRDeventInfo::GetCentralityBin(Float_t cenPer)
+{
+// calculate centrality bin
+  for(Int_t icen(0); icen<kCentralityClasses; icen++){
+    if(cenPer<fgkCentBin[icen]) return icen;
+  }
+  return -1;
+}
+
+//____________________________________________________________________
+Int_t  AliTRDeventInfo::GetMultiplicityBin(Int_t n)
+{
+// calculate centrality bin
+  for(Int_t im(0); im<kCentralityClasses; im++){
+    if(n<fgkMultBin[im]) return kCentralityClasses-im-1;
+  }
+  return 0;
+}
+
+//____________________________________________________________________
 void AliTRDeventInfo::GetListOfIsolatedBunches(TH1D* hbc, Int_t bunchSpacing) {
   //
   // Find the isolated bunch crossings
index cedb88e..b142b52 100644 (file)
@@ -33,22 +33,29 @@ public:
   AliESDHeader* GetEventHeader() const                 { return fHeader; }
   AliESDRun*    GetRunInfo() const                     { return fRun; }
   Int_t         GetCentrality() const                  { return fCentrality; }
+  static Int_t  GetCentralityBin(Float_t cenPer);
+  Int_t         GetMultiplicity() const                { return fMult; }
+  static Int_t  GetMultiplicityBin(Int_t n);
   UShort_t      GetBunchFill() const;
   static void   GetListOfIsolatedBunches(TH1D *hbc, Int_t bunchSpacing=10);
   Bool_t        IsOwner() const                        { return TestBit(kOwner); }
   void          SetEventHeader(AliESDHeader *evHeader) { fHeader = evHeader; }
   void          SetRunInfo(AliESDRun *evRun)           { fRun = evRun; }
-  void          SetCentrality(Int_t centrality)        { fCentrality = centrality; }
+  void          SetCentrality(Float_t cent)            { fCentrality = cent>=0.?GetCentralityBin(cent):-1;}
+  void          SetMultiplicity(Int_t n)               { fMult = n>=0?GetMultiplicityBin(n):-1;}
   void          SetOwner();
 
 private:
   enum{
     kOwner = BIT(14)
   };
+  static Int_t const   fgkMultBin[kCentralityClasses]; // multiplicity bins
+  static Float_t const fgkCentBin[kCentralityClasses]; // centrality bins
   AliESDHeader* fHeader;      //! The ESD Header
   AliESDRun*    fRun;         //! The ESD Run Info
-  Int_t         fCentrality;  //! Centrality class
+  Int_t         fCentrality;  //! Centrality class based on AliCentrality
+  Int_t         fMult;        //! Centrality class based on AliMultiplicity
 
-  ClassDef(AliTRDeventInfo, 1) // Event info  relevant for TRD analysis
+  ClassDef(AliTRDeventInfo, 2) // Event info  relevant for TRD analysis
 };
 #endif