CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
GenParticlePruner Class Reference
Inheritance diagram for GenParticlePruner:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 GenParticlePruner (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void flagDaughters (const reco::GenParticle &, int)
 
void flagMothers (const reco::GenParticle &, int)
 
void getDaughterKeys (std::vector< size_t > &, std::vector< size_t > &, const reco::GenParticleRefVector &) const
 
void getMotherKeys (std::vector< size_t > &, std::vector< size_t > &, const reco::GenParticleRefVector &) const
 
void parse (const std::string &selection, helper::SelectCode &code, std::string &cut) const
 
void produce (edm::Event &, const edm::EventSetup &) override
 
void recursiveFlagDaughters (size_t, const reco::GenParticleCollection &, int, std::vector< size_t > &)
 
void recursiveFlagMothers (size_t, const reco::GenParticleCollection &, int, std::vector< size_t > &)
 

Private Attributes

bool firstEvent_
 
std::vector< int > flags_
 
std::vector< size_t > indices_
 
int keepOrDropAll_
 
std::vector< std::pair
< StringCutObjectSelector
< reco::GenParticle >
, helper::SelectCode > > 
select_
 
std::vector< std::string > selection_
 
edm::EDGetTokenT
< reco::GenParticleCollection
srcToken_
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 22 of file GenParticlePruner.cc.

Constructor & Destructor Documentation

GenParticlePruner::GenParticlePruner ( const edm::ParameterSet cfg)

Definition at line 95 of file GenParticlePruner.cc.

95  :
96  firstEvent_(true),
97  srcToken_(consumes<GenParticleCollection>(cfg.getParameter<InputTag>("src"))), keepOrDropAll_(drop),
98  selection_(cfg.getParameter<vector<string> >("select")) {
99  using namespace ::helper;
100  produces<GenParticleCollection>();
101  produces<edm::Association<reco::GenParticleCollection> >();
102 }
T getParameter(std::string const &) const
const int drop
edm::EDGetTokenT< reco::GenParticleCollection > srcToken_
std::vector< std::string > selection_

Member Function Documentation

void GenParticlePruner::flagDaughters ( const reco::GenParticle gen,
int  keepOrDrop 
)
private

Definition at line 104 of file GenParticlePruner.cc.

References edm::RefVector< C, T, F >::begin(), reco::CompositeRefCandidateT< D >::daughterRefVector(), edm::RefVector< C, T, F >::end(), flags_, and i.

Referenced by produce().

104  {
105  GenParticleRefVector daughters = gen.daughterRefVector();
106  for(GenParticleRefVector::const_iterator i = daughters.begin(); i != daughters.end(); ++i)
107  flags_[i->key()] = keepOrDrop;
108 }
int i
Definition: DBlmapReader.cc:9
std::vector< int > flags_
const daughters & daughterRefVector() const
references to daughtes
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:255
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:250
void GenParticlePruner::flagMothers ( const reco::GenParticle gen,
int  keepOrDrop 
)
private

Definition at line 110 of file GenParticlePruner.cc.

References edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::end(), flags_, i, and reco::CompositeRefCandidateT< D >::motherRefVector().

Referenced by produce().

110  {
111  GenParticleRefVector mothers = gen.motherRefVector();
112  for(GenParticleRefVector::const_iterator i = mothers.begin(); i != mothers.end(); ++i)
113  flags_[i->key()] = keepOrDrop;
114 }
int i
Definition: DBlmapReader.cc:9
std::vector< int > flags_
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:255
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:250
const mothers & motherRefVector() const
references to mothers
void GenParticlePruner::getDaughterKeys ( std::vector< size_t > &  daIndxs,
std::vector< size_t > &  daNewIndxs,
const reco::GenParticleRefVector daughters 
) const
private

Definition at line 275 of file GenParticlePruner.cc.

References edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::end(), spr::find(), flags_, customizeTrackingMonitorSeedNumber::idx, j, edm::Ref< C, T, F >::key(), and edm::RefVector< C, T, F >::size().

Referenced by produce().

276  {
277  for(GenParticleRefVector::const_iterator j = daughters.begin();
278  j != daughters.end(); ++j) {
279  GenParticleRef dau = *j;
280  if (find(daIndxs.begin(), daIndxs.end(), dau.key()) == daIndxs.end()) {
281  daIndxs.push_back( dau.key() );
282  int idx = flags_[dau.key()];
283  if (idx > 0 ) {
284  daNewIndxs.push_back( idx );
285  } else {
286  const GenParticleRefVector & daus = dau->daughterRefVector();
287  if(daus.size()>0)
288  getDaughterKeys(daIndxs, daNewIndxs, daus);
289  }
290  }
291  }
292 }
std::vector< int > flags_
key_type key() const
Accessor for product key.
Definition: Ref.h:264
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:255
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:250
int j
Definition: DBlmapReader.cc:9
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
size_type size() const
Size of the RefVector.
Definition: RefVector.h:99
void getDaughterKeys(std::vector< size_t > &, std::vector< size_t > &, const reco::GenParticleRefVector &) const
void GenParticlePruner::getMotherKeys ( std::vector< size_t > &  moIndxs,
std::vector< size_t > &  moNewIndxs,
const reco::GenParticleRefVector mothers 
) const
private

Definition at line 296 of file GenParticlePruner.cc.

References edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::end(), spr::find(), flags_, customizeTrackingMonitorSeedNumber::idx, j, edm::Ref< C, T, F >::key(), and edm::RefVector< C, T, F >::size().

Referenced by produce().

297  {
299  j != mothers.end(); ++j) {
300  GenParticleRef mom = *j;
301  if (find(moIndxs.begin(), moIndxs.end(), mom.key()) == moIndxs.end()) {
302  moIndxs.push_back( mom.key() );
303  int idx = flags_[mom.key()];
304  if (idx >= 0 ) {
305  moNewIndxs.push_back( idx );
306  } else {
307  const GenParticleRefVector & moms = mom->motherRefVector();
308  if(moms.size()>0)
309  getMotherKeys(moIndxs, moNewIndxs, moms);
310  }
311  }
312  }
313 }
std::vector< int > flags_
key_type key() const
Accessor for product key.
Definition: Ref.h:264
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:255
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:250
int j
Definition: DBlmapReader.cc:9
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
size_type size() const
Size of the RefVector.
Definition: RefVector.h:99
void getMotherKeys(std::vector< size_t > &, std::vector< size_t > &, const reco::GenParticleRefVector &) const
void GenParticlePruner::parse ( const std::string &  selection,
helper::SelectCode code,
std::string &  cut 
) const
private

