BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtXsection Class Reference

#include <EvtXsection.hh>

Public Member Functions

 EvtXsection (std::vector< EvtId > evtdaugs)
 
 EvtXsection (int mode)
 
virtual ~EvtXsection ()
 
int getMode (std::vector< EvtId > evtdaugs)
 
void ini_data0 (int mode)
 
void ini_data (int mode)
 
void ini_data_diy ()
 
void ini_data_multimode ()
 
double getXsection (double mx)
 
double getErr (double mx)
 
double Xsection_a (double mx)
 
double Xsection_b (double mx)
 
double Xsection_c (double mx)
 
double Err_a (double mx)
 
double Err_b (double mx)
 
int getXBin (double mx, std::vector< double > vy)
 
int getXBin_a (double mx)
 
int getXBin_b (double mx)
 
std::string getUnit ()
 
std::vector< double > getXX ()
 
std::vector< double > getYY ()
 
std::vector< double > getEr ()
 
double getXup ()
 
double getXlw ()
 
std::string getMsg ()
 
void setBW (int pdg)
 
void setFile (std::string name)
 
double getVP (double mx)
 
void ReadVP ()
 
void setModes (std::vector< int > vmd)
 

Detailed Description

Definition at line 132 of file EvtXsection.hh.

Constructor & Destructor Documentation

◆ EvtXsection() [1/2]

EvtXsection::EvtXsection ( std::vector< EvtId evtdaugs)
inline

Definition at line 134 of file EvtXsection.hh.

134 {
135 xx.clear();yy.clear();er.clear();
136 _mode = getMode(evtdaugs);
137 ini_data(_mode);
138
139 }
void ini_data(int mode)
int getMode(std::vector< EvtId > evtdaugs)
Definition: EvtXsection.cc:218

◆ EvtXsection() [2/2]

EvtXsection::EvtXsection ( int  mode)
inline

Definition at line 140 of file EvtXsection.hh.

140 {
141 xx.clear();yy.clear();er.clear();
142 _mode = mode;
143 if(mode>=0){
144 ini_data(_mode);
145 }else if(mode==-1){//calculate the correction factor with Breit-wigner
146 _unit="nb";
147 }else if(mode==-2){//users provide the cross section list
148 //std::cout<<"user diy"<<std::endl;
149 ini_data_diy();
150 }else if(mode==-100){//multi-exclusive modes
151 _unit="nb";
152 }
153 //std::cout<<"The mode is : "<<_mode<<", "<<xx[0]<<", "<<yy[0]<<std::endl;
154 }
void ini_data_diy()
Definition: EvtXsection.cc:133

◆ ~EvtXsection()

EvtXsection::~EvtXsection ( )
virtual

Definition at line 124 of file EvtXsection.cc.

124{}

Member Function Documentation

◆ Err_a()

double EvtXsection::Err_a ( double  mx)

Definition at line 291 of file EvtXsection.cc.

291 {
292 if(_mode == -1) return 0.;
293 if (mx <= xx[0]) return er[0];
294 if (mx > xx[nbins]) return 0.;
295 int thebin = getXBin_a(mx);
296 //-- debug
297 //std::cout<<"Mode= "<<_mode<<", thebin"<<thebin<<std::endl;
298 return er[thebin];
299}
int getXBin_a(double mx)
Definition: EvtXsection.cc:315

◆ Err_b()

double EvtXsection::Err_b ( double  mx)

Definition at line 301 of file EvtXsection.cc.

301 {// interpolation of the cross section error between two bins
302 if (mx <= xx[0]) return er[0];
303 if (mx > xx[nbins-1]) return 0.;
304 int thebin = getXBin_b(mx);
305 double ylow = er[thebin];
306 double yup = er[thebin+1];
307
308 double xlow = xx[thebin];
309 double xup = xx[thebin+1];
310
311 double yi=ylow + (yup-ylow)/(xup-xlow)*(mx-xlow);
312 return yi;
313}
DOUBLE_PRECISION xup[20]
DOUBLE_PRECISION xlow[20]
int getXBin_b(double mx)
Definition: EvtXsection.cc:323

Referenced by getErr().

◆ getEr()

std::vector< double > EvtXsection::getEr ( )
inline

Definition at line 179 of file EvtXsection.hh.

179{return er;}

Referenced by EvtConExc::init().

◆ getErr()

double EvtXsection::getErr ( double  mx)

Definition at line 260 of file EvtXsection.cc.

260 {
261 //if(_mode <= 5 && _mode !=1 ){ return Err_a(mx);}
262 //else {return Err_b(mx);}
263 return Err_b(mx);
264}
double Err_b(double mx)
Definition: EvtXsection.cc:301

