]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG2/RESONANCES/AliRsnPairDef.cxx
example macros to run on proof
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnPairDef.cxx
index 42308e8f2bd9827e136e81b2f278c109633d7065..1eb34aa8a4222990aff6e13590d44413b6e2750c 100644 (file)
-//
-// Class AliRsnPairDef
-//
-// Defines a decay channel for a resonance,
-// resulting in a specified PDG code for the mother,
-// and the particle type for the daughters, defined
-// according to the internal PID format of the package
-//
-// author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
-//
+/**************************************************************************
+ * 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 is a simple set of definitions which are used to define a
+//  decay tree to be studied for a resonance, in terms of the PID and charge
+//  of its candidate daughters, which in turn determins what kind of objects
+//  the analysis must take into account.
+//  This object contains two AliRsnDaughterDef which define a model for each
+//  of the two expected daughters (see also AliRsnDaughterDef class) plus a
+//  mass hypothesis for the resonance, which is used for computin quantities
+//  which need it (like rapidity or Mt), and a PDG code, which is used to 
+//  check for true pairs, when needed. In all other cases, these two additional
+//  values can be left to their default (meaningless) value.
+//  Since this object must define a decay channel, the only provided constructor
+//  allow to set a PID and a charge.
+//
+//  authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
+//           M. Vala (martin.vala@cern.ch)
+//
+////////////////////////////////////////////////////////////////////////////////
 
 #include "AliLog.h"
-#include "AliRsnDaughter.h"
+#include "AliRsnMother.h"
 #include "AliRsnPairDef.h"
 
 ClassImp(AliRsnPairDef)
 
 //_____________________________________________________________________________
 AliRsnPairDef::AliRsnPairDef() :
-  fMotherPDG(0)
+   fMotherMass(0.0), 
+   fMotherPDG(0), 
+   fDef1(), 
+   fDef2()
 {
 //
-// Empty constructor.
-// Initializes the data members to default values:
-//  - no definition of particles in the pair;
-//  - histogram binning undefined.
-// When using this constructor, all analysis elements (particles, histogram)
-// must be defined before starting event processing.
+// Constructor.
+// If the two pointers are well initialized, they are used to init the members.
 //
-
-    Int_t i;
-    for (i = 0; i < 2; i++) {
-        fCharge[i] = '0';
-        fMass[i] = 0.0;
-        fType[i] = AliRsnPID::kUnknown;
-    }
 }
 
 //_____________________________________________________________________________
 AliRsnPairDef::AliRsnPairDef
-(Char_t sign1, AliRsnPID::EType type1, Char_t sign2, AliRsnPID::EType type2, Int_t motherPDG) :
-  fMotherPDG(motherPDG)
-{
-//
-// Constructor with arguments.
-// This constructor allows to define all the working parameters.
-//
-
-    SetPair(sign1, type1, sign2, type2);
-}
-
-//_____________________________________________________________________________
-AliRsnPairDef::AliRsnPairDef(const AliRsnPairDef &copy) :
-  TObject(copy),
-  fMotherPDG(copy.fMotherPDG)
-{
-//
-// Copy constructor with standard behavior
-//
-
-    SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
-}
-
-//_____________________________________________________________________________
-const AliRsnPairDef& AliRsnPairDef::operator=(const AliRsnPairDef &copy)
+(EPARTYPE type1, Char_t ch1, EPARTYPE type2, Char_t ch2, Int_t pdg, Double_t mass) :
+   fMotherMass(mass), 
+   fMotherPDG(pdg), 
+   fDef1(type1, ch1), 
+   fDef2(type2, ch2)
 {
 //
-// Assignment operator with standard behavior.
+// Constructor.
+// If the two pointers are well initialized, they are used to init the members.
 //
-
-    fMotherPDG = copy.fMotherPDG;
-    SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
-
-    return (*this);
 }
 
 //_____________________________________________________________________________
-Bool_t AliRsnPairDef::SetPairElement(Int_t i, Char_t charge, AliRsnPID::EType type)
+AliRsnPairDef::AliRsnPairDef
+(AliRsnDaughter::ESpecies type1, Char_t ch1, AliRsnDaughter::ESpecies type2, Char_t ch2, Int_t pdg, Double_t mass) :
+   fMotherMass(mass), 
+   fMotherPDG(pdg), 
+   fDef1(type1, ch1), 
+   fDef2(type2, ch2)
 {
 //
-// Set one element of the pair
-// and returns warnings if the type is not valid.
+// Constructor.
+// If the two pointers are well initialized, they are used to init the members.
 //
-    if (i < 0 || i > 1) {
-        AliError("Index out of range");
-        return kFALSE;
-    }
-    if (charge != '+' && charge != '-') {
-        AliError(Form("Character '%c' not recognized as charge sign"));
-        return kFALSE;
-    }
-    if (type < AliRsnPID::kElectron && type > AliRsnPID::kUnknown) {
-        AliError("Type index out of enumeration range");
-        return kFALSE;
-    }
-    fCharge[i] = charge;
-    fType[i] = type;
-    fMass[i] = AliRsnPID::ParticleMass(type);
-    return kTRUE;
 }
-
+   
 //_____________________________________________________________________________
-Bool_t AliRsnPairDef::SetPair
-(Char_t charge1, AliRsnPID::EType type1, Char_t charge2, AliRsnPID::EType type2)
+AliRsnPairDef::AliRsnPairDef(const AliRsnPairDef &copy) :
+   TObject(copy),
+   fMotherMass(copy.fMotherMass),
+   fMotherPDG(copy.fMotherPDG),
+   fDef1(copy.fDef1),
+   fDef2(copy.fDef2)
 {
 //
-// Set both elements of the pair,
-// returning logical AND of check for each one.
+// Copy constructor with standard behavior
 //
-
-    Bool_t part1 = SetPairElement(0, charge1, type1);
-    Bool_t part2 = SetPairElement(1, charge2, type2);
-    return (part1 && part2);
 }
 
 //_____________________________________________________________________________
-Double_t AliRsnPairDef::ComputeWeight(AliRsnDaughter *d0, AliRsnDaughter *d1)
+const AliRsnPairDef& AliRsnPairDef::operator=(const AliRsnPairDef &copy)
 {
 //
-// Compute a weight for filling the histograms:
-// probability of first track to be identified as 'type[0]' times
-// the probability of second track to be identified as 'type[1]',
-// according to the order of appearance in argument list.
+// Assignment operator with standard behavior.
 //
 
-    Double_t prob0 = d0->PIDProb()[fType[0]];
-    Double_t prob1 = d1->PIDProb()[fType[1]];
+   fMotherMass = copy.fMotherMass;
+   fMotherPDG = copy.fMotherPDG;
+   fDef1 = copy.fDef1;
+   fDef2 = copy.fDef2;
 
-    return prob0*prob1;
+   return (*this);
 }