Added the possibility to compute centrality values using all the three validated...
authorpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Feb 2011 15:05:06 +0000 (15:05 +0000)
committerpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 28 Feb 2011 15:05:06 +0000 (15:05 +0000)
PWG2/RESONANCES/AliRsnAnalysisTask.cxx
PWG2/RESONANCES/AliRsnCutCentrality.cxx [new file with mode: 0644]
PWG2/RESONANCES/AliRsnCutCentrality.h [new file with mode: 0644]
PWG2/RESONANCES/AliRsnValue.cxx
PWG2/RESONANCES/AliRsnValue.h

index 66efc28..a38526e 100644 (file)
@@ -83,6 +83,7 @@ void AliRsnAnalysisTask::RsnUserCreateOutputObjects()
    fOutList->Clear();
 
    fRsnAnalysisManager.InitAllPairs(fOutList);
+   fOutList->SetOwner(kTRUE);
 
    PostData(2, fOutList);
 }
diff --git a/PWG2/RESONANCES/AliRsnCutCentrality.cxx b/PWG2/RESONANCES/AliRsnCutCentrality.cxx
new file mode 100644 (file)
index 0000000..8503416
--- /dev/null
@@ -0,0 +1,94 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//  This cut is used to select PbPb events w.r. to their centrality class.
+//  It uses the AliCentrality object, and specifically its method to get
+//  the centrality percentile.
+//  The centrality estimator is decided by the user, in a second string
+//  in the constructor after the name.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include "AliLog.h"
+
+#include "AliRsnCutCentrality.h"
+
+ClassImp(AliRsnCutCentrality)
+
+//__________________________________________________________________________________________________
+AliRsnCutCentrality::AliRsnCutCentrality(const char *name, const char *est, Double_t min, Double_t max) :
+   AliRsnCut(name, AliRsnTarget::kEvent, min, max)
+{
+//
+// Constructor
+//
+
+   SetTitle(est);
+}
+
+//__________________________________________________________________________________________________
+AliRsnCutCentrality::AliRsnCutCentrality(const AliRsnCutCentrality& copy) :
+   AliRsnCut(copy)
+{
+//
+// Copy constructor
+//
+}
+
+//__________________________________________________________________________________________________
+AliRsnCutCentrality& AliRsnCutCentrality::operator=(const AliRsnCutCentrality& copy)
+{
+//
+// Assignment operator
+//
+
+   AliRsnCut::operator=(copy);
+   
+   return (*this);
+}
+
+//__________________________________________________________________________________________________
+Bool_t AliRsnCutCentrality::IsSelected(TObject *object)
+{
+//
+// Cut checking method.
+// Checks current event and compares the percentile centrality
+// with the allowed range.
+//
+
+   if (!TargetOK(object)) return kFALSE;
+   
+   AliESDEvent *esd = fEvent->GetRefESD();
+   AliAODEvent *aod = fEvent->GetRefAOD();
+   
+   // esd
+   if (esd) {
+      AliDebug(AliLog::kDebug + 2, "Centrality for ESDs");
+      AliCentrality *centrality = esd->GetCentrality();
+      if (centrality) {
+         fCutValueD = centrality->GetCentralityPercentile(fTitle.Data());
+         return OkRangeD();
+      } else {
+         AliError("Centrality object is not present");
+         return kFALSE;
+      }
+   }
+   else {
+      AliError("Currently the implementation works only with ESDs");
+      return kFALSE;
+   }
+}
diff --git a/PWG2/RESONANCES/AliRsnCutCentrality.h b/PWG2/RESONANCES/AliRsnCutCentrality.h
new file mode 100644 (file)
index 0000000..f065880
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef ALIRSNCUTCENTRALITY_H
+#define ALIRSNCUTCENTRALITY_H
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Centrality cut
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include "AliRsnCut.h"
+
+class AliRsnCutCentrality : public AliRsnCut {
+
+public:
+
+   AliRsnCutCentrality(const char *name = "cut", const char *est = "VOM", Double_t min = 0, Double_t max = 100.0);
+   AliRsnCutCentrality(const AliRsnCutCentrality& copy);
+   AliRsnCutCentrality& operator=(const AliRsnCutCentrality& copy);
+   virtual ~AliRsnCutCentrality() { }
+   
+   void           SetEstimator(const char *est) {SetTitle(est);}  
+   virtual Bool_t IsSelected(TObject *object);
+
+private:
+
+   ClassDef(AliRsnCutCentrality,1)
+};
+
+#endif
index 0098c09..bd9ca33 100644 (file)
 //
 ////////////////////////////////////////////////////////////////////////////////
 