Referenced by EvtConExc::difgamXs(), ini_data_multimode(), EvtConExc::init(), EvtConExc::Rad1difXs(), EvtConExc::Rad2difXs(), Rad2difXs_er(), and Rad2difXs_er2().

◆ getMode()

int EvtXsection::getMode ( std::vector< EvtId evtdaugs)

Definition at line 218 of file EvtXsection.cc.

218 {
219 /*******************--- mode definition:
220 0: ppbar
221 1: nnbar
222 2: Lambda0 anti-Lambda0
223 3: Sigma0 anti-Sigma0
224 4: Lambda0 anti-Sigma0
225 5: Sigma0 anti-Lambda0
226 6: pi+ pi-
227 7: pi+ pi- pi0
228 8: K+K- pi0
229 9: KsK+pi-
230 10: KsK-pi+
231 11: K+K-eta
232 *************************************/
233 int pp[2]={-2212,2212};
234 int nn[2]={-2112,2112};
235 int pipi[2]={-211,211};
236 int pi3[3]={-211,111,211};
237 int kkpi0[3]={-321,111,321}; //K+K-pi0
238 int kskpi[3]={-211,310,321};//KsK+pi-
239
240 std::vector<int> vson;vson.clear();
241 for(int i=0;i<evtdaugs.size();i++){vson.push_back( EvtPDL::getStdHep(evtdaugs[i]) );}
242 sort(vson.begin(),vson.end(),mysort);
243
244 if(vson.size() ==2 ){
245 if(vson[0]==pp[0] && vson[1]==pp[1] ) {return 0;}
246 if(vson[0]==nn[0] && vson[1]==nn[1] ) {return 1;}
247 if(vson[0]==pipi[0] && vson[1]==pipi[1] ) {return 2;}
248 }else if(vson.size()==3){
249
250 }
251
252}
struct myclass mysort
static int getStdHep(EvtId id)
Definition: EvtPDL.hh:56

Referenced by EvtXsection().

◆ getMsg()

std::string EvtXsection::getMsg ( )
inline

Definition at line 182 of file EvtXsection.hh.

182{return msg;}

Referenced by EvtConExc::init().

◆ getUnit()

std::string EvtXsection::getUnit ( )
inline

◆ getVP()

double EvtXsection::getVP ( double  mx)

◆ getXBin()

int EvtXsection::getXBin ( double  mx,
std::vector< double >  vy 
)

Definition at line 331 of file EvtXsection.cc.

331 {
332 double nbins = vy.size();
333 if(vy[0]<mx || mx<vy[nbins-1]) {std::cout<<"Outside vacuum pol. value"<<std::endl;abort();}
334 for(int i=0;i<nbins-1;i++){
335 if(mx <= vy[i+1] && mx > vy[i]) return i; //mx at i to i+1 bin
336 }
337}
const int nbins

◆ getXBin_a()

int EvtXsection::getXBin_a ( double  mx)

Definition at line 315 of file EvtXsection.cc.

315 {
316 if(mx <= xx[0]) return 0;
317 if(mx > xx[nbins]) return nbins;
318 for(int i=0;i<nbins;i++){
319 if(mx <= xx[i+1] && mx > xx[i]) return i; //mx at i-th bin
320 }
321}

Referenced by Err_a(), and Xsection_a().

◆ getXBin_b()

int EvtXsection::getXBin_b ( double  mx)

Definition at line 323 of file EvtXsection.cc.

323 {
324 if(mx <= xx[0]) return 0;
325 if(mx > xx[nbins-1]) return nbins;
326 for(int i=0;i<nbins-1;i++){
327 if(mx <= xx[i+1] && mx > xx[i]) return i; //mx at i to i+1 bin
328 }
329}

Referenced by Err_b(), and Xsection_b().

◆ getXlw()

double EvtXsection::getXlw ( )
inline

◆ getXsection()

double EvtXsection::getXsection ( double  mx)

Definition at line 254 of file EvtXsection.cc.

254 {
255 if(_mode == -1){return Xsection_c(mx);}
256 //else if(_mode == 0 || _mode == 2 || _mode == 3 || _mode == 4 ||_mode == 5){ return Xsection_a(mx);}
257 else {return Xsection_b(mx);}
258}
double Xsection_b(double mx)
Definition: EvtXsection.cc:276
double Xsection_c(double mx)
Definition: EvtXsection.cc:339

Referenced by EvtConExc::calAF(), EvtConExc::difgamXs(), EvtConExc::findMaxXS(), ini_data_multimode(), EvtConExc::init(), EvtConExc::mk_VXS(), EvtConExc::PrintXS(), EvtConExc::Rad1difXs(), Rad2difXs(), EvtConExc::Rad2difXs(), Rad2difXs2(), EvtConExc::selectMode(), and EvtConExc::sumExc().

