139 keepOrDropAll_(
drop),
140 selection_(iConfig.getParameter<
vector<
string>>(
"select")) {
141 produces<TrackingParticleCollection>();
159 std::vector<size_t> &allIndices) {
162 size_t cachedIndex =
index;
167 if (
find(allIndices.begin(), allIndices.end(),
index) == allIndices.end()) {
168 allIndices.push_back(
index);
169 if (cachedIndex !=
index) {
180 std::vector<size_t> &allIndices) {
183 size_t cachedIndex =
index;
188 if (
find(allIndices.begin(), allIndices.end(),
index) == allIndices.end()) {
189 allIndices.push_back(
index);
190 if (cachedIndex !=
index) {
199 vector<size_t> &daNewIndxs,
203 if (
find(daIndxs.begin(), daIndxs.end(), dau.
key()) == daIndxs.end()) {
204 daIndxs.push_back(dau.
key());
207 daNewIndxs.push_back(
idx);
218 vector<size_t> &moNewIndxs,
222 if (
find(moIndxs.begin(), moIndxs.end(), mom.
key()) == moIndxs.end()) {
223 moIndxs.push_back(mom.
key());
226 moNewIndxs.push_back(
idx);
243 ::helper::SelectCode code;
248 <<
"selections \"keep *\" and \"drop *\" can be used only as first options. Here used in position # "
251 switch (code.keepOrDrop_) {
252 case ::helper::SelectCode::kDrop:
255 case ::helper::SelectCode::kKeep:
271 const size_t n = gps.size();
275 const pair<StringCutObjectSelector<GenParticle>, SelectCode> &
sel =
select_[
j];
276 SelectCode code =
sel.second;
278 for (
size_t i = 0;
i <
n; ++
i) {
281 int keepOrDrop =
keep;
282 switch (code.keepOrDrop_) {
283 case SelectCode::kKeep:
286 case SelectCode::kDrop:
290 std::vector<size_t> allIndicesDa;
291 std::vector<size_t> allIndicesMo;
292 switch (code.daughtersDepth_) {
293 case SelectCode::kAll:
296 case SelectCode::kFirst:
301 switch (code.mothersDepth_) {
302 case SelectCode::kAll:
305 case SelectCode::kFirst:
314 auto out = std::make_unique<TrackingParticleCollection>();
317 for (
auto &&
tp : tps) {
318 auto &associatedGenParticles =
tp.genParticles();
321 for (
auto &&assocGen : associatedGenParticles) {
327 out->emplace_back(
tp);
337 desc.add<vector<string>>(
"select");
339 descriptions.
add(
"tpSelectorByGenDefault",
desc);