CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FMGLfromL3TKEfficiencyHandler.cc
Go to the documentation of this file.
1 #include <fstream>
2 
5 
8 
10 
12  : random(engine) {
13 
14  std::string fname = "FastSimulation/ParamL3MuonProducer/data/efficiencyGL_L3TK.data";
15  std::string path(getenv("CMSSW_SEARCH_PATH"));
16  FileInPath f1(path,fname);
17 
18  if ( f1() == 0) {
19  std::cout << "File " << fname << " not found in " << path << std::endl;
20  throw Genexception(" efficiency list not found for FMGLfromL3TKEfficiencyHandler.");
21  } else {
22  // The following should be on LogInfo
23  //std::cout << "Reading " << f1.name() << std::endl;
24  }
25  std::ifstream & listfile = *f1();
26 
27  double eff=0.;
28  int nent;
29  listfile >> nent;
30  if (nent != nEtaBins) {
31  std::cout << " *** ERROR -> FMGLfromL3TKEfficiencyHandler : nEta bins "
32  << nent << " instead of " << nEtaBins << std::endl;
33  }
34  for (int i=0; i<nEtaBins; i++) {
35  listfile >> eff;
36  Effic_Eta[i]=eff;
37  }
38 
39 }
40 
42  delete Effic_Eta;
43 }
44 
46 
47  // At least eight hit in the tracker : To be tuned !!!
48  //if ( aTrack.recHits().size() < 8 ) return false;
49 
50  // At least zero reconstructed Pixel hits : To be tuned !!!
51  //int seed = 0;
52  //for ( unsigned i=1; i<6; ++i )
53  // if ( aTrack.isARecHit(i) ) ++seed;
54  //if ( seed < 0 ) return false;
55 
56  double myEffEta=0. , myCorrection=1. , myEff;
57 
58  // Eta dependence :
59  double eta = fabs(aTrack.momentum().eta());
60  if (eta < 2.40) {
61  int iEtaBin = (int) ( (eta/2.40) * nEtaBins);
62  myEffEta = Effic_Eta[iEtaBin];
63  } else return false;
64 
65  if (eta<1.04) myCorrection = 1.0296;
66 
67  /*
68  double pt = std::sqrt(aTrack.momentum().perp2());
69  if (eta<1.04) {
70  if (pt>40.) myEffPt = 0.9583 - pt*5.82726e-05;
71  else if (pt>4.10) myEffPt = 0.952*(1.-exp(-(pt-4.072)));
72  myCorrection = 1.115;
73  }
74  else if (eta<2.07) {
75  if (pt>173.) myEffPt = 0.991 - pt*3.46562e-05;
76  else if (pt>3.10) myEffPt = 0.985*(1.-exp(-(pt-3.061)));
77  myCorrection = 1.034;
78  }
79  else if (eta<2.40) {
80  if (pt>26.) myEffPt = 0.9221 - pt*7.75139e-05;
81  else if (pt>3.00) myEffPt = 0.927*(1.-exp(-sqrt(pt-1.617)));
82  myCorrection = 1.157;
83  }
84  else return false;
85  */
86 
87  // myEff = myEffEta*myEffPt*myCorrection;
88  myEff = myEffEta * myCorrection;
89  double prob = random->flatShoot();
90  return (myEff > prob) ;
91 
92 }
93 
94 
95 
int i
Definition: DBlmapReader.cc:9
TRandom random
Definition: MVATrainer.cc:138
T eta() const
int path() const
Definition: HLTadd.h:3
double flatShoot(double xmin=0.0, double xmax=1.0) const
Definition: RandomEngine.h:30
string fname
main script
const math::XYZTLorentzVectorD & momentum() const
particle info...
Definition: CoreSimTrack.h:36
tuple cout
Definition: gather_cfg.py:41
FMGLfromL3TKEfficiencyHandler(const RandomEngine *engine)