BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtFromParent.cc
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2//
3// Environment:
4// This software is part of the EvtGen package developed jointly
5// for the BaBar and CLEO collaborations. If you use all or part
6// of it, please give an appropriate acknowledgement.
7//
8// Copyright Information: See EvtGen/COPYRIGHT
9// Copyright (C) 1998 Caltech, UCSB
10//
11// Module: EvtFromParent.cc
12//
13// Description: Routine to decay a particle according th phase space
14//
15// Modification history:
16//
17// RYD January 8, 1997 Module created
18//
19//------------------------------------------------------------------------
20//
21#include "EvtFromParent.hh"
30#include <fstream>
31#include <iomanip>
32#include <iostream>
33#include <stdio.h>
34#include <stdlib.h>
35#include <unistd.h>
36
37#include "GeneratorObject/McGenEvent.h"
38#include <string>
40
41void EvtFromParent::getName( std::string& model_name ) { model_name = "FromParent"; }
42
44
46
47 // check that there are 0 arguments
48 checkNArg( 0 );
49}
50
52
54 bool debug = 0;
55 // p->printTree();
56 // std::cout<<"FromParent:p->getId() = "<<p->getId()<<std::endl;
57 EvtId LambdaId = EvtPDL::getId( "Lambda0" );
58 // std::cout<<"LambdaId = "<<LambdaId<<std::endl;
59 EvtId antiLambdaId = EvtPDL::getId( "anti-Lambda0" );
60 // std::cout<<"antiLambdaId = "<<antiLambdaId<<std::endl;
61 if ( p->getId() != LambdaId && p->getId() != antiLambdaId )
62 {
63 std::cout << "Parent particle is required to be Lambda0 or antiLambda0" << std::endl;
64 abort();
65 }
66 int more = 0;
67 int numstable = 0;
68 EvtId evtnumstable[100];
69 EvtVector4R p4[20];
70 /*if(EvtParticle::_NextLevelDauNum == 0) {
71 report(ERROR,"EvtGen") << "EvtParticle failed to store the info of NextLevel";
72 ::abort();
73 }*/
75 {
76 if ( p->getId() == LambdaId )
77 {
78 // pi-
79 evtnumstable[numstable] = EvtPDL::evtIdFromStdHep( -211 );
80 p4[numstable] = EvtParticle::_NextLevelP4[2];
81 if ( debug )
82 std::cout << "FromParent: pi- p4[numstable] = " << p4[numstable] << std::endl;
83 numstable++;
84 // p
85 evtnumstable[numstable] = EvtPDL::evtIdFromStdHep( 2212 );
86 p4[numstable] = EvtParticle::_NextLevelP4[3];
87 if ( debug )
88 std::cout << "FromParent: p+ p4[numstable] = " << p4[numstable] << std::endl;
89 numstable++;
90 }
91 if ( p->getId() == antiLambdaId )
92 {
93 if ( debug )
94 std::cout << "anti-Lambda0's parent id:" << p->getParent()->getId()
95 << " p4 =" << p->getParent()->getP4() << std::endl;
96 // pi+
97 evtnumstable[numstable] = EvtPDL::evtIdFromStdHep( 211 );
98 p4[numstable] = EvtParticle::_NextLevelP4[0];
99 if ( debug )
100 std::cout << "FromParent: pi+ p4[numstable] = " << p4[numstable] << std::endl;
101 numstable++;
102 // pbar
103 evtnumstable[numstable] = EvtPDL::evtIdFromStdHep( -2212 );
104 p4[numstable] = EvtParticle::_NextLevelP4[1];
105 if ( debug )
106 std::cout << "FromParent: anti-p- p4[numstable] = " << p4[numstable] << std::endl;
107 numstable++;
108 }
109 p->makeDaughters( numstable, evtnumstable );
110 int ndaugFound = 0;
111 for ( int i = 0; i < numstable; i++ )
112 {
113 p->getDaug( i )->init( evtnumstable[i], p4[i] );
114 ndaugFound++;
115 }
116 if ( ndaugFound == 0 )
117 {
118 report( ERROR, "EvtGen" ) << "Phokhara has failed to do a decay ";
119 report( ERROR, "EvtGen" ) << EvtPDL::name( p->getId() ).c_str() << " " << p->mass()
120 << endl;
121 assert( 0 );
122 }
123 if ( p->getId() == LambdaId )
124 {
125 // int channel=EvtDecayTable::inChannelList(p->getId(),numstable,evtnumstable);
126 // more=(channel!=-1)&&(channel!=0);
127 // if(more) { std::cout<<"EvtFromParent:Existence of mode "<<channel<<" in exclusive
128 // decay list has the same final state as this one"<<std::endl;abort(); }
129
130 if ( debug )
131 std::cout << "EvtFromParent Lambda0's parent id:" << p->getParent()->getId()
132 << " p4 =" << p->getParent()->getP4Lab() << std::endl;
133 if ( debug ) std::cout << "EvtFromParent SUMMARY: part p4" << p->getP4Lab() << std::endl;
134 if ( debug )
135 std::cout << "EvtFromParent SUMMARY: Daug0 p4" << p->getDaug( 0 )->getP4Lab()
136 << std::endl;
137 if ( debug )
138 std::cout << "EvtFromParent SUMMARY: Daug1 p4" << p->getDaug( 1 )->getP4Lab()
139 << std::endl;
140 }
141 if ( p->getId() == antiLambdaId )
142 {
143 // int channel=EvtDecayTable::inChannelList(p->getId(),numstable,evtnumstable);
144 // more=(channel!=0);
145 // if(more) { std::cout<<"EvtFromParent:Existence of mode "<<channel<<" in exclusive
146 // decay list has the same final state as this one"<<std::endl;abort(); }
147
148 if ( debug )
149 std::cout << "EvtFromParent antiLambda0's parent id:" << p->getParent()->getId()
150 << " p4 =" << p->getParent()->getP4Lab() << std::endl;
151 if ( debug ) std::cout << "EvtFromParent SUMMARY: part p4" << p->getP4Lab() << std::endl;
152 if ( debug )
153 std::cout << "EvtFromParent SUMMARY: Daug0 p4" << p->getDaug( 0 )->getP4Lab()
154 << std::endl;
155 if ( debug )
156 std::cout << "EvtFromParent SUMMARY: Daug1 p4" << p->getDaug( 1 )->getP4Lab()
157 << std::endl;
158 }
159 }
160 return;
161}
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:34
@ ERROR
Definition EvtReport.hh:49
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
EvtDecayBase * clone()
virtual ~EvtFromParent()
void getName(std::string &name)
void decay(EvtParticle *p)
Definition EvtId.hh:27
static EvtId evtIdFromStdHep(int stdhep)
Definition EvtPDL.cc:232
static std::string name(EvtId i)
Definition EvtPDL.hh:70
static EvtId getId(const std::string &name)
Definition EvtPDL.cc:272
void makeDaughters(int ndaug, EvtId *id)
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
EvtVector4R getP4Lab()
EvtId getId() const
EvtParticle * getParent()
static int _NextLevelDauNum
const EvtVector4R & getP4() const
EvtParticle * getDaug(int i)
static EvtVector4R _NextLevelP4[20]
double mass() const