MINT2
BW_BW.cpp
Go to the documentation of this file.
1 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
2 // status: Mon 9 Feb 2009 19:18:04 GMT
3 #include <cmath>
4 
5 #include "Mint/Utils.h"
6 #include "Mint/BW_BW.h"
8 //#include "fitSetup.h"
11 
12 #include "Mint/BWFct.h"
13 #include "Mint/FlatFct.h"
14 
15 using namespace std;
16 using namespace MINT;
17 
18 bool bigDbg=false;
19 
20 //bool PDGWithReco=false;
21 bool PDGWithReco=true;
22 
23 bool DoAsLaurenDid = false;
25 
26 BW_BW::BW_BW( const AssociatedDecayTree& decay, const std::string& lineshapePrefix, MINT::MinuitParameterSet* mps)
27  : _eventPtr(0)
28  , _prSq(-9999.0)
29  , _prSqForGofM(-9999.0)
30  , _pABSq(-9999.0)
31  // , _mumsPDGMass(-9999.0)
32  // , _mumsPDGWidth(-9999.0)
33  , _mumsRecoMass2(-9999.0)
34  , _mumsRecoMass(-9999.0)
35  , _Fr_BELLE(-9999.0)
36  , _Fr_PDG_BL(-9999.0)
37  , _GofM(-9999.0)
38  , _mumsPID(0)
39  , _mumsPID_set(false)
40  // , _mumsPDGRadius(-9999.0)
41  , _mumsParity(0)
42  , _dgtrsInternalParity(0)
43  , _twoLPlusOne(-9999)
44  , _daughterRecoMass2(2, -9999.0)
45  , _daughterPDGMass(2, -9999.0)
46  , _daughterWidth(2, -9999.0)
47  , _substitutePDGForReco(false)
48  , _genFct(0)
49  , _mps(mps)
50  , _prefix(lineshapePrefix)
51  , _normBF("NormBF", 2)
52  , _useGlobalRadius(true)
53  , _theDecay(decay)
54  , _gen_s_mi(0)
55  , _gen_s_ma(0)
56  , _RPL(0)
57  , _fittableResonancePropertiesPtr(0)
58  , _fittableGlobalRadiusPtr(0)
59 {
60  // const fitSetup* fs = fitSetup::getMe();
61  resetPDG();
62  if(0 == _mps) _mps = MinuitParameterSet::getDefaultSet();
63 
64  if(_theDecay.nDgtr() > 2 && ! (startOfDecayChain())){
65  std::cout << "WARNING: BW_BW can only properly handle"
66  << "\n > two body decays."
67  << "\n > This: " << _theDecay.oneLiner()
68  << "\n > is a " << _theDecay.nDgtr() << " body decay."
69  << "\n > Please improve me."
70  << std::endl;
71  std::cout << " startOfDecayChain()? " << startOfDecayChain()
72  << " PID " << mumsPID()
73  << std::endl;
74  }
75  /*
76  _RPL = ResonancePropertiesList::getMe();
77  if(_RPL->get(mumsPID())==0){
78  ResonanceProperties* rp= new ResonanceProperties(mumsProperties()->name());
79  _RPL->AddToList(rp);
80  }
81  */
83 }
84 BW_BW::BW_BW(const BW_BW& other)
85  : ILineshape()
86  , FitParDependent(other)
87  , _prSq(other._prSq)
88  , _prSqForGofM(other._prSqForGofM)
89  , _pABSq(other._pABSq)
90  // , _mumsPDGMass(other._mumsPDGMass)
91  // , _mumsPDGWidth(other._mumsPDGWidth)
92  , _mumsRecoMass2(other._mumsRecoMass2)
93  , _mumsRecoMass(other._mumsRecoMass)
94  , _Fr_BELLE(other._Fr_BELLE)
95  , _Fr_PDG_BL(other._Fr_PDG_BL)
96  , _GofM(other._GofM)
97  , _mumsPID(other._mumsPID)
98  , _mumsPID_set(other._mumsPID_set)
99  // , _mumsPDGRadius(other._mumsPDGRadius)
100  , _mumsParity(other._mumsParity)
101  , _dgtrsInternalParity(other._dgtrsInternalParity)
102  , _twoLPlusOne(other._twoLPlusOne)
103  , _daughterRecoMass2(other._daughterRecoMass2)
104  , _daughterPDGMass(other._daughterPDGMass)
105  , _daughterWidth(other._daughterWidth)
106  , _substitutePDGForReco(other._substitutePDGForReco)
107  , _genFct(other._genFct)
108  , _mps(other._mps)
109  , _prefix(other._prefix)
110  , _normBF(other._normBF)
111  , _useGlobalRadius(other._useGlobalRadius)
112  , _theDecay(other._theDecay)
113  , _gen_s_mi(other._gen_s_mi)
114  , _gen_s_ma(other._gen_s_ma)
115  , _RPL(other._RPL)
116  , _fittableResonancePropertiesPtr(0)
117  , _fittableGlobalRadiusPtr(0)
118 {
119 
120  /* if(_RPL->get(mumsPID())==0){
121  ResonanceProperties* rp= new ResonanceProperties(mumsProperties()->name());
122  _RPL->AddToList(rp);
123  }
124  */
126 }
127 
131 }
132 
134  return _mps;
135 }
137  if(0 == _mps) _mps = MinuitParameterSet::getDefaultSet();
138  return _mps;
139 }
140 
142  //_oldPointers.push(getEvent());
143  _eventPtr = &(evt);
144  return true;
145 }
146 
148  return _eventPtr;
149 }
150 
151 int BW_BW::twoLPlusOne() const{
152  if( _twoLPlusOne < 0 ){
153  int externallySetL = _theDecay.getVal().L();
154  if( externallySetL >= 0){
155  _twoLPlusOne = 2* externallySetL + 1;
156  }else{
158  }
159  }
160  return _twoLPlusOne;
161 }
162 
164  bool dbThis=false;
165  int l_1 = abs(mumsSpinValue() - maxDaughterSpinSum());
166  int l_2 = abs(mumsSpinValue() - minDaughterSpinSum());
167 
168  int l = (l_1 < l_2 ? l_1 : l_2);
169  int maxL = mumsSpinValue() + maxDaughterSpinSum();
170 
171  if(dbThis){
172  cout << "BW_BW::lowestPossibleTwoLPlusOne() "
173  << _theDecay.oneLiner()
174  << " before considering parity: " << 2*l+1
175  << " for " << mumsSpinValue()
176  << (mumsParity() > 0 ? "+" : "-")
177  << " -> "
178  << daughterSpinValue(0)
179  << (daughterP(0) > 0 ? "+" : "-")
180  << ", "
181  << daughterSpinValue(1)
182  << (daughterP(1) > 0 ? "+" : "-")
183  << " l = " << l
184  << " and maxL " << maxL
185  << " is weak decay? " << isWeakDecay()
186  << endl;
187  }
188 
189  if(! isWeakDecay()){
190  while((! parityConservingL(l)) && l < maxL) l++;
191  }
192  if(dbThis){
193  if(isWeakDecay()){
194  cout << " is weak decay: mum " << mumsQuarkContent()
195  << " daughters: " << dgtrsQuarkContent() << endl;
196  cout << "is weak decay - would it have made a difference?"
197  << " now l = " << l;
198  int tmpL=l;
199  while((! parityConservingL(tmpL)) && tmpL < maxL) tmpL++;
200  cout << ", would have been: " << tmpL << endl;
201  }
202  cout << "\tBW_BW::lowestPossibleTwoLPlusOne() "
203  << " returning " << 2*l+1
204  << " (l=" << l <<")"
205  << endl;
206  }
207 
208  return 2*l + 1;
209 }
210 
211 bool BW_BW::isWeakDecay() const{
213 }
214 
216  return netQuarkContent(_theDecay); // handles non-res
217 
218  //return mumsProperties()->netQuarkContent();
219 }
220 
221 bool BW_BW::nonResonant() const{
222  return mumsProperties()->isNonResonant();
223 }
224 
226  MultiQuarkContent sum;
227  for(int i=0; i < numDaughters(); i++){
228  sum += daughterQuarkContent(i);
229  }
230  return sum;
231 }
232 
233 bool BW_BW::parityConservingL(int L) const{
234  int PL = (L%2 == 0 ? 1 : -1);
235  return ((PL * dgtrsInternalParity()) == mumsParity());
236 }
237 
238 int BW_BW::mumsParity() const{
239  if( 0 == _mumsParity ){
240  const ParticleProperties* pp = _theDecay.getVal().props();
241  if(0==pp){
242  cout << "ERROR in BW_BW::mumsParity()"
243  << " can't find properties for first element"
244  << " in this decay tree\n" << _theDecay << endl;
245  throw "invalid decay tree in BW_BW::mumsParity()";
246  }
247  _mumsParity = pp->P();
248  }
249  return _mumsParity;
250 }
251 
253  return _theDecay.nDgtr();
254 }
255 int BW_BW::daughterP(int i) const{
256  if( i >= numDaughters() || i < 0){
257  cout << " ERROR in BW_BW::daughterSpinValue:"
258  << " You requested the spin of dgtr number " << i
259  << ". There are " << numDaughters()
260  << " daughters." << endl;
261  return 0;
262  }
263  const ParticleProperties* pp = _theDecay.getDgtrVal(i).props();
264  if(0==pp){
265  cout << "ERROR in BW_BW::daughterP(" << i <<")"
266  << " can't find properties for first element"
267  << " in this decay tree\n" << _theDecay << endl;
268  throw "invalid decay tree in BW_BW::daughterP()";
269  }
270  return pp->P();
271 }
272 
274  if( 0 == _dgtrsInternalParity ){
276  for(int i=0; i < numDaughters(); i++){
278  }
279  }
280  return _dgtrsInternalParity;
281 
282 }
283 
285  int sum=0;
286  for(int i=0; i < numDaughters(); i++){
287  sum += daughterSpinValue(i);
288  }
289  return sum;
290 }
291 
293  if(2 == numDaughters()){
294  return minDaughterSpinSum2();
295  }else if(3 == numDaughters()){
296  return minDaughterSpinSum3();
297  }if(4 == numDaughters()){
298  return minDaughterSpinSum4();
299  }else{
300  cout << "BW_BW::minDaughterSpinSum() WARNING! "
301  << " can't handle more than 4 daughters - have "
302  << numDaughters() << ". Please improve me." << endl;
303  return 0;
304  }
305 }
306 
307 /*
308  generic spin values, no restriction on num daughters
309  - not really needed, implement another day
310 int BW_BW::maxConseqDaughterSpinSum(int minIndex, int maxIndex) const{
311  if(maxIndex < minIndex) return 0;
312  int sum=0;
313  for(int i=minIndex; i <= maxIndex; i++){
314  sum += daughterSpinValue(i);
315  }
316  return sum;
317 }
318 
319 int BW_BW::minConseqDaughterSpinSum(int minIndex, int maxIndex) const{
320  if(minIndex == maxIndex){
321  return daughterSpinValue(minIndex);
322  }else if(minIndex + 1 == maxIndex){
323  return minDaughterPairSpinSum(minIndex, maxIndex);
324  }
325 
326  int minSpinMany = minConseqDaughterSpinSum(minIndex + 1, maxIndex);
327  int minSpinMany = maxConseqDaughterSpinSum(minIndex + 1, maxIndex);
328  int singleSpin = daughterSpinValue(minIndex);
329 
330  if(minSpinMany <= singleSpin && maxSpinMany >= singleSpin){
331  return 0;
332  }else if (minSpinMany > singleSpin){
333  return abs(minSpinMany - singleSpin);
334  }else{
335  return abs(maxSpinMany - singleSpin);
336  }
337 }
338 */
339 
341  return abs(daughterSpinValue(1) - daughterSpinValue(0));
342 }
344  int minSpinPair = minDaughterPairSpinSum(0,1);
345  int maxSpinPair = maxDaughterPairSpinSum(0,1);
346  int otherSpin = daughterSpinValue(2);
347  int min = maxSpinPair + otherSpin;
348  for(int s = minSpinPair; s <= maxSpinPair; s++){
349  int thisMinSpin = abs(s - otherSpin);
350  if(thisMinSpin < min) min=thisMinSpin;
351  }
352  return min;
353 }
355  int minSpinPair1 = minDaughterPairSpinSum(0,1);
356  int maxSpinPair1 = maxDaughterPairSpinSum(0,1);
357 
358  int minSpinPair2 = minDaughterPairSpinSum(2,3);
359  int maxSpinPair2 = maxDaughterPairSpinSum(2,3);
360 
361  int min = maxSpinPair1 + maxSpinPair2;
362  for(int s1 = minSpinPair1; s1 <= maxSpinPair1; s1++){
363  for(int s2 = minSpinPair2; s2 <= maxSpinPair2; s2++){
364  int thisMinSpin = abs(s1 - s2);
365  if(thisMinSpin < min) min=thisMinSpin;
366  }
367  }
368  return min;
369 }
370 
371 int BW_BW::maxDaughterPairSpinSum(int i, int j)const{
372  return daughterSpinValue(i) + daughterSpinValue(j);
373 }
374 
375 int BW_BW::minDaughterPairSpinSum(int i, int j) const{
376  return abs(daughterSpinValue(i) - daughterSpinValue(j));
377 }
378 
379 
381  const ParticleProperties* pp = _theDecay.getVal().props();
382  if(0==pp){
383  cout << "ERROR in BW_BW::mumsProperties()"
384  << " can't find properties for first element"
385  << " in this decay tree\n" << _theDecay << endl;
386  throw "invalid decay tree in BW_BW::mumsProperties()";
387  }
388  return pp;
389 }
390 
392  //cout << "in BW_BW::resonancePropertiesList(): prefix() = " << prefix() << endl;
394  if(0 == _RPL){
395  cout << "ERROR in BW_BW::resonanceProperties()"
396  << " can't find properties for first element"
397  << " in this decay tree\n" << _theDecay << endl;
398  throw "invalid decay tree in BW_BW::resonanceProperties()";
399  }
400  return _RPL;
401 }
402 
405  if(0 == rp){
406  cout << "ERROR in BW_BW::ResonanceProperties()"
407  << " can't find properties for first element"
408  << " in this decay tree\n" << _theDecay << endl;
409  throw "invalid decay tree in BW_BW::mumsFittableProperties()";
410  }
411  return rp;
412 }
413 
416  cout << "something went wrong in BW_BW::mumsFittableProperties() "
417  << " _fittableResonancePropertiesPtr is 0 although it should be"
418  << " set at construction."
419  << " Looking at this decay tree\n" << _theDecay << endl;
420 
421  throw "error in BW_BW::mumsFittableProperties()";
422  }
424 }
425 
427  bool dbThis = false;
428  if(dbThis)cout << "BW_BW::setAllFitParameters() called" << endl;
429  bool s=true;
430  if(0 == resonancePropertiesList()){
431  cout << "big problem in BW_BW::setAllFitParameters"
432  << ", resonancePropertiesList is zero" << endl;
433  throw "BW_BW::setAllFitParameters can't find resonancePropertiesList()";
434  }
435  if(dbThis)cout << "getting _fittableGlobalRadiusPtr" << endl;
436  const FitParameter& rad(resonancePropertiesList()->radius());
437  if(dbThis)cout << "called radius, no crash, now pringint it:" << endl;
438  if(dbThis)cout << "rad is" << rad << endl;
439  if(dbThis)cout << " radius is: " << resonancePropertiesList()->radius() << endl;
441  if(dbThis)cout << "hurray, got _fittableGlobalRadiusPtr" << endl;
442  s &= (0 != _fittableGlobalRadiusPtr);
445  NamedParameter<int> useGlobalRadius(("UseGlobalRadiusFor_"+ resonanceProperties()->nameFromPid(mumsPID()) ).c_str(),1,NamedParameterBase::QUIET);
446  if(useGlobalRadius == 0) _useGlobalRadius = 0;
447  if(dbThis && _useGlobalRadius)cout << "I'll use the global radius for this decay tree\n" << _theDecay << endl;
448  if(dbThis && !_useGlobalRadius)cout << "I'll use the individual radius for this decay tree\n" << _theDecay << endl;
449  return s;
450 }
451 
452 
453 double BW_BW::mumsMass() const{
454  bool dbThis=false;
455  return mumsFittableProperties().mass();
456  // return _RPL->get(mumsPID())->mass();
457  (void)dbThis;
458 }
459 
460 double BW_BW::mumsWidth() const{
461  return mumsFittableProperties().width();
462  // return _RPL->get(mumsPID())->width();
463 }
464 
465 double BW_BW::mumsRadius() const{
466  return mumsFittableProperties().radius();
467  // return _RPL->get(mumsPID())->radius();
468 }
469 
470 double BW_BW::globalRadius() const{
471  if(0 == _fittableGlobalRadiusPtr){
472  cout << "ERROR in BW_BW::Radius()"
473  << " _fittableGlobalRadiusPtr is 0"
474  << ", although it should have been set during construction."
475  << " Looking at this decay tree\n" << _theDecay << endl;
476  throw "invalid decay tree in BW_BW::Radius()";
477  }
478  return *_fittableGlobalRadiusPtr;
479 }
480 
481 double BW_BW::Radius() const{
482  if(_useGlobalRadius) return globalRadius();
483  else return mumsRadius();
484 }
485 
486 /*
487 double BW_BW::mumsPDGMass() const{
488  if(_mumsPDGMass < 0){
489  _mumsPDGMass = mumsProperties()->mass();
490  }
491  return _mumsPDGMass;
492 }
493 
494 double BW_BW::mumsPDGWidth() const{
495  if(_mumsPDGWidth < 0){
496  _mumsPDGWidth = mumsProperties()->width();
497  }
498  return _mumsPDGWidth;
499 }
500 
501 double BW_BW::mumsPDGRadius() const{
502  if(_mumsPDGRadius < -9998){
503  _mumsPDGRadius = mumsProperties()->radius();
504  }
505  return _mumsPDGRadius;
506 }
507 */
508 
509 std::string BW_BW::mumsSpin() const{
510  return mumsProperties()->J();
511 }
512 
514  return atoi(mumsSpin().c_str());
515 }
516 
517 int BW_BW::mumsPID() const{
518  if(! _mumsPID_set){
520  _mumsPID_set = true;
521  }
522  return _mumsPID;
523 }
524 /*
525 bool BW_BW::thisIsD() const{
526  return (abs(mumsPID()) == 421
527  || abs(mumsPID()) == 411
528  || abs(mumsPID()) == 431);
529 }
530 */
531 
533  return ! (_theDecay.hasParent());
534 }
535 
536 
539  double meanM = mumsMass();
540  double width = mumsWidth();
541 
542  double minMass = meanM - nSigma*width/2.0;
543  double maxMass = meanM + nSigma*width/2.0;
544 
545  coord.setMinMax(minMass*minMass, maxMass*maxMass);
546  return coord;
547 }
548 double BW_BW::mumsRecoMass2() const{
549  if(substitutePDGForReco()) return mumsMass()*mumsMass();
550 
551  if(_mumsRecoMass2 < 0){
552  std::vector<int> asi = _theDecay.getVal().asi();
553  if(asi.size() < 2){
554  cout << "ERROR in BW_BW::mumsRecoMass2() "
556  << ", " << _theDecay.getVal().name()
557  << " decays into " << asi.size() << " particles?\n"
558  << _theDecay
559  << endl;
560  }
561  _mumsRecoMass2 = getEvent()->sij(asi);
562  }
563  return _mumsRecoMass2;
564 }
565 
566 TLorentzVector BW_BW::daughterP4(int i) const{
567  // for diagnostics only.
568  if( i >= _theDecay.nDgtr() || i < 0){
569  cout << " ERROR in BW_BW::daughterP4:"
570  << " You requested the 4-momentum of dgtr number " << i
571  << ". There are " << _theDecay.nDgtr()
572  << " daughters." << endl;
573  exit(1);
574  }
576  std::vector<int> asi = dgtr->getVal().asi();
577  if(asi.size() < 2){
578  return getEvent()->p(asi[0]);
579  }else{
580  return TLorentzVector();
581  }
582 }
583 double BW_BW::daughterRecoMass2(int i) const{
585 
586  if( i >= _theDecay.nDgtr() || i < 0){
587  cout << " ERROR in BW_BW::daughterRecoMass2:"
588  << " You requested the mass of dgtr number " << i
589  << ". There are " << _theDecay.nDgtr()
590  << " daughters." << endl;
591  return -9999;
592  }
593  if(_daughterRecoMass2[i] < 0){
594 
596  if(dgtr->isFinalState()){
597  double m = daughterPDGMass(i);
598  _daughterRecoMass2[i] = m*m;
599  //_daughterRecoMass2[i] = daughterP4(i).M2();
600  }else{
601  std::vector<int> asi = dgtr->getVal().asi();
602  if(asi.size() < 2){
603  cout << "ERROR in BW_BW::daughterRecoMass2() "
604  << dgtr->getVal()._pdg_id
605  << ", " << dgtr->getVal().name()
606  << " is associated to " << asi.size() << " particles"
607  << " and is not stable? "
608  << _theDecay
609  << endl;
610 
611  }
612  _daughterRecoMass2[i] = getEvent()->sij(asi);
613  }
614  }
615  return _daughterRecoMass2[i];
616 }
617 double BW_BW::daughterRecoMass(int i) const{
618  if(substitutePDGForReco()) return daughterPDGMass(i);
619 
620  double m2 = daughterRecoMass2(i);
621  if(m2 < 0){
622  cout << " ERROR negative reconstructed mass2"
623  << " in decay:\n " << _theDecay << endl;
624  return - sqrt(-m2);
625  }
626  // cout << " for index " << i << endl;
627  // cout << " m2 = " << m2 << " mass = " << sqrt(m2) << endl;
628  return sqrt(m2);
629 }
630 
631 double BW_BW::mumsRecoMass() const{
632  if(substitutePDGForReco()){
633  return mumsMass();
634  }
635  if(_mumsRecoMass < 0){
636  double m2 = mumsRecoMass2();
637  if(m2 < 0){
638  cout << " ERROR negative reconstructed mass2"
639  << " in decay:\n " << _theDecay << endl;
640  _mumsRecoMass = - sqrt(-m2);
641  }else{
642  _mumsRecoMass = sqrt(m2);
643  }
644  }
645  return _mumsRecoMass;
646 }
647 
648 double BW_BW::daughterPDGMass( const int& i ) const{
649  if( i >= _theDecay.nDgtr() || i < 0 ){
650  cout << " ERROR in BW_BW::daughterPDGMass:"
651  << " You requested the mass of dgtr number " << i
652  << ". There are " << _theDecay.nDgtr()
653  << " daughters." << endl;
654  return -9999;
655  }
656 
657  if( _daughterPDGMass[i] < 0 ){
659  }
660 
663  }
664 
665  return _daughterPDGMass[i];
666 }
667 
668 double BW_BW::daughterWidth(int i) const{
669  if( i >= _theDecay.nDgtr() || i < 0){
670  cout << " ERROR in BW_BW::daughterWidth:"
671  << " You requested the mass of dgtr number " << i
672  << ". There are " << _theDecay.nDgtr()
673  << " daughters." << endl;
674  return -9999;
675  }
676  if(_daughterWidth[i] < 0){
678  }
679  return _daughterWidth[i];
680 }
681 
682 std::string BW_BW::daughterSpin(int i) const{
683  if( i >= _theDecay.nDgtr() || i < 0){
684  cout << " ERROR in BW_BW::daughterSpinValue:"
685  << " You requested the spin of dgtr number " << i
686  << ". There are " << _theDecay.nDgtr()
687  << " daughters." << endl;
688  return "-9999";
689  }
690  return _theDecay.getDgtrVal(i).J();
691 }
693  if( i >= _theDecay.nDgtr() || i < 0){
694  cout << " ERROR in BW_BW::daughterQuarkContent"
695  << " You requested the spin of dgtr number " << i
696  << ". There are " << _theDecay.nDgtr()
697  << " daughters."
698  << "\n\t I'll crash now. Sorry."
699  << endl;
700  throw "can't handle this";
701  }
702 
704  //return _theDecay.getDgtrVal(i).props()->netQuarkContent();
705 }
706 
707 int BW_BW::daughterSpinValue(int i) const{
708  return atoi(daughterSpin(i).c_str());
709 }
710 double BW_BW::Fr(){
711  return Fr_BELLE(prSq());
712 }
714  return Fr_BELLE(prSqForGofM());
715 }
716 double BW_BW::FrMax(){
717  return Fr_BELLE_Max();
718 }
719 
720 double BW_BW::Fr_BELLE(double prSquared){
721  // (ratio of) Blatt-Weisskopf penetration factors
722  // as in BELLE note hep-ex/0406067, pg 5.
723  bool dbThis=false;
724  //if(startOfDecayChain()) dbThis=true;
725 
726  if(dbThis){
727  cout << " mums name " << mumsProperties()->name() << endl;
728  cout << " decay chain " << _theDecay.oneLiner() << endl;
729  cout << " twoLPlusOne: " << twoLPlusOne() << endl;
730  }
731 
732  double Fr_BELLE;
733 
734  //if(_Fr_BELLE < 0){
735  if(twoLPlusOne() == 1){ // spin = 0
736  Fr_BELLE = 1;
737  if(dbThis){
738  cout << " _Fr_BELLE = " << Fr_BELLE << endl;
739  }
740  return Fr_BELLE;
741  }
742  double R = Radius(); // or mumsRadius() ???
743  double R_pr_sq = R*R * prSquared;
744  double R_pAB_sq = R*R * pABSq();
745  if(twoLPlusOne() == 3){ // spin = 1
746  if(dbThis) cout << "in Fr() " << sqrt(prSqForGofM())
747  << ", " << sqrt(prSquared) << endl;
748 
749  if(dbThis)cout << "BW Fr R = " << R << "prSquared = " << prSqForGofM()
750  << " pABSq() " << prSquared
751  << endl;
752  Fr_BELLE = sqrt( (1. + R_pr_sq)/(1. + R_pAB_sq) );
753  }else if(twoLPlusOne() == 5){ // spin == 2
754  double R_pr_4 = R_pr_sq*R_pr_sq;
755  double R_pAB_4 = R_pAB_sq*R_pAB_sq;
756 
757  Fr_BELLE = sqrt( ( 9. + 3.*R_pr_sq + R_pr_4)
758  /( 9. + 3.*R_pAB_sq + R_pAB_4)
759  );
760  } else{
761  std::cout << "BW_BW for decay \n" << _theDecay
762  << "\n ERROR! Can't deal with L == "
763  << twoLPlusOne()
764  << ". Please improve me!"
765  << std::endl;
766  Fr_BELLE = -9999;
767  }
768  //}
769 
770 
771  if(dbThis){
772  cout << "returning _Fr_BELLE = " << Fr_BELLE << endl;
773  }
774  return Fr_BELLE;
775 }
777  // Max value of Blatt-Weisskopf penetration factors
778  // as in BELLE note hep-ex/0406067, pg 5.
779  bool dbThis=false;
780  //if(startOfDecayChain()) dbThis=true;
781 
782  if(dbThis){
783  cout << " mums name " << mumsProperties()->name() << endl;
784  cout << " decay chain " << _theDecay.oneLiner() << endl;
785  cout << " twoLPlusOne: " << twoLPlusOne() << endl;
786  }
787 
788  double FrBelleMax=-9999;
789 
790  if(twoLPlusOne() == 1){ // spin = 0
791  FrBelleMax = 1;
792  if(dbThis){
793  cout << " FrBelleMax = " << FrBelleMax << endl;
794  }
795  return FrBelleMax;
796  }
797  double R = Radius(); // or mumsRadius() ???
798  // double R_pr_sq = R*R * prSq();
799  double R_pr_sq = R*R * prSq();
800  double R_pAB_sq = 0;//R*R * pABSq();
801  if(twoLPlusOne() == 3){ // spin = 1
802  if(dbThis) cout << "in FrMax() " << sqrt(prSq())
803  << ", " << sqrt(pABSq()) << endl;
804 
805  if(dbThis)cout << "BW FrMax R = " << R << "prSq() = " << prSq()
806  << " pABSq() " << pABSq()
807  << endl;
808  FrBelleMax = sqrt( (1. + R_pr_sq)/(1. + R_pAB_sq) );
809  }else if(twoLPlusOne() == 5){ // spin == 2
810  double R_pr_4 = R_pr_sq*R_pr_sq;
811  double R_pAB_4 = 0;//R_pAB_sq*R_pAB_sq;
812 
813  FrBelleMax = sqrt( ( 9. + 3.*R_pr_sq + R_pr_4)
814  /( 9. + 3.*R_pAB_sq + R_pAB_4)
815  );
816  } else{
817  std::cout << "BW_BW for decay \n" << _theDecay
818  << "\n ERROR! Can't deal with L == "
819  << twoLPlusOne()
820  << ". Please improve me!"
821  << std::endl;
822  FrBelleMax = -9999;
823  }
824  if(dbThis){
825  cout << "returning FrBelleMax = " << FrBelleMax << endl;
826  cout << " compare: Fr: " << Fr() << endl;
827  }
828  return FrBelleMax;
829 }
831  // (ratio of) Blatt-Weisskopf penetration factors
832  // as David Asner's PDG review, Table 1 (page 3),
833  // column 2 (BELLE, above is col 3 in the same table)
834 
835  bool dbThis = false;
836  //if(startOfDecayChain()) dbThis=true;
837 
838  if(dbThis){
839  cout << " BW_BW::Fr mums name " << mumsProperties()->name() << endl;
840  cout << " decay chain " << _theDecay.oneLiner() << endl;
841  cout << " twoLPlusOne: " << twoLPlusOne() << endl;
842  }
843 
844  if(_Fr_PDG_BL < 0){
845  if(twoLPlusOne() == 1){ // spin = 0
846  _Fr_PDG_BL = 1;
847  if(dbThis){
848  cout << " _Fr_PDG_BL = " << _Fr_PDG_BL << endl;
849  }
850  return _Fr_PDG_BL;
851  }
852  double R = Radius(); // or mumsRadius() ???
853  // double R_pr_sq = R*R * prSq();
854  double R_pAB_sq = R*R * pABSq();
855 
856  double z = R_pAB_sq;
857 
858  double FrSq = -9999;
859 
860  if(twoLPlusOne() == 3){ // spin = 1
861  if(dbThis) cout << "in Fr() " << sqrt(prSq())
862  << ", " << sqrt(pABSq()) << endl;
863 
864  if(dbThis)cout << "BW Fr R = " << R << "prSq() = " << prSq()
865  << " pABSq() " << pABSq()
866  << endl;
867  FrSq = 2.0*z/(1.0 + z);
868  if(FrSq >=0) _Fr_PDG_BL = sqrt(FrSq);
869  else _Fr_PDG_BL = 0;
870  }else if(twoLPlusOne() == 5){ // spin == 2
871  FrSq = 13.0*z*z / ( (z-3.0)*(z-3.0) + 9*z );
872  if(FrSq >=0) _Fr_PDG_BL = sqrt(FrSq);
873  else _Fr_PDG_BL = 0;
874  }else{
875  std::cout << "BW_BW for decay \n" << _theDecay
876  << "\n ERROR! Can't deal with L == "
877  << twoLPlusOne()
878  << ". Please improve me!"
879  << std::endl;
880  _Fr_PDG_BL = -9999;
881  }
882  }
883  if(dbThis){
884  cout << "returning _Fr_PDG_BL = " << _Fr_PDG_BL << endl;
885  }
886  return _Fr_PDG_BL;
887 }
888 
890  if(! PDGWithReco){
892  , daughterPDGMass(0)
893  , daughterPDGMass(1)
894  );
895  }else{
897  , daughterRecoMass(0)
898  , daughterRecoMass(1)
899  );
900  }
901 }
902 
905  , daughterRecoMass(0)
906  , daughterRecoMass(1)
907  );
908 }
909 
912  , daughterRecoMass(0)
913  , daughterRecoMass(1)
914  );
915 }
916 
918  , double mA
919  , double mB)const{
920  bool dbThis=false;
921 
922  double Msq = mumsMass*mumsMass;
923  if(Msq <=0) return -9999;
924 
925  double mpsq = (mA + mB)*(mA + mB);
926  double mmsq = (mA - mB)*(mA - mB);
927  double num = (Msq - mpsq)*(Msq - mmsq);
928 
929  double returnVal = num/(4*Msq);
930 
931  if(dbThis){
932  double mAB = mumsMass;
933  double EvtGenVal = (((mAB*mAB-mA*mA-mB*mB)*(mAB*mAB-mA*mA-mB*mB)/4.0) -
934  mA*mA*mB*mB)/(mAB*mAB);
935  cout << " BW_BW::twoBody_dgtPsq_in_MumsFrame"
936  << " compare: cleo: " << EvtGenVal
937  << " MINT: " << returnVal
938  << endl;
939  }
940  return returnVal;
941 
942 }
943 
944 double BW_BW::prSqMax() const{
945 
946 
947  std::vector<const AssociatedDecayTreeItem*> dgtrOne =
948  _theDecay.getDgtrTreePtr(0)->finalState();
949  double m1_min=0;
950  for(unsigned int i=0; i < dgtrOne.size(); i++) m1_min += dgtrOne[i]->mass();
951 
952  std::vector<const AssociatedDecayTreeItem*> dgtrTwo =
953  _theDecay.getDgtrTreePtr(1)->finalState();
954  double m2_min=0;
955  for(unsigned int i=0; i < dgtrTwo.size(); i++) m2_min += dgtrTwo[i]->mass();
956 
957  /*
958  double m1 = daughterPDGMass(0) - 0.5*daughterWidth(0);
959  if(m1 < m1_min) m1 = m1_min;
960 
961  double m2 = daughterPDGMass(1) - 0.5*daughterWidth(1);
962  if(m2 < m2_min) m2 = m2_min;
963  */
964 
965  return twoBody_dgtPsq_in_MumsFrame(mumsMass(), m1_min, m2_min);
966 
967  // return mumsPDGMass()*mumsPDGMass()/4.0;
968 }
969 double BW_BW::prSq() const{
970  bool dbThis=false;
971  if(_prSq < 0){
973  if(dbThis && _prSq < 0){ //dbg
974  cout << " BW_BW::prSq()"
975  << " suspicious... pr < 0. This is for:"
976  << "\n mumM PDG " << mumsMass()
977  << ", m1_nominal " << daughterPDGMass(0)
978  << ", m2_nominal " << daughterPDGMass(1)
979  << ", m1_reco " << daughterRecoMass(0)
980  << ", m2_reco " << daughterRecoMass(1)
981  << " _prSq " << _prSq
982  << " will return 0 "
983  << endl;
984  }
985  }
986  if(_prSq < 0) _prSq = 0;
987  return _prSq;
988 }
989 double BW_BW::prSqForGofM() const{
990  bool dbThis=false;
991  if(DoAsLaurenDid) return prSq();
992 
993  if(_prSqForGofM < 0){
994  _prSqForGofM = fabs(twoBody_recodgtPsq_in_MumsPDGFrame()); // forces > 0.
995  }
996  if(dbThis || _prSqForGofM < 0){ //dbg
997  cout << " compare : " << _prSqForGofM
998  << ", " << fabs(twoBody_recodgtPsq_in_MumsPDGFrame())
999  << endl;
1000  cout << " BW_BW::prSqForGofM()"
1001  << " suspicious... pr < 0. This is for:"
1002  << "\n mumM PDG " << mumsMass()
1003  << ", m1_nominal " << daughterPDGMass(0)
1004  << ", m2_nominal " << daughterPDGMass(1)
1005  << ", m1_reco " << daughterRecoMass(0)
1006  << ", m2_reco " << daughterRecoMass(1)
1007  << " _prSq " << _prSqForGofM
1008  << " will return 0 "
1009  << endl;
1010  }
1011  if(_prSqForGofM < 0) _prSqForGofM = 0; // can not happen as I'm using fabs above...
1012  return _prSqForGofM;
1013 }
1014 double BW_BW::pABSq(){
1015  bool dbThis=false;
1016  if(_pABSq < 0 || dbThis){
1018  if(_pABSq < 0 || dbThis){ //dbg
1019  cout << "In " << _theDecay.oneLiner()
1020  << " BW_BW::pABSq()"
1021  << " suspicious... pABSq < 0. This is for:"
1022  << "\n mumM = " << mumsRecoMass()
1023  << "\n, m1 " << daughterRecoMass(0)
1024  << ", p1 " << daughterP4(0) << ", " << daughterP4(0).M()
1025  << "\n , m2 " << daughterRecoMass(1)
1026  << ", p2 " << daughterP4(1) << ", " << daughterP4(1).M()
1027  << " returnVal " << _pABSq
1028  << endl;
1029  }
1030  if(_pABSq < 0) _pABSq = 0;
1031  }
1032  return _pABSq;
1033 }
1034 
1035 double BW_BW::GofM(){
1036  // return mumsWidth(); // debug only!
1037  bool dbThis=false;
1038  if(_GofM < 0){
1039  double densq = prSqForGofM();
1040  double numsq = pABSq();
1041  if(numsq < 0){
1042  cout << "ERROR in BW_BW::GofM() for decay\n"
1043  << _theDecay
1044  << "\n ERROR: pABSq() = " << pABSq() << endl;
1045  _GofM = -9999;
1046  return _GofM;
1047  }
1048  double epsilon = 1 * eV*eV;
1049  if(0.0 == densq ) densq = epsilon;
1050 
1051  double pratio = 1;
1052  if(densq > 0 && numsq >=0){
1053  pratio = sqrt(numsq/densq);
1054  }
1055  if(dbThis){
1056  cout << "pratio = sqrt( " << numsq << " / " << densq << " )" << endl;
1057  }
1058  double pratio_to_2Jplus1 = 1;
1059  if(dbThis) cout << " pratio "
1060  << pratio
1061  // << "^ 2*mumsSpinValue() + 1 = "; //dbg
1062  << "^ " << twoLPlusOne() << " = "; //dbg
1063  // for(int i=0; i < 2*mumsSpinValue() + 1; i++){
1064  for(int i=0; i < twoLPlusOne(); i++){
1065  pratio_to_2Jplus1 *= pratio;
1066  }
1067  if(dbThis) cout << pratio_to_2Jplus1 << endl;//dbg
1068 
1069  densq = mumsRecoMass2();
1070  if(densq <= 0){
1071  cout << "ERROR in BW_BW::GofM() for decay\n"
1072  << _theDecay
1073  << ": ERROR: mumsRecoMass() = "
1074  << mumsRecoMass() << endl;
1075  _GofM = -9999;
1076  return _GofM;
1077  }
1078  double mRatio = mumsMass()/sqrt(densq);
1079  // this factor varies for different final states - check!!
1080 
1081  double thisFr = FrForGofM();
1082  if(dbThis) cout << "GofM() = " << mumsWidth() << " * " // dbg
1083  << pratio_to_2Jplus1 << " * "
1084  << mRatio << " * "
1085  << thisFr << " * " << thisFr
1086  << endl;
1087  _GofM = mumsWidth() * pratio_to_2Jplus1 * mRatio * thisFr*thisFr;
1088  if(dbThis) cout << " so, GofM/G0 = " << _GofM/mumsWidth() << endl;
1089  }
1090  return _GofM;
1091 }
1092 
1093 std::complex<double> BW_BW::BreitWigner() {
1094  double mass = mumsMass();
1095  double width = mumsWidth();
1096 
1097  double gamma = sqrt(mass*mass*(mass*mass+width*width));
1098  double k = mass*width*gamma/sqrt(mass*mass+gamma);
1099 
1100  std::complex<double> BW(mass*mass - mumsRecoMass2(), mass * GofM());
1101  double den = (mass*mass - mumsRecoMass2())*(mass*mass - mumsRecoMass2()) + mass * GofM() * mass * GofM();
1102 
1103  //std::complex<double> invBW(mass*mass - mumsRecoMass2(), - mass * GofM());
1104  //return 1.*GeV*GeV/invBW;
1105  return sqrt(k)*BW/den;
1106  // return std::complex<Double_t>(ReBreitWigner(), ImBreitWigner());
1107 }
1108 
1109 void BW_BW::setGenerationLimits(double mi, double ma){
1110  _gen_s_mi = mi;
1111  _gen_s_ma = ma;
1112 }
1113 
1116 
1118  for(int i=0; i< _theDecay.nDgtr(); i++){
1119  _daughterRecoMass2[i] = -1;
1120  }
1121 }
1122 
1124  // _mumsPDGMass = _mumsPDGWidth = -1;
1125  _mumsPID_set = false;
1126  // _mumsPDGRadius = -9999.0;
1127 
1128  _daughterPDGMass.resize(_theDecay.nDgtr());
1129  for(int i=0; i< _theDecay.nDgtr(); i++){
1130  _daughterPDGMass[i] = -1;
1131  }
1132  _daughterWidth.resize(_theDecay.nDgtr());
1133  for(int i=0; i< _theDecay.nDgtr(); i++){
1134  _daughterWidth[i] = -1;
1135  }
1136 }
1137 
1138 std::complex<double> BW_BW::getVal(IDalitzEvent& evt){
1139  bool dbThis= false; // bigDbg;
1140 
1141  setEventPtr(evt);
1142  resetInternals();
1143 
1144  double formFactor= 1.;
1145  if( _normBF == 1 ) formFactor = Fr();
1146  else if( _normBF == 0 ) formFactor = Fr_PDG_BL();
1147  else if(_normBF == 2 ) formFactor = Fr_BELLE(0.);
1148  else if(_normBF == 3 ) formFactor = pow(pABSq(),GetAlpha());
1149 
1150  if( nonResonant() ){
1151  return formFactor;
1152  }
1153 
1154  if(startOfDecayChain()){
1155  // in principle there is no need to distinguish the start
1156  // of the decay chain from the rest - it could just get
1157  // a Breit Wigner (with a constant value of the width of
1158  // the D is zero, as usual). However,
1159  // this is to comply with the usual convention: Only the
1160  // form factor, not the BW-propagator.
1161  if (compareToOldRooFit){
1162  return 1;
1163  }
1164  if(_theDecay.nDgtr() > 2){
1165  // all calculations of Fr etc are meaningless in this case
1166  // assume Fr=1;
1167  if(dbThis){
1168  cout << "BW_BW::getVal() for " << name() << endl;
1169  cout << "instead of Fr() for 2l+1 = " << twoLPlusOne() << endl;
1170  cout << " I'll return 1 " << endl;
1171  }
1172  return 1;
1173  }
1174  return formFactor;
1175  }
1176 
1177  if(dbThis){
1178  if(0 != getEvent()){
1179  cout << "BW pz " << getEvent()->p(1).Z() << endl;
1180  }
1181  cout << " BW_BW for "
1182  << _theDecay.oneLiner() << endl; // dbg
1183  cout << "\n > nominalMass " << mumsMass()
1184  << "\n > nominalWidth " << mumsWidth()
1185  << "\n > GoM() " << GofM()
1186  << "\n > Fr() " << Fr()
1187  << "\n > FrForGofM " <<FrForGofM()
1188  << "\n > Fr_BELLE() " <<Fr_BELLE(0.)
1189  << "\n > BW " << BreitWigner()
1190  << "\n > FR*BW = " << Fr() * BreitWigner()
1191  << "\n > recoMass " << mumsRecoMass()
1192  << "\n > EvtGenValue " << EvtGenValue(*(getEvent()))
1193  << endl;
1194  }
1195 
1196  const std::complex<double> returnVal = formFactor*BreitWigner();
1197 
1198  if(dbThis) cout << " value = " << returnVal
1199  << "|A|^2 | " << returnVal.real()*returnVal.real()
1200  + returnVal.imag()*returnVal.imag()
1201  << endl; //dbg
1202 
1203  return returnVal;
1204 }
1205 
1206 
1207 double BW_BW::peakShift() const{
1208  // from: J.D. Jackson, Il Nuovo Cimento, Siere X, Vol 34, pag 1644-1666
1209  // 16 Dicembre 1964
1210  // equation 10. (refers to (4)).
1211  //
1212  double m1 = daughterPDGMass(0);
1213  double m2 = daughterPDGMass(1);
1214 
1215  double m1s = m1*m1;
1216  double m2s = m2*m2;
1217 
1218  double om = mumsMass();
1219  double om2 = om*om;
1220  double om4 = om2*om2;
1221 
1222  double G = mumsWidth();
1223 
1224  double mpm = m1s + m2s;
1225  double mmm = m1s - m2s;
1226  double mmm2 = mmm*mmm;
1227 
1228  double num = om4 - mmm2;
1229  double den = om4 - 2*mpm*om2 + mmm2;
1230 
1231  double f1 = ((double) twoLPlusOne())/8.0;
1232  double f2 = G*G/om;
1233  double f3 = num/den;
1234 
1235  return f1*f2*f3;
1236 }
1237 double BW_BW::peakPosition() const{
1238  // from: J.D. Jackson, Il Nuovo Cimento, Siere X, Vol 34, pag 1644-1666
1239  // 16 Dicembre 1964
1240  // equation 10. (refers to (4)).
1241  //
1242  return mumsMass() + peakShift();
1243 }
1244 
1246  if(! _genFct){
1247 
1248  std::vector< const_counted_ptr<DDTree<AssociatedDecayTreeItem> > > sister = _theDecay.getSistersTrees() ;
1249 
1250  if(nonResonant()){
1252  _genFct = gptr;
1253  }
1254  else if(sister.size()>0){
1255  for (unsigned int i = 0; i< sister.size(); i++) {
1256  if(sister[i]->getVal().props()->isNonResonant()){
1258  _genFct = gptr;
1259  return;
1260  }
1261  }
1262  }
1265  , mumsMass()
1266  , mumsWidth() * 1.02 ));
1267  _genFct = gptr;
1268  }else{
1270  , peakPosition()
1271  , mumsWidth() * 2. ));
1272  _genFct = gptr;
1273  }
1274  }
1275 }
1276 
1278  if(! _genFct){
1280  }
1281  return _genFct;
1282 }
1283 
1284 void BW_BW::print(std::ostream& out)const {
1285  out << name();
1286 }
1287 void BW_BW::print(IDalitzEvent& evt, std::ostream& out) {
1288  setEventPtr(evt);
1289  resetInternals();
1290  out << name()
1291  << "\n\t> co-ordinate: " << getDalitzCoordinate()
1292  << "\n\t> This is the decay I'm looking at:"
1293  << "\n" << _theDecay
1294  << "\n\t> These are a few values: "
1295  << " startOfDecayChain? " << startOfDecayChain()
1296  << ", BreitWigner = "
1297  << BreitWigner()
1298  << ", Blatt-Weisskopf penetration factor: "
1299  << Fr()
1300  << ", total BW_BW: "
1301  << getVal(evt);
1302 }
1303 
1304 std::complex<double> BW_BW::EvtGenValue(IDalitzEvent& evt){
1305  // For debugging only.
1306  // This is the EvtGen version of the full 3-body amplitude
1307  // (cut'n'paste with minimal changes).
1308  // BW_BW only returns only the Breit Wigner plus form factor for one
1309  // resonance. So don't compare with BW_BW, but with Amplitude. This
1310  // function is part of BW_BW for convencience, BW_BW provides all
1311  // the "services" needed to compute this.
1312 
1313  setEventPtr(evt);
1314  double pi180inv = pi/108.0;//1.0/EvtConst::radToDegrees;
1315 
1316  complex<double> ampl(0,0);
1317  double magn =1;
1318  double theta = 0;
1319 
1320  int spin = (twoLPlusOne() -1)/2;
1321 
1322  // get parent
1323  if(0 == _theDecay.hasParent()) {
1324  return -9999;
1325  }
1326  TLorentzVector p4_p = getEvent()->p(0) * (1./GeV);
1327  TLorentzVector p4_d1 = getEvent()->p(_theDecay.getDgtrTreePtr(0)->getVal().asi()[0]) * (1./GeV);
1328  TLorentzVector p4_d2 = getEvent()->p(_theDecay.getDgtrTreePtr(1)->getVal().asi()[0]) * (1./GeV);
1329  TLorentzVector p4_d3 = p4_p-p4_d1-p4_d2;
1330 
1331  //get cos of the angle between the daughters from their 4-momenta
1332  //and the 4-momentum of the parent
1333 
1334  //in general, EvtDecayAngle(parent, part1+part2, part1) gives the angle
1335  //the missing particle (not listed in the arguments) makes
1336  //with part2 in the rest frame of both
1337  //listed particles (12)
1338 
1339  //angle 3 makes with 2 in rest frame of 12 (CS3)
1340  //double cos_phi_0 = EvtDecayAngle(p4_p, p4_d1+p4_d2, p4_d1);
1341  //angle 3 makes with 1 in 12 is, of course, -cos_phi_0
1342 
1343  //first compute several quantities...follow CLEO preprint 00-23
1344 
1345  bool invmass_angdenom = false;
1346  double bwm = mumsMass() / GeV;
1347  double gamma = mumsWidth() / GeV;
1348 
1349  double mAB=(p4_d1+p4_d2).M();
1350  double mBC=(p4_d2+p4_d3).M();
1351  double mAC=(p4_d1+p4_d3).M();
1352  double mA=p4_d1.M();
1353  double mB=p4_d2.M();
1354  double mD=p4_p.M();
1355  double mC=p4_d3.M();
1356 
1357  double mR=bwm;
1358  double mdenom = invmass_angdenom ? mAB : mR;
1359  double gammaR = gamma;
1360  double pAB=sqrt( (((mAB*mAB-mA*mA-mB*mB)*(mAB*mAB-mA*mA-mB*mB)/4.0) -
1361  mA*mA*mB*mB)/(mAB*mAB));
1362  double pR=sqrt( (((mR*mR-mA*mA-mB*mB)*(mR*mR-mA*mA-mB*mB)/4.0) -
1363  mA*mA*mB*mB)/(mR*mR));
1364 
1365  double pD= (((mD*mD-mR*mR-mC*mC)*(mD*mD-mR*mR-mC*mC)/4.0) -
1366  mR*mR*mC*mC)/(mD*mD);
1367  if ( pD>0 ) { pD=sqrt(pD); } else {pD=0;}
1368  double pDAB=sqrt( (((mD*mD-mAB*mAB-mC*mC)*(mD*mD-mAB*mAB-mC*mC)/4.0) -
1369  mAB*mAB*mC*mC)/(mD*mD));
1370 
1371 
1372  // report(INFO,"EvtGen") << mAB<<" "<< mBC<<" "<< mAC<<" "<< mA<<" "<< mB<<" "<< mC<<" "
1373  // << mD<<" "<< mR<<" "<< gammaR<<" "<< pAB<<" "<< pR<<" "<< pD<<" "<<pDAB<<endl;
1374 
1375  double fR=1;
1376  double fD=1;
1377  int power=0;
1378  switch (spin) {
1379  case 0:
1380  fR=1.0;
1381  fD=1.0;
1382  power=1;
1383  //report(INFO,"EvtGen") << "fR="<<fR<<" fD="<<fD<<endl;
1384  break;
1385  case 1:
1386  fR=sqrt(1.0+1.5*1.5*pR*pR)/sqrt(1.0+1.5*1.5*pAB*pAB);
1387  fD=sqrt(1.0+5.0*5.0*pD*pD)/sqrt(1.0+5.0*5.0*pDAB*pDAB);
1388  //report(INFO,"EvtGen") << "fR="<<fR<<" fD="<<fD<<endl;
1389  power=3;
1390  break;
1391  case 2:
1392  fR = sqrt( (9+3*pow((1.5*pR),2)+pow((1.5*pR),4))/(9+3*pow((1.5*pAB),2)+pow((1.5*pAB),4)) );
1393  fD = sqrt( (9+3*pow((5.0*pD),2)+pow((5.0*pD),4))/(9+3*pow((5.0*pDAB),2)+pow((5.0*pDAB),4)) );
1394  power=5;
1395  //report(INFO,"EvtGen") << "fR="<<fR<<" fD="<<fD<<std::endl;
1396  break;
1397 
1398 
1399 
1400  default:
1401  ;//report(INFO,"EvtGen") << "Incorrect spin in EvtResonance22.cc\n";
1402  }
1403 
1404  cout << "EvtGen: fR = " << fR << ", fD = " << fD << endl;
1405 
1406  // report(INFO,"EvtGen") << "fR = " << fR << " fD = " << fD << endl;
1407 
1408  double gammaAB= gammaR*pow(pAB/pR,power)*(mR/mAB)*fR*fR;
1409  cout << "EvtGen: gamma AB = " << gammaAB << endl;
1410  //report(INFO,"EvtGen") << gammaAB<<endl;
1411  double sf;
1412  switch (spin) {
1413  case 0:
1414  ampl=magn*complex<double>(cos(theta*pi180inv),sin(theta*pi180inv))*
1415  fR*fD/(mR*mR-mAB*mAB-complex<double>(0.0,mR*gammaAB));
1416  sf=1;
1417  break;
1418  case 1:
1419  ampl=magn*complex<double>(cos(theta*pi180inv),sin(theta*pi180inv))*
1420  (fR*fD*(mAC*mAC-mBC*mBC+((mD*mD-mC*mC)*(mB*mB-mA*mA)/(mdenom*mdenom)))/
1421  (mR*mR-mAB*mAB-complex<double>(0.0,mR*gammaAB)));
1422 
1423  sf = mAC*mAC-mBC*mBC+((mD*mD-mC*mC)*(mB*mB-mA*mA)/(mdenom*mdenom));
1424  cout << "EvtGen: sf spin 1 : " << sf << endl;
1425  break;
1426  case 2:
1427 // ampl=magn*complex<double>(cos(theta*pi180inv),sin(theta*pi180inv))*
1428 // fR*fD/(mR*mR-mAB*mAB-complex<double>(0.0,mR*gammaAB))*
1429 // (pow((mBC*mBC-mAC*mAC+(mD*mD-mC*mC)*(mA*mA-mB*mB)/(mAB*mAB)),2)-
1430 // (1.0/3.0)*(mAB*mAB-2*mD*mD-2*mC*mC+pow((mD*mD- mC*mC)/mAB, 2))*
1431 // (mAB*mAB-2*mA*mA-2*mB*mB+pow((mA*mA-mB*mB)/mAB,2)));
1432  ampl=magn*complex<double>(cos(theta*pi180inv),sin(theta*pi180inv))*
1433  fR*fD/(mR*mR-mAB*mAB-complex<double>(0.0,mR*gammaAB))*
1434  (pow((mBC*mBC-mAC*mAC+(mD*mD-mC*mC)*(mA*mA-mB*mB)/(mdenom*mdenom)),2)-
1435  (1.0/3.0)*(mAB*mAB-2*mD*mD-2*mC*mC+pow((mD*mD- mC*mC)/mdenom, 2))*
1436  (mAB*mAB-2*mA*mA-2*mB*mB+pow((mA*mA-mB*mB)/mdenom,2)));
1437 
1438  sf = pow((mBC*mBC-mAC*mAC+(mD*mD-mC*mC)*(mA*mA-mB*mB)/(mdenom*mdenom)),2)-
1439  (1.0/3.0)*(mAB*mAB-2*mD*mD-2*mC*mC+pow((mD*mD- mC*mC)/mdenom, 2))*
1440  (mAB*mAB-2*mA*mA-2*mB*mB+pow((mA*mA-mB*mB)/mdenom,2));
1441  cout << "EvtGen: sf spin 2 " << sf << endl;
1442  break;
1443 
1444  default:
1445  ;//report(INFO,"EvtGen") << "Incorrect spin in EvtResonance22.cc\n";
1446  }
1447 
1448  //report(INFO,"EvtGen") <<"The amplitude is "<<ampl<<endl;
1449  return ampl;
1450 
1451 }
1452 
1453 std::ostream& operator<<(std::ostream& out, const BW_BW& amp){
1454  amp.print(out);
1455  return out;
1456 }
1457 
1458 
1459 //
virtual double prSqForGofM() const
Definition: BW_BW.cpp:989
virtual int daughterP(int i) const
Definition: BW_BW.cpp:255
ResonancePropertiesList * _RPL
Definition: BW_BW.h:97
const MINT::MinuitParameterSet * getMinuitParameterSet() const
Definition: BW_BW.cpp:133
virtual double prSq() const
Definition: BW_BW.cpp:969
virtual void resetInternals()
Definition: BW_BW.cpp:1114
double _gen_s_ma
Definition: BW_BW.h:70
std::vector< MINT::const_counted_ptr< DDTree< ValueType > > > getSistersTrees() const
Definition: DDTree.h:271
virtual double Fr()
Definition: BW_BW.cpp:710
double _prSq
Definition: BW_BW.h:35
bool compareToOldRooFit
Definition: BW_BW.cpp:24
bool bigDbg
Definition: BW_BW.cpp:18
virtual double FrForGofM()
Definition: BW_BW.cpp:713
virtual const ParticleProperties * mumsProperties() const
Definition: BW_BW.cpp:380
virtual bool parityConservingL(int L) const
Definition: BW_BW.cpp:233
std::vector< double > _daughterPDGMass
Definition: BW_BW.h:47
int _twoLPlusOne
Definition: BW_BW.h:44
virtual bool isWeakDecay() const
Definition: BW_BW.cpp:211
std::ostream & operator<<(std::ostream &out, const BW_BW &amp)
Definition: BW_BW.cpp:1453
const AssociatedDecayTree & _theDecay
Definition: BW_BW.h:69
virtual double mumsMass() const
Definition: BW_BW.cpp:453
virtual double Radius() const
Definition: BW_BW.cpp:481
virtual int minDaughterPairSpinSum(int i, int j) const
Definition: BW_BW.cpp:375
virtual double daughterPDGMass(const int &i) const
Definition: BW_BW.cpp:648
virtual int daughterSpinValue(int i) const
Definition: BW_BW.cpp:707
virtual int twoLPlusOne() const
Definition: BW_BW.cpp:151
virtual void resetPDG()
Definition: BW_BW.cpp:1123
static const double pi
bool setEventPtr(IDalitzEvent &evt) const
Definition: BW_BW.cpp:141
int _mumsParity
Definition: BW_BW.h:42
int _dgtrsInternalParity
Definition: BW_BW.h:42
static const double s
virtual int dgtrsInternalParity() const
Definition: BW_BW.cpp:273
MINT::MinuitParameterSet * _mps
Definition: BW_BW.h:59
virtual MultiQuarkContent daughterQuarkContent(int i) const
Definition: BW_BW.cpp:692
virtual std::complex< double > EvtGenValue(IDalitzEvent &evt)
Definition: BW_BW.cpp:1304
bool PDGWithReco
Definition: BW_BW.cpp:21
virtual double sij(const MINT::PolymorphVector< int > &indices) const =0
std::string J() const
double _gen_s_mi
Definition: BW_BW.h:70
virtual int mumsPID() const
Definition: BW_BW.cpp:517
double _prSqForGofM
Definition: BW_BW.h:35
virtual double FrMax()
Definition: BW_BW.cpp:716
virtual void setGenerationLimits(double mi, double ma)
Definition: BW_BW.cpp:1109
virtual double prSqMax() const
Definition: BW_BW.cpp:944
virtual void print(IDalitzEvent &evt, std::ostream &out=std::cout)
Definition: BW_BW.cpp:1287
bool setAllFitParameters()
Definition: BW_BW.cpp:426
const ValueType & getVal() const
Definition: DDTree.h:102
virtual double daughterRecoMass2(int i) const
Definition: BW_BW.cpp:583
Definition: BW_BW.h:30
virtual int minDaughterSpinSum4() const
Definition: BW_BW.cpp:354
virtual double daughterRecoMass(int i) const
Definition: BW_BW.cpp:617
Definition: BWFct.h:11
static ResonancePropertiesList * getMe(const std::string &prefix="", MINT::MinuitParameterSet *mps=0)
bool isFinalState() const
Definition: DDTree.h:93
virtual double Fr_PDG_BL()
Definition: BW_BW.cpp:830
BW_BW(const AssociatedDecayTree &decay, const std::string &lineshapePrefix="", MINT::MinuitParameterSet *mps=0)
Definition: BW_BW.cpp:26
virtual int minDaughterSpinSum3() const
Definition: BW_BW.cpp:343
virtual double globalRadius() const
Definition: BW_BW.cpp:470
double mass() const
IDalitzEvent * getEvent() const
Definition: BW_BW.cpp:147
virtual int mumsSpinValue() const
Definition: BW_BW.cpp:513
bool nonResonant() const
Definition: BW_BW.cpp:221
double peakPosition() const
Definition: BW_BW.cpp:1237
virtual int maxDaughterPairSpinSum(int i, int j) const
Definition: BW_BW.cpp:371
MINT::const_counted_ptr< DDTree< ValueType > > getDgtrTreePtr(int i) const
Definition: DDTree.h:114
bool hasParent() const
Definition: DDTree.h:154
virtual int minDaughterSpinSum2() const
Definition: BW_BW.cpp:340
virtual const TLorentzVector & p(unsigned int i) const =0
virtual double mumsRecoMass2() const
Definition: BW_BW.cpp:548
virtual double Fr_BELLE_Max()
Definition: BW_BW.cpp:776
virtual ~BW_BW()
Definition: BW_BW.cpp:128
MultiQuarkContent netQuarkContent(const DecayTree &dt_in)
Definition: DecayTree.cpp:33
bool DoAsLaurenDid
Definition: BW_BW.cpp:23
virtual std::string daughterSpin(int i) const
Definition: BW_BW.cpp:682
virtual MultiQuarkContent dgtrsQuarkContent() const
Definition: BW_BW.cpp:225
double _pABSq
Definition: BW_BW.h:35
static const double rad
static const double m2
static const double m
virtual TLorentzVector daughterP4(int i) const
Definition: BW_BW.cpp:566
std::vector< double > _daughterRecoMass2
Definition: BW_BW.h:47
bool compatible(const MultiQuarkContent &other) const
virtual MultiQuarkContent mumsQuarkContent() const
Definition: BW_BW.cpp:215
int _mumsPID
Definition: BW_BW.h:37
double GetAlpha() const
Definition: BW_BW.h:116
virtual double pABSq()
Definition: BW_BW.cpp:1014
MINT::NamedParameter< int > _normBF
Definition: BW_BW.h:66
virtual ResonancePropertiesFitRef & mumsFittableProperties() const
Definition: BW_BW.cpp:414
static const double GeV
double _Fr_BELLE
Definition: BW_BW.h:35
virtual bool startOfDecayChain() const
Definition: BW_BW.cpp:532
std::string J() const
int L() const
Definition: DecayTreeItem.h:59
virtual double Fr_BELLE(double prSquared)
Definition: BW_BW.cpp:720
MINT::FitParRef * _fittableGlobalRadiusPtr
Definition: BW_BW.h:99
std::string name() const
bool substitutePDGForReco() const
Definition: BW_BW.h:73
std::string name() const
virtual MINT::counted_ptr< IGenFct > generatingFunction() const
Definition: BW_BW.cpp:1277
virtual double twoBody_recodgtPsq_in_MumsPDGFrame() const
Definition: BW_BW.cpp:903
const ResonanceProperties * resonanceProperties() const
Definition: BW_BW.cpp:403
virtual double GofM()
Definition: BW_BW.cpp:1035
virtual double mumsRecoMass() const
Definition: BW_BW.cpp:631
const MINT::FitParameter & radius() const
bool _mumsPID_set
Definition: BW_BW.h:38
virtual double mumsWidth() const
Definition: BW_BW.cpp:460
int nDgtr() const
Definition: DDTree.h:96
double width() const
virtual int mumsParity() const
Definition: BW_BW.cpp:238
virtual double mumsRadius() const
Definition: BW_BW.cpp:465
bool isNonResonant() const
void oneLiner(std::stringstream &seam, int generation=0) const
Definition: DDTree.h:375
const std::vector< int > & asi() const
double peakShift() const
Definition: BW_BW.cpp:1207
const ParticleProperties * props() const
virtual int numDaughters() const
Definition: BW_BW.cpp:252
static const double eV
ResonancePropertiesList * resonancePropertiesList() const
Definition: BW_BW.cpp:391
double _Fr_PDG_BL
Definition: BW_BW.h:35
std::vector< double > _daughterWidth
Definition: BW_BW.h:47
virtual double twoBody_dgtPsq_in_MumsRecoFrame()
Definition: BW_BW.cpp:910
double _GofM
Definition: BW_BW.h:35
virtual int lowestPossibleTwoLPlusOne() const
Definition: BW_BW.cpp:163
virtual std::string name() const
Definition: BW_BW.h:198
ResonancePropertiesFitRef * _fittableResonancePropertiesPtr
Definition: BW_BW.h:98
virtual std::string mumsSpin() const
Definition: BW_BW.cpp:509
virtual double daughterWidth(int i) const
Definition: BW_BW.cpp:668
virtual int minDaughterSpinSum() const
Definition: BW_BW.cpp:292
virtual double twoBody_dgtPsq_in_MumsFrame(double mumsMass, double mA, double mB) const
Definition: BW_BW.cpp:917
virtual int maxDaughterSpinSum() const
Definition: BW_BW.cpp:284
MINT::counted_ptr< IGenFct > _genFct
Definition: BW_BW.h:51
bool _useGlobalRadius
Definition: BW_BW.h:67
virtual double twoBody_dgtPsq_in_MumsPDGFrame() const
Definition: BW_BW.cpp:889
virtual std::complex< double > getVal(IDalitzEvent &evt)
Definition: BW_BW.cpp:1138
const ValueType & getDgtrVal(int i) const
Definition: DDTree.h:108
const std::string & prefix() const
Definition: BW_BW.h:72
double _mumsRecoMass2
Definition: BW_BW.h:35
virtual std::complex< double > BreitWigner()
Definition: BW_BW.cpp:1093
virtual DalitzCoordinate getDalitzCoordinate(double nSigma=3) const
Definition: BW_BW.cpp:537
IDalitzEvent * _eventPtr
Definition: BW_BW.h:32
double _mumsRecoMass
Definition: BW_BW.h:35
void makeGeneratingFunction() const
Definition: BW_BW.cpp:1245
const ResonanceProperties * AddToListIfMissing(int pdg)