]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnDaughterDef.cxx
PWG2rsnextra:
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnDaughterDef.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 ////////////////////////////////////////////////////////////////////////////////
17 //
18 //  This class is a simple set of definitions which are used to select among
19 //  all daughter candidates in term of the object type (track, V0, cascade),
20 //  charge and eventually PID.
21 //  The PID assigned to the definition is the one which is 'assigned' to the
22 //  candidate daughter for whatever implies a mass hypothesis. When MC is 
23 //  available and one requires this, thie PID is also used to select only the
24 //  daughters which are of that species in MC.
25 // 
26 //  NOTE: charge is a single character. If one wants to select a well-defined 
27 //        charge, he must use '+', '-' or '0', while any other character is
28 //        interpreted as 'no charge selection'.
29 //
30 //  authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
31 //           M. Vala (martin.vala@cern.ch)
32 //
33 ////////////////////////////////////////////////////////////////////////////////
34
35 #include "AliLog.h"
36 #include "AliRsnDaughterDef.h"
37
38 ClassImp(AliRsnDaughterDef)
39
40
41 //_____________________________________________________________________________
42 AliRsnDaughterDef::AliRsnDaughterDef() :
43    fPID(AliRsnDaughter::kUnknown),
44    fMass(0.0),
45    fCharge(0),
46    fRefType(AliRsnDaughter::kNoType)
47 {
48 //
49 // This version of constructor leaves everything undefined:
50 // this will cause all daughters to be accepted.
51 //
52 }
53
54 //_____________________________________________________________________________
55 AliRsnDaughterDef::AliRsnDaughterDef(AliRsnDaughter::ESpecies type, Char_t sign) :
56    fPID(type),
57    fMass(0.0),
58    fCharge(sign),
59    fRefType(AliRsnDaughter::RefType(type))
60 {
61 //
62 // This version of constructor initializes the PID type
63 // and the charge (optional, leave 2nd argument to default to include both),
64 // and calls 'SetPID()' to assign the object type accordingly.
65 //
66 }
67
68 //_____________________________________________________________________________
69 AliRsnDaughterDef::AliRsnDaughterDef(EPARTYPE type, Char_t sign) :
70    fPID(AliRsnDaughter::FromAliPID(type)),
71    fMass(0.0),
72    fCharge(sign),
73    fRefType(AliRsnDaughter::RefType(AliRsnDaughter::FromAliPID(type)))
74 {
75 //
76 // This version of constructor initializes the PID type
77 // and the charge (optional, leave 2nd argument to default to include both),
78 // and calls 'SetPID()' to assign the object type accordingly.
79 //
80 }
81
82 //_____________________________________________________________________________
83 AliRsnDaughterDef::AliRsnDaughterDef(AliRsnDaughter::ERefType refType, Char_t sign) :
84    fPID(AliRsnDaughter::kUnknown),
85    fMass(0.0),
86    fCharge(sign),
87    fRefType(refType)
88 {
89 //
90 // This version of constructor initializes the object type
91 // and the charge (optional, leave 2nd argument to default to include both),
92 // and leaves the PID type undefined.
93 // This is useful when one is interested in all tracks/V0s/cascades without
94 // requiring them to be identified as a certain species, but if one then requires
95 // an object linked to this definition to compute a rapidity or a transverse mass,
96 // this will not work.
97 //
98 }
99
100 //_____________________________________________________________________________
101 AliRsnDaughterDef::AliRsnDaughterDef(const AliRsnDaughterDef &copy) :
102    TObject(copy),
103    fPID(copy.fPID),
104    fMass(copy.fMass),
105    fCharge(copy.fCharge),
106    fRefType(copy.fRefType)
107 {
108 //
109 // Copy constructor has standard behavior.
110 //
111 }
112
113 //_____________________________________________________________________________
114 const AliRsnDaughterDef& AliRsnDaughterDef::operator=(const AliRsnDaughterDef &copy)
115 {
116 //
117 // Assignment operator has standard behavior.
118 //
119
120    fMass = copy.fMass;
121    fCharge = copy.fCharge;
122    fPID = copy.fPID;
123    fRefType = copy.fRefType;
124
125    return (*this);
126 }
127
128 //_____________________________________________________________________________
129 Bool_t AliRsnDaughterDef::MatchesDaughter(AliRsnDaughter *checked, Bool_t truePID)
130 {
131 //
132 // Checks if the argument matches the definitions, by combining the other
133 // inline methods, and using the same philosophy.
134 // The only exception is for the PID matching, which can be disabled
135 // by second argument. In this case, a track is considered matched
136 // if it is matched just in object type and charge.
137 //
138
139    Bool_t chargeMatch = MatchesCharge(checked);
140    Bool_t objMatch    = MatchesRefType(checked);
141    Bool_t pidMatch    = (truePID ? MatchesPID(checked) : kTRUE);
142       
143    // return the AND of all
144    return (chargeMatch && objMatch && pidMatch);
145 }