CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FMGLfromL3EfficiencyHandler.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_L3.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 FMGLfromL3EfficiencyHandler.");
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 -> FMGLfromL3EfficiencyHandler : 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. , myEff;
57  // double myCorrection=1.;
58 
59  // Eta dependence :
60  double eta = fabs(aTrack.momentum().eta());
61  if (eta < 2.40) {
62  int iEtaBin = (int) ( (eta/2.40) * nEtaBins);
63  myEffEta = Effic_Eta[iEtaBin];
64  } else return false;
65 
66  /*
67  double pt = aTrack.momentum().pt();
68  if (eta<1.04) {
69  if (pt>40.) myEffPt = 0.9583 - pt*5.82726e-05;
70  else if (pt>4.10) myEffPt = 0.952*(1.-exp(-(pt-4.072)));
71  myCorrection = 1.115;
72  }
73  else if (eta<2.07) {
74  if (pt>173.) myEffPt = 0.991 - pt*3.46562e-05;
75  else if (pt>3.10) myEffPt = 0.985*(1.-exp(-(pt-3.061)));
76  myCorrection = 1.034;
77  }
78  else if (eta<2.40) {
79  if (pt>26.) myEffPt = 0.9221 - pt*7.75139e-05;
80  else if (pt>3.00) myEffPt = 0.927*(1.-exp(-sqrt(pt-1.617)));
81  myCorrection = 1.157;
82  }
83  else return false;
84  */
85 
86  // myEff = myEffEta*myEffPt*myCorrection;
87  myEff = myEffEta;
88  double prob = random->flatShoot();
89  return (myEff > prob) ;
90 
91 }
int i
Definition: DBlmapReader.cc:9
TRandom random
Definition: MVATrainer.cc:138
T eta() const
int path() const
Definition: HLTadd.h:3
FMGLfromL3EfficiencyHandler(const RandomEngine *engine)
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