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