4 // Defines a decay channel for a resonance,
5 // resulting in a specified PDG code for the mother,
6 // and the particle type for the daughters, defined
7 // according to the internal PID format of the package
9 // author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
13 #include "AliRsnDaughter.h"
14 #include "AliRsnPairDef.h"
16 ClassImp(AliRsnPairDef)
18 //_____________________________________________________________________________
19 AliRsnPairDef::AliRsnPairDef() :
24 // Initializes the data members to default values:
25 // - no definition of particles in the pair;
26 // - histogram binning undefined.
27 // When using this constructor, all analysis elements (particles, histogram)
28 // must be defined before starting event processing.
32 for (i = 0; i < 2; i++) {
35 fType[i] = AliRsnPID::kUnknown;
39 //_____________________________________________________________________________
40 AliRsnPairDef::AliRsnPairDef
41 (Char_t sign1, AliRsnPID::EType type1, Char_t sign2, AliRsnPID::EType type2, Int_t motherPDG) :
45 // Constructor with arguments.
46 // This constructor allows to define all the working parameters.
49 SetPair(sign1, type1, sign2, type2);
52 //_____________________________________________________________________________
53 AliRsnPairDef::AliRsnPairDef(const AliRsnPairDef ©) :
55 fMotherPDG(copy.fMotherPDG)
58 // Copy constructor with standard behavior
61 SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
64 //_____________________________________________________________________________
65 const AliRsnPairDef& AliRsnPairDef::operator=(const AliRsnPairDef ©)
68 // Assignment operator with standard behavior.
71 fMotherPDG = copy.fMotherPDG;
72 SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
77 //_____________________________________________________________________________
78 Bool_t AliRsnPairDef::SetPairElement(Int_t i, Char_t charge, AliRsnPID::EType type)
81 // Set one element of the pair
82 // and returns warnings if the type is not valid.
85 AliError("Index out of range");
88 if (charge != '+' && charge != '-') {
89 AliError(Form("Character '%c' not recognized as charge sign"));
92 if (type < AliRsnPID::kElectron && type > AliRsnPID::kUnknown) {
93 AliError("Type index out of enumeration range");
98 fMass[i] = AliRsnPID::ParticleMass(type);
102 //_____________________________________________________________________________
103 Bool_t AliRsnPairDef::SetPair
104 (Char_t charge1, AliRsnPID::EType type1, Char_t charge2, AliRsnPID::EType type2)
107 // Set both elements of the pair,
108 // returning logical AND of check for each one.
111 Bool_t part1 = SetPairElement(0, charge1, type1);
112 Bool_t part2 = SetPairElement(1, charge2, type2);
113 return (part1 && part2);
116 //_____________________________________________________________________________
117 Double_t AliRsnPairDef::ComputeWeight(AliRsnDaughter *d0, AliRsnDaughter *d1)
120 // Compute a weight for filling the histograms:
121 // probability of first track to be identified as 'type[0]' times
122 // the probability of second track to be identified as 'type[1]',
123 // according to the order of appearance in argument list.
126 Double_t prob0 = d0->PIDProb()[fType[0]];
127 Double_t prob1 = d1->PIDProb()[fType[1]];