1 #ifndef CandAlgos_CandCombiner_h 2 #define CandAlgos_CandCombiner_h 49 roles_ = cfg.
getParameter<std::vector<std::string> >(
"roles");
51 roles_ = std::vector<std::string>();
53 const std::vector<std::string>
roles()
const {
return roles_; }
70 setMassConstraint_(
false),
76 for(vector<ConjInfo>::iterator
label = labels_.begin();
79 dauCharge_.push_back(1);
80 else if (
label->mode_ == ConjInfo::kMinus)
81 dauCharge_.push_back(-1);
83 dauCharge_.push_back(0);
86 "failed to parse \"" + decay +
"\"");
88 int lists = labels_.size();
89 if(lists != 2 && lists != 3)
91 "invalid number of collections");
93 const string setLongLived(
"setLongLived");
95 found =
find(vBoolParams.begin(), vBoolParams.end(), setLongLived) != vBoolParams.end();
96 if(found) setLongLived_ = cfg.
getParameter<
bool>(
"setLongLived");
97 const string setMassConstraint(
"setMassConstraint");
98 found =
find(vBoolParams.begin(), vBoolParams.end(), setMassConstraint) != vBoolParams.end();
99 if(found) setMassConstraint_ = cfg.
getParameter<
bool>(
"setMassConstraint");
100 const string setPdgId(
"setPdgId");
102 found =
find(vIntParams.begin(), vIntParams.end(), setPdgId) != vIntParams.end();
103 if(found) { setPdgId_ =
true; pdgId_ = cfg.
getParameter<
int>(
"setPdgId"); }
109 std::vector<edm::EDGetTokenT<CandidateView> >
tokens_;
137 cfg.existsAs<bool>(
"checkCharge") ? cfg.getParameter<bool>(
"checkCharge") :
true,
138 cfg.existsAs<bool>(
"checkOverlap") ? cfg.getParameter<bool>(
"checkOverlap") :
true,
141 produces<OutputCollection>();
150 int n = labels_.size();
151 std::vector<edm::Handle<CandidateView> > colls(n);
152 for(
int i = 0;
i <
n; ++
i)
155 std::unique_ptr<OutputCollection>
out = combiner_.combine(colls, names_.roles());
156 if(setLongLived_ || setMassConstraint_ || setPdgId_) {
157 typename OutputCollection::iterator i = out->begin(),
e = out->end();
160 if(setLongLived_) i->setLongLived();
161 if(setMassConstraint_) i->setMassConstraint();
162 if(setPdgId_) i->setPdgId(pdgId_);
T getParameter(std::string const &) const
const std::vector< std::string > roles() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::vector< CompositeCandidate > CompositeCandidateCollection
collection of Candidate objects
bool getByToken(EDGetToken token, Handle< PROD > &result) const
S make(const edm::ParameterSet &cfg)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
int pdgId_
which pdgId to set
void produce(edm::Event &evt, const edm::EventSetup &es) override
process an event
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 >
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
std::vector< std::string > roles_
virtual ~CandCombiner()
destructor
std::vector< edm::EDGetTokenT< CandidateView > > tokens_
RoleNames(const edm::ParameterSet &cfg)
CandCombiner(const edm::ParameterSet &cfg)
constructor from parameter settypedef
std::string name_
Name of this candidate.
bool decayParser(const std::string &iValue, std::vector< ConjInfo > &oStrings)
bool setPdgId_
set pdgId flag
bool setLongLived_
set long lived flag
std::vector< cand::parser::ConjInfo > labels_
label vector
::CandCombiner< Selector, PairSelector, Cloner, OutputCollection, Setup > combiner_
combiner utility
std::vector< int > dauCharge_
daughter charges
CandCombinerBase(const edm::ParameterSet &cfg)
bool setMassConstraint_
set mass constraint flag