]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnDaughterDef.cxx
Implementation of all needed changes in the package in order to speed-up the executio...
[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    fOnlyTrue(kFALSE),
44    fPID(AliRsnDaughter::kUnknown),
45    fMass(0.0),
46    fCharge(0),
47    fRefType(AliRsnDaughter::kNoType)
48 {
49 //
50 // This version of constructor leaves everything undefined:
51 // this will cause all daughters to be accepted.
52 //
53 }
54
55 //_____________________________________________________________________________
56 AliRsnDaughterDef::AliRsnDaughterDef(AliRsnDaughter::ESpecies type, Char_t sign) :
57    fOnlyTrue(kFALSE),
58    fPID(type),
59    fMass(AliRsnDaughter::SpeciesMass(type)),
60    fCharge(sign),
61    fRefType(AliRsnDaughter::RefType(type))
62 {
63 //
64 // This version of constructor initializes the PID type
65 // and the charge (optional, leave 2nd argument to default to include both),
66 // and calls 'SetPID()' to assign the object type accordingly.
67 //
68 }
69
70 //_____________________________________________________________________________
71 AliRsnDaughterDef::AliRsnDaughterDef(EPARTYPE type, Char_t sign) :
72    fOnlyTrue(kFALSE),
73    fPID(AliRsnDaughter::FromAliPID(type)),
74    fMass(AliRsnDaughter::SpeciesMass(AliRsnDaughter::FromAliPID(type))),
75    fCharge(sign),
76    fRefType(AliRsnDaughter::RefType(AliRsnDaughter::FromAliPID(type)))
77 {
78 //
79 // This version of constructor initializes the PID type
80 // and the charge (optional, leave 2nd argument to default to include both),
81 // and calls 'SetPID()' to assign the object type accordingly.
82 //
83 }
84
85 //_____________________________________________________________________________
86 AliRsnDaughterDef::AliRsnDaughterDef(AliRsnDaughter::ERefType refType, Char_t sign) :
87    fOnlyTrue(kFALSE),
88    fPID(AliRsnDaughter::kUnknown),
89    fMass(0.0),
90    fCharge(sign),
91    fRefType(refType)
92 {
93 //
94 // This version of constructor initializes the object type
95 // and the charge (optional, leave 2nd argument to default to include both),
96 // and leaves the PID type undefined.
97 // This is useful when one is interested in all tracks/V0s/cascades without
98 // requiring them to be identified as a certain species, but if one then requires
99 // an object linked to this definition to compute a rapidity or a transverse mass,
100 // this will not work.
101 //
102 }
103
104 //_____________________________________________________________________________
105 AliRsnDaughterDef::AliRsnDaughterDef(const AliRsnDaughterDef &copy) :
106    TObject(copy),
107    fOnlyTrue(copy.fOnlyTrue),
108    fPID(copy.fPID),
109    fMass(copy.fMass),
110    fCharge(copy.fCharge),
111    fRefType(copy.fRefType)
112 {
113 //
114 // Copy constructor has standard behavior.
115 //
116 }
117
118 //_____________________________________________________________________________
119 const AliRsnDaughterDef& AliRsnDaughterDef::operator=(const AliRsnDaughterDef &copy)
120 {
121 //
122 // Assignment operator has standard behavior.
123 //
124
125    fOnlyTrue = copy.fOnlyTrue;
126    fMass = copy.fMass;
127    fCharge = copy.fCharge;
128    fPID = copy.fPID;
129    fRefType = copy.fRefType;
130
131    return (*this);
132 }
133
134 //_____________________________________________________________________________
135 Bool_t AliRsnDaughterDef::MatchesDaughter(AliRsnDaughter *checked)
136 {
137 //
138 // Checks if the argument matches the definitions, by combining the other
139 // inline methods, and using the same philosophy.
140 // The only exception is for the PID matching, which can be disabled
141 // by second argument. In this case, a track is considered matched
142 // if it is matched just in object type and charge.
143 //
144
145    Bool_t chargeMatch = MatchesCharge(checked);
146    Bool_t objMatch    = MatchesRefType(checked);
147    Bool_t pidMatch    = (fOnlyTrue ? MatchesPID(checked) : kTRUE);
148       
149    // return the AND of all
150    return (chargeMatch && objMatch && pidMatch);
151 }