Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

DefaultSmearer.cxx

Go to the documentation of this file.
00001 // DefaultSmearer.cxx
00002 //
00003 // Implementation of Default Smearer class
00004 //
00005 // Namespace Atlfast::
00006 //
00007 //--------------------------------------------------------------------
00008 //
00009 // Authors: H.T. Phillips, P. Clarke, E. Richter-Was, P. Sherwood, R. Steward
00010 //
00011 //
00012 #include "AtlfastAlgs/DefaultSmearer.h"
00013 // CLHEP includes
00014 #include "CLHEP/Vector/LorentzVector.h"
00015 #include "CLHEP/Random/JamesRandom.h"
00016 #include "CLHEP/Random/RandGauss.h"
00017 
00018 
00019 
00020 
00021 
00022 namespace Atlfast {
00023 
00024   DefaultSmearer::DefaultSmearer(const int aseed) {
00025     // instantiate the random number engine based on the seed and store it
00026     HepRandomEngine* randomEngine = new HepJamesRandom( aseed );
00027     m_randGauss    = new RandGauss( randomEngine );
00028     m_randSeed     = aseed;
00029   }
00030 
00031 
00032   DefaultSmearer::~DefaultSmearer() {
00033     // we check to see if our random engine and gauss are still set and if so kill them
00034     //    if (m_randomEngine) {
00035     //      delete m_randomEngine;
00036     //    }
00037     if (m_randGauss) {
00038       delete m_randGauss;
00039     }
00040   }
00041 
00042   HepLorentzVector DefaultSmearer::smear( const HepLorentzVector& avec) {
00043     // do the actual business... to fake it up, just smear in each variable ofthe four vector with width 1.0
00044     // for testing purposes only
00045 
00046     HepLorentzVector bvec;
00047     // set each component by smearing around the central value with width 1.0
00048     bvec.setE( m_randGauss->fire(avec.e(), 1.0) );
00049     bvec.setPx(m_randGauss->fire(avec.px(),1.0) );
00050     bvec.setPy(m_randGauss->fire(avec.py(),1.0) );
00051     bvec.setPz(m_randGauss->fire(avec.pz(),1.0) );
00052 
00053     return bvec;
00054   }
00055 
00056 
00057 
00058 } // end of namespace bracket

Generated on Tue Mar 18 11:18:23 2003 for AtlfastAlgs by doxygen1.3-rc1