laura is hosted by Hepforge, IPPP Durham
Laura++  v1r0
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 using std::cout;
17 using std::cerr;
18 using std::endl;
19 
20 #include "TSystem.h"
21 
22 #include "LauDatabasePDG.hh"
23 #include "LauDaughters.hh"
24 #include "LauKinematics.hh"
25 #include "LauParticlePDG.hh"
26 
27 ClassImp(LauDaughters)
28 
29 
30 LauDaughters::LauDaughters(Int_t codeParent, Int_t code1, Int_t code2, Int_t code3, Bool_t useSquareDP) :
31  kinematics_(0),
32  parent_(0),
33  symmetricalDP_(kFALSE)
34 {
35  this->createParticleLists();
36 
37  TString nameParent = LauDatabasePDG::string( codeParent );
38  TString name1 = LauDatabasePDG::string( code1 );
39  TString name2 = LauDatabasePDG::string( code2 );
40  TString name3 = LauDatabasePDG::string( code3 );
41  this->setParentType(nameParent);
42  this->setDaugType(name1, name2, name3);
43 
44  // Create kinematics object
45  kinematics_ = new LauKinematics(this->getMassDaug1(), this->getMassDaug2(), this->getMassDaug3(), this->getMassParent(), useSquareDP);
46 }
47 
48 LauDaughters::LauDaughters(const TString& nameParent, const TString& name1, const TString& name2, const TString& name3, Bool_t useSquareDP) :
49  kinematics_(0),
50  parent_(0),
51  symmetricalDP_(kFALSE)
52 {
53  this->createParticleLists();
54 
55  this->setParentType(nameParent);
56  this->setDaugType(name1, name2, name3);
57 
58  // Create kinematics object
59  kinematics_ = new LauKinematics(this->getMassDaug1(), this->getMassDaug2(), this->getMassDaug3(), this->getMassParent(), useSquareDP);
60 }
61 
63 {
64  delete kinematics_; kinematics_ = 0;
65 }
66 
68  kinematics_(0),
69  parent_(0),
70  symmetricalDP_(kFALSE)
71 {
72  this->createParticleLists();
73 
74  this->setParentType( rhs.getNameParent() );
75  this->setDaugType( rhs.getNameDaug1() , rhs.getNameDaug2() , rhs.getNameDaug3() );
76 
77  // Create kinematics object
78  kinematics_ = new LauKinematics(this->getMassDaug1(), this->getMassDaug2(), this->getMassDaug3(), this->getMassParent(), rhs.squareDP());
79 }
80 
82 {
83  // Create list of allowed daughters
84  allowedDaughters_.clear();
96  allowedDaughters_.push_back(LauDatabasePDG::particle("D0_bar"));
99 
100  // Create list of allowed parents
101  allowedParents_.clear();
102  allowedParents_.push_back(LauDatabasePDG::particle("B+"));
103  allowedParents_.push_back(LauDatabasePDG::particle("B-"));
104  allowedParents_.push_back(LauDatabasePDG::particle("B0"));
105  allowedParents_.push_back(LauDatabasePDG::particle("B0_bar"));
106  allowedParents_.push_back(LauDatabasePDG::particle("B_s0"));
107  allowedParents_.push_back(LauDatabasePDG::particle("B_s0_bar"));
108  allowedParents_.push_back(LauDatabasePDG::particle("D+"));
109  allowedParents_.push_back(LauDatabasePDG::particle("D-"));
110  allowedParents_.push_back(LauDatabasePDG::particle("D0"));
111  allowedParents_.push_back(LauDatabasePDG::particle("D0_bar"));
112  allowedParents_.push_back(LauDatabasePDG::particle("D_s+"));
113  allowedParents_.push_back(LauDatabasePDG::particle("D_s-"));
114 }
115 
116 void LauDaughters::setParentType(const TString& nameParent)
117 {
118  parent_ = 0;
119 
120  const Int_t codeParent = LauDatabasePDG::code( nameParent );
121 
122  for ( std::vector<const LauParticlePDG*>::const_iterator iter = allowedParents_.begin(); iter != allowedParents_.end(); ++iter ) {
123  const Int_t code = (*iter)->code();
124  if ( codeParent == code ) {
125  parent_ = (*iter);
126  cout<<"INFO in LauDaughters::setParentType : Setting parent to be "<<parent_->string()<<" == "<<parent_->code()<<endl;
127  break;
128  }
129  }
130 
131  if ( ! parent_ ) {
132  cerr<<"ERROR in LauDaughters::setParentType : Couldn't find a valid parent called \""<<nameParent<<"\"."<<endl;
133  gSystem->Exit(EXIT_FAILURE);
134  }
135 }
136 
137 void LauDaughters::setDaugType(const TString& name1, const TString& name2, const TString& name3)
138 {
139  const TString names[3] = { name1, name2, name3 };
140  const Int_t codes[3] = { LauDatabasePDG::code( name1 ), LauDatabasePDG::code( name2 ), LauDatabasePDG::code( name3 ) };
141 
142  daughters_.clear();
143  daughters_.resize(3);
144 
145  for ( int i(0); i<3; ++i ) {
146  for ( std::vector<const LauParticlePDG*>::const_iterator iter = allowedDaughters_.begin(); iter != allowedDaughters_.end(); ++iter ) {
147  Int_t code = (*iter)->code();
148  if ( codes[i] == code ) {
149  daughters_[i] = (*iter);
150  cout<<"INFO in LauDaughters::setDaugType : Setting daughter "<<i+1<<" to be "<<daughters_[i]->string()<<" == "<<daughters_[i]->code()<<endl;
151  break;
152  }
153  }
154  if ( ! daughters_[i] ) {
155  cerr<<"ERROR in LauDaughters::setDaugType : Couldn't find a valid daughter called \""<<names[i]<<"\"."<<endl;
156  gSystem->Exit(EXIT_FAILURE);
157  }
158  }
159 
160  // Initialise the various data members concerning particle masses
161  this->sanityCheck();
162 
163  // Check whether we have a symmetrical Dalitz plot
164  this->testDPSymmetry();
165 }
166 
168 {
169  // Check to see if we have a symmetrical DP.
170 
171  symmetricalDP_ = kFALSE;
172  if ( daughters_[0]->code() == daughters_[1]->code() ) {
173  cout<<"We have a symmetrical DP. "<<endl;
174  symmetricalDP_ = kTRUE;
175  } else if ( daughters_[0]->code() == daughters_[2]->code() ) {
176  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."<<endl;
177  } else if ( daughters_[1]->code() == daughters_[2]->code() ) {
178  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."<<endl;
179  }
180 
181 }
182 
184 {
185  // Check masses and charges of daughters
186 
187  Int_t totCharge(0);
188  Double_t totMass(0.0);
189 
190  for ( std::vector<const LauParticlePDG*>::const_iterator iter = daughters_.begin(); iter != daughters_.end(); ++iter ) {
191  totCharge += (*iter)->charge();
192  totMass += (*iter)->mass();
193  }
194 
195  if (totCharge != parent_->charge()) {
196  cerr<<"ERROR in LauDaughters::sanityCheck : Total charge of daughters ("<<totCharge<<") not equal to charge of parent ("<<parent_->charge()<<")."<<endl;
197  gSystem->Exit(EXIT_FAILURE);
198  }
199 
200  if (totMass > parent_->mass()) {
201  cerr<<"ERROR in LauDaughters::sanityCheck : Total mass of daughters ("<<totMass<<") greater than mass of parent ("<<parent_->mass()<<")."<<endl;
202  gSystem->Exit(EXIT_FAILURE);
203  }
204 }
205 
207 {
208  return daughters_[0]->mass();
209 }
210 
212 {
213  return daughters_[1]->mass();
214 }
215 
217 {
218  return daughters_[2]->mass();
219 }
220 
222 {
223  return parent_->mass();
224 }
225 
227 {
228  return daughters_[0]->string();
229 }
230 
232 {
233  return daughters_[1]->string();
234 }
235 
237 {
238  return daughters_[2]->string();
239 }
240 
242 {
243  return parent_->string();
244 }
245 
247 {
248  return daughters_[0]->code();
249 }
250 
252 {
253  return daughters_[1]->code();
254 }
255 
257 {
258  return daughters_[2]->code();
259 }
260 
262 {
263  return parent_->code();
264 }
265 
267 {
268  return daughters_[0]->charge();
269 }
270 
272 {
273  return daughters_[1]->charge();
274 }
275 
277 {
278  return daughters_[2]->charge();
279 }
280 
282 {
283  return parent_->charge();
284 }
285 
286 Int_t LauDaughters::getCharge(Int_t resPairAmpInt) const
287 {
288  Int_t charge = this->getChargeParent();
289  if ( resPairAmpInt>0 && resPairAmpInt<4 ) {
290  charge -= daughters_[resPairAmpInt-1]->charge();
291  }
292  return charge;
293 }
294 
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:62
LauDaughters(Int_t codeParent, Int_t code1, Int_t code2, Int_t code3, Bool_t useSquareDP=kFALSE)
Constructor from PDG codes.
Definition: LauDaughters.cc:30
void createParticleLists()
Create list of all the allowed parent/daughter particles.
Definition: LauDaughters.cc:81
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.