BOSS
7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtHAngSam3.cc
Go to the documentation of this file.
1
//--------------------------------------------------------------------------
2
//
3
// Environment:
4
// This software is part of models developed at BES collaboration
5
// based on the EvtGen framework. If you use all or part
6
// of it, please give an appropriate acknowledgement.
7
//
8
// Copyright Information: See EvtGen/BesCopyright
9
// Copyright (A) 2006 Ping Rong-Gang @IHEP
10
//
11
// Module: EvtMassH1.cc
12
//
13
// Description: Routine to decay a particle using the invariant mass distribution of histogram
14
// dimension one.
15
//
16
// Modification history:
17
//
18
// Ping R.-G. December, 2006 Module created
19
//
20
//------------------------------------------------------------------------
21
//
22
#include "
EvtGenBase/EvtPatches.hh
"
23
#include <stdlib.h>
24
#include "
EvtGenBase/EvtParticle.hh
"
25
#include "
EvtGenBase/EvtGenKine.hh
"
26
#include "
EvtGenBase/EvtPDL.hh
"
27
#include "
EvtGenBase/EvtVector4C.hh
"
28
#include "
EvtGenBase/EvtVector4R.hh
"
29
#include "
EvtGenBase/EvtTensor4C.hh
"
30
#include "
EvtGenBase/EvtDiracParticle.hh
"
31
#include "
EvtGenBase/EvtScalarParticle.hh
"
32
#include "
EvtGenBase/EvtVectorParticle.hh
"
33
#include "
EvtGenBase/EvtTensorParticle.hh
"
34
#include "
EvtGenBase/EvtPhotonParticle.hh
"
35
#include "
EvtGenBase/EvtNeutrinoParticle.hh
"
36
#include "
EvtGenBase/EvtStringParticle.hh
"
37
#include "
EvtGenBase/EvtRaritaSchwingerParticle.hh
"
38
#include "
EvtGenBase/EvtHighSpinParticle.hh
"
39
#include "
EvtGenBase/EvtReport.hh
"
40
#include "
EvtGenBase/EvtHelSys.hh
"
41
#include "
EvtGenModels/EvtHAngSam3.hh
"
42
#include "
EvtGenBase/EvtRandom.hh
"
43
#include <string>
44
45
#include "TH1.h"
46
#include "TAxis.h"
47
#include "TH2.h"
48
#include "TFile.h"
49
#include "TApplication.h"
50
#include "TROOT.h"
51
//#include "CLHEP/config/CLHEP.h"
52
//#include "CLHEP/config/TemplateFunctions.h"
53
54
55
using
std::endl;
56
57
EvtHAngSam3::~EvtHAngSam3
() {}
58
59
void
EvtHAngSam3::getName
(std::string& model_name){
60
61
model_name=
"HAngSam3"
;
62
63
}
64
65
EvtDecayBase
*
EvtHAngSam3::clone
(){
66
67
return
new
EvtHAngSam3
;
68
69
}
70
71
72
void
EvtHAngSam3::init
(){
73
74
// check that there are 4 arguments: Invariant mass part. Index: i,j, histor. file name, Hid
75
checkNArg
(0);
76
EvtSpinType::spintype
parenttype =
EvtPDL::getSpinType
(
getParentId
());
77
}
78
void
EvtHAngSam3::initProbMax
(){
79
80
noProbMax
();
81
82
}
83
84
void
EvtHAngSam3::decay
(
EvtParticle
*p ){
85
86
const
char
* fl=
setFileName
();
87
const
char
* hp=
setHpoint
();
88
int
* dp;
89
90
TFile
f
(fl);
91
TH1F *hid = (TH1F*)
f
.Get(hp);
92
TAxis* xaxis = hid->GetXaxis();
93
94
double
BLE =xaxis->GetBinLowEdge(1);
95
int
BINS =xaxis->GetLast();
96
double
yvalue[20000];
97
static
double
ymax=0.0;
98
int
i;
99
double
Ntotal=0,yc[20000];
100
static
int
icount=0;
101
102
if
(icount==0){
103
for
(i=1;i<BINS+1;i++){
104
yvalue[i]=hid->GetBinContent(i);
105
if
(yvalue[i]>ymax) ymax=yvalue[i];
106
}
107
icount++;
108
ymax=ymax*1.2;
109
}
110
111
loop:
112
p->
initializePhaseSpace
(
getNDaug
(),
getDaugs
());
113
114
EvtParticle
*d1,*d2,*d3;
115
EvtVector4R
pd1,pd2,pd3,pp,nor;
116
double
costheta
,cosphi;
117
118
d1 =p->
getDaug
(0);
119
d2 =p->
getDaug
(1);
120
pd1=d1->
getP4
();
121
pd2=d2->
getP4
();
122
pp =p->
getP4
();
123
double
ppmag=pp.
d3mag
();
124
nor=pd1.
cross
(pd2);
125
126
if
(ppmag<0.0001){
costheta
=nor.
get
(3)/nor.
d3mag
();}
else
127
{
costheta
=nor.
dot
(pp)/nor.
d3mag
()/pp.
d3mag
();}
128
129
int
xbin =hid->FindBin(
costheta
);
130
double
xratio=(hid->GetBinContent(xbin))/ymax;
131
132
double
rd1=
EvtRandom::Flat
(0.0, 1.0);
133
if
(rd1>xratio)
goto
loop;
134
return ;
135
}
136
137
f
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
EvtDiracParticle.hh
EvtGenKine.hh
EvtHAngSam3.hh
EvtHelSys.hh
EvtHighSpinParticle.hh
EvtNeutrinoParticle.hh
EvtPDL.hh
EvtParticle.hh
EvtPatches.hh
EvtPhotonParticle.hh
EvtRandom.hh
EvtRaritaSchwingerParticle.hh
EvtReport.hh
EvtScalarParticle.hh
EvtStringParticle.hh
EvtTensor4C.hh
EvtTensorParticle.hh
EvtVector4C.hh
EvtVector4R.hh
EvtVectorParticle.hh
EvtDecayBase
Definition
EvtDecayBase.hh:33
EvtDecayBase::noProbMax
void noProbMax()
Definition
EvtDecayBase.cc:304
EvtDecayBase::getParentId
EvtId getParentId()
Definition
EvtDecayBase.hh:60
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
EvtHAngSam3::clone
EvtDecayBase * clone()
Definition
EvtHAngSam3.cc:65
EvtHAngSam3::setFileName
const char * setFileName()
Definition
UserHAngSam3.cc:11
EvtHAngSam3::decay
void decay(EvtParticle *p)
Definition
EvtHAngSam3.cc:84
EvtHAngSam3::initProbMax
void initProbMax()
Definition
EvtHAngSam3.cc:78
EvtHAngSam3::~EvtHAngSam3
virtual ~EvtHAngSam3()
Definition
EvtHAngSam3.cc:57
EvtHAngSam3::init
void init()
Definition
EvtHAngSam3.cc:72
EvtHAngSam3::getName
void getName(std::string &name)
Definition
EvtHAngSam3.cc:59
EvtHAngSam3::EvtHAngSam3
EvtHAngSam3()
Definition
EvtHAngSam3.hh:34
EvtHAngSam3::setHpoint
const char * setHpoint()
Definition
UserHAngSam3.cc:18
EvtPDL::getSpinType
static EvtSpinType::spintype getSpinType(EvtId i)
Definition
EvtPDL.hh:61
EvtParticle
Definition
EvtParticle.hh:42
EvtParticle::getP4
const EvtVector4R & getP4() const
Definition
EvtParticle.cc:120
EvtParticle::getDaug
EvtParticle * getDaug(int i)
Definition
EvtParticle.cc:84
EvtParticle::initializePhaseSpace
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
Definition
EvtParticle.cc:1070
EvtRandom::Flat
static double Flat()
Definition
EvtRandom.cc:74
EvtSpinType::spintype
spintype
Definition
EvtSpinType.hh:31
EvtVector4R
Definition
EvtVector4R.hh:29
EvtVector4R::dot
double dot(const EvtVector4R &v2) const
Definition
EvtVector4R.cc:199
EvtVector4R::get
double get(int i) const
Definition
EvtVector4R.hh:179
EvtVector4R::cross
EvtVector4R cross(const EvtVector4R &v2)
Definition
EvtVector4R.cc:171
EvtVector4R::d3mag
double d3mag() const
Definition
EvtVector4R.cc:186
costheta
float costheta
Definition
prepare_data.cxx:28
7.1.2
Generator
BesEvtGen
BesEvtGen-00-04-30
src
EvtGen
EvtGenModels
EvtHAngSam3.cc
Generated by
1.12.0