evtgen is hosted by Hepforge, IPPP Durham
EvtGen  2.0.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
EvtManyDeltaFuncLineShape.cpp
Go to the documentation of this file.
1 
2 /***********************************************************************
3 * Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4 * *
5 * This file is part of EvtGen. *
6 * *
7 * EvtGen is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * EvtGen is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19 ***********************************************************************/
20 
22 
24 #include "EvtGenBase/EvtPDL.hh"
25 #include "EvtGenBase/EvtPatches.hh"
28 #include "EvtGenBase/EvtRandom.hh"
31 
33 {
34 }
35 
37  double maxRange,
39 {
40  _mass = mass;
41  _width = width;
42  _spin = sp;
43  _maxRange = maxRange;
44 
45  double maxdelta = width;
46 
47  _massMax = mass + maxdelta;
48  _massMin = mass - maxdelta;
49 
50  if ( _massMin < 0. )
51  _massMin = 0.;
52 }
53 
55  const EvtManyDeltaFuncLineShape& x ) :
56  EvtAbsLineShape( x )
57 {
58  _mass = x._mass;
59  _width = x._width;
60  _spin = x._spin;
61  _massMax = x._massMax;
62  _massMin = x._massMin;
63  _maxRange = x._maxRange;
64 }
65 
67  const EvtManyDeltaFuncLineShape& x )
68 {
69  _mass = x._mass;
70  _massMax = x._massMax;
71  _massMin = x._massMin;
72  _width = x._width;
73  _maxRange = x._maxRange;
74  _spin = x._spin;
75  return *this;
76 }
77 
79 {
80  return new EvtManyDeltaFuncLineShape( *this );
81 }
82 
83 double EvtManyDeltaFuncLineShape::getMassProb( double mass, double massPar,
84  int nDaug, double* massDau )
85 {
86  double dTotMass = 0.;
87 
88  int i;
89  for ( i = 0; i < nDaug; i++ ) {
90  dTotMass += massDau[i];
91  }
92  if ( ( mass < dTotMass ) )
93  return 0.;
94 
95  if ( massPar > 0.0000000001 ) {
96  if ( mass > massPar )
97  return 0.;
98  }
99 
100  return 1.;
101 }
102 
104  double, double* )
105 {
106  int nDelta = int( ( _massMax - _massMin ) / _width );
107  nDelta++;
108  double rand = EvtRandom::Flat( 0., float( nDelta ) );
109  int randI = int( rand );
110  return _massMin + randI * _width;
111 }
double getRandMass(EvtId *parId, int nDaug, EvtId *dauId, EvtId *othDaugId, double maxMass, double *dauMasses) override
Definition: EvtId.hh:27
double getMassProb(double mass, double massPar, int nDaug, double *massDau) override
static double Flat()
Definition: EvtRandom.cpp:72
EvtSpinType::spintype _spin
EvtAbsLineShape * clone() override
EvtManyDeltaFuncLineShape & operator=(const EvtManyDeltaFuncLineShape &x)