CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Attributes
reco::modules::CandCombinerBase Struct Reference

#include <CandCombiner.h>

Inheritance diagram for reco::modules::CandCombinerBase:
edm::stream::EDProducer<> reco::modules::CandCombiner< Selector, PairSelector, Cloner, OutputCollection, Setup, Init >

Public Member Functions

 CandCombinerBase (const edm::ParameterSet &cfg)
 
- 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
 

Protected Attributes

std::vector< int > dauCharge_
 daughter charges More...
 
std::vector
< cand::parser::ConjInfo
labels_
 label vector More...
 
int pdgId_
 which pdgId to set More...
 
bool setLongLived_
 set long lived flag More...
 
bool setMassConstraint_
 set mass constraint flag More...
 
bool setPdgId_
 set pdgId flag More...
 
std::vector< edm::EDGetTokenT
< CandidateView > > 
tokens_
 

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

Definition at line 66 of file CandCombiner.h.

Constructor & Destructor Documentation

reco::modules::CandCombinerBase::CandCombinerBase ( const edm::ParameterSet cfg)
inline

Definition at line 67 of file CandCombiner.h.

References edm::errors::Configuration, dauCharge_, cand::parser::decayParser(), Exception, spr::find(), newFWLiteAna::found, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), reco::ParticleMasses::kPlus, label, labels_, edm::errors::LogicError, writedatasetfile::parser, pdgId_, setLongLived_, setMassConstraint_, setPdgId_, cand::parser::ConjInfo::tag_, tokens_, and edm::vector_transform().

68  : setLongLived_(false), setMassConstraint_(false), setPdgId_(false) {
69  using namespace cand::parser;
70  using namespace std;
71  string decay(cfg.getParameter<string>("decay"));
72  if (decayParser(decay, labels_))
73  for (vector<ConjInfo>::iterator label = labels_.begin(); label != labels_.end(); ++label)
74  if (label->mode_ == ConjInfo::kPlus)
75  dauCharge_.push_back(1);
76  else if (label->mode_ == ConjInfo::kMinus)
77  dauCharge_.push_back(-1);
78  else
79  dauCharge_.push_back(0);
80  else
81  throw edm::Exception(edm::errors::Configuration, "failed to parse \"" + decay + "\"");
82 
83  int lists = labels_.size();
84  if (lists != 2 && lists != 3)
85  throw edm::Exception(edm::errors::LogicError, "invalid number of collections");
86  bool found;
87  const string setLongLived("setLongLived");
88  vector<string> vBoolParams = cfg.getParameterNamesForType<bool>();
89  found = find(vBoolParams.begin(), vBoolParams.end(), setLongLived) != vBoolParams.end();
90  if (found)
91  setLongLived_ = cfg.getParameter<bool>("setLongLived");
92  const string setMassConstraint("setMassConstraint");
93  found = find(vBoolParams.begin(), vBoolParams.end(), setMassConstraint) != vBoolParams.end();
94  if (found)
95  setMassConstraint_ = cfg.getParameter<bool>("setMassConstraint");
96  const string setPdgId("setPdgId");
97  vector<string> vIntParams = cfg.getParameterNamesForType<int>();
98  found = find(vIntParams.begin(), vIntParams.end(), setPdgId) != vIntParams.end();
99  if (found) {
100  setPdgId_ = true;
101  pdgId_ = cfg.getParameter<int>("setPdgId");
102  }
103  tokens_ =
104  edm::vector_transform(labels_, [this](ConjInfo const& cI) { return consumes<CandidateView>(cI.tag_); });
105  }
const double kPlus
Definition: ParticleMasses.h:8
int pdgId_
which pdgId to set
Definition: CandCombiner.h:120
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::InputTag tag_
Definition: decayParser.h:36
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:179
char const * label
std::vector< edm::EDGetTokenT< CandidateView > > tokens_
Definition: CandCombiner.h:110
bool decayParser(const std::string &iValue, std::vector< ConjInfo > &oStrings)
bool setPdgId_
set pdgId flag
Definition: CandCombiner.h:118
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool setLongLived_
set long lived flag
Definition: CandCombiner.h:114
std::vector< cand::parser::ConjInfo > labels_
label vector
Definition: CandCombiner.h:109
std::vector< int > dauCharge_
daughter charges
Definition: CandCombiner.h:112
bool setMassConstraint_
set mass constraint flag
Definition: CandCombiner.h:116

Member Data Documentation

std::vector<int> reco::modules::CandCombinerBase::dauCharge_
protected

daughter charges

Definition at line 112 of file CandCombiner.h.

Referenced by CandCombinerBase().

std::vector<cand::parser::ConjInfo> reco::modules::CandCombinerBase::labels_
protected
int reco::modules::CandCombinerBase::pdgId_
protected
bool reco::modules::CandCombinerBase::setLongLived_
protected
bool reco::modules::CandCombinerBase::setMassConstraint_
protected
bool reco::modules::CandCombinerBase::setPdgId_
protected
std::vector<edm::EDGetTokenT<CandidateView> > reco::modules::CandCombinerBase::tokens_
protected