EvtGen 2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Loading...
Searching...
No Matches
EvtFlatQ2.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
23#include "EvtGenBase/EvtPDL.hh"
26
27#include <fstream>
28#include <string>
29
30double lambda( double q, double m1, double m2 )
31{
32 double L( 1.0 );
33 double mSum = m1 + m2;
34 double mDiff = m1 - m2;
35 double qSq = q * q;
36
37 if ( qSq > 0.0 ) {
38 double prodTerm = ( qSq - mSum * mSum ) * ( qSq - mDiff * mDiff );
39
40 if ( prodTerm > 0.0 ) {
41 L = sqrt( prodTerm ) / qSq;
42 }
43 }
44
45 return L;
46}
47
48std::string EvtFlatQ2::getName() const
49{
50 return "FLATQ2";
51}
52
54{
55 return new EvtFlatQ2;
56}
57
59{
60 setProbMax( 100 );
61}
62
64{
65 // check that there are 3 daughters
66 checkNDaug( 3 );
67
68 // We expect B -> X lepton lepton events
70
73
74 if ( !( d1type == EvtSpinType::DIRAC || d1type == EvtSpinType::NEUTRINO ) ) {
75 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
76 << "EvtFlatQ2 expects 2nd daughter to "
77 << "be a lepton" << std::endl;
78 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
79 << "Will terminate execution!" << std::endl;
80 ::abort();
81 }
82
83 if ( !( d2type == EvtSpinType::DIRAC || d2type == EvtSpinType::NEUTRINO ) ) {
84 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
85 << "EvtFlatQ2 expects 3rd daughter to "
86 << "be a lepton" << std::endl;
87 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
88 << "Will terminate execution!" << std::endl;
89 ::abort();
90 }
91
92 // Specify if we want to use the phase space factor
93 m_usePhsp = false;
94 if ( getNArg() > 0 ) {
95 if ( getArg( 0 ) != 0 ) {
96 m_usePhsp = true;
97 }
98 }
99
100 EvtGenReport( EVTGEN_INFO, "EvtGen" )
101 << "EvtFlatQ2 usePhsp = " << int( m_usePhsp ) << std::endl;
102}
103
105{
107
108 EvtVector4R p4Xu = p->getDaug( 0 )->getP4();
109
110 EvtVector4R p4ell1 = p->getDaug( 1 )->getP4();
111 EvtVector4R p4ell2 = p->getDaug( 2 )->getP4();
112
113 double pXu_x2 = p4Xu.get( 1 ) * p4Xu.get( 1 );
114 double pXu_y2 = p4Xu.get( 2 ) * p4Xu.get( 2 );
115 double pXu_z2 = p4Xu.get( 3 ) * p4Xu.get( 3 );
116 double pXu = sqrt( pXu_x2 + pXu_y2 + pXu_z2 );
117 double prob( 0.0 );
118 if ( fabs( pXu ) > 0.0 ) {
119 prob = 1 / pXu;
120 }
121
122 // Include the phase space factor if requested
123 if ( m_usePhsp ) {
124 // Invariant mass of lepton pair
125 double q = ( p4ell1 + p4ell2 ).mass();
126 // Rest masses of the leptons
127 double m1 = p4ell1.mass();
128 double m2 = p4ell2.mass();
129 // Phase space factor, which includes the various square roots
130 double Lambda = lambda( q, m1, m2 );
131 if ( Lambda > 0.0 ) {
132 prob = prob / Lambda;
133 }
134 }
135
136 if ( pXu > 0.01 ) {
137 setProb( prob );
138 }
139
140 return;
141}
double lambda(double q, double m1, double m2)
Definition EvtFlatQ2.cpp:30
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition EvtReport.cpp:32
@ EVTGEN_INFO
Definition EvtReport.hh:52
@ EVTGEN_ERROR
Definition EvtReport.hh:49
EvtDecayBase()=default
int getNDaug() const
void checkSpinParent(EvtSpinType::spintype sp)
int getNArg() const
double getArg(unsigned int j)
void setProbMax(double prbmx)
EvtId getDaug(int i) const
void checkNDaug(int d1, int d2=-1)
const EvtId * getDaugs() const
void setProb(double prob)
void initProbMax() override
Definition EvtFlatQ2.cpp:58
std::string getName() const override
Definition EvtFlatQ2.cpp:48
void init() override
Definition EvtFlatQ2.cpp:63
EvtDecayBase * clone() const override
Definition EvtFlatQ2.cpp:53
bool m_usePhsp
Definition EvtFlatQ2.hh:41
void decay(EvtParticle *p) override
static EvtSpinType::spintype getSpinType(EvtId i)
Definition EvtPDL.cpp:371
double initializePhaseSpace(size_t numdaughter, const EvtId *daughters, bool forceResetMasses=false, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
const EvtVector4R & getP4() const
EvtParticle * getDaug(const int i)
double mass() const
double get(int i) const