#include <FastSimulation/Muons/interface/FML1EfficiencyHandler.h>
Public Member Functions | |
FML1EfficiencyHandler (const RandomEngine *engine) | |
Constructor (read in the parametrizations from a data file). | |
bool | kill (const SimpleL1MuGMTCand *) |
reject tracks according to parametrized algorithmic efficiency | |
~FML1EfficiencyHandler () | |
Destructor. | |
Private Member Functions | |
double | dumpingfactor (int ieta, float pt) |
double | tuningfactor (int ieta) |
Private Attributes | |
double | Effic_Eta [nEtaBins] |
double | Effic_Phi_Barrel [nPhiBins] |
double | Effic_Phi_Endcap [nPhiBins] |
double | Effic_Phi_Extern [nPhiBins] |
const RandomEngine * | random |
Static Private Attributes | |
static const int | nEtaBins = 120 |
static const int | nPhiBins = 100 |
Definition at line 15 of file FML1EfficiencyHandler.h.
FML1EfficiencyHandler::FML1EfficiencyHandler | ( | const RandomEngine * | engine | ) |
Constructor (read in the parametrizations from a data file).
Definition at line 13 of file FML1EfficiencyHandler.cc.
References GenMuonPlsPt100GeV_cfg::cout, Effic_Eta, Effic_Phi_Barrel, Effic_Phi_Endcap, Effic_Phi_Extern, lat::endl(), f1, mergeAndRegister_online::fname, i, FileInPath::name(), nEtaBins, nPhiBins, and path().
00014 : random(engine){ 00015 00016 string fname = "FastSimulation/Muons/data/efficiencyL1.data"; 00017 // std::string path(std::getenv("CMSSW_SEARCH__PATH")); 00018 std::string path(getenv("CMSSW_SEARCH_PATH")); 00019 FileInPath f1(path,fname); 00020 if ( f1() == 0) { 00021 std::cout << "File " << fname << " not found in " << path << std::endl; 00022 throw Genexception(" efficiency list not found for FML1EfficiencyHandler."); 00023 } else { 00024 std::cout << "Reading " << f1.name() << std::endl; 00025 } 00026 std::ifstream & listfile = *f1(); 00027 00028 double eff=0.; 00029 for (int i=0; i<nEtaBins; i++) { 00030 listfile >> eff; 00031 Effic_Eta[i]=eff; 00032 } 00033 int iStart=nEtaBins; 00034 for (int i=iStart; i<iStart+nPhiBins; i++) { 00035 listfile >> eff; 00036 Effic_Phi_Barrel[i-iStart]=eff; 00037 } 00038 iStart += nPhiBins; 00039 for (int i=iStart; i<iStart+nPhiBins; i++) { 00040 listfile >> eff; 00041 Effic_Phi_Endcap[i-iStart]=eff; 00042 } 00043 iStart += nPhiBins; 00044 for (int i=iStart; i<iStart+nPhiBins; i++) { 00045 listfile >> eff; 00046 Effic_Phi_Extern[i-iStart]=eff; 00047 } 00048 00049 }
FML1EfficiencyHandler::~FML1EfficiencyHandler | ( | ) |
double FML1EfficiencyHandler::dumpingfactor | ( | int | ieta, | |
float | pt | |||
) | [inline, private] |
Definition at line 57 of file FML1EfficiencyHandler.h.
References funct::exp().
Referenced by kill().
00057 { 00058 if (pt<3.) return 0.; 00059 // float df=0.; 00060 double df=0.; 00061 switch (ieta) { 00062 case 0: 00063 df = 1. - 1.260 * exp(-(pt-2.607)*(pt-2.607)) ; 00064 break; 00065 case 1: 00066 df = 1. - 5.540 * exp(-(pt-1.401)*(pt-1.401)) ; 00067 break; 00068 case 2: 00069 df = 1.; 00070 break; 00071 } 00072 return (df>0? df: 0.) ; 00073 }
bool FML1EfficiencyHandler::kill | ( | const SimpleL1MuGMTCand * | aMuon | ) |
reject tracks according to parametrized algorithmic efficiency
Definition at line 54 of file FML1EfficiencyHandler.cc.
References dumpingfactor(), Effic_Eta, Effic_Phi_Barrel, Effic_Phi_Endcap, Effic_Phi_Extern, RandomEngine::flatShoot(), SimpleL1MuGMTCand::getMomentum(), int, nEtaBins, nPhiBins, random, funct::sqrt(), and tuningfactor().
Referenced by ParamL3MuonProducer::produce(), and FastL1MuonProducer::produce().
00054 { 00055 00056 double myEffEta=0. , myEffPhi=0. , myEff; 00057 double AbsEta = fabs(aMuon->getMomentum().eta()); 00058 double Phi = aMuon->getMomentum().phi(); 00059 double Pt = std::sqrt(aMuon->getMomentum().perp2()); 00060 00061 // efficiency as a function of |eta| 00062 00063 if (AbsEta < 2.40) { 00064 int iEtaBin = (int) ( (AbsEta/2.40) * nEtaBins); 00065 myEffEta = Effic_Eta[iEtaBin]; 00066 } else { myEffEta = 0.0; } 00067 00068 // efficiency as a function of phi and combined efficiency: 00069 00070 if (Phi < 0.) {Phi = 2* M_PI + Phi; } 00071 int iPhiBin = (int) ((Phi/(2*M_PI)) * nPhiBins); 00072 00073 int ieta = 0; 00074 if (AbsEta < 1.04) { 00075 myEffPhi = Effic_Phi_Barrel[iPhiBin]; 00076 myEff = myEffEta * myEffPhi * tuningfactor(0); 00077 ieta = 0; 00078 } else if (AbsEta < 2.07) { 00079 myEffPhi = Effic_Phi_Endcap[iPhiBin]; 00080 myEff = myEffEta * myEffPhi * tuningfactor(1); 00081 ieta = 1; 00082 } else if (AbsEta < 2.40) { 00083 myEffPhi = Effic_Phi_Extern[iPhiBin]; 00084 myEff = myEffEta * myEffPhi * tuningfactor(2); 00085 ieta = 2; 00086 } else { myEff = 0. ; } 00087 00088 // Drop of efficiency at the lowest Pt's: 00089 if (Pt<6) myEff *= dumpingfactor(ieta,Pt); 00090 00091 double prob = random->flatShoot(); 00092 00093 return (myEff > prob); 00094 }
double FML1EfficiencyHandler::tuningfactor | ( | int | ieta | ) | [inline, private] |
Definition at line 40 of file FML1EfficiencyHandler.h.
Referenced by kill().
00040 { 00041 double tf=0.; 00042 switch (ieta) { 00043 case 0: 00044 tf = 1.045; 00045 break; 00046 case 1: 00047 tf = 1.049; 00048 break; 00049 case 2: 00050 tf = 1.059; 00051 break; 00052 } 00053 return tf ; 00054 }
double FML1EfficiencyHandler::Effic_Eta[nEtaBins] [private] |
Definition at line 34 of file FML1EfficiencyHandler.h.
Referenced by FML1EfficiencyHandler(), and kill().
double FML1EfficiencyHandler::Effic_Phi_Barrel[nPhiBins] [private] |
Definition at line 35 of file FML1EfficiencyHandler.h.
Referenced by FML1EfficiencyHandler(), and kill().
double FML1EfficiencyHandler::Effic_Phi_Endcap[nPhiBins] [private] |
Definition at line 36 of file FML1EfficiencyHandler.h.
Referenced by FML1EfficiencyHandler(), and kill().
double FML1EfficiencyHandler::Effic_Phi_Extern[nPhiBins] [private] |
Definition at line 37 of file FML1EfficiencyHandler.h.
Referenced by FML1EfficiencyHandler(), and kill().
const int FML1EfficiencyHandler::nEtaBins = 120 [static, private] |
Definition at line 32 of file FML1EfficiencyHandler.h.
Referenced by FML1EfficiencyHandler(), and kill().
const int FML1EfficiencyHandler::nPhiBins = 100 [static, private] |
Definition at line 33 of file FML1EfficiencyHandler.h.
Referenced by FML1EfficiencyHandler(), and kill().
const RandomEngine* FML1EfficiencyHandler::random [private] |