CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

StringResolutionProvider Class Reference

Class to provide resolution factors for PAT candidates. More...

#include <PhysicsTools/PatAlgos/interface/StringResolutionProvider.h>

Inheritance diagram for StringResolutionProvider:
KinematicResolutionProvider

List of all members.

Public Types

typedef StringObjectFunction
< reco::Candidate
Function
 short cut within the common namespace

Public Member Functions

virtual pat::CandKinResolution getResolution (const reco::Candidate &cand) const
 get a CandKinResolution object from the service
 StringResolutionProvider (const edm::ParameterSet &cfg)
 default constructor
virtual ~StringResolutionProvider ()
 default destructor

Private Attributes

std::vector< std::string > bins_
 a vector of strings for the binning
std::vector
< pat::CandKinResolution::Scalar
constraints_
std::vector< std::string > funcEt_
 vectors for the resolution functions
std::vector< std::string > funcEta_
std::vector< std::string > funcPhi_
pat::CandKinResolution::Parametrization parametrization_

Detailed Description

Class to provide resolution factors for PAT candidates.

A class to provide resolution functions for PAT candidates. The class is derived from the KinematicResolutionProvider class. It expects the following parameters:

parametrization : indicates the used representation (e.g. EtEtaPhi). This parameter is MANDATORY. resolutions : a vector of edm::ParameterSets, that contain the resolutions func- tionspotentially in multiple bins of a cetain parameter. For the default implementeation we have bins of reco::Candidate's eta in mind, though might be any kind of variable that is accessible as memeber function of reco::Candidate. This parameter is MANDATORY.

The edm::ParameterSets of the _resolutions_ parameter are expected to be of form:

bin : Indicated the binning compatible with the StringCutObjectSelector. If omitted no binning is applied and the obtained resolution func- tions are assumed to be valid for all candidates. This parameter is OPTIONAL. et/eta/phi : Contain the parametrization in et if working in the EtEtaPhi pa- rametrization. These parameters are OPTIONAL. They are expected to be present in the et/eta/phi representation though. constraint : adding further information on constraints. It needs to investigated further what the meaning of this parameter exactly is before we can decide about its future. This parameter is OPTIONAL.

We expect that cfi files of this form will be generated automatically. edm::ParameterSets for other represenations will be implemented on request.

Definition at line 43 of file StringResolutionProvider.h.


Member Typedef Documentation

short cut within the common namespace

Definition at line 47 of file StringResolutionProvider.h.


Constructor & Destructor Documentation

StringResolutionProvider::StringResolutionProvider ( const edm::ParameterSet cfg)

default constructor

Definition at line 8 of file StringResolutionProvider.cc.

References bins_, constraints_, Exception, pat::helper::ParametrizationHelper::fromString(), funcEt_, funcEta_, funcPhi_, edm::ParameterSet::getParameter(), and parametrization_.

                                                                            : constraints_() 
{ 
  typedef pat::CandKinResolution::Parametrization Parametrization;
  
  // 
  std::vector<double> constr = cfg.getParameter<std::vector<double> > ("constraints");
  constraints_.insert(constraints_.end(), constr.begin(), constr.end());
  
  std::string parametrization(cfg.getParameter<std::string> ("parametrization") );
  parametrization_ = pat::helper::ParametrizationHelper::fromString(parametrization);
  
  std::vector<edm::ParameterSet> functionSets_ = cfg.getParameter <std::vector<edm::ParameterSet> >("functions");
  for(std::vector<edm::ParameterSet>::const_iterator iSet = functionSets_.begin(); iSet != functionSets_.end(); ++iSet){
    if(iSet->exists("bin"))bins_.push_back(iSet->getParameter<std::string>("bin"));
    else if(functionSets_.size()==1)bins_.push_back("");
    else throw cms::Exception("WrongConfig") << "Parameter 'bin' is needed if more than one PSet is specified\n";

    funcEt_.push_back(iSet->getParameter<std::string>("et"));
    funcEta_.push_back(iSet->getParameter<std::string>("eta"));
    funcPhi_.push_back(iSet->getParameter<std::string>("phi"));
  }
}
StringResolutionProvider::~StringResolutionProvider ( ) [virtual]

default destructor

Definition at line 31 of file StringResolutionProvider.cc.

{
}

Member Function Documentation

pat::CandKinResolution StringResolutionProvider::getResolution ( const reco::Candidate cand) const [virtual]

get a CandKinResolution object from the service

Implements KinematicResolutionProvider.

Definition at line 36 of file StringResolutionProvider.cc.

References bins_, constraints_, funcEt_, funcEta_, funcPhi_, i, and parametrization_.

{ 
  int selectedBin=-1;
  for(unsigned int i=0; i<bins_.size(); ++i){
    StringCutObjectSelector<reco::Candidate> select_(bins_[i]);
    if(select_(cand)){
      selectedBin = i;
      break;
    }
  }
  std::vector<pat::CandKinResolution::Scalar> covariances(3);
  if(selectedBin>=0){
    covariances[0] = ROOT::Math::Square(Function(funcEt_ [selectedBin]).operator()(cand));
    covariances[1] = ROOT::Math::Square(Function(funcEta_[selectedBin]).operator()(cand));
    covariances[2] = ROOT::Math::Square(Function(funcPhi_[selectedBin]).operator()(cand));
  }
  // fill 0. for not selected candidates
  else for(int i=0; i<3; ++i){covariances[i] = 0.;}
  
  return pat::CandKinResolution(parametrization_, covariances, constraints_);
}

Member Data Documentation

std::vector<std::string> StringResolutionProvider::bins_ [private]

a vector of strings for the binning

Definition at line 64 of file StringResolutionProvider.h.

Referenced by getResolution(), and StringResolutionProvider().

a vector of constrtaints for the CanKinResolution object

Definition at line 59 of file StringResolutionProvider.h.

Referenced by getResolution(), and StringResolutionProvider().

std::vector<std::string> StringResolutionProvider::funcEt_ [private]

vectors for the resolution functions

Definition at line 66 of file StringResolutionProvider.h.

Referenced by getResolution(), and StringResolutionProvider().

std::vector<std::string> StringResolutionProvider::funcEta_ [private]

Definition at line 66 of file StringResolutionProvider.h.

Referenced by getResolution(), and StringResolutionProvider().

std::vector<std::string> StringResolutionProvider::funcPhi_ [private]

Definition at line 66 of file StringResolutionProvider.h.

Referenced by getResolution(), and StringResolutionProvider().

a parametrization for the CanKinResolution object (this needs an extension)

Definition at line 62 of file StringResolutionProvider.h.

Referenced by getResolution(), and StringResolutionProvider().