#include <FastSimulation/ParamL3MuonProducer/interface/FML3EfficiencyHandler.h>
Public Member Functions | |
FML3EfficiencyHandler (const RandomEngine *engine) | |
bool | kill (const SimTrack &) |
~FML3EfficiencyHandler () | |
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 12 of file FML3EfficiencyHandler.h.
FML3EfficiencyHandler::FML3EfficiencyHandler | ( | const RandomEngine * | engine | ) |
Definition at line 11 of file FML3EfficiencyHandler.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().
00012 : random(engine) { 00013 00014 std::string fname = "FastSimulation/ParamL3MuonProducer/data/efficiencyL3.data"; 00015 std::string path(getenv("CMSSW_SEARCH_PATH")); 00016 FileInPath f1(path,fname); 00017 if ( f1() == 0) { 00018 std::cout << "File " << fname << " not found in " << path << std::endl; 00019 throw Genexception(" efficiency list not found for FML3EfficiencyHandler."); 00020 } else { 00021 std::cout << "Reading " << f1.name() << std::endl; 00022 } 00023 std::ifstream & listfile = *f1(); 00024 00025 double eff=0.; 00026 int nent; 00027 listfile >> nent; 00028 if (nent != nEtaBins) { 00029 std::cout << " *** ERROR -> FML3EfficiencyHandler : nEta bins " 00030 << 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 int iStart=nEtaBins; 00037 listfile >> nent; 00038 if (nent != nPhiBins) { 00039 std::cout << " *** ERROR -> FML3EfficiencyHandler : nPhi bins " 00040 << nent << " instead of " << nPhiBins << std::endl; 00041 } 00042 for (int i=iStart; i<iStart+nPhiBins; i++) { 00043 listfile >> eff; 00044 Effic_Phi_Barrel[i-iStart]=eff; 00045 } 00046 iStart += nPhiBins; 00047 listfile >> nent; 00048 if (nent != nPhiBins) { 00049 std::cout << " *** ERROR -> FML3EfficiencyHandler : nPhi bins " 00050 << nent << " instead of " << nPhiBins << std::endl; 00051 } 00052 for (int i=iStart; i<iStart+nPhiBins; i++) { 00053 listfile >> eff; 00054 Effic_Phi_Endcap[i-iStart]=eff; 00055 } 00056 iStart += nPhiBins; 00057 listfile >> nent; 00058 if (nent != nPhiBins) { 00059 std::cout << " *** ERROR -> FML3EfficiencyHandler : nPhi bins " 00060 << nent << " instead of " << nPhiBins << std::endl; 00061 } 00062 for (int i=iStart; i<iStart+nPhiBins; i++) { 00063 listfile >> eff; 00064 Effic_Phi_Extern[i-iStart]=eff; 00065 } 00066 00067 }
FML3EfficiencyHandler::~FML3EfficiencyHandler | ( | ) |
Definition at line 69 of file FML3EfficiencyHandler.cc.
References Effic_Eta, Effic_Phi_Barrel, Effic_Phi_Endcap, and Effic_Phi_Extern.
00069 { 00070 delete Effic_Eta; 00071 delete Effic_Phi_Barrel; 00072 delete Effic_Phi_Endcap; 00073 delete Effic_Phi_Extern; 00074 }
Definition at line 76 of file FML3EfficiencyHandler.cc.
References Effic_Eta, Effic_Phi_Barrel, eta, funct::exp(), RandomEngine::flatShoot(), int, CoreSimTrack::momentum(), nEtaBins, nPhiBins, phi, random, and funct::sqrt().
Referenced by ParamL3MuonProducer::produce().
00076 { 00077 00078 00079 // At least eight hit in the tracker : To be tuned !!! 00080 // if ( aTrack.recHits().size() < 8 ) return false; 00081 00082 // At least zero reconstructed Pixel hits : To be tuned !!! 00083 // int seed = 0; 00084 // for ( unsigned i=1; i<6; ++i ) 00085 // if ( aTrack.isARecHit(i) ) ++seed; 00086 // if ( seed < 0 ) return false; 00087 00088 double myEffEta=0. , myEffPhi=0. , myEffPt=0. , myCorrection=1. , myEff; 00089 00090 // Eta dependence : 00091 double eta = fabs(aTrack.momentum().eta()); 00092 if (eta < 2.40) { 00093 int iEtaBin = (int) ( (eta/2.40) * nEtaBins); 00094 myEffEta = Effic_Eta[iEtaBin]; 00095 } else return false; 00096 00097 // Phi and Pt dependence: 00098 double pt = std::sqrt(aTrack.momentum().perp2()); 00099 double phi = aTrack.momentum().phi(); 00100 if (phi < 0.) {phi = 2* M_PI + phi; } 00101 int iPhiBin = (int) ((phi/(2*M_PI)) * nPhiBins); 00102 if (eta<1.04) { 00103 myEffPhi = Effic_Phi_Barrel[iPhiBin]; 00104 if (pt>40.) myEffPt = 0.9583 - pt*5.82726e-05; 00105 // else if (pt>4.10) myEffPt = 0.952*(1.-exp(-(pt-4.072))); 00106 else if (pt>4.0) myEffPt = 0.952*(1.-sqrt(exp(-(pt-3.3)))); 00107 myCorrection = 1.124; 00108 } 00109 else if (eta<2.07) { 00110 myEffPhi = 1.; // no visible residual phi structure in the endcaps 00111 if (pt>173.) myEffPt = 0.991 - pt*3.46562e-05; 00112 // else if (pt>3.10) myEffPt = 0.985*(1.-exp(-(pt-3.061))); 00113 else if (pt>3.0) myEffPt = 0.985*(1.-sqrt(exp(-(pt-2.4)))); 00114 myCorrection = 1.028; 00115 } 00116 else if (eta<2.40) { 00117 myEffPhi = 1.; // no visible residual phi structure in the endcaps 00118 if (pt>26.) myEffPt = 0.9221 - pt*7.75139e-05; 00119 else if (pt>3.00) myEffPt = 0.927*(1.-exp(-sqrt(pt-1.617))); 00120 myCorrection = 1.133; 00121 } 00122 else return false; 00123 00124 /* 00125 // Special high Pt muons treatment : 00126 if (pt>400.) { 00127 double myEffHighPt=1.; 00128 double pttev = pt/1000.; 00129 if (eta < 0.3) { 00130 // myEffHighPt = 0.952 - 0.033*pttev; 00131 myEffHighPt = 0.945 - 0.028*pttev; // fit up to 3.0 TeV 00132 } else if ( eta < 0.6) { 00133 // myEffHighPt = 0.973 - 0.033*pttev; 00134 myEffHighPt = 0.974 - 0.033*pttev; // fit up to 3.0 TeV 00135 } else if ( eta < 0.9) { 00136 // myEffHighPt = 0.969 - 0.045*pttev; 00137 myEffHighPt = 0.966 - 0.041*pttev; // fit up to 2.7 TeV 00138 } else if ( eta < 1.2) { 00139 // myEffHighPt = 0.968 - 0.058*pttev; 00140 myEffHighPt = 0.957 - 0.044*pttev; // fit up to 2.7 TeV 00141 } else if ( eta < 1.5) { 00142 // myEffHighPt = 0.966 - 0.074*pttev; 00143 myEffHighPt = 0.944 - 0.045*pttev; // fit up to 2.4 TeV 00144 } else if ( eta < 1.8) { 00145 // myEffHighPt = 0.955 - 0.11*pttev; 00146 myEffHighPt = 0.939 - 0.086*pttev; // fit up to 1.8 TeV 00147 } else if ( eta < 2.1) { 00148 // myEffHighPt = 0.982 - 0.11*pttev; 00149 myEffHighPt = 0.989 - 0.122*pttev; // fit up to 1.5 TeV 00150 } else { 00151 // myEffHighPt = 0.958 - 0.14*pttev; 00152 myEffHighPt = 0.934 - 0.088*pttev; // fit up to 1.2 TeV 00153 } 00154 myEffPt = (myEffPt>myEffHighPt? myEffHighPt : myEffPt); 00155 } 00156 */ 00157 00158 myEff = myEffEta*myEffPhi*myEffPt*myCorrection; 00159 double prob = random->flatShoot(); 00160 return (myEff > prob) ; 00161 00162 }
double FML3EfficiencyHandler::Effic_Eta[nEtaBins] [private] |
Definition at line 26 of file FML3EfficiencyHandler.h.
Referenced by FML3EfficiencyHandler(), kill(), and ~FML3EfficiencyHandler().
double FML3EfficiencyHandler::Effic_Phi_Barrel[nPhiBins] [private] |
Definition at line 27 of file FML3EfficiencyHandler.h.
Referenced by FML3EfficiencyHandler(), kill(), and ~FML3EfficiencyHandler().
double FML3EfficiencyHandler::Effic_Phi_Endcap[nPhiBins] [private] |
Definition at line 28 of file FML3EfficiencyHandler.h.
Referenced by FML3EfficiencyHandler(), and ~FML3EfficiencyHandler().
double FML3EfficiencyHandler::Effic_Phi_Extern[nPhiBins] [private] |
Definition at line 29 of file FML3EfficiencyHandler.h.
Referenced by FML3EfficiencyHandler(), and ~FML3EfficiencyHandler().
const int FML3EfficiencyHandler::nEtaBins = 120 [static, private] |
Definition at line 24 of file FML3EfficiencyHandler.h.
Referenced by FML3EfficiencyHandler(), and kill().
const int FML3EfficiencyHandler::nPhiBins = 100 [static, private] |
Definition at line 25 of file FML3EfficiencyHandler.h.
Referenced by FML3EfficiencyHandler(), and kill().
const RandomEngine* FML3EfficiencyHandler::random [private] |