104 keepOrDropAll_(
drop),
107 produces<GenParticleCollection>();
108 produces<edm::Association<reco::GenParticleCollection>>();
126 std::vector<size_t> &allIndices) {
129 size_t cachedIndex =
index;
134 if (
find(allIndices.begin(), allIndices.end(),
index) == allIndices.end()) {
135 allIndices.push_back(
index);
136 if (cachedIndex !=
index) {
147 std::vector<size_t> &allIndices) {
150 size_t cachedIndex =
index;
155 if (
find(allIndices.begin(), allIndices.end(),
index) == allIndices.end()) {
156 allIndices.push_back(
index);
157 if (cachedIndex !=
index) {
171 ::helper::SelectCode code;
176 <<
"selections \"keep *\" and \"drop *\" can be used only as first options. Here used in position # " 179 switch (code.keepOrDrop_) {
180 case ::helper::SelectCode::kDrop:
183 case ::helper::SelectCode::kKeep:
197 const size_t n =
src->size();
201 const pair<StringCutObjectSelector<GenParticle>, SelectCode> &
sel =
select_[
j];
202 SelectCode code =
sel.second;
204 for (
size_t i = 0;
i <
n; ++
i) {
207 int keepOrDrop =
keep;
208 switch (code.keepOrDrop_) {
209 case SelectCode::kKeep:
212 case SelectCode::kDrop:
216 std::vector<size_t> allIndicesDa;
217 std::vector<size_t> allIndicesMo;
218 switch (code.daughtersDepth_) {
219 case SelectCode::kAll:
222 case SelectCode::kFirst:
227 switch (code.mothersDepth_) {
228 case SelectCode::kAll:
231 case SelectCode::kFirst:
241 for (
size_t i = 0;
i <
n; ++
i) {
250 auto out = std::make_unique<GenParticleCollection>();
267 vector<size_t> daIndxs, daNewIndxs;
269 std::sort(daNewIndxs.begin(), daNewIndxs.end());
270 for (
size_t i = 0;
i < daNewIndxs.size(); ++
i)
273 vector<size_t> moIndxs, moNewIndxs;
275 std::sort(moNewIndxs.begin(), moNewIndxs.end());
276 for (
size_t i = 0;
i < moNewIndxs.size(); ++
i)
281 auto orig2new = std::make_unique<edm::Association<reco::GenParticleCollection>>(oh);
284 orig2newFiller.fill();
289 vector<size_t> &daNewIndxs,
293 if (
find(daIndxs.begin(), daIndxs.end(), dau.
key()) == daIndxs.end()) {
294 daIndxs.push_back(dau.
key());
297 daNewIndxs.push_back(
idx);
308 vector<size_t> &moNewIndxs,
312 if (
find(moIndxs.begin(), moIndxs.end(), mom.
key()) == moIndxs.end()) {
313 moIndxs.push_back(mom.
key());
316 moNewIndxs.push_back(
idx);
std::vector< std::pair< StringCutObjectSelector< reco::GenParticle >, helper::SelectCode > > select_
void flagDaughters(const reco::GenParticle &, int)
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
bool empty() const
Is the RefVector empty.
std::vector< int > flags_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void setCollisionId(int s)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void flagMothers(const reco::GenParticle &, int)
void recursiveFlagMothers(size_t, const reco::GenParticleCollection &, int, std::vector< size_t > &)
std::string pdgEntryReplace(const std::string &, HepPDT::ParticleDataTable const &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
GenParticlePruner(const edm::ParameterSet &)
void parse(const std::string &selection, helper::SelectCode &code, std::string &cut) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void recursiveFlagDaughters(size_t, const reco::GenParticleCollection &, int, std::vector< size_t > &)
key_type key() const
Accessor for product key.
void addDaughter(const typename daughters::value_type &)
add a daughter via a reference
std::vector< size_t > indices_
FlagDepth daughtersDepth_
#define DEFINE_FWK_MODULE(type)
def gen(fragment, howMuch)
Event to runs.
void addMother(const typename mothers::value_type &)
add a daughter via a reference
RefProd< PROD > getRefBeforePut()
void getMotherKeys(std::vector< size_t > &, std::vector< size_t > &, const reco::GenParticleRefVector &) const
TracksUtilities< TrackerTraits > helper
const GenStatusFlags & statusFlags() const
const_iterator end() const
Termination of iteration.
edm::EDGetTokenT< reco::GenParticleCollection > srcToken_
void getDaughterKeys(std::vector< size_t > &, std::vector< size_t > &, const reco::GenParticleRefVector &) const
void produce(edm::Event &, const edm::EventSetup &) override
std::vector< std::string > selection_
const_iterator begin() const
Initialize an iterator over the RefVector.
edm::ESGetToken< HepPDT::ParticleDataTable, edm::DefaultRecord > tableToken_