Go to the documentation of this file.00001 #include <fstream>
00002
00003 #include "FastSimulation/ParamL3MuonProducer/interface/FMGLfromL3EfficiencyHandler.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 FMGLfromL3EfficiencyHandler::FMGLfromL3EfficiencyHandler(const RandomEngine * engine)
00012 : random(engine) {
00013
00014 std::string fname = "FastSimulation/ParamL3MuonProducer/data/efficiencyGL_L3.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 FMGLfromL3EfficiencyHandler.");
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 -> FMGLfromL3EfficiencyHandler : 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 FMGLfromL3EfficiencyHandler::~FMGLfromL3EfficiencyHandler(){
00042 delete Effic_Eta;
00043 }
00044
00045 bool FMGLfromL3EfficiencyHandler::kill(const SimTrack & aTrack) {
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 double myEffEta=0. , myEff;
00057
00058
00059
00060 double eta = fabs(aTrack.momentum().eta());
00061 if (eta < 2.40) {
00062 int iEtaBin = (int) ( (eta/2.40) * nEtaBins);
00063 myEffEta = Effic_Eta[iEtaBin];
00064 } else return false;
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 myEff = myEffEta;
00088 double prob = random->flatShoot();
00089 return (myEff > prob) ;
00090
00091 }