CMS 3D CMS Logo

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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Protected Attributes

std::vector< int > dauCharge_
 daughter charges More...
 
std::vector< cand::parser::ConjInfolabels_
 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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 65 of file CandCombiner.h.

Constructor & Destructor Documentation

◆ CandCombinerBase()

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

Definition at line 66 of file CandCombiner.h.

67  : setLongLived_(false), setMassConstraint_(false), setPdgId_(false) {
68  using namespace cand::parser;
69  using namespace std;
70  string decay(cfg.getParameter<string>("decay"));
72  for (vector<ConjInfo>::iterator label = labels_.begin(); label != labels_.end(); ++label)
73  if (label->mode_ == ConjInfo::kPlus)
74  dauCharge_.push_back(1);
75  else if (label->mode_ == ConjInfo::kMinus)
76  dauCharge_.push_back(-1);
77  else
78  dauCharge_.push_back(0);
79  else
80  throw edm::Exception(edm::errors::Configuration, "failed to parse \"" + decay + "\"");
81 
82  int lists = labels_.size();
83  if (lists != 2 && lists != 3)
84  throw edm::Exception(edm::errors::LogicError, "invalid number of collections");
85  bool found;
86  const string setLongLived("setLongLived");
87  vector<string> vBoolParams = cfg.getParameterNamesForType<bool>();
88  found = find(vBoolParams.begin(), vBoolParams.end(), setLongLived) != vBoolParams.end();
89  if (found)
90  setLongLived_ = cfg.getParameter<bool>("setLongLived");
91  const string setMassConstraint("setMassConstraint");
92  found = find(vBoolParams.begin(), vBoolParams.end(), setMassConstraint) != vBoolParams.end();
93  if (found)
94  setMassConstraint_ = cfg.getParameter<bool>("setMassConstraint");
95  const string setPdgId("setPdgId");
96  vector<string> vIntParams = cfg.getParameterNamesForType<int>();
97  found = find(vIntParams.begin(), vIntParams.end(), setPdgId) != vIntParams.end();
98  if (found) {
99  setPdgId_ = true;
100  pdgId_ = cfg.getParameter<int>("setPdgId");
101  }
102  tokens_ =
103  edm::vector_transform(labels_, [this](ConjInfo const& cI) { return consumes<CandidateView>(cI.tag_); });
104  }

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

Member Data Documentation

◆ dauCharge_

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

daughter charges

Definition at line 111 of file CandCombiner.h.

Referenced by CandCombinerBase().

◆ labels_

std::vector<cand::parser::ConjInfo> reco::modules::CandCombinerBase::labels_
protected

◆ pdgId_

int reco::modules::CandCombinerBase::pdgId_
protected

◆ setLongLived_

bool reco::modules::CandCombinerBase::setLongLived_
protected

◆ setMassConstraint_

bool reco::modules::CandCombinerBase::setMassConstraint_
protected

◆ setPdgId_

bool reco::modules::CandCombinerBase::setPdgId_
protected

◆ tokens_

std::vector<edm::EDGetTokenT<CandidateView> > reco::modules::CandCombinerBase::tokens_
protected
reco::ParticleMasses::kPlus
const double kPlus
Definition: ParticleMasses.h:8
cand::parser
Definition: decayParser.h:35
reco::modules::CandCombinerBase::setMassConstraint_
bool setMassConstraint_
set mass constraint flag
Definition: CandCombiner.h:115
edm::errors::LogicError
Definition: EDMException.h:37
reco::modules::CandCombinerBase::setPdgId_
bool setPdgId_
set pdgId flag
Definition: CandCombiner.h:117
cand::parser::ConjInfo
Definition: decayParser.h:36
reco::modules::CandCombinerBase::labels_
std::vector< cand::parser::ConjInfo > labels_
label vector
Definition: CandCombiner.h:108
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
reco::modules::CandCombinerBase::pdgId_
int pdgId_
which pdgId to set
Definition: CandCombiner.h:119
edm::vector_transform
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
cand::parser::decayParser
bool decayParser(const std::string &iValue, std::vector< ConjInfo > &oStrings)
reco::modules::CandCombinerBase::dauCharge_
std::vector< int > dauCharge_
daughter charges
Definition: CandCombiner.h:111
cand::parser::ConjInfo::tag_
edm::InputTag tag_
Definition: decayParser.h:38
looper.cfg
cfg
Definition: looper.py:297
PA_ZEESkim_cff.decay
decay
Definition: PA_ZEESkim_cff.py:26
std
Definition: JetResolutionObject.h:76
Exception
Definition: hltDiff.cc:246
reco::modules::CandCombinerBase::setLongLived_
bool setLongLived_
set long lived flag
Definition: CandCombiner.h:113
edm::errors::Configuration
Definition: EDMException.h:36
label
const char * label
Definition: PFTauDecayModeTools.cc:11
reco::modules::CandCombinerBase::tokens_
std::vector< edm::EDGetTokenT< CandidateView > > tokens_
Definition: CandCombiner.h:109