◆ getXup()

double EvtXsection::getXup ( )
inline

Definition at line 180 of file EvtXsection.hh.

180{return xx[nbins-1];}

Referenced by EvtConExc::energySpread(), ini_data_multimode(), and EvtConExc::init().

◆ getXX()

std::vector< double > EvtXsection::getXX ( )
inline

Definition at line 177 of file EvtXsection.hh.

177{return xx;}

Referenced by EvtConExc::init().

◆ getYY()

std::vector< double > EvtXsection::getYY ( )
inline

Definition at line 178 of file EvtXsection.hh.

178{return yy;}

Referenced by EvtConExc::init().

◆ ini_data()

void EvtXsection::ini_data ( int  mode)

Referenced by EvtXsection(), and ini_data_multimode().

◆ ini_data0()

void EvtXsection::ini_data0 ( int  mode)

Definition at line 126 of file EvtXsection.cc.

126 {
127
128 xx.clear();yy.clear();er.clear();
129 nbins=yy.size();
130
131}

◆ ini_data_diy()

void EvtXsection::ini_data_diy ( )

Definition at line 133 of file EvtXsection.cc.

133 {//user provide xs list
134
135 xx.clear();yy.clear();er.clear();
136
137 ifstream file("xs_user.txt");
138
139 if (!file){
140 cout << "EvtXsection.cc: The input file not found. The default file name should be xs_user.txt!"<<std::endl;
141 exit(0);
142 }
143
144 double xm,xs,xs_er;
145
146 while(!file.eof()){
147 file>>xm>>xs>>xs_er;
148 //std::cout<<"read XS: "<<xm<<" "<<xs<<" "<<xs_er<<std::endl;
149 xx.push_back(xm);
150 yy.push_back(xs);
151 er.push_back(xs_er);
152 }
153
154 xx.pop_back();
155 yy.pop_back();
156 er.pop_back();
157 nbins=yy.size();
158 file.close();
159 _unit="";
160 msg="";
161
162}
std::ifstream ifstream
Definition: bpkt_streams.h:44

Referenced by EvtXsection().

◆ ini_data_multimode()

void EvtXsection::ini_data_multimode ( )

Definition at line 164 of file EvtXsection.cc.

164 {//multi-exclusive modes
165 xx.clear();yy.clear();er.clear();
166
167 if(_vmd.size()==0){std::cout<<"EvtXsection::ini_data_multimode: No mode indexes are available"<<std::endl; abort();}
168
169 double xL=10.0;
170 double xU=-1.0;
171
172 for(int i=0;i<_vmd.size();i++){
173 ini_data(_vmd[i]);
174 double x0=getXlw();
175 double x1=getXup();
176 if(x0<xL) xL=x0;
177 if(x1>xU) xU=x1;
178 }
179
180 std::cout<<"The low and up end of multimodes: "<<xL<<" ~ "<<xU<<std::endl;
181 double stp=0.0005; //5 MeV for bin width
182 double xm;
183 double xs=0; //xsection in nb;
184 double xs_er=0;
185 double mypb=1;
186 std::vector<double>uxx,uyy,uer;
187 uxx.clear();uyy.clear();uer.clear();
188 for(double xxm=xL;xxm<xU;xxm+=stp){
189 xm=xxm;
190 xs =0;
191 xs_er=0;
192 for(int i=0;i<_vmd.size();i++){
193 ini_data(_vmd[i]);
194 std::string myunit=getUnit();
195 if(myunit=="pb"){ mypb=0.001;}else{mypb=1;}
196 xs += mypb*getXsection(xxm);
197 xs_er+= mypb*getErr(xxm);
198 //std::cout<<_vmd[i]<< ": "<<xm<<" "<<xs<<" "<<xs_er<<std::endl;
199 }//loop over mode
200 uxx.push_back(xm);
201 uyy.push_back(xs);
202 uer.push_back(xs_er);
203 } //loop over mass
204
205 xx.clear();yy.clear();er.clear();
206 for(int i=0;i<uxx.size();i++){
207 xx.push_back(uxx[i]);yy.push_back(uyy[i]);er.push_back(uer[i]);
208 }
209 //debugging
210 //for(int i=0;i<yy.size();i++){
211 // std::cout<<xx[i]<<" "<<yy[i]<<std::endl;
212 //}
213 _unit="nb";
214 nbins=yy.size();
215 msg="multi-exclusive mode";
216}
double getXlw()
Definition: EvtXsection.hh:181
double getErr(double mx)
Definition: EvtXsection.cc:260
double getXup()
Definition: EvtXsection.hh:180
std::string getUnit()
Definition: EvtXsection.hh:175
double getXsection(double mx)
Definition: EvtXsection.cc:254