Definition at line 49 of file GenParticlePruner.cc.

References helper::SelectCode::all_, EnergyCorrector::c, edmPickEvents::command, edm::errors::Configuration, helper::SelectCode::daughtersDepth_, Exception, f, helper::SelectCode::keepOrDrop_, WDecay::kNone, helper::SelectCode::mothersDepth_, gen::n, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

49  {
50  using namespace ::helper;
51  size_t f = selection.find_first_not_of(' ');
52  size_t n = selection.size();
53  string command;
54  char c;
55  for(; (c = selection[f]) != ' ' && f < n; ++f) {
56  command.push_back(c);
57  }
58  if(command[0] == '+') {
59  command.erase(0, 1);
60  if(command[0] == '+') {
61  command.erase(0, 1);
62  code.mothersDepth_ = SelectCode::kAll;
63  } else {
64  code.mothersDepth_ = SelectCode::kFirst;
65  }
66  } else
68 
69  if(command[command.size() - 1] == '+') {
70  command.erase(command.size() - 1);
71  if(command[command.size()-1] == '+') {
72  command.erase(command.size() - 1);
73  code.daughtersDepth_ = SelectCode::kAll;
74  } else {
75  code.daughtersDepth_ = SelectCode::kFirst;
76  }
77  } else
79 
80  if(command == "keep") code.keepOrDrop_ = SelectCode::kKeep;
81  else if(command == "drop") code.keepOrDrop_ = SelectCode::kDrop;
82  else {
84  << "invalid selection command: " << command << "\n" << endl;
85  }
86  for(; f < n; ++f) {
87  if(selection[f] != ' ') break;
88  }
89  cut = string(selection, f);
90  if(cut[0] == '*')
91  cut = string(cut, 0, cut.find_first_of(' '));
92  code.all_ = cut == "*";
93 }
selection
main part
Definition: corrVsCorr.py:98
double f[11][100]
void GenParticlePruner::produce ( edm::Event evt,
const edm::EventSetup es 
)
overrideprivatevirtual

