Go to the documentation of this file.00001 #include <fstream>
00002
00003 #include "FastSimulation/ParamL3MuonProducer/interface/FMGLfromTKEfficiencyHandler.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 FMGLfromTKEfficiencyHandler::FMGLfromTKEfficiencyHandler(const RandomEngine * engine)
00012 : random(engine) {;
00013
00014 std::string fname = "FastSimulation/ParamL3MuonProducer/data/efficiencyGL_TK.data";
00015 std::string path(getenv("CMSSW_SEARCH_PATH"));
00016 FileInPath f1(path,fname);
00017
00018 if ( f1() == 0) {
00019 std::cout << "File efficiencyGL_TK.data not found in " << path << std::endl;
00020 throw Genexception(" efficiency list not found for FMGLfromTKEfficiencyHandler.");
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 -> FMGLfromTKEfficiencyHandler : nEta bins " << nent << " instead of " << nEtaBins << std::endl;
00031 }
00032 for (int i=0; i<nEtaBins; i++) {
00033 listfile >> eff;
00034 Effic_Eta[i]=eff;
00035 }
00036
00037 }
00038
00039 FMGLfromTKEfficiencyHandler::~FMGLfromTKEfficiencyHandler(){
00040 delete Effic_Eta;
00041 }
00042
00043 bool FMGLfromTKEfficiencyHandler::kill(const SimTrack & aTrack) {
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 double myEffEta=0. , myEffPt=0. , myCorrection=1. , myEff;
00055
00056
00057 double eta = fabs(aTrack.momentum().eta());
00058 if (eta < 2.40) {
00059 int iEtaBin = (int) ( (eta/2.40) * nEtaBins);
00060 myEffEta = Effic_Eta[iEtaBin];
00061 } else return false;
00062
00063
00064 double pt = std::sqrt(aTrack.momentum().perp2());
00065 if (eta<1.04) {
00066 if (pt>40.) myEffPt = 0.9583 - pt*5.82726e-05;
00067
00068 else if (pt>4.0) myEffPt = 0.952*(1.-sqrt(exp(-(pt-3.2))));
00069
00070 myCorrection = 1.077;
00071 }
00072 else if (eta<2.07) {
00073 if (pt>173.) myEffPt = 0.991 - pt*3.46562e-05;
00074
00075 else if (pt>3.0) myEffPt = 0.985*(1.-sqrt(exp(-(pt-2.4))));
00076
00077 myCorrection = 1.028;
00078 }
00079 else if (eta<2.40) {
00080 if (pt>26.) myEffPt = 0.9221 - pt*7.75139e-05;
00081 else if (pt>3.00) myEffPt = 0.927*(1.-exp(-sqrt(pt-1.617)));
00082
00083 myCorrection = 1.133;
00084 }
00085 else return false;
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131 myEff = myEffEta*myEffPt*myCorrection;
00132
00133 double prob = random->flatShoot();
00134 return (myEff > prob) ;
00135
00136 }
00137
00138
00139