/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/BesEvtGen/BesEvtGen-00-03-58/src/EvtGen/EvtGenBase/EvtDalitzFlatPdf.cc

Go to the documentation of this file.
00001 #include "EvtGenBase/EvtPatches.hh"
00002 /*******************************************************************************
00003  * Project: BaBar detector at the SLAC PEP-II B-factory
00004  * Package: EvtGenBase
00005  *    File: $Id: EvtDalitzFlatPdf.cc,v 1.1.1.2 2007/10/26 05:03:14 pingrg Exp $
00006  *  Author: Alexei Dvoretskii, dvoretsk@slac.stanford.edu, 2001-2002
00007  *
00008  * Copyright (C) 2002 Caltech
00009  *******************************************************************************/
00010 
00011 #include "EvtGenBase/EvtPatches.hh"
00012 #include "EvtGenBase/EvtDalitzFlatPdf.hh"
00013 
00014 EvtDalitzFlatPdf::EvtDalitzFlatPdf(const EvtDalitzPlot& dp)
00015   : EvtPdf<EvtDalitzPoint>(), _dp(dp)
00016 {}
00017 
00018 EvtDalitzFlatPdf::EvtDalitzFlatPdf(const EvtDalitzFlatPdf& other)
00019   : EvtPdf<EvtDalitzPoint>(other), _dp(other._dp)
00020 {}
00021 
00022 EvtDalitzFlatPdf::~EvtDalitzFlatPdf()
00023 {}
00024 
00025 EvtPdf<EvtDalitzPoint>* EvtDalitzFlatPdf::clone() const
00026 {
00027   return new EvtDalitzFlatPdf(*this);
00028 }
00029 
00030 double EvtDalitzFlatPdf::pdf(const EvtDalitzPoint&) const
00031 {
00032   return 1.;
00033 }
00034   
00035 EvtValError EvtDalitzFlatPdf::compute_integral(int N) const
00036 {
00037   return EvtValError(_dp.getArea(N),0.);
00038 }
00039 
00040 EvtDalitzPoint EvtDalitzFlatPdf::randomPoint()
00041 {
00042   // To obtain a uniform distribution generate 
00043   // in terms of q's. Generate in a box that circumscribes the 
00044   // Dalitz plot. Accept points inside. If there are two 
00045   // many unsuccessful attempts it's a hint that the Dalitz plot
00046   // area is tiny compared to the box. It's a pathological
00047   // case. Abort.
00048   
00049   EvtCyclic3::Pair pair1 = EvtCyclic3::BC;
00050   EvtCyclic3::Pair pair2 = EvtCyclic3::CA;
00051   
00052   int n = 0;
00053   int maxTries = 1000;
00054   while(n++ < maxTries) {
00055     
00056     double q1 = EvtRandom::Flat(_dp.qAbsMin(pair1),_dp.qAbsMax(pair2));
00057     double q2 = EvtRandom::Flat(_dp.qAbsMin(pair2),_dp.qAbsMax(pair2)); 
00058     
00059     EvtDalitzCoord point(pair1,q1,pair2,q2);
00060     EvtDalitzPoint x(_dp,point);
00061     
00062     if(x.isValid()) return x;
00063   }
00064   
00065   printf("No point generated for dalitz plot after %d tries\n",maxTries);
00066   assert(0);
00067 }

Generated on Tue Nov 29 23:12:12 2016 for BOSS_7.0.2 by  doxygen 1.4.7