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 #include "CLHEP/Random/RandFlat.h"
00018 
00019 
00020 
00021 namespace Atlfast {
00022 
00023   DefaultSmearer::DefaultSmearer(const int aseed) {
00024     // instantiate the random number engine based on the seed and store it
00025     HepRandomEngine* randomEngine = new HepJamesRandom( aseed );
00026     m_randGauss    = new RandGauss( randomEngine );
00027     m_randFlat     = new RandFlat( *randomEngine );
00028     m_randSeed     = aseed;
00029   }
00030 
00031 
00032   DefaultSmearer::~DefaultSmearer() {
00033 
00034     // we check to see if our random engine and gauss are still set and if so kill them
00035     
00036     if (m_randFlat) {
00037       delete m_randFlat;
00038     }
00039     
00040     if (m_randGauss) {
00041       delete m_randGauss;
00042     }
00043     
00044     //    if (m_randomEngine) {
00045     //      delete m_randomEngine;
00046     //    }
00047     
00048   }
00049   
00050   HepLorentzVector DefaultSmearer::smear(const HepMC::GenParticle& particle){
00051     return smear(particle.momentum());
00052   }
00053   
00054   HepLorentzVector DefaultSmearer::smear( const HepLorentzVector& avec) {
00055     // do the actual business... to fake it up, just smear in each variable ofthe four vector with width 1.0
00056     // for testing purposes only
00057 
00058     HepLorentzVector bvec;
00059     // set each component by smearing around the central value with width 1.0
00060     bvec.setE( m_randGauss->fire(avec.e(), 1.0) );
00061     bvec.setPx(m_randGauss->fire(avec.px(),1.0) );
00062     bvec.setPy(m_randGauss->fire(avec.py(),1.0) );
00063     bvec.setPz(m_randGauss->fire(avec.pz(),1.0) );
00064 
00065     return bvec;
00066   }
00067 
00068   //cct: implement the setSmearParameters method
00069   int DefaultSmearer::setSmearParameters (const std::vector<double>& /*smearValues*/){
00070     return 0;
00071   }
00072   //cct: implement the setSmearParamSchema method
00073   int DefaultSmearer::setSmearParamSchema ( const int /*smearSchema*/){
00074     return 0;
00075   }
00076   
00077 } // end of namespace bracket

Generated on Mon Sep 24 14:19:12 2007 for AtlfastAlgs by  doxygen 1.5.1