00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "AtlfastAlgs/CellSmearer.h"
00013 #include <cmath>
00014 #include <iostream>
00015 #include "CLHEP/Vector/LorentzVector.h"
00016 #include "CLHEP/Random/JamesRandom.h"
00017 #include "CLHEP/Random/RandGauss.h"
00018 #include "CLHEP/Units/SystemOfUnits.h"
00019
00020
00021 namespace Atlfast {
00022
00023 HepLorentzVector CellSmearer::smear(const HepMC::GenParticle& particle){
00024 return smear(particle.momentum());
00025 }
00026
00027 HepLorentzVector CellSmearer::smear (const HepLorentzVector& vec) {
00028
00029
00030
00031
00032
00033
00034
00035 float sigma=0.;
00036 HepLorentzVector smearedVec(vec);
00037 float aa, bb;
00038 float sqrtene = sqrt(vec.e()/GeV);
00039 float abseta = fabs(vec.pseudoRapidity());
00040 while(1) {
00041 aa=randGauss()->fire();
00042 bb=randGauss()->fire();
00043 if(abseta < m_BarrelForwardEta) sigma = aa*0.5/sqrtene + bb*0.03;
00044 else sigma = aa*1.0/sqrtene + bb*0.07;
00045 if(1.+sigma > .0) break;
00046 }
00047 smearedVec.setPx(vec.px()*(1.0+sigma));
00048 smearedVec.setPy(vec.py()*(1.0+sigma));
00049 smearedVec.setPz(vec.pz()*(1.0+sigma));
00050 smearedVec.setE(vec.e()*(1.0+sigma));
00051 return smearedVec;
00052
00053 }
00054
00055
00056 int CellSmearer::setSmearParameters (const std::vector<double>& ){
00057 return 0;
00058 }
00059
00060 int CellSmearer::setSmearParamSchema ( const int ){
00061 return 0;
00062 }
00063
00064 }
00065
00066
00067
00068
00069
00070
00071