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
00023
00024 }
00025 std::ifstream & listfile = *f1();
00026
00027 double eff=0.;
00028 int nent;
00029 listfile >> nent;
00030 if (nent != nEtaBins) {
00031 std::cout << " *** ERROR -> FMGLfromL3TKEfficiencyHandler : nEta bins "
00032 << nent << " instead of " << nEtaBins << std::endl;
00033 }
00034 for (int i=0; i<nEtaBins; i++) {
00035 listfile >> eff;
00036 Effic_Eta[i]=eff;
00037 }
00038
00039 }
00040
00041 FMGLfromL3TKEfficiencyHandler::~FMGLfromL3TKEfficiencyHandler(){
00042 delete Effic_Eta;
00043 }
00044
00045 bool FMGLfromL3TKEfficiencyHandler::kill(const SimTrack & aTrack) {
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 double myEffEta=0. , myCorrection=1. , myEff;
00057
00058
00059 double eta = fabs(aTrack.momentum().eta());
00060 if (eta < 2.40) {
00061 int iEtaBin = (int) ( (eta/2.40) * nEtaBins);
00062 myEffEta = Effic_Eta[iEtaBin];
00063 } else return false;
00064
00065 if (eta<1.04) myCorrection = 1.0296;
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088 myEff = myEffEta * myCorrection;
00089 double prob = random->flatShoot();
00090 return (myEff > prob) ;
00091
00092 }
00093
00094
00095