Implements edm::stream::EDProducerBase.

Definition at line 154 of file GenParticlePruner.cc.

References reco::CompositeRefCandidateT< D >::addDaughter(), reco::CompositeRefCandidateT< D >::addMother(), helper::SelectCode::all_, edm::errors::Configuration, counter, GOODCOLL_filter_cfg::cut, reco::CompositeRefCandidateT< D >::daughterRefVector(), drop, Exception, edm::helper::Filler< Map >::fill(), firstEvent_, flagDaughters(), flagMothers(), flags_, relval_steps::gen(), GenParticle::GenParticle, edm::Event::getByToken(), getDaughterKeys(), getMotherKeys(), edm::Event::getRefBeforePut(), i, cmsHarvester::index, indices_, edm::helper::Filler< Map >::insert(), j, keep, helper::SelectCode::keepOrDrop_, keepOrDropAll_, WDecay::kNone, reco::CompositeRefCandidateT< D >::motherRefVector(), gen::n, dbtoconf::out, AlCaHLTBitMon_ParallelJobs::p, parse(), edm::Event::put(), recursiveFlagDaughters(), recursiveFlagMothers(), cuy::rep, PdgEntryReplacer::replace(), EgammaValidation_Wenu_cff::sel, select_, selection_, python.multivaluedict::sort(), alcazmumu_cfi::src, srcToken_, and reco::GenParticle::statusFlags().

