CMS 3D CMS Logo

SiStripGaussianSmearingRecHitConverterAlgorithm.cc

Go to the documentation of this file.
00001 
00010 // SiStrip Gaussian Smearing
00011 #include "FastSimulation/TrackingRecHitProducer/interface/SiStripGaussianSmearingRecHitConverterAlgorithm.h"
00012 
00013 // Famos
00014 #include "FastSimulation/Utilities/interface/RandomEngine.h"
00015 
00016 // STL
00017 
00018 // #define FAMOS_DEBUG
00019 
00020 SiStripGaussianSmearingRecHitConverterAlgorithm::SiStripGaussianSmearingRecHitConverterAlgorithm
00021 (const RandomEngine* engine) : random(engine) {}
00022 
00023 
00024 void 
00025 SiStripGaussianSmearingRecHitConverterAlgorithm::smearHit(const PSimHit& simHit, 
00026                                                           double localPositionResolutionX, 
00027                                                           double localPositionResolutionY,      
00028                                                           double localPositionResolutionZ,
00029                                                           double boundX,
00030                                                           double boundY) 
00031 {
00032 
00033   // Gaussian Smearing
00034   // x is smeared,
00035   // y fixed at the centre of the strip, 
00036   // z fixed at the centre of the active area
00037   // For the double-sided modules it will be a problem 
00038   // for the RecHit matcher (starting from these PSimHits)
00039   //
00040   do {
00041     thePosition = 
00042       Local3DPoint(random->gaussShoot((double)simHit.localPosition().x(), localPositionResolutionX), 
00043                   (double)simHit.localPosition().y(),
00044                   0.);
00045 #ifdef FAMOS_DEBUG
00046     std::cout << " Detector bounds: "
00047               << "\t\tx = " << boundX
00048               << "\ty = " << boundY
00049               << std::endl;
00050     std::cout << " Generated local position "
00051               << "\tx = " << thePosition.x()
00052               << "\ty = " << thePosition.y()
00053               << std::endl;       
00054 #endif  
00055   } while(fabs(thePosition.x()) > boundX);
00056   
00057   //
00058   thePositionX = thePosition.x();
00059   thePositionY = thePosition.y();
00060   thePositionZ = thePosition.z();
00061   //
00062   theErrorX = localPositionResolutionX;
00063   theErrorY = localPositionResolutionY;
00064   theErrorZ = localPositionResolutionZ;
00065 
00066   theError = LocalError( theErrorX * theErrorX,
00067                          0.0,
00068                          theErrorY * theErrorY ); 
00069   // Local Error is 2D: (xx,xy,yy), square of sigma 
00070   // in first an third position as for resolution matrix
00071   //
00072 }

Generated on Tue Jun 9 17:35:16 2009 for CMSSW by  doxygen 1.5.4