CMS 3D CMS Logo

Public Member Functions | Private Attributes | Static Private Attributes

FML3EfficiencyHandler Class Reference

#include <FML3EfficiencyHandler.h>

List of all members.

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 RandomEnginerandom

Static Private Attributes

static const int nEtaBins = 120
static const int nPhiBins = 100

Detailed Description

Definition at line 12 of file FML3EfficiencyHandler.h.


Constructor & Destructor Documentation

FML3EfficiencyHandler::FML3EfficiencyHandler ( const RandomEngine engine)

Definition at line 11 of file FML3EfficiencyHandler.cc.

References gather_cfg::cout, Effic_Eta, Effic_Phi_Barrel, Effic_Phi_Endcap, Effic_Phi_Extern, connectstrParser::f1, alignmentValidation::fname, i, FileInPath::name(), nEtaBins, nPhiBins, and path().

  : random(engine) {

   std::string fname = "FastSimulation/ParamL3MuonProducer/data/efficiencyL3.data";
   std::string path(getenv("CMSSW_SEARCH_PATH"));
   FileInPath f1(path,fname);
   if ( f1() == 0) {
     std::cout << "File " << fname << " not found in " << path << std::endl;
     throw Genexception(" efficiency list not found for FML3EfficiencyHandler.");
   } else {
     std::cout << "Reading " << f1.name() << std::endl;
   }
   std::ifstream & listfile = *f1();
 
   double eff=0.;
   int nent;
   listfile >> nent;
   if (nent != nEtaBins) { 
     std::cout << " *** ERROR -> FML3EfficiencyHandler : nEta bins " 
          << nent << " instead of " << nEtaBins << std::endl;
   }
   for (int i=0; i<nEtaBins; i++) {
     listfile >> eff;
     Effic_Eta[i]=eff;
   }
   int iStart=nEtaBins;
   listfile >> nent;
   if (nent != nPhiBins) { 
     std::cout << " *** ERROR -> FML3EfficiencyHandler : nPhi bins "
               << nent << " instead of " << nPhiBins << std::endl;
   }
   for (int i=iStart; i<iStart+nPhiBins; i++) {
     listfile >> eff;
     Effic_Phi_Barrel[i-iStart]=eff;
   }
   iStart += nPhiBins;
   listfile >> nent;
   if (nent != nPhiBins) { 
     std::cout << " *** ERROR -> FML3EfficiencyHandler : nPhi bins "
               << nent << " instead of " << nPhiBins << std::endl;
   }
   for (int i=iStart; i<iStart+nPhiBins; i++) {
     listfile >> eff;
     Effic_Phi_Endcap[i-iStart]=eff;
   }
   iStart += nPhiBins;
   listfile >> nent;
   if (nent != nPhiBins) { 
     std::cout << " *** ERROR -> FML3EfficiencyHandler : nPhi bins "
          << nent << " instead of " << nPhiBins << std::endl;
   }
   for (int i=iStart; i<iStart+nPhiBins; i++) {
     listfile >> eff;
     Effic_Phi_Extern[i-iStart]=eff;
   }

}
FML3EfficiencyHandler::~FML3EfficiencyHandler ( )

Definition at line 69 of file FML3EfficiencyHandler.cc.

References Effic_Eta, Effic_Phi_Barrel, Effic_Phi_Endcap, and Effic_Phi_Extern.

                                             {
  delete Effic_Eta;
  delete Effic_Phi_Barrel;
  delete Effic_Phi_Endcap;
  delete Effic_Phi_Extern;
}

Member Function Documentation

bool FML3EfficiencyHandler::kill ( const SimTrack aTrack)

Definition at line 76 of file FML3EfficiencyHandler.cc.

References Effic_Eta, Effic_Phi_Barrel, eta(), funct::exp(), RandomEngine::flatShoot(), M_PI, CoreSimTrack::momentum(), nEtaBins, nPhiBins, phi, ExpressReco_HICollisions_FallBack::pt, random, and mathSSE::sqrt().