154  {
155  if (firstEvent_) {
156  PdgEntryReplacer rep(es);
157  for(vector<string>::const_iterator i = selection_.begin(); i != selection_.end(); ++i) {
158  string cut;
160  parse(*i, code, cut);
161  if(code.all_) {
162  if(i != selection_.begin())
164  << "selections \"keep *\" and \"drop *\" can be used only as first options. Here used in position # "
165  << (i - selection_.begin()) + 1 << "\n" << endl;
166  switch(code.keepOrDrop_) {
167  case ::helper::SelectCode::kDrop :
168  keepOrDropAll_ = drop; break;
169  case ::helper::SelectCode::kKeep :
171  };
172  } else {
173  cut = rep.replace(cut);
174  select_.push_back(make_pair(StringCutObjectSelector<GenParticle>(cut), code));
175  }
176  }
177  firstEvent_ = false;
178  }
179 
180  using namespace ::helper;
182  evt.getByToken(srcToken_, src);
183  const size_t n = src->size();
184  flags_.clear();
185  flags_.resize(n, keepOrDropAll_);
186  for(size_t j = 0; j < select_.size(); ++j) {
187  const pair<StringCutObjectSelector<GenParticle>, SelectCode> & sel = select_[j];
188  SelectCode code = sel.second;
189  const StringCutObjectSelector<GenParticle> & cut = sel.first;
190  for(size_t i = 0; i < n; ++i) {
191  const GenParticle & p = (*src)[i];
192  if(cut(p)) {
193  int keepOrDrop = keep;
194  switch(code.keepOrDrop_) {
195  case SelectCode::kKeep:
196  keepOrDrop = keep; break;
197  case SelectCode::kDrop:
198  keepOrDrop = drop;
199  };
200  flags_[i] = keepOrDrop;
201  std::vector<size_t> allIndicesDa;
202  std::vector<size_t> allIndicesMo;
203  switch(code.daughtersDepth_) {
204  case SelectCode::kAll :
205  recursiveFlagDaughters(i, *src, keepOrDrop, allIndicesDa); break;
206  case SelectCode::kFirst :
207  flagDaughters(p, keepOrDrop); break;
208  case SelectCode::kNone:
209  ;
210  };
211  switch(code.mothersDepth_) {
212  case SelectCode::kAll :
213  recursiveFlagMothers(i, *src, keepOrDrop, allIndicesMo); break;
214  case SelectCode::kFirst :
215  flagMothers(p, keepOrDrop); break;
216  case SelectCode::kNone:
217  ;
218  };
219  }
220  }
221  }
222  indices_.clear();
223  int counter = 0;
224  for(size_t i = 0; i < n; ++i) {
225  if(flags_[i] == keep) {
226  indices_.push_back(i);
227  flags_[i] = counter++;
228  } else
229  {
230  flags_[i]=-1; //set to invalid ref
231  }
232  }
233 
234  auto_ptr<GenParticleCollection> out(new GenParticleCollection);
236  out->reserve(counter);
237 
238  for(vector<size_t>::const_iterator i = indices_.begin(); i != indices_.end(); ++i) {
239  size_t index = *i;
240  const GenParticle & gen = (*src)[index];
241  const LeafCandidate & part = gen;
242  out->push_back(GenParticle(part));
243  GenParticle & newGen = out->back();
244  //fill status flags
245  newGen.statusFlags() = gen.statusFlags();
246  // The "daIndxs" and "moIndxs" keep a list of the keys for the mother/daughter
247  // parentage/descendency. In some cases, a circular referencing is encountered,
248  // which would result in an infinite loop. The list is checked to
249  // avoid this.
250  vector<size_t> daIndxs, daNewIndxs;
251  getDaughterKeys(daIndxs, daNewIndxs, gen.daughterRefVector());
252  std::sort(daNewIndxs.begin(),daNewIndxs.end());
253  for(size_t i=0; i<daNewIndxs.size(); ++i)
254  newGen.addDaughter( GenParticleRef(outRef, daNewIndxs[i]) );
255 
256  vector<size_t> moIndxs, moNewIndxs;
257  getMotherKeys(moIndxs, moNewIndxs, gen.motherRefVector());
258  std::sort(moNewIndxs.begin(),moNewIndxs.end());
259  for(size_t i=0; i<moNewIndxs.size(); ++i)
260  newGen.addMother( GenParticleRef(outRef, moNewIndxs[i]) );
261  }
262 
263 
265  std::auto_ptr<edm::Association<reco::GenParticleCollection> > orig2new(new edm::Association<reco::GenParticleCollection>(oh ));
267  orig2newFiller.insert(src, flags_.begin(), flags_.end());
268  orig2newFiller.fill();
269  evt.put(orig2new);
270 
271 
272 }
std::vector< std::pair< StringCutObjectSelector< reco::GenParticle >, helper::SelectCode > > select_
void flagDaughters(const reco::GenParticle &, int)
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
int i
Definition: DBlmapReader.cc:9
string rep
Definition: cuy.py:1188
std::vector< int > flags_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
void flagMothers(const reco::GenParticle &, int)
void recursiveFlagMothers(size_t, const reco::GenParticleCollection &, int, std::vector< size_t > &)
const daughters & daughterRefVector() const
references to daughtes
void recursiveFlagDaughters(size_t, const reco::GenParticleCollection &, int, std::vector< size_t > &)
void addDaughter(const typename daughters::value_type &)
add a daughter via a reference
std::vector< size_t > indices_
const int keep
const mothers & motherRefVector() const
references to mothers
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
int j
Definition: DBlmapReader.cc:9
void parse(const std::string &selection, helper::SelectCode &code, std::string &cut) const
void addMother(const typename mothers::value_type &)
add a daughter via a reference
RefProd< PROD > getRefBeforePut()
Definition: Event.h:135
const int drop
tuple out
Definition: dbtoconf.py:99
const GenStatusFlags & statusFlags() const
Definition: GenParticle.h:41
part
Definition: HCALResponse.h:20
edm::EDGetTokenT< reco::GenParticleCollection > srcToken_
static std::atomic< unsigned int > counter
std::vector< std::string > selection_
void getDaughterKeys(std::vector< size_t > &, std::vector< size_t > &, const reco::GenParticleRefVector &) const
void getMotherKeys(std::vector< size_t > &, std::vector< size_t > &, const reco::GenParticleRefVector &) const
void GenParticlePruner::recursiveFlagDaughters ( size_t  index,
const reco::GenParticleCollection src,
int  keepOrDrop,
std::vector< size_t > &  allIndices 
)
private

