laura is hosted by Hepforge, IPPP Durham
Laura++  v2r1
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauDaughters.cc
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2004 - 2013.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 // Authors:
7 // Thomas Latham
8 // John Back
9 // Paul Harrison
10 
15 #include <iostream>
16 
17 #include "TSystem.h"
18 
19 #include "LauDatabasePDG.hh"
20 #include "LauDaughters.hh"
21 #include "LauKinematics.hh"
22 #include "LauParticlePDG.hh"
23 
25 
26 
27 LauDaughters::LauDaughters(Int_t codeParent, Int_t code1, Int_t code2, Int_t code3, Bool_t useSquareDP) :
28  kinematics_(0),
29  parent_(0),
30  symmetricalDP_(kFALSE)
31 {
32  this->createParticleLists();
33 
34  TString nameParent = LauDatabasePDG::string( codeParent );
35  TString name1 = LauDatabasePDG::string( code1 );
36  TString name2 = LauDatabasePDG::string( code2 );
37  TString name3 = LauDatabasePDG::string( code3 );
38  this->setParentType(nameParent);
39  this->setDaugType(name1, name2, name3);
40 
41  // Create kinematics object
42  kinematics_ = new LauKinematics(this->getMassDaug1(), this->getMassDaug2(), this->getMassDaug3(), this->getMassParent(), useSquareDP);
43 }
44 
45 LauDaughters::LauDaughters(const TString& nameParent, const TString& name1, const TString& name2, const TString& name3, Bool_t useSquareDP) :
46  kinematics_(0),
47  parent_(0),
48  symmetricalDP_(kFALSE)
49 {
50  this->createParticleLists();
51 
52  this->setParentType(nameParent);
53  this->setDaugType(name1, name2, name3);
54 
55  // Create kinematics object
56  kinematics_ = new LauKinematics(this->getMassDaug1(), this->getMassDaug2(), this->getMassDaug3(), this->getMassParent(), useSquareDP);
57 }
58 
60 {
61  delete kinematics_; kinematics_ = 0;
62 }
63 
65  kinematics_(0),
66  parent_(0),
67  symmetricalDP_(kFALSE)
68 {
69  this->createParticleLists();
70 
71  this->setParentType( rhs.getNameParent() );
72  this->setDaugType( rhs.getNameDaug1() , rhs.getNameDaug2() , rhs.getNameDaug3() );
73 
74  // Create kinematics object
75  kinematics_ = new LauKinematics(this->getMassDaug1(), this->getMassDaug2(), this->getMassDaug3(), this->getMassParent(), rhs.squareDP());
76 }
77 
79 {
80  // Create list of allowed daughters
81  allowedDaughters_.clear();
93  allowedDaughters_.push_back(LauDatabasePDG::particle("D0_bar"));
96 
97  // Create list of allowed parents
98  allowedParents_.clear();
100  allowedParents_.push_back(LauDatabasePDG::particle("B-"));
101  allowedParents_.push_back(LauDatabasePDG::particle("B0"));
102  allowedParents_.push_back(LauDatabasePDG::particle("B0_bar"));
103  allowedParents_.push_back(LauDatabasePDG::particle("B_s0"));
104  allowedParents_.push_back(LauDatabasePDG::particle("B_s0_bar"));
105  allowedParents_.push_back(LauDatabasePDG::particle("D+"));
106  allowedParents_.push_back(LauDatabasePDG::particle("D-"));
107  allowedParents_.push_back(LauDatabasePDG::particle("D0"));
108  allowedParents_.push_back(LauDatabasePDG::particle("D0_bar"));
109  allowedParents_.push_back(LauDatabasePDG::particle("D_s+"));
110  allowedParents_.push_back(LauDatabasePDG::particle("D_s-"));
111 }
112 
113 void LauDaughters::setParentType(const TString& nameParent)
114 {
115  parent_ = 0;
116 
117  const Int_t codeParent = LauDatabasePDG::code( nameParent );
118 
119  for ( std::vector<const LauParticlePDG*>::const_iterator iter = allowedParents_.begin(); iter != allowedParents_.end(); ++iter ) {
120  const Int_t code = (*iter)->code();
121  if ( codeParent == code ) {
122  parent_ = (*iter);
123  std::cout<<"INFO in LauDaughters::setParentType : Setting parent to be "<<parent_->string()<<" == "<<parent_->code()<<std::endl;
124  break;
125  }
126  }
127 
128  if ( ! parent_ ) {
129  std::cerr<<"ERROR in LauDaughters::setParentType : Couldn't find a valid parent called \""<<nameParent<<"\"."<<std::endl;
130  gSystem->Exit(EXIT_FAILURE);
131  }
132 }
133 
134 void LauDaughters::setDaugType(const TString& name1, const TString& name2, const TString& name3)
135 {
136  const TString names[3] = { name1, name2, name3 };
137  const Int_t codes[3] = { LauDatabasePDG::code( name1 ), LauDatabasePDG::code( name2 ), LauDatabasePDG::code( name3 ) };
138 
139  daughters_.clear();
140  daughters_.resize(3);
141 
142  for ( int i(0); i<3; ++i ) {
143  for ( std::vector<const LauParticlePDG*>::const_iterator iter = allowedDaughters_.begin(); iter != allowedDaughters_.end(); ++iter ) {
144  Int_t code = (*iter)->code();
145  if ( codes[i] == code ) {
146  daughters_[i] = (*iter);
147  std::cout<<"INFO in LauDaughters::setDaugType : Setting daughter "<<i+1<<" to be "<<daughters_[i]->string()<<" == "<<daughters_[i]->code()<<std::endl;
148  break;
149  }
150  }
151  if ( ! daughters_[i] ) {
152  std::cerr<<"ERROR in LauDaughters::setDaugType : Couldn't find a valid daughter called \""<<names[i]<<"\"."<<std::endl;
153  gSystem->Exit(EXIT_FAILURE);
154  }
155  }
156 
157  // Initialise the various data members concerning particle masses
158  this->sanityCheck();
159 
160  // Check whether we have a symmetrical Dalitz plot
161  this->testDPSymmetry();
162 }
163 
165 {
166  // Check to see if we have a symmetrical DP.
167 
168  symmetricalDP_ = kFALSE;
169  if ( daughters_[0]->code() == daughters_[1]->code() ) {
170  std::cout<<"INFO in LauDaughters::testDPSymmetry : We have a symmetrical DP. "<<std::endl;
171  symmetricalDP_ = kTRUE;
172  } else if ( daughters_[0]->code() == daughters_[2]->code() ) {
173  std::cerr<<"WARNING in LauDaughters::testDPSymmetry : daughter 0 and daughter 2 are both "<<daughters_[0]->string()<<" but DP can only fold on daughers 0 and 1."<<std::endl;
174  } else if ( daughters_[1]->code() == daughters_[2]->code() ) {
175  std::cerr<<"WARNING in LauDaughters::testDPSymmetry : daughter 1 and daughter 2 are both "<<daughters_[1]->string()<<" but DP can only fold on daughers 0 and 1."<<std::endl;
176  }
177 
178 }
179 
181 {
182  // Check masses and charges of daughters
183 
184  Int_t totCharge(0);
185  Double_t totMass(0.0);
186 
187  for ( std::vector<const LauParticlePDG*>::const_iterator iter = daughters_.begin(); iter != daughters_.end(); ++iter ) {
188  totCharge += (*iter)->charge();
189  totMass += (*iter)->mass();
190  }
191 
192  if (totCharge != parent_->charge()) {
193  std::cerr<<"ERROR in LauDaughters::sanityCheck : Total charge of daughters ("<<totCharge<<") not equal to charge of parent ("<<parent_->charge()<<")."<<std::endl;
194  gSystem->Exit(EXIT_FAILURE);
195  }
196 
197  if (totMass > parent_->mass()) {
198  std::cerr<<"ERROR in LauDaughters::sanityCheck : Total mass of daughters ("<<totMass<<") greater than mass of parent ("<<parent_->mass()<<")."<<std::endl;
199  gSystem->Exit(EXIT_FAILURE);
200  }
201 }
202 
204 {
205  return daughters_[0]->mass();
206 }
207 
209 {
210  return daughters_[1]->mass();
211 }
212 
214 {
215  return daughters_[2]->mass();
216 }
217 
219 {
220  return parent_->mass();
221 }
222 
224 {
225  return daughters_[0]->string();
226 }
227 
229 {
230  return daughters_[1]->string();
231 }
232 
234 {
235  return daughters_[2]->string();
236 }
237 
239 {
240  return parent_->string();
241 }
242 
244 {
245  return daughters_[0]->code();
246 }
247 
249 {
250  return daughters_[1]->code();
251 }
252 
254 {
255  return daughters_[2]->code();
256 }
257 
259 {
260  return parent_->code();
261 }
262 
264 {
265  return daughters_[0]->charge();
266 }
267 
269 {
270  return daughters_[1]->charge();
271 }
272 
274 {
275  return daughters_[2]->charge();
276 }
277 
279 {
280  return parent_->charge();
281 }
282 
283 Int_t LauDaughters::getCharge(Int_t resPairAmpInt) const
284 {
285  Int_t charge = this->getChargeParent();
286  if ( resPairAmpInt>0 && resPairAmpInt<4 ) {
287  charge -= daughters_[resPairAmpInt-1]->charge();
288  }
289  return charge;
290 }
291 
TString string() const
Particle name.
Double_t getMassParent() const
Get mass of the parent particle.
TString getNameDaug1() const
Get name of the first daughter particle.
Int_t getChargeDaug3() const
Get charge of the third daughter particle.
Double_t mass() const
The mass of the particle.
Int_t charge() const
The charge of the particle.
Int_t getTypeDaug1() const
Get PDG code of the first daughter particle.
void setParentType(const TString &nameParent)
Set the parent particle type.
virtual ~LauDaughters()
Destructor.
Definition: LauDaughters.cc:59
LauDaughters(Int_t codeParent, Int_t code1, Int_t code2, Int_t code3, Bool_t useSquareDP=kFALSE)
Constructor from PDG codes.
Definition: LauDaughters.cc:27
ClassImp(LauAbsCoeffSet)
void createParticleLists()
Create list of all the allowed parent/daughter particles.
Definition: LauDaughters.cc:78
const LauParticlePDG * parent_
The parent particle.
Class that defines the particular 3-body decay under study.
Definition: LauDaughters.hh:33
Int_t getTypeParent() const
Get PDG code of the parent particle.
Int_t getCharge(Int_t resPairAmpInt) const
Get charge of a particular two-daughter combination.
void testDPSymmetry()
Check whether there is a symmetrical Dalitz plot.
LauParameter * parent_
The parent parameter.
File containing declaration of LauDaughters class.
Int_t getChargeDaug1() const
Get charge of the first daughter particle.
LauKinematics * kinematics_
Dalitz plot kinematics.
Bool_t symmetricalDP_
Boolean flag for symmetrical Dalitz plot.
TString getNameDaug2() const
Get name of the second daughter particle.
Bool_t squareDP() const
Determine to use or not the square Dalitz plot.
Definition: LauDaughters.hh:72
Double_t getMassDaug2() const
Get mass of second daughter particle.
File containing declaration of LauKinematics class.
std::vector< const LauParticlePDG * > daughters_
The daughter particles.
Int_t getChargeDaug2() const
Get charge of the second daughter particle.
File containing declaration of LauDatabasePDG class.
std::vector< const LauParticlePDG * > allowedParents_
All possible parent types.
File containing declaration of LauParticlePDG class.
static const LauParticlePDG * particle(Int_t code)
Get particle object based on the PDG code.
Int_t getTypeDaug3() const
Get PDG code of the third daughter particle.
Int_t getTypeDaug2() const
Get PDG code of the second daughter particle.
TString getNameParent() const
Get name of the parent particle.
void setDaugType(const TString &name1, const TString &name2, const TString &name3)
Set the three daughter types.
Int_t getChargeParent() const
Get charge of the parent particle.
Double_t getMassDaug1() const
Get mass of first daughter particle.
Class for calculating 3-body kinematic quantities.
void sanityCheck()
Check masses and charges of daughters.
std::vector< const LauParticlePDG * > allowedDaughters_
All possible daughter types.
static Int_t code(const TString &string)
Method to convert from a particle name string into a PDG code.
Double_t getMassDaug3() const
Get mass of third daughter particle.
TString getNameDaug3() const
Get name of the third daughter particle.
Int_t code() const
The particle PDG code.
static TString string(Int_t code)
Method to convert from a PDG code to a particle name string.