CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtBody3.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: EvtBody3.cc
12//
13// Description: Routine to decay a particle into three bodies using the Dalitz plots and two particle
14// angular distributions.
15//
16// Modification history:
17//
18// Ping R.-G. December, 2006 Module created
19//
20//------------------------------------------------------------------------
21//
23#include <stdlib.h>
26#include "EvtGenBase/EvtPDL.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//using namespace CLHEP;
55using std::endl;
56
58
59void EvtBody3::getName(std::string& model_name){
60
61 model_name="Body3";
62
63}
64
66
67 return new EvtBody3;
68
69}
70
71
73
74 // check that there are 4 arguments: Invariant mass part. Index: i,j, histor. file name, Hid
75 checkNArg(0);
77}
79
80 noProbMax();
81
82}
83
85
86 const char* fl=setFileName();
87 const char* hp=setHpoint();
88 int* dp;
89 int nd1,nd2,ii,sn;
90
91
92 sn=setDaugAngNo();
93
94 if(sn==2){
95 nd1=0;
96 nd2=1;
97 }
98
99 if(sn==0){
100 nd1=1;
101 nd2=2;
102 }
103
104 if(sn==1){
105 nd1=0;
106 nd2=2;
107 }
108 const char* DA1=setDaugAng(nd1);
109 const char* DA2=setDaugAng(nd2);
110
111
112 dp=setDaugPair();
113 int d1=dp[0]; //m(d1,d2) pair at X axis
114 int d2=dp[1];
115 int d3=dp[2]; //m(d3,d4) pair at Y axis
116 int d4=dp[3];
117
118
119 TFile f(fl);
120 TH1F *did1= (TH1F*)f.Get(DA1);
121 TH1F *did2= (TH1F*)f.Get(DA2);
122 TH2F *hid = (TH2F*)f.Get(hp);
123
124 TAxis* d1x=did1->GetXaxis();
125 TAxis* d2x=did2->GetXaxis();
126 TAxis* xaxis = hid->GetXaxis();
127 TAxis* yaxis = hid->GetYaxis();
128
129 int BINSd1 =did1->GetXaxis()->GetLast();
130 int BINSd2 =did2->GetXaxis()->GetLast();
131 int BINSx =xaxis->GetLast();
132 int BINSy =yaxis->GetLast();
133 int BINS =BINSx*BINSy;
134
135 double av1,av2,avm1,avm2;
136 avm1=0.;
137 avm2=0.;
138 double yvalue,ymax=0.0;
139 int i,j,binxy;
140
141// look for maxmum for the first hist.1
142 for(i=1;i<BINSd1+1;i++){
143 av1=did1->GetBinContent(i);
144 if(av1>avm1) avm1=av1;
145 }
146
147// look for maxmum for the second hist.1
148 for(i=1;i<BINSd2+1;i++){
149 av2=did2->GetBinContent(i);
150 if(av2>avm2) avm2=av2;
151 }
152
153// look for maxmum for the Dalitz plot
154
155 for(i=1;i<BINSx+1;i++){
156 for(j=1;j<BINSy+1;j++){
157 binxy=hid->GetBin(i,j);
158 yvalue=hid->GetBinContent(binxy);
159// cout<<"binxy,yvalue = "<<binxy<<"; "<<yvalue<<endl;
160 if(yvalue>ymax) ymax=yvalue;
161 }
162 }
163
164loop:
166
167 EvtParticle *id1,*id2,*id3,*id4,*s1;
168 EvtVector4R pd1,pd2,pd3,pd4,ps;
169 EvtVector4R dp1,dp2;
170 double xmass2,ymass2;
171
172 id1 =p->getDaug(d1);
173 id2 =p->getDaug(d2);
174 id3 =p->getDaug(d3);
175 id4 =p->getDaug(d4);
176
177 pd1 =id1->getP4Lab();
178 pd2 =id2->getP4Lab();
179 pd3 =id3->getP4Lab();
180 pd4 =id4->getP4Lab();
181
182 dp1 =p->getDaug(nd1)->getP4Lab();
183 dp2 =p->getDaug(nd2)->getP4Lab();
184
185 xmass2=(pd1+pd2).mass2();
186 ymass2=(pd3+pd4).mass2();
187
188 int xbin = hid->GetXaxis()->FindBin(xmass2);
189 int ybin = hid->GetYaxis()->FindBin(ymass2);
190 int xybin= hid->GetBin(xbin,ybin);
191 double zvalue=hid->GetBinContent(xybin);
192 double xratio=zvalue/ymax;
193 if(xratio ==0 ) goto loop;
194 double rd1=EvtRandom::Flat(0.0, 1.0);
195 if(rd1>xratio) goto loop; //sigle out event by 2-D mass distribution histo.
196
197 double da1=dp1.get(3)/dp1.d3mag();
198 double da2=dp2.get(3)/dp2.d3mag();
199
200 int dbin1=did1->FindBin(da1);
201 int dbin2=did2->FindBin(da2);
202
203 double dr1=(did1->GetBinContent(dbin1))/avm1;
204 double dr2=(did2->GetBinContent(dbin2))/avm2;
205 if(dr1==0 || dr2==0) goto loop;
206 rd1=EvtRandom::Flat(0.0, 1.0);
207 if(rd1>dr1) goto loop; //sigle out event by the first angular distribution histo.
208
209 rd1=EvtRandom::Flat(0.0, 1.0);
210 if(rd1>dr2) goto loop; //sigle out event by the second angular distribution histo.
211
212 return ;
213}
214
215
EvtDecayBase * clone()
Definition: EvtBody3.cc:65
const char * setFileName()
Definition: UserBody3.cc:11
void getName(std::string &name)
Definition: EvtBody3.cc:59
void init()
Definition: EvtBody3.cc:72
void decay(EvtParticle *p)
Definition: EvtBody3.cc:84
int * setDaugPair()
Definition: UserBody3.cc:38
const char * setDaugAng(int i)
Definition: UserBody3.cc:23
virtual ~EvtBody3()
Definition: EvtBody3.cc:57
int setDaugAngNo()
Definition: UserBody3.cc:33
void initProbMax()
Definition: EvtBody3.cc:78
EvtBody3()
Definition: EvtBody3.hh:32
const char * setHpoint()
Definition: UserBody3.cc:17
void noProbMax()
EvtId getParentId()
Definition: EvtDecayBase.hh:60
EvtId * getDaugs()
Definition: EvtDecayBase.hh:65
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
static EvtSpinType::spintype getSpinType(EvtId i)
Definition: EvtPDL.hh:61
EvtVector4R getP4Lab()
Definition: EvtParticle.cc:683
EvtParticle * getDaug(int i)
Definition: EvtParticle.cc:85
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
static double Flat()
Definition: EvtRandom.cc:73
double get(int i) const
Definition: EvtVector4R.hh:179
double d3mag() const
Definition: EvtVector4R.cc:186