101 keepOrDropAll_(
drop),
102 selection_(
cfg.getParameter<vector<
string>>(
"select")) {
104 produces<GenParticleCollection>();
105 produces<edm::Association<reco::GenParticleCollection>>();
123 std::vector<size_t> &allIndices) {
126 size_t cachedIndex =
index;
131 if (
find(allIndices.begin(), allIndices.end(),
index) == allIndices.end()) {
132 allIndices.push_back(
index);
133 if (cachedIndex !=
index) {
144 std::vector<size_t> &allIndices) {
147 size_t cachedIndex =
index;
152 if (
find(allIndices.begin(), allIndices.end(),
index) == allIndices.end()) {
153 allIndices.push_back(
index);
154 if (cachedIndex !=
index) {
167 ::helper::SelectCode code;
172 <<
"selections \"keep *\" and \"drop *\" can be used only as first options. Here used in position # "
175 switch (code.keepOrDrop_) {
176 case ::helper::SelectCode::kDrop:
179 case ::helper::SelectCode::kKeep:
193 const size_t n =
src->size();
197 const pair<StringCutObjectSelector<GenParticle>, SelectCode> &
sel =
select_[
j];
198 SelectCode code =
sel.second;
200 for (
size_t i = 0;
i <
n; ++
i) {
203 int keepOrDrop =
keep;
204 switch (code.keepOrDrop_) {
205 case SelectCode::kKeep:
208 case SelectCode::kDrop:
212 std::vector<size_t> allIndicesDa;
213 std::vector<size_t> allIndicesMo;
214 switch (code.daughtersDepth_) {
215 case SelectCode::kAll:
218 case SelectCode::kFirst:
223 switch (code.mothersDepth_) {
224 case SelectCode::kAll:
227 case SelectCode::kFirst:
237 for (
size_t i = 0;
i <
n; ++
i) {
246 auto out = std::make_unique<GenParticleCollection>();
262 vector<size_t> daIndxs, daNewIndxs;
264 std::sort(daNewIndxs.begin(), daNewIndxs.end());
265 for (
size_t i = 0;
i < daNewIndxs.size(); ++
i)
268 vector<size_t> moIndxs, moNewIndxs;
270 std::sort(moNewIndxs.begin(), moNewIndxs.end());
271 for (
size_t i = 0;
i < moNewIndxs.size(); ++
i)
276 auto orig2new = std::make_unique<edm::Association<reco::GenParticleCollection>>(oh);
279 orig2newFiller.fill();
284 vector<size_t> &daNewIndxs,
288 if (
find(daIndxs.begin(), daIndxs.end(), dau.
key()) == daIndxs.end()) {
289 daIndxs.push_back(dau.
key());
292 daNewIndxs.push_back(
idx);
303 vector<size_t> &moNewIndxs,
307 if (
find(moIndxs.begin(), moIndxs.end(), mom.
key()) == moIndxs.end()) {
308 moIndxs.push_back(mom.
key());
311 moNewIndxs.push_back(
idx);