Referenced by ParamL3MuonProducer::produce().

                                                        {

  
  // At least eight hit in the tracker : To be tuned !!!
  //  if ( aTrack.recHits().size() < 8 ) return false;

  // At least zero reconstructed  Pixel hits : To be tuned !!!
  //  int seed = 0;
  //  for ( unsigned i=1; i<6; ++i ) 
  //    if ( aTrack.isARecHit(i) ) ++seed;
  //  if ( seed < 0 ) return false;

  double myEffEta=0. , myEffPhi=0. , myEffPt=0. , myCorrection=1. , myEff;

  // Eta dependence :
  double eta = fabs(aTrack.momentum().eta());
  if (eta < 2.40) {
    int iEtaBin = (int) ( (eta/2.40) * nEtaBins);
    myEffEta = Effic_Eta[iEtaBin];
  } else return false;

  // Phi and Pt dependence:
  double pt = std::sqrt(aTrack.momentum().perp2());
  double phi = aTrack.momentum().phi();
  if (phi < 0.) {phi = 2* M_PI + phi; }
  int iPhiBin = (int) ((phi/(2*M_PI)) * nPhiBins);
  if (eta<1.04) {
    myEffPhi = Effic_Phi_Barrel[iPhiBin];
    if (pt>40.) myEffPt = 0.9583 - pt*5.82726e-05;
    //    else if (pt>4.10) myEffPt = 0.952*(1.-exp(-(pt-4.072)));
    else if (pt>4.0) myEffPt = 0.952*(1.-sqrt(exp(-(pt-3.3))));
    myCorrection = 1.124;
  }
  else if (eta<2.07) {
    myEffPhi = 1.;  // no visible residual phi structure in the endcaps
    if (pt>173.) myEffPt = 0.991 - pt*3.46562e-05;
    //    else if (pt>3.10) myEffPt = 0.985*(1.-exp(-(pt-3.061)));
    else if (pt>3.0) myEffPt = 0.985*(1.-sqrt(exp(-(pt-2.4))));
    myCorrection = 1.028;
  }
  else if (eta<2.40) {
    myEffPhi = 1.; // no visible residual phi structure in the endcaps
    if (pt>26.) myEffPt = 0.9221 - pt*7.75139e-05;
    else if (pt>3.00) myEffPt = 0.927*(1.-exp(-sqrt(pt-1.617)));
    myCorrection = 1.133;
  }
  else return false;

  /*
  // Special high Pt muons treatment :
  if (pt>400.) {
    double myEffHighPt=1.;
    double pttev = pt/1000.;
    if (eta < 0.3) {
      //      myEffHighPt = 0.952 - 0.033*pttev;
      myEffHighPt = 0.945 - 0.028*pttev;  // fit up to 3.0 TeV
    } else if ( eta < 0.6) {
      //      myEffHighPt = 0.973 - 0.033*pttev;
      myEffHighPt = 0.974 - 0.033*pttev;  // fit up to 3.0 TeV
    } else if ( eta < 0.9) {
      //      myEffHighPt = 0.969 - 0.045*pttev;  
      myEffHighPt = 0.966 - 0.041*pttev;  // fit up to 2.7 TeV
    } else if ( eta < 1.2) {
      //      myEffHighPt = 0.968 - 0.058*pttev;
      myEffHighPt = 0.957 - 0.044*pttev;  // fit up to 2.7 TeV
    } else if ( eta < 1.5) {
      //      myEffHighPt = 0.966 - 0.074*pttev;
      myEffHighPt = 0.944 - 0.045*pttev;  // fit up to 2.4 TeV
    } else if ( eta < 1.8) {
      //      myEffHighPt = 0.955 - 0.11*pttev;
      myEffHighPt = 0.939 - 0.086*pttev;  // fit up to 1.8 TeV
    } else if ( eta < 2.1) {
      //      myEffHighPt = 0.982 - 0.11*pttev;
      myEffHighPt = 0.989 - 0.122*pttev;  // fit up to 1.5 TeV
    } else {
      //     myEffHighPt = 0.958 - 0.14*pttev;
      myEffHighPt = 0.934 - 0.088*pttev;  // fit up to 1.2 TeV
    }
    myEffPt = (myEffPt>myEffHighPt? myEffHighPt : myEffPt);
  }
  */

  myEff = myEffEta*myEffPhi*myEffPt*myCorrection;
  double prob = random->flatShoot();
  return (myEff > prob) ;

}

Member Data Documentation

Definition at line 26 of file FML3EfficiencyHandler.h.

Referenced by FML3EfficiencyHandler(), kill(), and ~FML3EfficiencyHandler().

Definition at line 27 of file FML3EfficiencyHandler.h.

Referenced by FML3EfficiencyHandler(), kill(), and ~FML3EfficiencyHandler().

Definition at line 28 of file FML3EfficiencyHandler.h.

Referenced by FML3EfficiencyHandler(), and ~FML3EfficiencyHandler().

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().

Definition at line 23 of file FML3EfficiencyHandler.h.

Referenced by kill().