+#include <Riostream.h>
 #include "AliESDtrackCuts.h"
 #include "AliESDpid.h"
 #include "AliAODPid.h"
+#include "AliCentrality.h"
 
 #include "AliRsnEvent.h"
 #include "AliRsnDaughter.h"
@@ -258,6 +260,9 @@ const char* AliRsnValue::GetValueTypeName() const
       case kEventMultMC:          return "EventMultMC";
       case kEventMultESDCuts:     return "EventMultESDCuts";
       case kEventVz:              return "EventVz";
+      case kEventCentralityV0:    return "EventCentralityV0";
+      case kEventCentralityTrack: return "EventCentralityTrack";
+      case kEventCentralityCL1:   return "EventCentralityCL1";
       default:                    return "Undefined";
    }
 }
@@ -514,7 +519,7 @@ Bool_t AliRsnValue::Eval(TObject *object, Bool_t useMC)
       case kPairY:
          // pair:
          // rapidity (requires an AliRsnPairDef to get mass hypothesis)
-         if (!pairDef) {
+         if (pairDef) {
             pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), pairDef->GetMotherMass());
             pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), pairDef->GetMotherMass());
             fComputedValue = useMC ? pSim.Rapidity() : pRec.Rapidity();
@@ -625,6 +630,39 @@ Bool_t AliRsnValue::Eval(TObject *object, Bool_t useMC)
          // Z position of primary vertex
          fComputedValue = fgCurrentEvent->GetRef()->GetPrimaryVertex()->GetZ();
          return kTRUE;
+      case kEventCentralityV0:
+         // event:
+         // centrality using V0 method
+         if (esdev) {
+            AliCentrality *centrality = esdev->GetCentrality();
+            fComputedValue = centrality->GetCentralityPercentile("V0M");
+            return kTRUE;
+         } else {
+            AliError(Form("[%s] Centrality computation is implemented for ESDs only up to now", GetName()));
+            return kFALSE;
+         }
+      case kEventCentralityTrack:
+         // event:
+         // centrality using tracks method
+         if (esdev) {
+            AliCentrality *centrality = esdev->GetCentrality();
+            fComputedValue = centrality->GetCentralityPercentile("TRK");
+            return kTRUE;
+         } else {
+            AliError(Form("[%s] Centrality computation is implemented for ESDs only up to now", GetName()));
+            return kFALSE;
+         }
+      case kEventCentralityCL1:
+         // event:
+         // centrality using CL1 method
+         if (esdev) {
+            AliCentrality *centrality = esdev->GetCentrality();
+            fComputedValue = centrality->GetCentralityPercentile("CL1");
+            return kTRUE;
+         } else {
+            AliError(Form("[%s] Centrality computation is implemented for ESDs only up to now", GetName()));
+            return kFALSE;
+         }
       default:
          AliError(Form("[%s] Invalid value type for this computation", GetName()));
          return kFALSE;
index 02ad7eb..7fac0b7 100644 (file)
@@ -57,6 +57,9 @@ public:
       kEventMultMC,          // multiplicity from MC
       kEventMultESDCuts,     // multiplicity computed as the number of track passing an ESD quality cut (need this cut defined)
       kEventVz,              // Z position of event primary vertex
+      kEventCentralityV0,    // event centrality (V0 method)
+      kEventCentralityTrack, // event centrality (tracks method)
+      kEventCentralityCL1,   // event centrality (CL1 method)
       kValueTypes            // --- last value (used to have a meaningless enum value) ---------------
    };