Definition at line 116 of file GenParticlePruner.cc.

References edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::end(), spr::find(), flags_, i, and cmsHarvester::index.

Referenced by produce().

117  {
118  GenParticleRefVector daughters = src[index].daughterRefVector();
119  // avoid infinite recursion if the daughters are set to "this" particle.
120  size_t cachedIndex = index;
121  for(GenParticleRefVector::const_iterator i = daughters.begin(); i != daughters.end(); ++i) {
122  index = i->key();
123  // To also avoid infinite recursion if a "loop" is found in the daughter list,
124  // check to make sure the index hasn't already been added.
125  if ( find( allIndices.begin(), allIndices.end(), index ) == allIndices.end() ) {
126  allIndices.push_back( index );
127  if ( cachedIndex != index ) {
128  flags_[index] = keepOrDrop;
129  recursiveFlagDaughters(index, src, keepOrDrop, allIndices);
130  }
131  }
132  }
133 }
int i
Definition: DBlmapReader.cc:9
std::vector< int > flags_
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:255
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
void recursiveFlagDaughters(size_t, const reco::GenParticleCollection &, int, std::vector< size_t > &)
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:250
void GenParticlePruner::recursiveFlagMothers ( size_t  index,
const reco::GenParticleCollection src,
int  keepOrDrop,
std::vector< size_t > &  allIndices 
)
private

Definition at line 135 of file GenParticlePruner.cc.

References edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::end(), spr::find(), flags_, i, and cmsHarvester::index.

Referenced by produce().

136  {
137  GenParticleRefVector mothers = src[index].motherRefVector();
138  // avoid infinite recursion if the mothers are set to "this" particle.
139  size_t cachedIndex = index;
140  for(GenParticleRefVector::const_iterator i = mothers.begin(); i != mothers.end(); ++i) {
141  index = i->key();
142  // To also avoid infinite recursion if a "loop" is found in the daughter list,
143  // check to make sure the index hasn't already been added.
144  if ( find( allIndices.begin(), allIndices.end(), index ) == allIndices.end() ) {
145  allIndices.push_back( index );
146  if ( cachedIndex != index ) {
147  flags_[index] = keepOrDrop;
148  recursiveFlagMothers(index, src, keepOrDrop, allIndices);
149  }
150  }
151  }
152 }
int i
Definition: DBlmapReader.cc:9
std::vector< int > flags_
void recursiveFlagMothers(size_t, const reco::GenParticleCollection &, int, std::vector< size_t > &)
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:255
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:250

Member Data Documentation

bool GenParticlePruner::firstEvent_
private

Definition at line 27 of file GenParticlePruner.cc.

Referenced by produce().

std::vector<int> GenParticlePruner::flags_
private
std::vector<size_t> GenParticlePruner::indices_
private

Definition at line 33 of file GenParticlePruner.cc.

Referenced by produce().

int GenParticlePruner::keepOrDropAll_
private

Definition at line 29 of file GenParticlePruner.cc.

Referenced by produce().

std::vector<std::pair<StringCutObjectSelector<reco::GenParticle>, helper::SelectCode> > GenParticlePruner::select_
private

Definition at line 31 of file GenParticlePruner.cc.

Referenced by produce().

std::vector<std::string> GenParticlePruner::selection_
private

Definition at line 30 of file GenParticlePruner.cc.

Referenced by produce().

edm::EDGetTokenT<reco::GenParticleCollection> GenParticlePruner::srcToken_
private

Definition at line 28 of file GenParticlePruner.cc.

Referenced by produce().