Referenced by EvtConExc::init().

◆ ReadVP()

void EvtXsection::ReadVP ( )

◆ setBW()

void EvtXsection::setBW ( int  pdg)

Definition at line 358 of file EvtXsection.cc.

358 {
359 pdgcode = pdg;
360 EvtId pid = EvtPDL::evtIdFromStdHep(pdgcode );
361 double maxM= EvtPDL::getMaxMass(pid);
362 double minM= EvtPDL::getMinMass(pid);
363 double meanM = EvtPDL::getMeanMass(pid);
364 double width = EvtPDL::getWidth(pid);
365 // std::cout<<minM<<" <=M<= "<<maxM<<std::endl;
366 double xstp=(maxM-minM)/100.;
367 xx.clear();yy.clear();er.clear();
368 for(int i=0;i<100;i++){
369 double m=i*xstp;
370 EvtComplex im(0.,1.);
371 EvtComplex bw=1./(m*m-meanM*meanM+im*m*width);
372 double amps = abs2(bw);
373 xx.push_back(m); yy.push_back(amps); er.push_back(0.);
374 }
375 nbins=yy.size();
376}
double abs2(const EvtComplex &c)
Definition: EvtComplex.hh:221
Definition: EvtId.hh:27
static double getWidth(EvtId i)
Definition: EvtPDL.hh:54
static double getMeanMass(EvtId i)
Definition: EvtPDL.hh:45
static EvtId evtIdFromStdHep(int stdhep)
Definition: EvtPDL.cc:244
static double getMinMass(EvtId i)
Definition: EvtPDL.hh:51
static double getMaxMass(EvtId i)
Definition: EvtPDL.hh:50

Referenced by EvtConExc::init().

◆ setFile()

void EvtXsection::setFile ( std::string  name)
inline

Definition at line 184 of file EvtXsection.hh.

184{file = name;}

◆ setModes()

void EvtXsection::setModes ( std::vector< int >  vmd)

Definition at line 378 of file EvtXsection.cc.

378 {
379 _vmd.clear();
380 for(int i=0;i<vmd.size();i++){
381 _vmd.push_back(vmd[i]);
382 }
383}

Referenced by EvtConExc::init().

◆ Xsection_a()

double EvtXsection::Xsection_a ( double  mx)

Definition at line 267 of file EvtXsection.cc.

267 {
268 if (mx <= xx[0]) return 0.;
269 if (mx > xx[nbins]) return 0.;
270 int thebin = getXBin_a(mx);
271 //-- debug
272 //std::cout<<"Mode= "<<_mode<<", thebin"<<thebin<<std::endl;
273 return yy[thebin];
274}

◆ Xsection_b()

double EvtXsection::Xsection_b ( double  mx)

Definition at line 276 of file EvtXsection.cc.

276 {// interpolation of the cross section between two bins
277 if (mx <= xx[0]) return 0.;
278 if (mx > xx[nbins-1]) return 0.;
279 int thebin = getXBin_b(mx);
280 double ylow = yy[thebin];
281 double yup = yy[thebin+1];
282
283 double xlow = xx[thebin];
284 double xup = xx[thebin+1];
285
286 double yi=ylow + (yup-ylow)/(xup-xlow)*(mx-xlow);
287 return yi;
288}

Referenced by getXsection().

◆ Xsection_c()

double EvtXsection::Xsection_c ( double  mx)

Definition at line 339 of file EvtXsection.cc.

339 {// in unit nb
340 double pi=3.1415926;
341 double s= mx*mx;
342 EvtId pid = EvtPDL::evtIdFromStdHep(pdgcode );
343 double mass = EvtPDL::getMeanMass(pid);
344 double width = EvtPDL::getWidth(pid);
345 double mass2 = mass*mass;
346 double width2 = width*width;
347 double br = (s - mass2)*(s - mass2) + mass2 * width2;
348 bree = 1; //this value is canceled when calculation the correction factor;
349 double sigma = 12*pi*bree*width2/br;
350 double nbar = 4E05; // ! GeV-2 = 4*10^5 nbar
351 double thexs = sigma*nbar;
352 // std::cout<<"EvtXsection::Xsection_c: "<<mass<<" "<<width<<" "<<thexs<<std::endl;
353 // msg = "Calculate the correction factor for " + EvtPDL::name(pid);
354
355 return thexs;
356 }
double mass
TTree * sigma
XmlRpcServer s
Definition: HelloServer.cpp:11
const float pi
Definition: vector3.h:133

Referenced by getXsection().


The documentation for this class was generated from the following files: