CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

FML1EfficiencyHandler Class Reference

#include <FML1EfficiencyHandler.h>

List of all members.

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 RandomEnginerandom

Static Private Attributes

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

Detailed Description

Class to deal with L1 muon efficiency as a function of eta, phi and pt.

Author:
Andrea Perrotta Date: 05/09/2006

Definition at line 15 of file FML1EfficiencyHandler.h.


Constructor & Destructor Documentation

FML1EfficiencyHandler::FML1EfficiencyHandler ( const RandomEngine engine)

Constructor (read in the parametrizations from a data file)

Definition at line 13 of file FML1EfficiencyHandler.cc.

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

  : random(engine){

   string fname = "FastSimulation/Muons/data/efficiencyL1.data";
   //   std::string path(std::getenv("CMSSW_SEARCH__PATH"));
   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 FML1EfficiencyHandler.");
   } else {
     // The following should be on LogDebug
     //std::cout << "Reading " << f1.name() << std::endl;
   }
   std::ifstream & listfile = *f1();

   double eff=0.;
   for (int i=0; i<nEtaBins; i++) {
     listfile >> eff;
     Effic_Eta[i]=eff;
   }
   int iStart=nEtaBins;
   for (int i=iStart; i<iStart+nPhiBins; i++) {
     listfile >> eff;
     Effic_Phi_Barrel[i-iStart]=eff;
   }
   iStart += nPhiBins;
   for (int i=iStart; i<iStart+nPhiBins; i++) {
     listfile >> eff;
     Effic_Phi_Endcap[i-iStart]=eff;
   }
   iStart += nPhiBins;
   for (int i=iStart; i<iStart+nPhiBins; i++) {
     listfile >> eff;
     Effic_Phi_Extern[i-iStart]=eff;
   }

}
FML1EfficiencyHandler::~FML1EfficiencyHandler ( )

Destructor.

Definition at line 52 of file FML1EfficiencyHandler.cc.

{}

Member Function Documentation

double FML1EfficiencyHandler::dumpingfactor ( int  ieta,
float  pt 
) [inline, private]

Definition at line 57 of file FML1EfficiencyHandler.h.

References funct::exp().

Referenced by kill().

                                                   {
    if (pt<3.) return 0.;
    //    float df=0.;
    double df=0.;
    switch (ieta) {
    case 0: 
      df = 1. - 1.260 * exp(-(pt-2.607)*(pt-2.607)) ;
      break;
    case 1:  
      df = 1. - 5.540 * exp(-(pt-1.401)*(pt-1.401)) ;
      break;
    case 2:  
      df = 1.;
      break;
    }
    return (df>0? df: 0.) ;
  }
bool FML1EfficiencyHandler::kill ( const SimpleL1MuGMTCand aMuon)

reject tracks according to parametrized algorithmic efficiency

Definition at line 55 of file FML1EfficiencyHandler.cc.

References dumpingfactor(), Effic_Eta, Effic_Phi_Barrel, Effic_Phi_Endcap, Effic_Phi_Extern, RandomEngine::flatShoot(), SimpleL1MuGMTCand::getMomentum(), M_PI, nEtaBins, nPhiBins, colinearityKinematic::Phi, reco::tau::disc::Pt(), random, mathSSE::sqrt(), and tuningfactor().

Referenced by ParamL3MuonProducer::produce(), and FastL1MuonProducer::produce().

                                                                {

  double myEffEta=0. , myEffPhi=0. , myEff;
  double AbsEta = fabs(aMuon->getMomentum().eta());
  double Phi = aMuon->getMomentum().phi();
  double Pt = std::sqrt(aMuon->getMomentum().perp2());

// efficiency as a function of |eta|
  
  if (AbsEta < 2.40) {
    int iEtaBin = (int) ( (AbsEta/2.40) * nEtaBins);
    myEffEta = Effic_Eta[iEtaBin];
  } else { myEffEta = 0.0; }

// efficiency as a function of phi and combined efficiency:
  
  if (Phi < 0.) {Phi = 2* M_PI + Phi; }
  int iPhiBin = (int) ((Phi/(2*M_PI)) * nPhiBins);

  int ieta = 0;
  if (AbsEta < 1.04) {
    myEffPhi = Effic_Phi_Barrel[iPhiBin];
    myEff = myEffEta * myEffPhi * tuningfactor(0);
    ieta = 0;
  } else if (AbsEta < 2.07) {
    myEffPhi = Effic_Phi_Endcap[iPhiBin];
    myEff = myEffEta * myEffPhi * tuningfactor(1);
    ieta = 1;
  } else if (AbsEta < 2.40) {
    myEffPhi = Effic_Phi_Extern[iPhiBin];
    myEff = myEffEta * myEffPhi * tuningfactor(2);
    ieta = 2;
 } else { myEff = 0. ; }

// Drop of efficiency at the lowest Pt's:
  if (Pt<6) myEff *= dumpingfactor(ieta,Pt);  
   
  double prob =  random->flatShoot();

  return (myEff > prob);
}
double FML1EfficiencyHandler::tuningfactor ( int  ieta) [inline, private]

Definition at line 40 of file FML1EfficiencyHandler.h.

References tests::test_DownloadDQM::tf.

Referenced by kill().

                                       {
    double tf=0.;
    switch (ieta) {
    case 0: 
      tf = 1.045;
      break;
    case 1:
      tf = 1.049;
      break;
    case 2:  
      tf = 1.059;
      break;
    }
    return tf ;
  }

Member Data Documentation

Definition at line 34 of file FML1EfficiencyHandler.h.

Referenced by FML1EfficiencyHandler(), and kill().

Definition at line 35 of file FML1EfficiencyHandler.h.

Referenced by FML1EfficiencyHandler(), and kill().

Definition at line 36 of file FML1EfficiencyHandler.h.

Referenced by FML1EfficiencyHandler(), and kill().

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

Definition at line 31 of file FML1EfficiencyHandler.h.

Referenced by kill().