laura is hosted by Hepforge, IPPP Durham
Laura++  v3r0p1
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauResonanceInfo.cc
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2006 - 2014.
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 "LauParameter.hh"
18 #include "LauResonanceInfo.hh"
19 
21 
22 
23 LauResonanceInfo::LauResonanceInfo(const TString& name, const Double_t mass, const Double_t width, const Int_t spin, const Int_t charge, const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory, const Double_t bwRadius) :
24  name_(name),
25  sanitisedName_(""),
26  mass_(0),
27  width_(0),
28  spin_(spin),
29  charge_(charge),
30  bwCategory_(bwCategory),
31  bwRadius_(bwRadius),
32  conjugate_(0),
33  extraPars_()
34 {
35  this->sanitiseName();
36  mass_ = new LauParameter(sanitisedName_+"_MASS",mass,0.0,3.0*mass,kTRUE);
37  mass_->secondStage(kTRUE);
38  width_ = new LauParameter(sanitisedName_+"_WIDTH",width,0.0,3.0*width,kTRUE);
39  width_->secondStage(kTRUE);
40 }
41 
43 {
44  delete mass_; mass_ = 0;
45  delete width_; width_ = 0;
46 }
47 
48 LauResonanceInfo::LauResonanceInfo( const LauResonanceInfo& other, const TString& newName, const Int_t newCharge ) :
49  name_(newName),
50  sanitisedName_(""),
51  mass_(0),
52  width_(0),
53  spin_(other.spin_),
54  charge_(newCharge),
55  bwCategory_(other.bwCategory_),
56  bwRadius_(other.bwRadius_),
57  conjugate_(0),
58  extraPars_()
59 {
60  this->sanitiseName();
61  mass_ = other.mass_->createClone( sanitisedName_+"_MASS" );
62  width_ = other.width_->createClone( sanitisedName_+"_WIDTH" );
63  for ( std::set<LauParameter*>::iterator iter = other.extraPars_.begin(); iter != other.extraPars_.end(); ++iter ) {
64  TString parName = (*iter)->name();
65  parName.Remove(0, parName.Last('_'));
66  parName.Prepend( sanitisedName_ );
67  LauParameter* par = (*iter)->createClone( parName );
68  extraPars_.insert( par );
69  }
70 }
71 
73 {
74  Int_t newCharge = -charge_;
75 
76  TString newName( name_ );
77  Ssiz_t index = newName.Index("+");
78  if ( index != -1 ) {
79  newName.Replace( index, 1, "-" );
80  } else {
81  index = newName.Index("-");
82  if ( index != -1 ) {
83  newName.Replace( index, 1, "+" );
84  }
85  }
86 
87  LauResonanceInfo* conjugate = new LauResonanceInfo( *this, newName, newCharge );
88  conjugate->conjugate_ = this;
89  this->conjugate_ = conjugate;
90 
91  return conjugate;
92 }
93 
95 {
96  LauResonanceInfo* newinfo = new LauResonanceInfo( *this, name, charge_ );
97 
98  sharedParRecords_.push_back(newinfo);
99 
100  return newinfo;
101 }
102 
104 {
105  LauParameter* par(0);
106  for ( std::set<LauParameter*>::iterator iter = extraPars_.begin(); iter != extraPars_.end(); ++iter ) {
107  if ( (*iter)->name() == parName ) {
108  par = (*iter);
109  }
110  }
111  return par;
112 }
113 
115 {
116  bool ok = extraPars_.insert( param ).second;
117  if ( !ok ) {
118  std::cerr << "WARNING in LauResonanceInfo::addExtraParameter : parameter already present, not adding again" << std::endl;
119  return;
120  }
121 
122  if ( conjugate_ != 0 ) {
124  }
125 
126  for ( std::vector<LauResonanceInfo*>::iterator iter = sharedParRecords_.begin(); iter != sharedParRecords_.end(); ++iter ) {
127  (*iter)->addCloneOfExtraParameter(param);
128  }
129 }
130 
132 {
133  TString parName = param->name();
134  parName.Remove(0, parName.Last('_'));
135  parName.Prepend( sanitisedName_ );
136 
137  LauParameter* cloneParam = param->createClone( parName );
138  extraPars_.insert( cloneParam );
139 }
140 
141 std::ostream& operator<<( std::ostream& stream, const LauResonanceInfo& infoRecord )
142 {
143  stream << infoRecord.getName() << ": ";
144  stream << "mass = " << infoRecord.getMass()->value() << ", ";
145  stream << "width = " << infoRecord.getWidth()->value() << ", ";
146  stream << "spin = " << infoRecord.getSpin() << ", ";
147  Int_t charge = infoRecord.getCharge();
148  if ( charge < 0 ) {
149  stream << "charge = " << infoRecord.getCharge() << ", ";
150  } else {
151  stream << "charge = " << infoRecord.getCharge() << ", ";
152  }
153  stream << "BW radius = " << infoRecord.getBWRadius();
154 
155  return stream;
156 }
157 
159 {
161  sanitisedName_ = sanitisedName_.ReplaceAll("+","p");
162  sanitisedName_ = sanitisedName_.ReplaceAll("-","m");
163  sanitisedName_ = sanitisedName_.ReplaceAll("*","st");
164  sanitisedName_ = sanitisedName_.ReplaceAll("(","_");
165  sanitisedName_ = sanitisedName_.ReplaceAll(")","_");
166  sanitisedName_ = sanitisedName_.ReplaceAll("[","_");
167  sanitisedName_ = sanitisedName_.ReplaceAll("]","_");
168  sanitisedName_ = sanitisedName_.ReplaceAll("<","_");
169  sanitisedName_ = sanitisedName_.ReplaceAll(">","_");
170  sanitisedName_ = sanitisedName_.ReplaceAll("{","_");
171  sanitisedName_ = sanitisedName_.ReplaceAll("}","_");
172  sanitisedName_ = sanitisedName_.ReplaceAll(" ","_");
173  sanitisedName_ = sanitisedName_.ReplaceAll("$","");
174  sanitisedName_ = sanitisedName_.ReplaceAll("%","");
175  sanitisedName_ = sanitisedName_.ReplaceAll("&","");
176  sanitisedName_ = sanitisedName_.ReplaceAll("/","");
177  sanitisedName_ = sanitisedName_.ReplaceAll(":","");
178  sanitisedName_ = sanitisedName_.ReplaceAll(";","");
179  sanitisedName_ = sanitisedName_.ReplaceAll("=","");
180  sanitisedName_ = sanitisedName_.ReplaceAll("\\","");
181  sanitisedName_ = sanitisedName_.ReplaceAll("^","");
182  sanitisedName_ = sanitisedName_.ReplaceAll("|","");
183  sanitisedName_ = sanitisedName_.ReplaceAll(",","");
184  sanitisedName_ = sanitisedName_.ReplaceAll(".","");
185  sanitisedName_.Remove(TString::kBoth,'_');
186 }
187 
Int_t getCharge() const
Retrieve the charge of the resonant particle.
TString getName() const
Retrieve the name of the resonant particle.
LauParameter * width_
The width of the resonant particle.
std::vector< LauResonanceInfo * > sharedParRecords_
Other info objects that share parameters with this one.
LauParameter * getMass() const
Retrieve the mass of the resonant particle.
LauResonanceInfo * conjugate_
The conjugate info object.
File containing declaration of LauResonanceInfo class.
ClassImp(LauAbsCoeffSet)
LauParameter()
Default constructor.
Definition: LauParameter.cc:30
Class for defining the properties of a resonant particle.
const TString & name() const
The parameter name.
void addCloneOfExtraParameter(LauParameter *param)
Add a clone of an extra parameter of the resonance.
LauParameter * getWidth() const
Retrieve the width of the resonant particle.
Double_t getBWRadius() const
Retrieve the BW radius of the resonant particle.
LauParameter * mass_
The mass of the resonant particle.
TString sanitisedName_
The name of the resonant particle with illegal characters removed.
LauResonanceInfo(const TString &name, const Double_t mass, const Double_t width, const Int_t spin, const Int_t charge, const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory, const Double_t bwRadius=4.0)
Constructor.
UInt_t getSpin() const
Retrieve the spin of the resonant particle.
Int_t charge_
The charge of the resonant particle.
std::ostream & operator<<(std::ostream &os, const LauComplex &z)
Definition: LauComplex.cc:43
void sanitiseName()
Create the sanitised name by removing characters that are illegal in TBranch names.
File containing declaration of LauParameter class.
TString name_
The name of the resonant particle.
Class for defining the fit parameter objects.
Definition: LauParameter.hh:34
LauParameter * getExtraParameter(const TString &parName)
Retrieve an extra parameter of the resonance.
virtual ~LauResonanceInfo()
Destructor.
TString name_
The parameter name.
void addExtraParameter(LauParameter *param)
Add an extra parameter of the resonance.
Class that implements the Blatt-Weisskopf barrier factor.
LauParameter * createClone(Double_t constFactor=1.0)
Method to create a clone from the parent parameter using the copy constructor.
Double_t value() const
The value of the parameter.
std::set< LauParameter * > extraPars_
Extra parameters.
LauResonanceInfo * createChargeConjugate()
Create the charge conjugate particle info record.
LauResonanceInfo * createSharedParameterRecord(const TString &name)
Create another record that will share parameters with this one.