laura is hosted by Hepforge, IPPP Durham
Laura++  v3r0
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  fullySymmetricDP_(kFALSE)
32 {
33  this->createParticleLists();
34 
35  TString nameParent = LauDatabasePDG::string( codeParent );
36  TString name1 = LauDatabasePDG::string( code1 );
37  TString name2 = LauDatabasePDG::string( code2 );
38  TString name3 = LauDatabasePDG::string( code3 );
39  this->setParentType(nameParent);
40  this->setDaugType(name1, name2, name3);
41 
42  // Create kinematics object
43  kinematics_ = new LauKinematics(this->getMassDaug1(), this->getMassDaug2(), this->getMassDaug3(), this->getMassParent(), useSquareDP);
44 }
45 
46 LauDaughters::LauDaughters(const TString& nameParent, const TString& name1, const TString& name2, const TString& name3, Bool_t useSquareDP) :
47  kinematics_(0),
48  parent_(0),
49  symmetricalDP_(kFALSE),
50  fullySymmetricDP_(kFALSE)
51 {
52  this->createParticleLists();
53 
54  this->setParentType(nameParent);
55  this->setDaugType(name1, name2, name3);
56 
57  // Create kinematics object
58  kinematics_ = new LauKinematics(this->getMassDaug1(), this->getMassDaug2(), this->getMassDaug3(), this->getMassParent(), useSquareDP);
59 }
60 
62 {
63  delete kinematics_; kinematics_ = 0;
64 }
65 
67  kinematics_(0),
68  parent_(0),
69  symmetricalDP_(kFALSE),
70  fullySymmetricDP_(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  std::cout<<"INFO in LauDaughters::setParentType : Setting parent to be "<<parent_->string()<<" == "<<parent_->code()<<std::endl;
127  break;
128  }
129  }
130 
131  if ( ! parent_ ) {
132  std::cerr<<"ERROR in LauDaughters::setParentType : Couldn't find a valid parent called \""<<nameParent<<"\"."<<std::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  std::cout<<"INFO in LauDaughters::setDaugType : Setting daughter "<<i+1<<" to be "<<daughters_[i]->string()<<" == "<<daughters_[i]->code()<<std::endl;
151  break;
152  }
153  }
154  if ( ! daughters_[i] ) {
155  std::cerr<<"ERROR in LauDaughters::setDaugType : Couldn't find a valid daughter called \""<<names[i]<<"\"."<<std::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  fullySymmetricDP_ = kFALSE;
173 
174  if ( daughters_[0]->code() == daughters_[1]->code() && daughters_[0]->code() == daughters_[2]->code() ) {
175  std::cout<<"INFO in LauDaughters::testDPSymmetry : We have a fully symmetric DP. "<<std::endl;
176  fullySymmetricDP_ = kTRUE;
177  } else if ( daughters_[0]->code() == daughters_[1]->code() ) {
178  std::cout<<"INFO in LauDaughters::testDPSymmetry : We have a symmetrical DP. "<<std::endl;
179  symmetricalDP_ = kTRUE;
180  } else if ( daughters_[0]->code() == daughters_[2]->code() ) {
181  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;
182  } else if ( daughters_[1]->code() == daughters_[2]->code() ) {
183  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;
184  }
185 
186 }
187 
189 {
190  // Check masses and charges of daughters
191 
192  Int_t totCharge(0);
193  Double_t totMass(0.0);
194 
195  for ( std::vector<const LauParticlePDG*>::const_iterator iter = daughters_.begin(); iter != daughters_.end(); ++iter ) {
196  totCharge += (*iter)->charge();
197  totMass += (*iter)->mass();
198  }
199 
200  if (totCharge != parent_->charge()) {
201  std::cerr<<"ERROR in LauDaughters::sanityCheck : Total charge of daughters ("<<totCharge<<") not equal to charge of parent ("<<parent_->charge()<<")."<<std::endl;
202  gSystem->Exit(EXIT_FAILURE);
203  }
204 
205  if (totMass > parent_->mass()) {
206  std::cerr<<"ERROR in LauDaughters::sanityCheck : Total mass of daughters ("<<totMass<<") greater than mass of parent ("<<parent_->mass()<<")."<<std::endl;
207  gSystem->Exit(EXIT_FAILURE);
208  }
209 }
210 
212 {
213  return daughters_[0]->mass();
214 }
215 
217 {
218  return daughters_[1]->mass();
219 }
220 
222 {
223  return daughters_[2]->mass();
224 }
225 
227 {
228  return parent_->mass();
229 }
230 
232 {
233  return daughters_[0]->string();
234 }
235 
237 {
238  return daughters_[1]->string();
239 }
240 
242 {
243  return daughters_[2]->string();
244 }
245 
247 {
248  return parent_->string();
249 }
250 
252 {
253  return daughters_[0]->code();
254 }
255 
257 {
258  return daughters_[1]->code();
259 }
260 
262 {
263  return daughters_[2]->code();
264 }
265 
267 {
268  return parent_->code();
269 }
270 
272 {
273  return daughters_[0]->charge();
274 }
275 
277 {
278  return daughters_[1]->charge();
279 }
280 
282 {
283  return daughters_[2]->charge();
284 }
285 
287 {
288  return parent_->charge();
289 }
290 
291 Int_t LauDaughters::getCharge(Int_t resPairAmpInt) const
292 {
293  Int_t charge = this->getChargeParent();
294  if ( resPairAmpInt>0 && resPairAmpInt<4 ) {
295  charge -= daughters_[resPairAmpInt-1]->charge();
296  }
297  return charge;
298 }
299 
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.
Bool_t fullySymmetricDP_
Boolean flag for fully symmetric Dalitz plot.
void setParentType(const TString &nameParent)
Set the parent particle type.
virtual ~LauDaughters()
Destructor.
Definition: LauDaughters.cc:61
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: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:78
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.