1 #include "marlin/MarlinConfig.h"
3 #ifdef MARLIN_CLHEP // only if CLHEP is available !
7 #include "CLHEP/Random/RandGauss.h"
8 #include "CLHEP/Random/RandEngine.h"
15 using namespace CLHEP ;
27 const unsigned int size = resVec.
size() / (
sizeof(TrackResolution) /
sizeof(
float) );
28 _resVec.reserve(size);
32 for(
unsigned int i=0 ; i < size ; i++ ){
34 float dPP = resVec[ index++ ] ;
35 float thMin = resVec[ index++ ] ;
36 float thMax = resVec[ index++ ] ;
38 _resVec.
push_back( TrackResolution( dPP, thMin, thMax ) );
47 double theta = v.theta() ;
49 if( theta > M_PI_2 ) theta =
M_PI - theta ;
51 double resolution = -1. ;
53 for(
unsigned int i=0 ; i < _resVec.size() ; i++ ){
55 if( theta <= _resVec[i].ThMax && theta > _resVec[i].ThMin ) {
56 resolution = _resVec[i].DPP ;
62 if( resolution > - 1e-10 ) {
66 double P = v.vect().mag() ;
68 double deltaP = RandGauss::shoot( 0.0 , P*P*resolution ) ;
70 Hep3Vector n3v( v.vect() ) ;
72 n3v.setMag( P + deltaP ) ;
83 double mass = PION_MASS ;
85 if( std::abs( pdgCode ) == 12 )
87 mass = ELECTRON_MASS ;
89 else if( std::abs( pdgCode ) == 13 )
93 sv.setVectM( n3v , mass ) ;
103 #endif // MARLIN_CLHEP