Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

PhotonSmearer.cxx

Go to the documentation of this file.
00001 // PhotonSmearer.cxx
00002 //
00003 // Implementation of the Photon Smearer class
00004 //
00005 // Only the smear() method is overridden
00006 //
00007 //
00008 // Authors: H.T. Phillips, P.Clarke, E.Richter-Was, P.Sherwood, R.Steward
00009 //
00010 //
00011 
00012 #include "AtlfastAlgs/PhotonSmearer.h"
00013 
00014 #include <cmath>
00015 
00016 #include "CLHEP/Vector/LorentzVector.h"
00017 
00018 #include "CLHEP/Random/JamesRandom.h"
00019 #include "CLHEP/Random/RandGauss.h"
00020 
00021 namespace Atlfast {
00022   using std::abs;
00023 
00024   HepLorentzVector PhotonSmearer::smear (const HepLorentzVector& avec) {
00025     // do the smearing, copied verbatim (except for ROOT dependencies)
00026     // from photonmaker codein Atlfast++
00027     // The code is very procedural (even more so than Atlfast++!) and should be tidied later!
00028     //
00029     // Parametrisation was by L.Poggioli and F. Gianotti
00030 
00031     double rpilup = 0.0;
00032     double aa, bb, sigph1, sigph, sigpu;
00033     double sqrtene = sqrt(avec.e());
00034     double abseta  = fabs(avec.pseudoRapidity());
00035 
00036     // do smearing of theta first
00037     HepLorentzVector bvec(avec);
00038     
00039     double sigph2 = 0.0;
00040     while (1) {
00041       aa=randGauss()->fire();
00042       if (abseta < 0.8) sigph2                  = aa*0.065/sqrtene;
00043       if (abseta >= 0.8 && abseta < 1.4) sigph2 = aa*0.050/sqrtene;
00044       if (abseta >= 1.4 && abseta < 2.5) sigph2 = aa*0.040/sqrtene;
00045       if (abseta >= 2.5)                 sigph2 = 0;
00046       if (fabs(bvec.theta()) + sigph2 <= M_PI) break;
00047     }
00048 
00049     // sigph2 is now the offset for theta...
00050     bvec.setPz(bvec.e()*cos(bvec.theta()+sigph2));
00051 
00052 
00053     // now do the energy resolution
00054     //
00055     while (1) {
00056       aa=randGauss()->fire();
00057       //bb=randGauss()->fire();
00058       sigph1 = aa*0.10/sqrtene;
00059       if (1.0 + sigph1 <= 0.0) continue;
00060       sigph = sigph1;
00061       if (abseta < 1.4) {
00062         while (1) {
00063           aa=randGauss()->fire();
00064           bb=randGauss()->fire();
00065           sigph1 = aa*0.245/bvec.perp() + bb*0.007;
00066           if (1.0+sigph1 > 0) break;
00067         }
00068       } else {
00069         while (1) {
00070           aa=randGauss()->fire();
00071           bb=randGauss()->fire();
00072           sigph1 = aa*0.306*((2.4-abseta)+0.228)/bvec.e() + bb*0.007;
00073           if (1.0+sigph1 > 0) break;
00074         }
00075       }
00076       sigph += sigph1;
00077       if (m_lumi == 2) {
00078         if (abseta < 0.6) rpilup = 0.32;
00079         if (abseta > 0.6 && abseta < 1.4) rpilup = 0.295;
00080         if (abseta > 1.4) rpilup = 0.27;
00081         while (1) {
00082           aa=randGauss()->fire();
00083           //bb=randGauss()->fire();
00084           sigpu = aa*rpilup/bvec.perp();
00085           if (1+sigpu > 0) break;
00086         }
00087         sigph += sigpu;
00088       }
00089       if (1.0 + sigph > 0) break;
00090     }
00091 
00092 
00093     // Now sigph is the photon "sigma" and we do the following a la Atlfast++ photon maker:
00094     // this seems to be OK for energy resolution. 
00095     //
00096     // It looks to me as though the functional form above for photons is actually the same as
00097     // electrons, just that one magic number is different. Suggest we revisit this and
00098     // exploit commonality.
00099     //
00100 
00101     bvec.setPx(bvec.px()*(1.0+sigph));
00102     bvec.setPy(bvec.py()*(1.0+sigph));
00103     bvec.setPz(bvec.pz()*(1.0+sigph));
00104 
00105     // nb from Atlfast++ code, we go back to the original photon energy here
00106     bvec.setE( avec.e() *(1.0+sigph));
00107   
00108     return bvec;
00109   }
00110 
00111 } // end of namespace bracket
00112 
00113 
00114 

Generated on Tue Jan 28 09:57:14 2003 for AtlfastAlgs by doxygen1.3-rc1