BOSS
7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtTrackGen.cc
Go to the documentation of this file.
1
//--------------------------------------------------------------------------
2
//
3
// Modification history:
4
//
5
// pingrg January 22, 2014 Module created
6
//
7
// -------- input file must take the form like:
8
// [number of final state particles in this event]
9
// [PDG ID of particle 1] [P_x] [P_y] [P_z] [E]
10
// [PDG ID of particle 2] [P_x] [P_y] [P_z] [E]
11
// and so on
12
//------------------------------------------------------------------------
13
//
14
#include "
EvtGenBase/EvtPatches.hh
"
15
#include <stdlib.h>
16
#include "
EvtGenBase/EvtParticle.hh
"
17
#include "
EvtGenBase/EvtGenKine.hh
"
18
#include "
EvtGenBase/EvtPDL.hh
"
19
#include "
EvtGenBase/EvtReport.hh
"
20
#include "
EvtGenBase/EvtRandom.hh
"
21
#include "
EvtTrackGen.hh
"
22
#include "
EvtGlobalSet.hh
"
23
#include <string>
24
25
EvtTrackGen::~EvtTrackGen
() {}
26
27
void
EvtTrackGen::getName
(std::string& model_name){
28
29
model_name=
"TrackGen"
;
30
31
}
32
33
EvtDecayBase
*
EvtTrackGen::clone
(){
34
35
return
new
EvtTrackGen
;
36
37
}
38
39
40
void
EvtTrackGen::init
(){
41
42
// check that there are 0 arguments
43
checkNArg
(1);
44
int
idx=
getArg
(0);
45
if
(
EvtGlobalSet::SV
.size()==0){
46
std::cout<<
"No track data file is available! "
<<std::endl;abort();
47
}
else
{m_inputFileName=
EvtGlobalSet::SV
[idx];}
48
49
m_inputFile.open(m_inputFileName.c_str());
50
if
(!m_inputFile){
51
cout <<
"EvtTrackGen: PROBLEMS OPENING FILE "
52
<< m_inputFileName << endl;
53
exit(0);
54
}
55
//load the event P4
56
Evt.clear();
57
while
(!m_inputFile.eof()){
58
m_inputFile >> nParticles;
59
std::vector<EvtVector4R> vp4;
60
for
(
int
i = 0; i < nParticles; i++){
61
EvtVector4R
p4;
62
m_inputFile >> idParticles[i];
63
m_inputFile >> pxParticle; p4.
set
(1,pxParticle);
64
m_inputFile >> pyParticle; p4.
set
(2,pyParticle);
65
m_inputFile >> pzParticle; p4.
set
(3,pzParticle);
66
m_inputFile >> eParticle; p4.
set
(0,eParticle);
67
vp4.push_back(p4);
68
}
69
Evt.push_back(vp4);
70
}
71
Evt.pop_back();
72
//check daughters id
73
if
(nParticles!=
getNDaug
()){std::cout<<
"The number of daughters are not cosistent with that the data file"
<<std::endl;abort();}
74
for
(
int
i=0;i<nParticles;i++){
75
EvtId
pid =
EvtPDL::evtIdFromStdHep
(idParticles[i] );
76
if
(pid!=
getDaug
(i) ){std::cout<<
"The daughter particle pdg in your data file is not consistent with you decay card."
<<std::endl;abort();}
77
}
78
//debugging
79
/*
80
for(int i=0;i<Evt.size();i++){
81
std::cout<<"Event "<<i<<std::endl;
82
for(int j=0;j<nParticles;j++){
83
std::cout<<Evt[i][j].get(0)<<" "<<Evt[i][j].get(1)<<" "<<Evt[i][j].get(2)<<" "<<Evt[i][j].get(3)<<std::endl;
84
}
85
}
86
*/
87
//---------
88
}
89
90
void
EvtTrackGen::initProbMax
(){
91
92
noProbMax
();
93
94
}
95
96
void
EvtTrackGen::decay
(
EvtParticle
*p ){
97
98
double
weight
= p->
initializePhaseSpace
(
getNDaug
(),
getDaugs
());
99
int
rdm= (int)Evt.size()*
EvtRandom::Flat
(0.0,1.0);
100
if
(Evt.size()==0) {std::cout<<
"EvtTrackGen: out of stored file record"
<<std::endl;abort();}
101
EvtVector4R
ptot(0,0,0,0);
102
for
(
int
i=0;i<nParticles;i++){
103
EvtParticle
* daug=p->
getDaug
(i);
104
ptot += Evt[rdm][i];
105
daug->
init
(daug->
getId
(),Evt[rdm][i]);
106
}
107
//p->init(p->getId(),ptot);
108
109
//debugging
110
// std::cout<<p->getDaug(getNDaug()-1)->getP4()<<" =? "<<eParticle<<" "<<pxParticle<<" "<<pyParticle<<" "<<pzParticle<<std::endl;
111
112
return ;
113
}
114
115
116
EvtGenKine.hh
EvtGlobalSet.hh
EvtPDL.hh
EvtParticle.hh
EvtPatches.hh
EvtRandom.hh
EvtReport.hh
EvtTrackGen.hh
weight
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared dimensionless $ !dummy photon IR regulator $ !crude photon multiplicity enhancement factor *EVENT $ !MC crude volume of PhhSpace *Sfactors $ !YFS formfactor IR part only $ !YFS formfactor non IR finite part $ !mass weight
Definition:
KarFin.h:34
EvtDecayBase
Definition:
EvtDecayBase.hh:33
EvtDecayBase::getArg
double getArg(int j)
Definition:
EvtDecayBase.cc:564
EvtDecayBase::noProbMax
void noProbMax()
Definition:
EvtDecayBase.cc:304
EvtDecayBase::getNDaug
int getNDaug()
Definition:
EvtDecayBase.hh:64
EvtDecayBase::getDaugs
EvtId * getDaugs()
Definition:
EvtDecayBase.hh:65
EvtDecayBase::checkNArg
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
Definition:
EvtDecayBase.cc:482
EvtDecayBase::getDaug
EvtId getDaug(int i)
Definition:
EvtDecayBase.hh:66
EvtGlobalSet::SV
static std::vector< std::string > SV
Definition:
EvtGlobalSet.hh:19
EvtId
Definition:
EvtId.hh:27
EvtPDL::evtIdFromStdHep
static EvtId evtIdFromStdHep(int stdhep)
Definition:
EvtPDL.cc:244
EvtParticle
Definition:
EvtParticle.hh:42
EvtParticle::init
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
EvtParticle::getId
EvtId getId() const
Definition:
EvtParticle.cc:113
EvtParticle::getDaug
EvtParticle * getDaug(int i)
Definition:
EvtParticle.cc:85
EvtParticle::initializePhaseSpace
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
Definition:
EvtParticle.cc:1071
EvtRandom::Flat
static double Flat()
Definition:
EvtRandom.cc:74
EvtTrackGen::initProbMax
void initProbMax()
Definition:
EvtTrackGen.cc:90
EvtTrackGen::~EvtTrackGen
virtual ~EvtTrackGen()
Definition:
EvtTrackGen.cc:25
EvtTrackGen::init
void init()
Definition:
EvtTrackGen.cc:40
EvtTrackGen::clone
EvtDecayBase * clone()
Definition:
EvtTrackGen.cc:33
EvtTrackGen::decay
void decay(EvtParticle *p)
Definition:
EvtTrackGen.cc:96
EvtTrackGen::getName
void getName(std::string &name)
Definition:
EvtTrackGen.cc:27
EvtTrackGen::EvtTrackGen
EvtTrackGen()
Definition:
EvtTrackGen.hh:39
EvtVector4R
Definition:
EvtVector4R.hh:29
EvtVector4R::set
void set(int i, double d)
Definition:
EvtVector4R.hh:183
source
Generator
BesEvtGen
BesEvtGen-00-04-08
src
EvtGen
EvtGenModels
EvtTrackGen.cc
Generated by
1.9.6