CMS 3D CMS Logo

List of all members | 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::stream::EDProducer<>

Public Member Functions

 ConstrainedFitCandProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

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

Private Attributes

Fitter fitter_
 
Init fitterInit_
 
int pdgId_
 
bool setLongLived_
 
bool setMassConstraint_
 
bool setPdgId_
 
edm::EDGetTokenT< InputCollection > srcToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

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

◆ ConstrainedFitCandProducer()

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

Definition at line 45 of file ConstrainedFitCandProducer.h.

References SiStripOfflineCRack_cfg::alias, looper::cfg, spr::find(), newFWLiteAna::found, ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::pdgId_, ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::setLongLived_, ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::setMassConstraint_, ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::setPdgId_, and AlCaHLTBitMon_QueryRunRegistry::string.

47  : srcToken_(consumes<InputCollection>(cfg.template getParameter<edm::InputTag>("src"))),
48  setLongLived_(false),
49  setMassConstraint_(false),
50  setPdgId_(false),
51  fitterInit_(consumesCollector()),
52  fitter_(reco::modules::make<Fitter>(cfg)) {
53  produces<OutputCollection>();
54  std::string alias(cfg.getParameter<std::string>("@module_label"));
55  const std::string setLongLived("setLongLived");
56  std::vector<std::string> vBoolParams = cfg.template getParameterNamesForType<bool>();
57  bool found = find(vBoolParams.begin(), vBoolParams.end(), setLongLived) != vBoolParams.end();
58  if (found)
59  setLongLived_ = cfg.template getParameter<bool>("setLongLived");
60  const std::string setMassConstraint("setMassConstraint");
61  found = find(vBoolParams.begin(), vBoolParams.end(), setMassConstraint) != vBoolParams.end();
62  if (found)
63  setMassConstraint_ = cfg.template getParameter<bool>("setMassConstraint");
64  const std::string setPdgId("setPdgId");
65  std::vector<std::string> vIntParams = cfg.getParameterNamesForType<int>();
66  found = find(vIntParams.begin(), vIntParams.end(), setPdgId) != vIntParams.end();
67  if (found) {
68  setPdgId_ = true;
69  pdgId_ = cfg.getParameter<int>("setPdgId");
70  }
71 }
edm::EDGetTokenT< InputCollection > srcToken_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

Member Function Documentation

◆ produce()

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

Definition at line 95 of file ConstrainedFitCandProducer.h.

References reco::fitHelper::add(), HltBtagPostValidation_cff::c, HLT_2024v11_cff::cands, clone(), edm::Event::getByToken(), eostools::move(), and edm::Event::put().

96  {
97  fitterInit_.init(fitter_, evt, es);
100  auto fitted = std::make_unique<OutputCollection>();
101  fitted->reserve(cands->size());
102  for (typename InputCollection::const_iterator c = cands->begin(); c != cands->end(); ++c) {
103  auto clone = std::make_unique<reco::VertexCompositeCandidate>(*c);
104  fitter_.set(*clone);
105  if (setLongLived_)
106  clone->setLongLived();
107  if (setMassConstraint_)
108  clone->setMassConstraint();
109  if (setPdgId_)
110  clone->setPdgId(pdgId_);
111  reco::fitHelper::add(fitted.get(), std::move(clone));
112  }
113  evt.put(std::move(fitted));
114 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::EDGetTokenT< InputCollection > srcToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
void add(C *c, std::unique_ptr< reco::VertexCompositeCandidate > t)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ fitter_

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 31 of file ConstrainedFitCandProducer.h.

◆ fitterInit_

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

Definition at line 30 of file ConstrainedFitCandProducer.h.

◆ pdgId_

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

◆ setLongLived_

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

◆ setMassConstraint_

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

◆ setPdgId_

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

◆ srcToken_

template<typename Fitter , typename InputCollection = reco::CandidateCollection, typename OutputCollection = InputCollection, typename Init = typename ::reco::modules::EventSetupInit<Fitter>::type>
edm::EDGetTokenT<InputCollection> ConstrainedFitCandProducer< Fitter, InputCollection, OutputCollection, Init >::srcToken_
private

Definition at line 25 of file ConstrainedFitCandProducer.h.