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.
EvtDiracParticle.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/EvtComplex.hh"
25 #include "EvtGenBase/EvtPDL.hh"
26 #include "EvtGenBase/EvtPatches.hh"
27 #include "EvtGenBase/EvtReport.hh"
30 
31 #include <iostream>
32 #include <math.h>
33 #include <stdlib.h>
34 using std::endl;
35 
36 void EvtDiracParticle::init( EvtId part_n, const EvtVector4R& p4 )
37 {
38  _validP4 = true;
39  setp( p4 );
40  setpart_num( part_n );
41 
42  if ( EvtPDL::getStdHep( part_n ) == 0 ) {
43  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
44  << "Error in EvtDiracParticle::init, part_n=" << part_n.getId()
45  << endl;
46  ::abort();
47  }
48 
49  if ( EvtPDL::getStdHep( part_n ) > 0 ) {
50  _spinorRest[0].set( EvtComplex( sqrt( 2.0 * mass() ), 0.0 ),
51  EvtComplex( 0.0, 0.0 ), EvtComplex( 0.0, 0.0 ),
52  EvtComplex( 0.0, 0.0 ) );
53  _spinorRest[1].set( EvtComplex( 0.0, 0.0 ),
54  EvtComplex( sqrt( 2.0 * mass() ), 0.0 ),
55  EvtComplex( 0.0, 0.0 ), EvtComplex( 0.0, 0.0 ) );
56 
57  _spinorParent[0] = boostTo( _spinorRest[0], p4 );
58  _spinorParent[1] = boostTo( _spinorRest[1], p4 );
59 
60  } else {
61  _spinorRest[0].set( EvtComplex( 0.0, 0.0 ), EvtComplex( 0.0, 0.0 ),
62  EvtComplex( sqrt( 2.0 * mass() ), 0.0 ),
63  EvtComplex( 0.0, 0.0 ) );
64  _spinorRest[1].set( EvtComplex( 0.0, 0.0 ), EvtComplex( 0.0, 0.0 ),
65  EvtComplex( 0.0, 0.0 ),
66  EvtComplex( sqrt( 2.0 * mass() ), 0.0 ) );
67 
68  _spinorParent[0] = boostTo( _spinorRest[0], p4 );
69  _spinorParent[1] = boostTo( _spinorRest[1], p4 );
70  }
71 
72  setLifetime();
73 }
74 
75 void EvtDiracParticle::init( EvtId part_n, const EvtVector4R& p4,
76  const EvtDiracSpinor& prod1,
77  const EvtDiracSpinor& prod2,
78  const EvtDiracSpinor& rest1,
79  const EvtDiracSpinor& rest2 )
80 {
81  _validP4 = true;
82  setp( p4 );
83  setpart_num( part_n );
84 
85  if ( EvtPDL::getStdHep( part_n ) == 0 ) {
86  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
87  << "Error in EvtDiracParticle::init, part_n=" << part_n.getId()
88  << std::endl;
89  ::abort();
90  }
91  _spinorRest[0] = rest1;
92  _spinorRest[1] = rest2;
93  _spinorParent[0] = prod1;
94  _spinorParent[1] = prod2;
95 
96  setLifetime();
97 }
98 
100 {
101  EvtDiracSpinor spplus;
102  EvtDiracSpinor spminus;
103 
104  double sqmt2 = sqrt( 2. * ( getP4().mass() ) );
105 
106  if ( EvtPDL::getStdHep( getId() ) > 0 ) {
107  spplus.set( 1.0, 0.0, 0.0, 0.0 );
108  spminus.set( 0.0, 1.0, 0.0, 0.0 );
109  } else {
110  spplus.set( 0.0, 0.0, 1.0, 0.0 );
111  spminus.set( 0.0, 0.0, 0.0, 1.0 );
112  }
113 
114  EvtSpinDensity R;
115  R.setDim( 2 );
116 
117  for ( int i = 0; i < 2; i++ ) {
118  R.set( 0, i, ( spplus * _spinorRest[i] ) / sqmt2 );
119  R.set( 1, i, ( spminus * _spinorRest[i] ) / sqmt2 );
120  }
121 
122  return R;
123 }
124 
126  double gamma ) const
127 {
128  EvtDiracSpinor spplus;
129  EvtDiracSpinor spminus;
130 
131  double sqmt2 = sqrt( 2. * ( getP4().mass() ) );
132 
133  if ( EvtPDL::getStdHep( getId() ) > 0 ) {
134  spplus.set( 1.0, 0.0, 0.0, 0.0 );
135  spminus.set( 0.0, 1.0, 0.0, 0.0 );
136  } else {
137  spplus.set( 0.0, 0.0, 1.0, 0.0 );
138  spminus.set( 0.0, 0.0, 0.0, 1.0 );
139  }
140 
141  spplus.applyRotateEuler( alpha, beta, gamma );
142  spminus.applyRotateEuler( alpha, beta, gamma );
143 
144  EvtSpinDensity R;
145  R.setDim( 2 );
146 
147  for ( int i = 0; i < 2; i++ ) {
148  R.set( 0, i, ( spplus * _spinorRest[i] ) / sqmt2 );
149  R.set( 1, i, ( spminus * _spinorRest[i] ) / sqmt2 );
150  }
151 
152  return R;
153 }
EvtSpinDensity rotateToHelicityBasis() const override
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=0)
Definition: EvtReport.cpp:33
EvtId getId() const
EvtRaritaSchwinger boostTo(const EvtRaritaSchwinger &rs, const EvtVector4R p4)
void init(EvtId part_n, const EvtVector4R &p4) override
Definition: EvtId.hh:27
EvtDiracSpinor _spinorParent[2]
void setp(double e, double px, double py, double pz)
Definition: EvtParticle.hh:437
EvtDiracSpinor _spinorRest[2]
void setLifetime()
const EvtVector4R & getP4() const
void set(const EvtComplex &sp0, const EvtComplex &sp1, const EvtComplex &sp2, const EvtComplex &sp3)
double mass() const
int getId() const
Definition: EvtId.hh:42
void set(int i, int j, const EvtComplex &rhoij)
void setDim(int n)
void applyRotateEuler(double alpha, double beta, double gamma)
static int getStdHep(EvtId id)
Definition: EvtPDL.cpp:362
void setpart_num(EvtId particle_number)
Definition: EvtParticle.hh:449