CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes

muonisolation::IsolatorByNominalEfficiency Class Reference

#include <IsolatorByNominalEfficiency.h>

Inheritance diagram for muonisolation::IsolatorByNominalEfficiency:
muonisolation::MuIsoBaseIsolator

List of all members.

Classes

class  ConeSizes

Public Types

typedef
MuIsoBaseIsolator::DepositContainer 
DepositContainer

Public Member Functions

Cuts cuts (float nominalEfficiency) const
 IsolatorByNominalEfficiency (const std::string &thrFile, const std::vector< std::string > &ceff, const std::vector< double > &weights, const std::vector< double > &thresh)
 IsolatorByNominalEfficiency (const std::string &thrFile, const std::vector< std::string > &ceff, const std::vector< double > &weights)
 Constructor.
virtual Result result (DepositContainer deposits) const
 Compute the deposit within the cone and return the isolation result.
virtual ~IsolatorByNominalEfficiency ()

Private Types

typedef std::multimap< float, int > mapNomEff_Cone

Private Member Functions

int bestConeForEfficiencyIndex (float eff_thr) const
mapNomEff_Cone cones (const std::vector< std::string > &names)
std::string findPath (const std::string &fileName)
virtual ResultType resultType () const
virtual double weightedSum (const DepositContainer &deposits, float dRcone) const

Private Attributes

mapNomEff_Cone coneForEfficiency
ConeSizes theConesInfo
std::vector< double > theDepThresholds
std::vector< double > theWeights
NominalEfficiencyThresholdsthresholds

Detailed Description

Definition at line 21 of file IsolatorByNominalEfficiency.h.


Member Typedef Documentation

Reimplemented from muonisolation::MuIsoBaseIsolator.

Definition at line 23 of file IsolatorByNominalEfficiency.h.

typedef std::multimap<float,int> muonisolation::IsolatorByNominalEfficiency::mapNomEff_Cone [private]

Definition at line 60 of file IsolatorByNominalEfficiency.h.


Constructor & Destructor Documentation

muonisolation::IsolatorByNominalEfficiency::IsolatorByNominalEfficiency ( const std::string &  thrFile,
const std::vector< std::string > &  ceff,
const std::vector< double > &  weights 
)

Constructor.

muonisolation::IsolatorByNominalEfficiency::IsolatorByNominalEfficiency ( const std::string &  thrFile,
const std::vector< std::string > &  ceff,
const std::vector< double > &  weights,
const std::vector< double > &  thresh 
)
IsolatorByNominalEfficiency::~IsolatorByNominalEfficiency ( ) [virtual]

Definition at line 36 of file IsolatorByNominalEfficiency.cc.

References thresholds.

{
  delete thresholds;
}

Member Function Documentation

int IsolatorByNominalEfficiency::bestConeForEfficiencyIndex ( float  eff_thr) const [private]

Definition at line 105 of file IsolatorByNominalEfficiency.cc.

References coneForEfficiency.

Referenced by result().

{

  //FIXME use upper_bound
  int best_cone;
  if (coneForEfficiency.size() != 0) {
    best_cone = (--(coneForEfficiency.end()))->second;
  } else return 0;

   mapNomEff_Cone::const_reverse_iterator it;
  for (it = coneForEfficiency.rbegin();
       it != coneForEfficiency.rend(); it++) {
    if (eff_thr <= (*it).first) best_cone = (*it).second;
  }
  return best_cone;
}
IsolatorByNominalEfficiency::mapNomEff_Cone IsolatorByNominalEfficiency::cones ( const std::vector< std::string > &  names) [private]

Definition at line 42 of file IsolatorByNominalEfficiency.cc.

References result().

                                                                   {
  mapNomEff_Cone result;
  for (vector<string>::const_iterator is = usrVec.begin();
         is != usrVec.end(); is++) {
    char * evp = 0;
    int  cone = strtol( (*is).c_str(), &evp, 10);
    float effic = strtod(evp+1, &evp);
    result.insert(make_pair(effic,cone));
  }
  return result;
}
Cuts IsolatorByNominalEfficiency::cuts ( float  nominalEfficiency) const

Definition at line 132 of file BdecayFilter.cc.

References abs, gather_cfg::cout, eta(), i, j, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by L3NominalEfficiencyConfigurator::cuts().

