New values and cuts
authorpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 21 Apr 2011 14:23:45 +0000 (14:23 +0000)
committerpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 21 Apr 2011 14:23:45 +0000 (14:23 +0000)
PWG2/RESONANCES/AliRsnCutKaonForPhi2010.cxx [new file with mode: 0644]
PWG2/RESONANCES/AliRsnCutKaonForPhi2010.h [new file with mode: 0644]
PWG2/RESONANCES/AliRsnValueDaughter.cxx [new file with mode: 0644]
PWG2/RESONANCES/AliRsnValueDaughter.h [new file with mode: 0644]
PWG2/RESONANCES/AliRsnValueEvent.cxx [new file with mode: 0644]
PWG2/RESONANCES/AliRsnValueEvent.h [new file with mode: 0644]
PWG2/RESONANCES/AliRsnValuePair.cxx [new file with mode: 0644]
PWG2/RESONANCES/AliRsnValuePair.h [new file with mode: 0644]

diff --git a/PWG2/RESONANCES/AliRsnCutKaonForPhi2010.cxx b/PWG2/RESONANCES/AliRsnCutKaonForPhi2010.cxx
new file mode 100644 (file)
index 0000000..cfbe1c2
--- /dev/null
@@ -0,0 +1,94 @@
+//
+// All cuts for single kaons in phi analysis 2010
+//
+
+#include <Riostream.h>
+
+#include "AliPID.h"
+#include "AliPIDResponse.h"
+#include "AliRsnCutKaonForPhi2010.h"
+
+ClassImp(AliRsnCutKaonForPhi2010)
+
+//__________________________________________________________________________________________________
+AliRsnCutKaonForPhi2010::AliRsnCutKaonForPhi2010(const char *name) :
+   AliRsnCut(name, AliRsnTarget::kDaughter, -3.0, 3.0),
+   fCutQuality(Form("%sQuality", name))
+{
+//
+// Constructor
+// Initialize the contained cuts and sets defaults
+//
+
+   // track quality
+   //fCutQuality.AddStatusFlag(AliESDtrack::kTPCin   , kTRUE);
+   //fCutQuality.AddStatusFlag(AliESDtrack::kTPCrefit, kTRUE);
+   //fCutQuality.AddStatusFlag(AliESDtrack::kITSrefit, kTRUE);
+   fCutQuality.SetPtRange(0.15, 1E+20);
+   fCutQuality.SetEtaRange(-0.8, 0.8);
+   fCutQuality.SetDCARPtFormula("0.0182+0.0350/pt^1.01");
+   fCutQuality.SetDCAZmax(2.0);
+   fCutQuality.SetSPDminNClusters(1);
+   fCutQuality.SetITSminNClusters(0);
+   fCutQuality.SetITSmaxChi2(1E+20);
+   fCutQuality.SetTPCminNClusters(70);
+   fCutQuality.SetTPCmaxChi2(4.0);
+   fCutQuality.SetRejectKinkDaughters();
+   fCutQuality.SetAODTestFilterBit(5);
+}
+
+//__________________________________________________________________________________________________
+Bool_t AliRsnCutKaonForPhi2010::IsSelected(TObject *obj)
+{
+//
+// Global check
+//
+
+   // coherence check
+   if (!TargetOK(obj)) return kFALSE;
+   
+   // check track
+   AliVTrack *track = fDaughter->Ref2Vtrack();
+   if (!track) {
+      if (!fDaughter->GetRef()) AliWarning("NULL ref");
+      return kFALSE;
+   }
+   
+   // check flags
+   if ((track->GetStatus() & AliESDtrack::kTPCin   ) == 0) return kFALSE;
+   if ((track->GetStatus() & AliESDtrack::kTPCrefit) == 0) return kFALSE;
+   if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) return kFALSE;
+   
+   // quality
+   if (!fCutQuality.IsSelected(obj)) return kFALSE;
+   
+   // check initialization of PID object
+   AliPIDResponse *pid = fEvent->GetPIDResponse();
+   if (!pid) {
+      AliFatal("NULL PID response");
+      return kFALSE;
+   }
+   
+   // PID ITS :
+   // depends on momentum
+   //SetRangeD(0.0, 4.0);
+   //fCutValueD = TMath::Abs(pid->NumberOfSigmasITS(track, AliPID::kKaon));
+   //if (!OkRangeD()) return kFALSE;
+   
+   // PID TPC :
+   // depends on momentum
+   //SetRangeD(0.0, 3.0);
+   //if (track->GetTPCmomentum() < 0.350) SetRangeD(0.0, 5.0);
+   fCutValueD = TMath::Abs(pid->NumberOfSigmasTPC(track, AliPID::kKaon));
+   if (!OkRangeD()) return kFALSE;
+   
+   // if TOF is not matched, end here
+   // otherwise check TOF
+   if (!MatchTOF(track)) 
+      return kTRUE;
+   else {
+      //SetRangeD(0.0, 3.0);
+      fCutValueD = TMath::Abs(pid->NumberOfSigmasTOF(track, AliPID::kKaon));
+      return OkRangeD();
+   }
+}
diff --git a/PWG2/RESONANCES/AliRsnCutKaonForPhi2010.h b/PWG2/RESONANCES/AliRsnCutKaonForPhi2010.h
new file mode 100644 (file)
index 0000000..a6a988b
--- /dev/null
@@ -0,0 +1,50 @@
+#ifndef ALIRSNCUTKaonForPhi2010_H
+#define ALIRSNCUTKaonForPhi2010_H
+
+//
+// All cuts for single kaons in phi analysis 2010
+//
+
+#include "AliVTrack.h"
+#include "AliRsnCut.h"
+#include "AliRsnCutTrackQuality.h"
+
+class AliRsnCutKaonForPhi2010 : public AliRsnCut {
+
+public:
+
+   AliRsnCutKaonForPhi2010(const char *name = "");
+   
+   virtual Bool_t IsSelected(TObject *obj);
+   
+   AliRsnCutTrackQuality *CutQuality() {return &fCutQuality;}
+
+private:
+
+   Bool_t MatchTOF(AliVTrack *vtrack);
+
+   AliRsnCutTrackQuality fCutQuality;  // track quality cut
+
+   ClassDef(AliRsnCutKaonForPhi2010,1)
+
+};
+
+//__________________________________________________________________________________________________
+inline Bool_t AliRsnCutKaonForPhi2010::MatchTOF(AliVTrack *vtrack)
+{
+//
+// Checks if the track has matched the TOF detector
+//
+
+   if (!vtrack) {
+      AliWarning("NULL argument: impossible to check status");
+      return kFALSE;
+   }
+
+   Bool_t isTOFout = ((vtrack->GetStatus() & AliESDtrack::kTOFout) != 0);
+   Bool_t isTIME   = ((vtrack->GetStatus() & AliESDtrack::kTIME) != 0);
+
+   return (isTOFout && isTIME);
+}
+
+#endif
diff --git a/PWG2/RESONANCES/AliRsnValueDaughter.cxx b/PWG2/RESONANCES/AliRsnValueDaughter.cxx
new file mode 100644 (file)
index 0000000..07507a7
--- /dev/null
@@ -0,0 +1,187 @@
+/**************************************************************************
+ * 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 class contains all code which is used to compute any of the values
+//  which can be of interest within a resonance analysis. Besides the obvious
+//  invariant mass, it allows to compute other utility values on all possible
+//  targets, in order to allow a wide spectrum of binning and checks.
+//  When needed, this object can also define a binning in the variable which
+//  it is required to compute, which is used for initializing axes of output
+//  histograms (see AliRsnFunction).
+//  The value computation requires this object to be passed the object whose
+//  informations will be used. This object can be of any allowed input type
+//  (track, Daughter, event), then this class must inherit from AliRsnTarget.
+//  Then, when value computation is attempted, a check on target type is done
+//  and computation is successful only if expected target matches that of the
+//  passed object.
+//  In some cases, the value computation can require a support external object,
+//  which must then be passed to this class. It can be of any type inheriting
+//  from TObject.
+//
+//  authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
+//           M. Vala (martin.vala@cern.ch)
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include "AliVVertex.h"
+#include "AliMultiplicity.h"
+#include "AliESDtrackCuts.h"
+#include "AliESDpid.h"
+#include "AliAODPid.h"
+#include "AliCentrality.h"
+#include "AliESDUtils.h"
+
+#include "AliRsnEvent.h"
+#include "AliRsnDaughter.h"
+#include "AliRsnMother.h"
+#include "AliRsnDaughterDef.h"
+#include "AliRsnDaughterDef.h"
+
+#include "AliRsnValueDaughter.h"
+
+ClassImp(AliRsnValueDaughter)
+
+//_____________________________________________________________________________
+AliRsnValueDaughter::AliRsnValueDaughter(const char *name, EType type) :
+   AliRsnValue(name, AliRsnTarget::kDaughter),
+   fType(type)
+{
+//
+// Constructor
+//
+}
+
+//_____________________________________________________________________________
+AliRsnValueDaughter::AliRsnValueDaughter(const AliRsnValueDaughter& copy) :
+   AliRsnValue(copy),
+   fType(copy.fType)
+{
+//
+// Copy constructor
+//
+}
+
+//_____________________________________________________________________________
+AliRsnValueDaughter& AliRsnValueDaughter::operator=(const AliRsnValueDaughter& copy)
+{
+//
+// Assignment operator.
+// Works like copy constructor.
+//
+
+   AliRsnValue::operator=(copy);
+   fType = copy.fType;
+
+   return (*this);
+}
+
+//_____________________________________________________________________________
+const char* AliRsnValueDaughter::GetTypeName() const
+{
+//
+// This method returns a string to give a name to each possible
+// computation value.
+//
+
+   switch (fType) {
+      case kP:         return "SingleTrackPtot";
+      case kPt:        return "SingleTrackPt";
+      case kPtpc:      return "SingleTrackPtpc";
+      case kEta:       return "SingleTrackEta";
+      case kITSsignal: return "SingleTrackITSsignal";
+      case kTPCsignal: return "SingleTrackTPCsignal";
+      case kTOFsignal: return "SingleTrackTOFsignal";
+      default:         return "Undefined";
+   }
+}
+
+//_____________________________________________________________________________
+Bool_t AliRsnValueDaughter::Eval(TObject *object)
+{
+//
+// Evaluation of the required value.
+// Checks that the passed object is of the right type
+// and if this check is successful, computes the required value.
+// The output of the function tells if computing was successful,
+// and the values must be taken with GetValue().
+//
+   
+   // coherence check, which also casts object 
+   // to AliRsnTarget data members and returns kFALSE
+   // in case the object is NULL
+   if (!TargetOK(object)) return kFALSE;
+
+   // set a reference to the mother momentum
+   TLorentzVector &p     = fDaughter->P(fUseMCInfo);
+   AliVTrack      *track = fDaughter->Ref2Vtrack();
+   
+   // compute value depending on types in the enumeration
+   // if the type does not match any available choice, or if
+   // the computation is not doable due to any problem
+   // (not initialized support object, wrong values, risk of floating point errors)
+   // the method returng kFALSE and sets the computed value to a meaningless number
+   switch (fType) {
+      case kP:
+         fComputedValue = p.Mag();
+         return kTRUE;
+      case kPt:
+         fComputedValue = p.Perp();
+         return kTRUE;
+      case kEta:
+         fComputedValue = p.Eta();
+         return kTRUE;
+      case kPtpc:
+         if (track) {
+            fComputedValue = track->GetTPCmomentum();
+            return kTRUE;
+         } else {
+            AliWarning("Cannot get TPC momentum for non-track object");
+            fComputedValue = 0.0;
+            return kFALSE;
+         }
+      case kITSsignal:
+         if (track) {
+            fComputedValue = track->GetITSsignal();
+            return kTRUE;
+         } else {
+            AliWarning("Cannot get ITS signal for non-track object");
+            fComputedValue = 0.0;
+            return kFALSE;
+         }
+      case kTPCsignal:
+         if (track) {
+            fComputedValue = track->GetTPCsignal();
+            return kTRUE;
+         } else {
+            AliWarning("Cannot get TPC signal for non-track object");
+            fComputedValue = 0.0;
+            return kFALSE;
+         }
+      case kTOFsignal:
+         if (track) {
+            fComputedValue = track->GetTOFsignal();
+            return kTRUE;
+         } else {
+            AliWarning("Cannot get TOF signal for non-track object");
+            fComputedValue = 0.0;
+            return kFALSE;
+         }
+      default:
+         AliError(Form("[%s] Invalid value type for this computation", GetName()));
+         return kFALSE;
+   }
+}
diff --git a/PWG2/RESONANCES/AliRsnValueDaughter.h b/PWG2/RESONANCES/AliRsnValueDaughter.h
new file mode 100644 (file)
index 0000000..64cfda8
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef ALIRSNVALUEDAUGHTER_H
+#define ALIRSNVALUEDAUGHTER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Values which depend on 4-momentum of the daughters.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include "AliRsnValue.h"
+
+class AliRsnValueDaughter : public AliRsnValue {
+public:
+
+   enum EType {
+      kP,          // total momentum
+      kPt,         // transverse momentum
+      kPtpc,       // total momentum in the TPC inner wall
+      kEta,        // pseudo-rapidity
+      kITSsignal,  // ITS signal
+      kTPCsignal,  // TPC signal
+      kTOFsignal,  // TOF signal
+      kTypes
+   };
+
+   AliRsnValueDaughter(const char *name = "valDaughter", EType type = kTypes);
+   AliRsnValueDaughter(const AliRsnValueDaughter& copy);
+   AliRsnValueDaughter& operator=(const AliRsnValueDaughter& copy);
+   virtual ~AliRsnValueDaughter() { }
+
+   void             SetType(EType type)  {fType = type;}
+   EType            GetType()     const  {return fType;}
+   const char*      GetTypeName() const;
+
+   virtual Bool_t   Eval(TObject *object);
+
+protected:
+
+   EType           fType;                //  type from enumeration
+
+   ClassDef(AliRsnValueDaughter, 1)  // AliRsnValueDaughter class
+};
+
+#endif
diff --git a/PWG2/RESONANCES/AliRsnValueEvent.cxx b/PWG2/RESONANCES/AliRsnValueEvent.cxx
new file mode 100644 (file)
index 0000000..f51b627
--- /dev/null
@@ -0,0 +1,218 @@
+/**************************************************************************
+ * 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 class contains all code which is used to compute any of the values
+//  which can be of interest within a resonance analysis. Besides the obvious
+//  invariant mass, it allows to compute other utility values on all possible
+//  targets, in order to allow a wide spectrum of binning and checks.
+//  When needed, this object can also define a binning in the variable which
+//  it is required to compute, which is used for initializing axes of output
+//  histograms (see AliRsnFunction).
+//  The value computation requires this object to be passed the object whose
+//  informations will be used. This object can be of any allowed input type
+//  (track, pair, event), then this class must inherit from AliRsnTarget.
+//  Then, when value computation is attempted, a check on target type is done
+//  and computation is successful only if expected target matches that of the
+//  passed object.
+//  In some cases, the value computation can require a support external object,
+//  which must then be passed to this class. It can be of any type inheriting
+//  from TObject.
+//
+//  authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
+//           M. Vala (martin.vala@cern.ch)
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include "AliVVertex.h"
+#include "AliMultiplicity.h"
+#include "AliESDtrackCuts.h"
+#include "AliESDpid.h"
+#include "AliAODPid.h"
+#include "AliCentrality.h"
+#include "AliESDUtils.h"
+
+#include "AliRsnEvent.h"
+#include "AliRsnDaughter.h"
+#include "AliRsnMother.h"
+#include "AliRsnPairDef.h"
+#include "AliRsnDaughterDef.h"
+
+#include "AliRsnValueEvent.h"
+
+ClassImp(AliRsnValueEvent)
+
+//_____________________________________________________________________________
+AliRsnValueEvent::AliRsnValueEvent(const char *name, EType type) :
+   AliRsnValue(name, AliRsnTarget::kEvent),
+   fType(type)
+{
+//
+// Constructor
+//
+}
+
+//_____________________________________________________________________________
+AliRsnValueEvent::AliRsnValueEvent(const AliRsnValueEvent& copy) :
+   AliRsnValue(copy),
+   fType(copy.fType)
+{
+//
+// Copy constructor
+//
+}
+
+//_____________________________________________________________________________
+AliRsnValueEvent& AliRsnValueEvent::operator=(const AliRsnValueEvent& copy)
+{
+//
+// Assignment operator.
+// Works like copy constructor.
+//
+
+   AliRsnValue::operator=(copy);
+   fType = copy.fType;
+
+   return (*this);
+}
+
+//_____________________________________________________________________________
+const char* AliRsnValueEvent::GetTypeName() const
+{
+//
+// This method returns a string to give a name to each possible
+// computation value.
+//
+
+   switch (fType) {
+      case kLeadingPt:       return "EventLeadingPt";
+      case kMult:            return "EventMult";
+      case kMultMC:          return "EventMultMC";
+      case kMultESDCuts:     return "EventMultESDCuts";
+      case kMultSPD:         return "EventMultSPD";
+      case kVz:              return "EventVz";
+      case kCentralityV0:    return "EventCentralityV0";
+      case kCentralityTrack: return "EventCentralityTrack";
+      case kCentralityCL1:   return "EventCentralityCL1";
+      default:               return "Undefined";
+   }
+}
+
+//_____________________________________________________________________________
+Bool_t AliRsnValueEvent::Eval(TObject *object)
+{
+//
+// Evaluation of the required value.
+// In this implementation, fills the member 4-vectors with data
+// coming from the object passed as argument, and then returns the value
+//
+   
+   // coherence check, which also casts object 
+   // to AliRsnTarget data members and returns kFALSE
+   // in case the object is NULL
+   if (!TargetOK(object)) return kFALSE;
+   if (!fEvent->GetRef()) {
+      AliWarning("NULL ref");
+      return kFALSE;
+   }
+   
+   // declare support variables
+   AliCentrality *centrality = fEvent->GetRef()->GetCentrality();
+   
+   // compute value depending on types in the enumeration
+   // if the type does not match any available choice, or if
+   // the computation is not doable due to any problem
+   // (not initialized support object, wrong values, risk of floating point errors)
+   // the method returng kFALSE and sets the computed value to a meaningless number
+   switch (fType) {
+      case kMult:
+         fComputedValue = (Double_t)fEvent->GetRef()->GetNumberOfTracks();
+         return (fComputedValue >= 0);
+      case kMultMC:
+         fComputedValue = -999.0;
+         if (fEvent->GetRefMC()) {
+            if (fEvent->IsESD()) 
+               fComputedValue = (Double_t)fEvent->GetRefMC()->GetNumberOfTracks();
+            else {
+               AliAODEvent *aod = (AliAODEvent*)fEvent->GetRefMC();
+               TClonesArray *mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
+               if (mcArray) fComputedValue = (Double_t)mcArray->GetEntries();
+            }
+         }
+         return (fComputedValue >= 0);
+      case kMultESDCuts:
+         fComputedValue = -999.0;
+         if (fEvent->IsESD()) {
+            fComputedValue = AliESDtrackCuts::GetReferenceMultiplicity(fEvent->GetRefESD(), kTRUE);
+         } else {
+            AliWarning("Cannot compute ESD cuts multiplicity in AOD");
+            return kFALSE;
+         }
+         return (fComputedValue >= 0);
+      case kMultSPD:
+         fComputedValue = -999.0;
+         if (fEvent->IsESD()) {
+            const AliMultiplicity *mult = fEvent->GetRefESD()->GetMultiplicity();
+            Float_t nClusters[6] = {0.0,0.0,0.0,0.0,0.0,0.0};
+            for(Int_t ilay = 0; ilay < 6; ilay++) nClusters[ilay] = (Float_t)mult->GetNumberOfITSClusters(ilay);
+            fComputedValue = AliESDUtils::GetCorrSPD2(nClusters[1], fEvent->GetRef()->GetPrimaryVertex()->GetZ());
+         } else {
+            AliWarning("Cannot compute SPD multiplicity with AOD");
+            return kFALSE;
+         }
+         return (fComputedValue >= 0);
+      case kLeadingPt: 
+         if (fEvent->GetLeadingIndex() >= 0) {
+            AliRsnDaughter leadingPart;
+            fEvent->SetLeadingParticle(leadingPart);
+            fComputedValue = leadingPart.GetRef()->Pt();
+            return kTRUE;
+         } else {
+            AliError("Not found good leading particle");
+            return kFALSE;
+         }
+      case kVz:
+         fComputedValue = fEvent->GetRef()->GetPrimaryVertex()->GetZ();
+         return kTRUE;
+      case kCentralityV0:
+         if (centrality) {
+            fComputedValue = centrality->GetCentralityPercentile("V0M");
+            return kTRUE;
+         } else {
+            AliError("Centrality undefined");
+            return kFALSE;
+         }
+      case kCentralityTrack:
+         if (centrality) {
+            fComputedValue = centrality->GetCentralityPercentile("TRK");
+            return kTRUE;
+         } else {
+            AliError("Centrality undefined");
+            return kFALSE;
+         }
+      case kCentralityCL1:
+         if (centrality) {
+            fComputedValue = centrality->GetCentralityPercentile("CL1");
+            return kTRUE;
+         } else {
+            AliError("Centrality undefined");
+            return kFALSE;
+         }
+      default:
+         AliError(Form("[%s] Invalid value type for this computation", GetName()));
+         return kFALSE;
+   }
+}
diff --git a/PWG2/RESONANCES/AliRsnValueEvent.h b/PWG2/RESONANCES/AliRsnValueEvent.h
new file mode 100644 (file)
index 0000000..f4a1286
--- /dev/null
@@ -0,0 +1,49 @@
+#ifndef ALIRSNVALUEEVENT_H
+#define ALIRSNVALUEEVENT_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Values which depend on 4-momentum of the pair.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include "AliRsnValue.h"
+
+class AliRsnValueEvent : public AliRsnValue {
+public:
+
+   enum EType {
+      kLeadingPt,       // transverse momentum of the event leading particle
+      kMult,            // multiplicity computed as the number of tracks
+      kMultMC,          // multiplicity from MC
+      kMultESDCuts,     // multiplicity of good quality tracks
+      kMultSPD,         // multiplicity from SPD
+      kVz,              // Z position of event primary vertex
+      kCentralityV0,    // event centrality (V0 method)
+      kCentralityTrack, // event centrality (tracks method)
+      kCentralityCL1,   // event centrality (CL1 method)
+      kTypes            
+   };
+
+   AliRsnValueEvent(const char *name = "valEvent", EType type = kTypes);
+   AliRsnValueEvent(const AliRsnValueEvent& copy);
+   AliRsnValueEvent& operator=(const AliRsnValueEvent& copy);
+   virtual ~AliRsnValueEvent() { }
+
+   void             SetType(EType type)  {fType = type;}
+   EType            GetType()     const  {return fType;}
+   const char*      GetTypeName() const;
+
+   virtual Bool_t   Eval(TObject *object);
+
+protected:
+
+   EType           fType;         //  type from enumeration
+
+   ClassDef(AliRsnValueEvent, 1)  // AliRsnValueEvent class
+};
+
+#endif
diff --git a/PWG2/RESONANCES/AliRsnValuePair.cxx b/PWG2/RESONANCES/AliRsnValuePair.cxx
new file mode 100644 (file)
index 0000000..fa02627
--- /dev/null
@@ -0,0 +1,176 @@
+/**************************************************************************
+ * 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 class contains all code which is used to compute any of the values
+//  which can be of interest within a resonance analysis. Besides the obvious
+//  invariant mass, it allows to compute other utility values on all possible
+//  targets, in order to allow a wide spectrum of binning and checks.
+//  When needed, this object can also define a binning in the variable which
+//  it is required to compute, which is used for initializing axes of output
+//  histograms (see AliRsnFunction).
+//  The value computation requires this object to be passed the object whose
+//  informations will be used. This object can be of any allowed input type
+//  (track, pair, event), then this class must inherit from AliRsnTarget.
+//  Then, when value computation is attempted, a check on target type is done
+//  and computation is successful only if expected target matches that of the
+//  passed object.
+//  In some cases, the value computation can require a support external object,
+//  which must then be passed to this class. It can be of any type inheriting
+//  from TObject.
+//
+//  authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
+//           M. Vala (martin.vala@cern.ch)
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Riostream.h"
+#include "AliVVertex.h"
+#include "AliMultiplicity.h"
+#include "AliESDtrackCuts.h"
+#include "AliESDpid.h"
+#include "AliAODPid.h"
+#include "AliCentrality.h"
+#include "AliESDUtils.h"
+
+#include "AliRsnEvent.h"
+#include "AliRsnDaughter.h"
+#include "AliRsnMother.h"
+#include "AliRsnPairDef.h"
+#include "AliRsnDaughterDef.h"
+
+#include "AliRsnValuePair.h"
+
+ClassImp(AliRsnValuePair)
+
+//_____________________________________________________________________________
+AliRsnValuePair::AliRsnValuePair(const char *name, EType type) :
+   AliRsnValue(name, AliRsnTarget::kMother),
+   fType(type)
+{
+//
+// Constructor
+//
+}
+
+//_____________________________________________________________________________
+AliRsnValuePair::AliRsnValuePair(const AliRsnValuePair& copy) :
+   AliRsnValue(copy),
+   fType(copy.fType)
+{
+//
+// Copy constructor
+//
+}
+
+//_____________________________________________________________________________
+AliRsnValuePair& AliRsnValuePair::operator=(const AliRsnValuePair& copy)
+{
+//
+// Assignment operator.
+// Works like copy constructor.
+//
+
+   AliRsnValue::operator=(copy);
+   fType = copy.fType;
+
+   return (*this);
+}
+
+//_____________________________________________________________________________
+const char* AliRsnValuePair::GetTypeName() const
+{
+//
+// This method returns a string to give a name to each possible
+// computation value.
+//
+
+   switch (fType) {
+      case kPt:           return "PairPt";
+      case kPz:           return "PairPz";
+      case kInvMass:      return "PairInvMass";
+      case kInvMassRes:   return "PairInvMassResolution";
+      case kEta:          return "PairEta";
+      case kMt:           return "PairMt";
+      case kY:            return "PairY";
+      case kPtRatio:      return "PairPtRatio";
+      case kDipAngle:     return "PairDipAngle";
+      case kCosThetaStar: return "PairCosThetaStar";
+      default:            return "Undefined";
+   }
+}
+
+//_____________________________________________________________________________
+Bool_t AliRsnValuePair::Eval(TObject *object)
+{
+//
+// Evaluation of the required value.
+// In this implementation, fills the member 4-vectors with data
+// coming from the object passed as argument, and then returns the value
+//
+
+   // coherence check, which also casts object 
+   // to AliRsnTarget data members and returns kFALSE
+   // in case the object is NULL
+   if (!TargetOK(object)) return kFALSE;
+   
+   // set a reference to the mother momentum
+   TLorentzVector &sum   = fMother->Sum(fUseMCInfo);
+   TLorentzVector &ref   = fMother->Ref(fUseMCInfo);
+   TLorentzVector &p1    = fMother->GetDaughter(0)->P(fUseMCInfo);
+   TLorentzVector &p2    = fMother->GetDaughter(1)->P(fUseMCInfo);
+   
+   // compute value depending on types in the enumeration
+   // if the type does not match any available choice, or if
+   // the computation is not doable due to any problem
+   // (not initialized support object, wrong values, risk of floating point errors)
+   // the method returng kFALSE and sets the computed value to a meaningless number
+   switch (fType) {
+      case kPt:
+         fComputedValue = sum.Perp();
+         return kTRUE;
+      case kInvMass:
+         fComputedValue = sum.M();
+         return kTRUE;
+      case kEta:
+         fComputedValue = sum.Eta();
+         return kTRUE;
+      case kInvMassRes:
+         fComputedValue  = fMother->Sum(kFALSE).M() - fMother->Sum(kTRUE).M();
+         fComputedValue /= fMother->Sum(kTRUE).M();
+         return kTRUE;
+      case kMt:
+         fComputedValue = ref.Mt();
+         return kTRUE;
+      case kY:
+         fComputedValue = ref.Rapidity();
+         return kTRUE;
+      case kPtRatio:
+         fComputedValue  = TMath::Abs(p1.Perp() - p2.Perp());
+         fComputedValue /= TMath::Abs(p1.Perp() + p2.Perp());
+         return kTRUE;
+      case kDipAngle:
+         fComputedValue  = p1.Perp() * p2.Perp() + p1.Z() * p2.Z();
+         fComputedValue /= p1.Mag() * p2.Mag();
+         return kTRUE;
+      case kCosThetaStar:
+         fComputedValue = fMother->CosThetaStar();
+         return kTRUE;
+      default:
+         AliError(Form("[%s] Invalid value type for this computation", GetName()));
+         return kFALSE;
+   }
+}
diff --git a/PWG2/RESONANCES/AliRsnValuePair.h b/PWG2/RESONANCES/AliRsnValuePair.h
new file mode 100644 (file)
index 0000000..772decf
--- /dev/null
@@ -0,0 +1,50 @@
+#ifndef ALIRSNVALUEPAIR_H
+#define ALIRSNVALUEPAIR_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Values which depend on 4-momentum of the pair.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include "AliRsnValue.h"
+
+class AliRsnValuePair : public AliRsnValue {
+public:
+
+   enum EType {
+      kPt,            // pair transverse momentum
+      kPz,            // pair longitudinal momentum
+      kInvMass,       // pair invariant mass (with reconstructed momenta)
+      kInvMassRes,    // pair invariant mass resolution
+      kEta,           // pair pseudo-rapidity
+      kMt,            // pair transverse mass (need a reference mass)
+      kY,             // pair rapidity (need a reference mass)
+      kPtRatio,       // ratio |pt1 - pt2|/(pt1 + pt2) of daughter transverse momenta
+      kDipAngle,      // inverse cosine of the angle between daughter vector momenta
+      kCosThetaStar,  // polarization angle
+      kTypes
+   };
+
+   AliRsnValuePair(const char *name = "valPair", EType type = kTypes);
+   AliRsnValuePair(const AliRsnValuePair& copy);
+   AliRsnValuePair& operator=(const AliRsnValuePair& copy);
+   virtual ~AliRsnValuePair() { }
+
+   void             SetType(EType type)  {fType = type;}
+   EType            GetType()     const  {return fType;}
+   const char*      GetTypeName() const;
+
+   virtual Bool_t   Eval(TObject *object);
+
+protected:
+
+   EType           fType;                //  type from enumeration
+
+   ClassDef(AliRsnValuePair, 1)  // AliRsnValuePair class
+};
+
+#endif