CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init > Class Template Reference

#include <ConstrainedFitCandProducer.h>

Inheritance diagram for ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 ConstrainedFitCandProducer (const edm::ParameterSet &)

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

Fitter fitter_
int pdgId_
bool setLongLived_
bool setMassConstraint_
bool setPdgId_
edm::InputTag src_

Detailed Description

template<typename Fitter, typename InputCollection = reco::CandidateCollection, typename OutputCollection = InputCollection, typename Init = typename ::reco::modules::EventSetupInit<Fitter>::type>
class ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >

Definition at line 20 of file ConstrainedFitCandProducer.h.


Constructor & Destructor Documentation

template<typename Fitter , typename InputCollection , typename OutputCollection , typename Init >
ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::ConstrainedFitCandProducer ( const edm::ParameterSet cfg) [explicit]

Definition at line 44 of file ConstrainedFitCandProducer.h.

References spr::find(), newFWLiteAna::found, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::pdgId_, ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::setLongLived_, ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::setMassConstraint_, and ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::setPdgId_.

                                                                                                                                   :
  src_(cfg.template getParameter<edm::InputTag>("src")),
  setLongLived_(false), setMassConstraint_(false), setPdgId_(false),
  fitter_(reco::modules::make<Fitter>(cfg)) {
  produces<OutputCollection>();
  std::string alias( cfg.getParameter<std::string>("@module_label"));
  const std::string setLongLived("setLongLived");
  std::vector<std::string> vBoolParams = cfg.template getParameterNamesForType<bool>();
  bool found = find(vBoolParams.begin(), vBoolParams.end(), setLongLived) != vBoolParams.end();
  if(found) setLongLived_ = cfg.template getParameter<bool>("setLongLived");
  const std::string setMassConstraint("setMassConstraint");
  found = find(vBoolParams.begin(), vBoolParams.end(), setMassConstraint) != vBoolParams.end();
  if(found) setMassConstraint_ = cfg.template getParameter<bool>("setMassConstraint");
  const std::string setPdgId("setPdgId");
  std::vector<std::string> vIntParams = cfg.getParameterNamesForType<int>();
  found = find(vIntParams.begin(), vIntParams.end(), setPdgId) != vIntParams.end();
  if(found) { setPdgId_ = true; pdgId_ = cfg.getParameter<int>("setPdgId"); }
}

Member Function Documentation

template<typename Fitter , typename InputCollection , typename OutputCollection , typename Init >
void ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::produce ( edm::Event evt,
const edm::EventSetup es 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 83 of file ConstrainedFitCandProducer.h.

References reco::fitHelper::add(), trackerHits::c, clone(), edm::Event::getByLabel(), init, and edm::Event::put().

                                                                                                                                  {
  Init::init(fitter_, evt, es);
  edm::Handle<InputCollection> cands;
  evt.getByLabel(src_, cands);
  std::auto_ptr<OutputCollection> fitted(new OutputCollection);
  fitted->reserve(cands->size());
  for(typename InputCollection::const_iterator c = cands->begin(); c != cands->end(); ++ c) {
    std::auto_ptr<reco::VertexCompositeCandidate> clone(new reco::VertexCompositeCandidate(*c));
    fitter_.set(*clone);
    if(setLongLived_) clone->setLongLived();
    if(setMassConstraint_) clone->setMassConstraint();
    if(setPdgId_) clone->setPdgId(pdgId_);
    reco::fitHelper::add(fitted, clone);
  }
  evt.put(fitted);
}

Member Data Documentation

template<typename Fitter , typename InputCollection = reco::CandidateCollection, typename OutputCollection = InputCollection, typename Init = typename ::reco::modules::EventSetupInit<Fitter>::type>
Fitter ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::fitter_ [private]

Definition at line 30 of file ConstrainedFitCandProducer.h.

template<typename Fitter , typename InputCollection = reco::CandidateCollection, typename OutputCollection = InputCollection, typename Init = typename ::reco::modules::EventSetupInit<Fitter>::type>
int ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::pdgId_ [private]
template<typename Fitter , typename InputCollection = reco::CandidateCollection, typename OutputCollection = InputCollection, typename Init = typename ::reco::modules::EventSetupInit<Fitter>::type>
bool ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::setLongLived_ [private]
template<typename Fitter , typename InputCollection = reco::CandidateCollection, typename OutputCollection = InputCollection, typename Init = typename ::reco::modules::EventSetupInit<Fitter>::type>
bool ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::setMassConstraint_ [private]
template<typename Fitter , typename InputCollection = reco::CandidateCollection, typename OutputCollection = InputCollection, typename Init = typename ::reco::modules::EventSetupInit<Fitter>::type>
bool ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::setPdgId_ [private]
template<typename Fitter , typename InputCollection = reco::CandidateCollection, typename OutputCollection = InputCollection, typename Init = typename ::reco::modules::EventSetupInit<Fitter>::type>
edm::InputTag ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::src_ [private]

Definition at line 25 of file ConstrainedFitCandProducer.h.