{
        cout << "start cuts" << endl;
  HepMC::GenVertex* myVertex = jpsi->end_vertex();
  int numChildren = myVertex->particles_out_size();
  int numDecProd = cut.decayProduct.size();
  std::vector<HepMC::GenParticle*> psiChild;
  // for(std::set<GenParticle*>::const_iterator p = myVertex->particles_out_const_begin();
  for(GenVertex::particles_out_const_iterator p = myVertex->particles_out_const_begin();
      p != myVertex->particles_out_const_end(); p++) 
    psiChild.push_back((*p));

  if (numChildren!=numDecProd) return false;
    cout << psiChild[0]->pdg_id()<<" "<<psiChild[1]->pdg_id()<<endl;

  for (int i=0; i<numChildren; ++i) {
    bool goodPart = false;
    for (int j=0; j < numChildren; ++j){
      if (abs(psiChild[i]->pdg_id()) == abs(cut.decayProduct[j])) goodPart = true;
        }
        cout << psiChild[i]->momentum().perp() << endl;
    if ( !goodPart || (!etaInRange(psiChild[i]->momentum().eta(), cut.etaMin, cut.etaMax)) || (psiChild[i]->momentum().perp() < cut.ptMin) ) return false;
  }
        cout << "cuts true" << endl;
  return true;
}
string IsolatorByNominalEfficiency::findPath ( const std::string &  fileName) [private]

Definition at line 54 of file IsolatorByNominalEfficiency.cc.

References f, and edm::FileInPath::fullPath().

{
  // FIXME
  edm::FileInPath f(fileName);
  return f.fullPath();
}
MuIsoBaseIsolator::Result IsolatorByNominalEfficiency::result ( DepositContainer  deposits) const [virtual]

Compute the deposit within the cone and return the isolation result.

Implements muonisolation::MuIsoBaseIsolator.

Definition at line 62 of file IsolatorByNominalEfficiency.cc.

References bestConeForEfficiencyIndex(), gather_cfg::cout, tests::location, resultType(), muonisolation::IsolatorByNominalEfficiency::ConeSizes::size(), theConesInfo, thresholds, muonisolation::NominalEfficiencyThresholds::thresholdValueForEfficiency(), muonisolation::MuIsoBaseIsolator::Result::valFloat, and weightedSum().

Referenced by cones().

                                                                  {

  if (deposits.size()==0) {
    cout << "IsolatorByNominalEfficiency: no deposit" << endl;
    return Result(resultType()); //FIXME
  }

  // To determine the threshold, the direction of the cone of the first
  // set of deposits is used.
  // For algorithms where different cone axis definitions are used
  // for different types deposits (eg. HCAL and ECAL deposits for
  // calorimeter isolation), the first one is used to determine the threshold
  // value!
  float theEta = deposits.back().dep->eta();

  // Try descending efficiency values to find the point where the candidate
  // becomes non isolated

  float nominalEfficiency = 1.;
  const float deltaeff=0.005;
  const float mineff=deltaeff;
  for (float eff=.995; eff>mineff; eff-=deltaeff) {
    int cone = bestConeForEfficiencyIndex(eff);
    float coneSize = theConesInfo.size(cone);
    NominalEfficiencyThresholds::ThresholdLocation location = {theEta,cone};
    float thres  = thresholds->thresholdValueForEfficiency(location, eff);
    float sumDep = weightedSum(deposits,coneSize);
//      cout << "   Eff=" << eff
//         << " eta=" << theEta
//         << " cone=" << cone
//         << " dR=" << coneSize
//         << " thres=" << thres
//         << " deposit=" << sumDep
//         << " isolated=" << (sumDep < thres)
//         << endl;
    if (sumDep > thres) break;
    nominalEfficiency = eff;
  }
  Result res(resultType());
  res.valFloat = nominalEfficiency;
  return res;
}
virtual ResultType muonisolation::IsolatorByNominalEfficiency::resultType ( ) const [inline, private, virtual]
double IsolatorByNominalEfficiency::weightedSum ( const DepositContainer deposits,
float  dRcone 
) const [private, virtual]

Definition at line 123 of file IsolatorByNominalEfficiency.cc.

References theDepThresholds, and theWeights.

Referenced by result().

                                                        {
  double sumDep=0;

  assert(deposits.size()==theWeights.size());

  vector<double>::const_iterator w = theWeights.begin();
  vector<double>::const_iterator dThresh = theDepThresholds.begin();
  for (DepositContainer::const_iterator dep = deposits.begin();
       dep != deposits.end(); dep++) {
    if (dep->vetos != 0){
      sumDep += dep->dep->depositAndCountWithin(dRcone, *dep->vetos, *dThresh).first * (*w);
    } else {
      sumDep += dep->dep->depositAndCountWithin(dRcone, Vetos(), *dThresh).first * (*w);
    }
    if (sumDep <0.) sumDep = 0.;
    w++;
    dThresh++;
  }
  return sumDep;
}

Member Data Documentation

Definition at line 68 of file IsolatorByNominalEfficiency.h.

Referenced by bestConeForEfficiencyIndex().

Definition at line 72 of file IsolatorByNominalEfficiency.h.

Referenced by result().

Definition at line 71 of file IsolatorByNominalEfficiency.h.

Referenced by weightedSum().

Definition at line 70 of file IsolatorByNominalEfficiency.h.

Referenced by weightedSum().

Definition at line 69 of file IsolatorByNominalEfficiency.h.

Referenced by result(), and ~IsolatorByNominalEfficiency().