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       while (1){
00057         aa=randGauss()->fire();
00058         sigph1 = aa*0.10/sqrtene;
00059         //std::cout << "THE VALUE SIGPH1 " << sigph1 << std::endl;
00060         if (1.0 + sigph1 > 0.0) break;
00061       }
00062       sigph = sigph1;
00063       if (abseta < 1.4) {
00064         while (1) {
00065           aa=randGauss()->fire();
00066           bb=randGauss()->fire();
00067           sigph1 = aa*0.245/bvec.perp() + bb*0.007;
00068           if (1.0+sigph1 > 0) break;
00069         }
00070       } else {
00071         while (1) {
00072           aa=randGauss()->fire();
00073           bb=randGauss()->fire();
00074           sigph1 = aa*0.306*((2.4-abseta)+0.228)/bvec.e() + bb*0.007;
00075           if (1.0+sigph1 > 0) break;
00076         }
00077       }
00078       sigph += sigph1;
00079       if (m_lumi == 2) {
00080         if (abseta < 0.6) rpilup = 0.32;
00081         if (abseta > 0.6 && abseta < 1.4) rpilup = 0.295;
00082         if (abseta > 1.4) rpilup = 0.27;
00083         while (1) {
00084           aa=randGauss()->fire();
00085           sigpu = aa*rpilup/bvec.perp();
00086           if (1+sigpu > 0) break;
00087         }
00088         sigph += sigpu;
00089       }
00090       //std::cout << "THE VALUE SIGPH " << sigph << std::endl;
00091       if (1.0 + sigph > 0) break;
00092     }
00093 
00094 
00095     // Now sigph is the photon "sigma" and we do the following a la Atlfast++ photon maker:
00096     // this seems to be OK for energy resolution. 
00097     //
00098     // It looks to me as though the functional form above for photons is actually the same as
00099     // electrons, just that one magic number is different. Suggest we revisit this and
00100     // exploit commonality.
00101     //
00102 
00103     bvec.setPx(avec.px()*(1.0+sigph));
00104     bvec.setPy(avec.py()*(1.0+sigph));
00105     bvec.setPz(bvec.pz()*(1.0+sigph));
00106 
00107     // nb from Atlfast++ code, we go back to the original photon energy here
00108     bvec.setE( avec.e() *(1.0+sigph));
00109   
00110     return bvec;
00111   }
00112 
00113 } // end of namespace bracket
00114 
00115 
00116 

Generated on Tue Mar 18 11:18:24 2003 for AtlfastAlgs by doxygen1.3-rc1