CMS 3D CMS Logo

FMGLfromL3TKEfficiencyHandler.cc

Go to the documentation of this file.
00001 #include <fstream>
00002 
00003 #include "FastSimulation/ParamL3MuonProducer/interface/FMGLfromL3TKEfficiencyHandler.h"
00004 #include "SimDataFormats/Track/interface/SimTrack.h"
00005  
00006 #include "Utilities/General/interface/FileInPath.h"
00007 #include "Utilities/General/interface/CMSexception.h"
00008  
00009 #include "FastSimulation/Utilities/interface/RandomEngine.h" 
00010 
00011 FMGLfromL3TKEfficiencyHandler::FMGLfromL3TKEfficiencyHandler(const RandomEngine * engine)
00012   : random(engine) {
00013 
00014   std::string fname = "FastSimulation/ParamL3MuonProducer/data/efficiencyGL_L3TK.data";
00015   std::string path(getenv("CMSSW_SEARCH_PATH"));
00016   FileInPath f1(path,fname);
00017   
00018   if ( f1() == 0) {
00019     std::cout << "File " << fname << " not found in " << path << std::endl;
00020     throw Genexception(" efficiency list not found for FMGLfromL3TKEfficiencyHandler.");
00021   } else {
00022     std::cout << "Reading " << f1.name() << std::endl;
00023   }
00024   std::ifstream & listfile = *f1();
00025   
00026   double eff=0.;
00027   int nent;
00028   listfile >> nent;
00029   if (nent != nEtaBins) { 
00030     std::cout << " *** ERROR -> FMGLfromL3TKEfficiencyHandler : nEta bins " 
00031               << nent << " instead of " << nEtaBins << std::endl;
00032   }
00033   for (int i=0; i<nEtaBins; i++) {
00034     listfile >> eff;
00035     Effic_Eta[i]=eff;
00036   }
00037 
00038 }
00039 
00040 FMGLfromL3TKEfficiencyHandler::~FMGLfromL3TKEfficiencyHandler(){
00041   delete Effic_Eta;
00042 }
00043 
00044 bool FMGLfromL3TKEfficiencyHandler::kill(const SimTrack & aTrack) {
00045 
00046   // At least eight hit in the tracker : To be tuned !!!
00047   //if ( aTrack.recHits().size() < 8 ) return false;
00048 
00049   // At least zero reconstructed  Pixel hits : To be tuned !!!
00050   //int seed = 0;
00051   //for ( unsigned i=1; i<6; ++i ) 
00052   //  if ( aTrack.isARecHit(i) ) ++seed;
00053   //if ( seed < 0 ) return false;
00054 
00055   double myEffEta=0. , myCorrection=1. , myEff;
00056 
00057   // Eta dependence : 
00058   double eta = fabs(aTrack.momentum().eta());
00059   if (eta < 2.40) {
00060     int iEtaBin = (int) ( (eta/2.40) * nEtaBins);
00061     myEffEta = Effic_Eta[iEtaBin];
00062   } else return false;
00063 
00064   if (eta<1.04) myCorrection = 1.0296;
00065 
00066   /*
00067   double pt = std::sqrt(aTrack.momentum().perp2());
00068   if (eta<1.04) {
00069     if (pt>40.) myEffPt = 0.9583 - pt*5.82726e-05;
00070     else if (pt>4.10) myEffPt = 0.952*(1.-exp(-(pt-4.072)));
00071     myCorrection = 1.115;
00072   }
00073   else if (eta<2.07) {
00074     if (pt>173.) myEffPt = 0.991 - pt*3.46562e-05;
00075     else if (pt>3.10) myEffPt = 0.985*(1.-exp(-(pt-3.061)));
00076     myCorrection = 1.034;
00077   }
00078   else if (eta<2.40) {
00079     if (pt>26.) myEffPt = 0.9221 - pt*7.75139e-05;
00080     else if (pt>3.00) myEffPt = 0.927*(1.-exp(-sqrt(pt-1.617)));
00081     myCorrection = 1.157;
00082   }
00083   else return false;
00084   */
00085 
00086   //  myEff = myEffEta*myEffPt*myCorrection;
00087   myEff = myEffEta * myCorrection;
00088   double prob = random->flatShoot();
00089   return (myEff > prob) ;
00090 
00091 }
00092 
00093 
00094 

Generated on Tue Jun 9 17:35:11 2009 for CMSSW by  doxygen 1.5.4