/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/BesDChain/BesDChain-00-00-14/src/CDDecay.cxx

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     DChain
00004 // Module:      CDDecay
00005 // 
00006 // Description: CDDecay candidate built from other candidates
00007 //
00008 // Implimentation:
00009 //     <Notes on implimentation>
00010 //
00011 // Author:      Simon Patton
00012 // Created:     Sat Oct 26 11:09:11 EDT 1996
00013 // $Id: CDDecay.cxx,v 1.5 2011/12/08 15:28:10 zoujh Exp $
00014 //
00015 // Revision history
00016 //
00017 // $Log: CDDecay.cxx,v $
00018 // Revision 1.5  2011/12/08 15:28:10  zoujh
00019 // change the rule of tag calculation
00020 //
00021 // Revision 1.4  2011/10/27 06:15:12  zoujh
00022 // add user tag to particle data
00023 //
00024 // Revision 1.3  2009/09/22 08:24:41  hujf
00025 // see ChangeLog
00026 //
00027 // Revision 1.2  2009/06/22 14:55:48  zoujh
00028 // See ChangeLog
00029 //
00030 // Revision 1.1.1.1  2009/03/03 06:05:56  maqm
00031 // first import of BesDChain
00032 //
00033 // Revision 1.9  2006/03/17 19:36:31  ponyisi
00034 // Fix mcParticle() to use gammaFSR when available while doing matching
00035 //
00036 // Revision 1.8  2006/01/11 20:37:25  cdj
00037 // work with renaming done in DChain package
00038 //
00039 // Revision 1.7  2004/06/30 16:43:08  chengp
00040 // deleted redundant lines
00041 //
00042 // Revision 1.6  2004/06/29 17:51:22  chengp
00043 // modified to match Monte Carlo decay with FSR
00044 //
00045 // Revision 1.5  2004/03/12 15:22:41  cdj
00046 // protect against case where get negative mass squared (sets it to 0)
00047 //
00048 // Revision 1.4  2004/03/05 22:01:43  chengp
00049 // implemented Monte Carlo matching
00050 //
00051 // Revision 1.3  2003/05/15 19:58:08  cdj
00052 // revamped memory handling so always use a ReferenceHolder to deal with the reference counting
00053 //
00054 // Revision 1.2  2002/04/09 20:54:16  lyon
00055 // Added CDDecay::setKinematicData
00056 //
00057 // Revision 1.1  2001/04/11 13:19:01  urner
00058 // transition to files with CD prefix. Addition of new files
00059 //
00060 // Revision 1.4  2001/04/04 15:16:55  cdj
00061 // added a protected default constructor (used for storage)
00062 //
00063 // Revision 1.3  2001/04/03 17:25:55  cdj
00064 // changed isCDDecay to builtFromCDDecay
00065 //
00066 // Revision 1.2  2001/03/30 19:41:33  cdj
00067 // addChild now adds to footprint
00068 //
00069 // Revision 1.1.1.1  2000/12/18 22:17:25  cdj
00070 // imported CleoDChain
00071 //
00072 // Revision 1.13  1998/05/04 19:11:26  sjp
00073 // Corrected order of arguments in KinematicData ctor
00074 //
00075 // Revision 1.12  1998/04/17 18:55:51  sjp
00076 // Modified to use latest types
00077 //
00078 // Revision 1.11  1997/09/03 14:58:32  sjp
00079 // Use new report.h and KTKinematicData
00080 //
00081 // Revision 1.10  1997/08/29 17:00:34  sjp
00082 // Modified to handle new Cairn Templated classes
00083 //
00084 // Revision 1.9  1997/08/28 07:00:31  sjp
00085 // Modified files to handle complete templating
00086 //
00087 // Revision 1.8  1997/08/20 12:49:29  sjp
00088 // Fudged up work around for <math.h>
00089 //
00090 // Revision 1.7  1997/08/19 23:02:46  sjp
00091 // Restructured package to be independent of CleoDChain
00092 //
00093 // Revision 1.6  1997/08/19 20:40:15  sjp
00094 // Updated to use <package>/<file>.h include structure.
00095 //   (Note: This version of the code has not been compiled)
00096 //
00097 // Revision 1.5  1997/01/31 20:10:12  sjp
00098 // Modified to use the new `bug' include files
00099 //
00100 // Revision 1.4  1997/01/21 20:29:59  sjp
00101 // Changed CPP flags and include because of library reorganization
00102 //
00103 // Revision 1.3  1997/01/19 20:32:11  sjp
00104 // Changed LargeCount to Count
00105 //
00106 // Revision 1.2  1996/12/20 21:00:50  sjp
00107 // Request of non-existant reference is now and error
00108 //
00109 // Revision 1.1  1996/11/04 16:55:10  sjp
00110 // New class for CDDecay CDCandidate
00111 //
00112 
00113 // system include files
00114 #include <stdlib.h>  // required for 'exit'
00115 #include <cmath>  // required for trigonometry and fabs
00116 
00117 // user include files
00118 #include "BesDChain/util/KinematicData.h"
00119 #include "DecayChain/Function/DCAnalysisFunction.h"
00120 #include "BesDChain/CDDecay.h"
00121 
00122 using namespace dchain;
00123 using std::vector;
00124 using DecayChain::KinematicData;
00125 
00126 CDDecay::CDDecay( const CDDecay& aOtherCDDecay ) :
00127 #ifdef EXTEND
00128     m_kmfit_chisq(aOtherCDDecay.chisq()),
00129     m_vxfit_chisq(aOtherCDDecay.vchisq()),
00130 #endif
00131     CDCandidate( aOtherCDDecay ) ,
00132     m_children( *new vector< ReferenceHolder< CDCandidate > >( aOtherCDDecay.children() ) )
00133 {
00134 }
00135 
00136 CDDecay::CDDecay( const CDCandidate& aProduct ) :
00137 #ifdef EXTEND
00138     m_kmfit_chisq(500000.),
00139     m_vxfit_chisq(500000.),
00140 #endif
00141     CDCandidate( aProduct.footPrint() ) ,
00142     m_children( *new vector< ReferenceHolder<CDCandidate> >
00143             ( 1, ReferenceHolder<CDCandidate>(&aProduct ) ) )
00144 {
00145 }
00146 
00147 CDDecay::CDDecay( const CDDecay& aProducts, const CDCandidate& aAdditionalProduct ) :
00148 #ifdef EXTEND
00149     m_kmfit_chisq(500000.),
00150     m_vxfit_chisq(500000.),
00151 #endif
00152     CDCandidate( aProducts.footPrint() + aAdditionalProduct.footPrint() ) ,
00153     m_children(  *new vector< ReferenceHolder<CDCandidate> >( aProducts.children() ) )
00154 {
00155     m_children.push_back( ReferenceHolder<CDCandidate>(&aAdditionalProduct) ) ;
00156 }
00157 
00158 CDDecay::~CDDecay()
00159 {
00160     delete &m_children ;
00161 }
00162 
00163 CDDecay::CDDecay() :
00164 #ifdef EXTEND
00165     m_kmfit_chisq(500000.),
00166     m_vxfit_chisq(500000.),
00167 #endif
00168     CDCandidate( CDFootPrint() ),
00169     m_children( *new vector< ReferenceHolder<CDCandidate> > )
00170 {
00171 }
00172 //
00173 // assignment operators
00174 //
00175 /*
00176    const CDDecay& CDDecay::operator=( const CDDecay& aOtherCDDecay )
00177    {
00178  *this = *(new CDDecay(aOtherCDDecay));
00179  return *this;
00180  }
00181  */
00182 
00183 //
00184 // member functions
00185 //
00186 
00187 void CDDecay::addChild( const CDCandidate& aAdditionalProduct )
00188 {
00189     setCDFootPrint( footPrint() + aAdditionalProduct.footPrint() );
00190     m_children.push_back( ReferenceHolder<CDCandidate>(&aAdditionalProduct) ) ;
00191 }
00192 
00193 void CDDecay::setKinematicData( const KinematicData& aKinematicData )
00194 {
00195     // Call setKinematicData of my super-class
00196     CDCandidate::setKinematicData( aKinematicData );
00197 }
00198 
00199 //
00200 // const member functions
00201 //
00202 
00203 bool CDDecay::builtFromCDDecay() const
00204 {
00205     return ( !false ) ;
00206 }
00207 
00208 const CDDecay& CDDecay::decay() const
00209 {
00210     return ( *this ) ;
00211 }
00212 
00213 //------ numberChildren -----
00214 // return the number of DCChildren a candidate has
00215 //
00216 uint32_t CDDecay::numberChildren() const
00217 {
00218     return ( m_children.size() ) ;
00219 }
00220 
00221 //------ iterateChildern -----
00222 // execute given function over all DCChildren
00223 //
00224 void CDDecay::iterateChildren( void ( * analyze )( const CDCandidate& ) ) const
00225 {
00226     vector< ReferenceHolder<CDCandidate> >::const_iterator finished( m_children.end() ) ;
00227     for ( vector< ReferenceHolder<CDCandidate> >::const_iterator child( m_children.begin() ) ;
00228             child != finished ;
00229             ++child ) {
00230         analyze( (*(*child)) ) ;
00231     }
00232 }
00233 
00234 //------ iterateChildern -----
00235 // execute given function over all DCChildren
00236 //
00237 void CDDecay::iterateChildren( DCAnalysisFunction< CDCandidate >& analyze ) const
00238 {
00239     vector< ReferenceHolder<CDCandidate> >::const_iterator finished ( m_children.end() ) ;
00240     for ( vector< ReferenceHolder<CDCandidate> >::const_iterator child ( m_children.begin() ) ;
00241             child != finished ;
00242             ++child ) {
00243         analyze( (*(*child)) ) ;
00244     }
00245 }
00246 
00247 const CDCandidate& CDDecay::child( unsigned int aPosition ) const
00248 {
00249     if ( aPosition >= m_children.size() ) {
00250         std::cerr << "Trying to access an invalid Child" << std::endl ;
00251         return ( *(m_children[ 0 ]) ) ;
00252     }
00253     return ( *(m_children[ aPosition ]) ) ;
00254 }
00255 
00256 const vector< ReferenceHolder<CDCandidate> >& CDDecay::children() const
00257 {
00258     return ( m_children ) ;
00259 }
00260 
00261 KinematicData* 
00262 CDDecay::defaultKinematicData() const
00263 {
00264     int    userTag   = 1 ;
00265     double energySum = 0 ;
00266     int    chargeSum = 0 ;
00267     HepLorentzVector p4( 0.0 , 0.0 , 0.0, 0.0 ) ;
00268     vector< ReferenceHolder<CDCandidate> >::const_iterator finished( m_children.end() ) ;
00269     for ( vector< ReferenceHolder<CDCandidate> >::const_iterator child( m_children.begin() ) ;
00270             child != finished ;
00271             ++child ) {
00272         userTag &= (*(*child)).userTag();
00273         chargeSum += (*(*child)).charge() ;
00274         p4 += (*(*child)).p4() ;
00275     }
00276 
00277     KinematicData* tmp = new KinematicData();
00278 
00279     tmp->setUserTag( userTag );
00280     tmp->setCharge( chargeSum );
00281     tmp->setP4( p4 );
00282 
00283     return tmp;
00284 }
00285 //
00286 // static member functions
00287 //

Generated on Tue Nov 29 22:58:19 2016 for BOSS_7.0.2 by  doxygen 1.4.7