CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
pat::PATGenCandsFromSimTracksProducer Class Reference

Produces reco::GenParticle from SimTracks. More...

Inheritance diagram for pat::PATGenCandsFromSimTracksProducer:
edm::stream::EDProducer<>

Classes

struct  GlobalContext
 Global context for all recursive methods. More...
 
struct  LessById
 

Public Member Functions

 PATGenCandsFromSimTracksProducer (const edm::ParameterSet &)
 
 ~PATGenCandsFromSimTracksProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Types

typedef StringCutObjectSelector< reco::GenParticleStrFilter
 

Private Member Functions

const SimTrackfindGeantMother (const SimTrack &tk, const GlobalContext &g) const
 Find the mother of a given GEANT track (or NULL if it can't be found). More...
 
edm::Ref< reco::GenParticleCollectionfindRef (const SimTrack &tk, GlobalContext &g) const
 
edm::Ref< reco::GenParticleCollectiongeneratorRef_ (const SimTrack &tk, const GlobalContext &g) const
 Used by findRef if the track is a PYTHIA particle. More...
 
reco::GenParticle makeGenParticle_ (const SimTrack &tk, const edm::Ref< reco::GenParticleCollection > &mother, const GlobalContext &g) const
 Make a GenParticle for this SimTrack, with a given mother. More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

const StrFilter filter_
 
bool firstEvent_
 
edm::EDGetTokenT< std::vector< int > > genBarcodesToken_
 
edm::EDGetTokenT< reco::GenParticleCollectiongenParticlesToken_
 Collection of GenParticles I need to make refs to. It must also have its associated vector<int> of barcodes, aligned with them. More...
 
bool makeMotherLink_
 If true, I'll try to make a link from the GEANT particle to a GenParticle. More...
 
std::set< int > motherPdgIds_
 
std::vector< PdtEntrymotherPdts_
 
std::set< int > pdgIds_
 
std::vector< PdtEntrypdts_
 
int setStatus_
 
edm::EDGetTokenT< edm::SimTrackContainersimTracksToken_
 
edm::EDGetTokenT< edm::SimVertexContainersimVertexToken_
 
edm::ESGetToken< HepPDT::ParticleDataTable, edm::DefaultRecordtableToken_
 
bool writeAncestors_
 If true, I'll save GenParticles corresponding to the ancestors of this GEANT particle. Common ancestors are only written once. More...
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Produces reco::GenParticle from SimTracks.

The PATGenCandsFromSimTracksProducer produces GenParticles from SimTracks, so they can be used for MC matching.

Author
Jordan Tucker (original module), Giovanni Petrucciani (PAT integration)
Version
Id
PATGenCandsFromSimTracksProducer.cc,v 1.8 2010/10/20 23:09:25 wmtan Exp

Definition at line 31 of file PATGenCandsFromSimTracksProducer.cc.

Member Typedef Documentation

◆ StrFilter

Definition at line 48 of file PATGenCandsFromSimTracksProducer.cc.

Constructor & Destructor Documentation

◆ PATGenCandsFromSimTracksProducer()

PATGenCandsFromSimTracksProducer::PATGenCandsFromSimTracksProducer ( const edm::ParameterSet cfg)
explicit

Definition at line 124 of file PATGenCandsFromSimTracksProducer.cc.

References looper::cfg, makeMotherLink_, motherPdts_, pdts_, and writeAncestors_.

125  : firstEvent_(true),
126  simTracksToken_(consumes<SimTrackContainer>(cfg.getParameter<InputTag>("src"))), // source sim tracks
127  simVertexToken_(consumes<SimVertexContainer>(cfg.getParameter<InputTag>("src"))), // source sim vertices
128  setStatus_(cfg.getParameter<int32_t>("setStatus")), // set status of GenParticle to this code
129  filter_(cfg.existsAs<string>("filter") ? cfg.getParameter<string>("filter") : std::string("1 == 1")),
130  makeMotherLink_(cfg.existsAs<bool>("makeMotherLink") ? cfg.getParameter<bool>("makeMotherLink") : false),
131  writeAncestors_(cfg.existsAs<bool>("writeAncestors") ? cfg.getParameter<bool>("writeAncestors") : false),
132  genParticlesToken_(mayConsume<GenParticleCollection>(cfg.getParameter<InputTag>("genParticles"))),
133  genBarcodesToken_(mayConsume<std::vector<int> >(cfg.getParameter<InputTag>("genParticles"))),
135  // Possibly allow a list of particle types
136  if (cfg.exists("particleTypes")) {
137  pdts_ = cfg.getParameter<vector<PdtEntry> >("particleTypes");
138  }
139  if (cfg.exists("motherTypes")) {
140  motherPdts_ = cfg.getParameter<vector<PdtEntry> >("motherTypes");
141  }
142 
144  edm::LogWarning("Configuration")
145  << "PATGenCandsFromSimTracksProducer: "
146  << "you have set 'writeAncestors' to 'true' and 'makeMotherLink' to false;"
147  << "GEANT particles with generator level (e.g.PYHIA) mothers won't have mother links.\n";
148  }
149  produces<GenParticleCollection>();
150 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::EDGetTokenT< reco::GenParticleCollection > genParticlesToken_
Collection of GenParticles I need to make refs to. It must also have its associated vector<int> of ba...
edm::EDGetTokenT< std::vector< int > > genBarcodesToken_
bool writeAncestors_
If true, I&#39;ll save GenParticles corresponding to the ancestors of this GEANT particle. Common ancestors are only written once.
bool makeMotherLink_
If true, I&#39;ll try to make a link from the GEANT particle to a GenParticle.
edm::ESGetToken< HepPDT::ParticleDataTable, edm::DefaultRecord > tableToken_
edm::EDGetTokenT< edm::SimVertexContainer > simVertexToken_
edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken_
Log< level::Warning, false > LogWarning

◆ ~PATGenCandsFromSimTracksProducer()

pat::PATGenCandsFromSimTracksProducer::~PATGenCandsFromSimTracksProducer ( )
inlineoverride

Definition at line 34 of file PATGenCandsFromSimTracksProducer.cc.

34 {}

Member Function Documentation

◆ findGeantMother()

const SimTrack * PATGenCandsFromSimTracksProducer::findGeantMother ( const SimTrack tk,
const GlobalContext g 
) const
private

Find the mother of a given GEANT track (or NULL if it can't be found).

Definition at line 152 of file PATGenCandsFromSimTracksProducer.cc.

References cms::cuda::assert(), g, SimTrack::genpartIndex(), heavyIonCSV_trainingSettings::idx, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, SimTrack::noVertex(), SimTrack::vertIndex(), and L1BJetProducer_cff::vtx.

Referenced by findRef(), and produce().

152  {
153  assert(tk.genpartIndex() == -1); // MUST NOT be called with a PYTHIA track
154  if (!tk.noVertex()) {
155  const SimVertex &vtx = g.simvtxs[tk.vertIndex()];
156  if (!vtx.noParent()) {
157  unsigned int idx = vtx.parentIndex();
158  SimTrackContainer::const_iterator it = std::lower_bound(g.simtks.begin(), g.simtks.end(), idx, LessById());
159  if ((it != g.simtks.end()) && (it->trackId() == idx)) {
160  return &*it;
161  }
162  }
163  }
164  return nullptr;
165 }
assert(be >=bs)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
Definition: SimTrack.h:33
bool noVertex() const
Definition: SimTrack.h:34
int genpartIndex() const
index of the corresponding Generator particle in the Event container (-1 if no Genpart) ...
Definition: SimTrack.h:37

◆ findRef()

edm::Ref< reco::GenParticleCollection > PATGenCandsFromSimTracksProducer::findRef ( const SimTrack tk,
GlobalContext g 
) const
private

Find the GenParticle reference for a given GEANT or PYTHIA track.

  • if the track corresponds to a PYTHIA particle, return a ref to that particle
  • otherwise, if this simtrack has no mother simtrack, return a null ref
  • otherwise, if writeAncestors is true, make a GenParticle for it and return a ref to it
  • otherwise, if writeAncestors is false, return the ref to the GEANT mother of this track

Definition at line 167 of file PATGenCandsFromSimTracksProducer.cc.

References cms::cuda::assert(), findGeantMother(), g, generatorRef_(), SimTrack::genpartIndex(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, makeGenParticle_(), makeMotherLink_, AlCaHLTBitMon_ParallelJobs::p, CoreSimTrack::trackId(), and writeAncestors_.

Referenced by produce().

168  {
169  if (tk.genpartIndex() != -1)
171  const SimTrack *simMother = findGeantMother(tk, g);
172 
174  if (simMother != nullptr)
175  motherRef = findRef(*simMother, g);
176 
177  if (writeAncestors_) {
178  // If writing ancestors, I need to serialize myself, and then to return a ref to me
179  // But first check if I've already been serialized
180  std::map<unsigned int, int>::const_iterator it = g.simTksProcessed.find(tk.trackId());
181  if (it != g.simTksProcessed.end()) {
182  // just return a ref to it
183  assert(it->second > 0);
184  return edm::Ref<reco::GenParticleCollection>(g.refprod, (it->second) - 1);
185  } else {
186  // make genParticle, save, update the map, and return ref to myself
187  reco::GenParticle p = makeGenParticle_(tk, motherRef, g);
188  g.output.push_back(p);
189  g.simTksProcessed[tk.trackId()] = g.output.size();
190  return edm::Ref<reco::GenParticleCollection>(g.refprod, g.output.size() - 1);
191  }
192  } else {
193  // Otherwise, I just return a ref to my mum
194  return motherRef;
195  }
196 }
bool writeAncestors_
If true, I&#39;ll save GenParticles corresponding to the ancestors of this GEANT particle. Common ancestors are only written once.
assert(be >=bs)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
edm::Ref< reco::GenParticleCollection > findRef(const SimTrack &tk, GlobalContext &g) const
reco::GenParticle makeGenParticle_(const SimTrack &tk, const edm::Ref< reco::GenParticleCollection > &mother, const GlobalContext &g) const
Make a GenParticle for this SimTrack, with a given mother.
bool makeMotherLink_
If true, I&#39;ll try to make a link from the GEANT particle to a GenParticle.
unsigned int trackId() const
Definition: CoreSimTrack.h:31
edm::Ref< reco::GenParticleCollection > generatorRef_(const SimTrack &tk, const GlobalContext &g) const
Used by findRef if the track is a PYTHIA particle.
const SimTrack * findGeantMother(const SimTrack &tk, const GlobalContext &g) const
Find the mother of a given GEANT track (or NULL if it can&#39;t be found).
int genpartIndex() const
index of the corresponding Generator particle in the Event container (-1 if no Genpart) ...
Definition: SimTrack.h:37

◆ generatorRef_()

edm::Ref< reco::GenParticleCollection > PATGenCandsFromSimTracksProducer::generatorRef_ ( const SimTrack tk,
const GlobalContext g 
) const
private

Used by findRef if the track is a PYTHIA particle.

Definition at line 198 of file PATGenCandsFromSimTracksProducer.cc.

References cms::cuda::assert(), spr::find(), g, SimTrack::genpartIndex(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and pfDeepBoostedJetPreprocessParams_cfi::lower_bound.

Referenced by findRef().

199  {
200  assert(st.genpartIndex() != -1);
201  // Note that st.genpartIndex() is the barcode, not the index within GenParticleCollection, so I have to search the particle
202  std::vector<int>::const_iterator it;
203  if (g.barcodesAreSorted) {
204  it = std::lower_bound(g.genBarcodes->begin(), g.genBarcodes->end(), st.genpartIndex());
205  } else {
206  it = std::find(g.genBarcodes->begin(), g.genBarcodes->end(), st.genpartIndex());
207  }
208 
209  // Check that I found something
210  // I need to check '*it == st.genpartIndex()' because lower_bound just finds the right spot for an item in a sorted list, not the item
211  if ((it != g.genBarcodes->end()) && (*it == st.genpartIndex())) {
212  return reco::GenParticleRef(g.gens, it - g.genBarcodes->begin());
213  } else {
214  return reco::GenParticleRef();
215  }
216 }
edm::Ref< GenParticleCollection > GenParticleRef
persistent reference to a GenParticle
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
assert(be >=bs)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4

◆ makeGenParticle_()

reco::GenParticle PATGenCandsFromSimTracksProducer::makeGenParticle_ ( const SimTrack tk,
const edm::Ref< reco::GenParticleCollection > &  mother,
const GlobalContext g 
) const
private

Make a GenParticle for this SimTrack, with a given mother.

Definition at line 218 of file PATGenCandsFromSimTracksProducer.cc.

References CoreSimTrack::charge(), ALCARECOTkAlJpsiMuMu_cff::charge, g, edm::Ref< C, T, F >::isNonnull(), CoreSimTrack::momentum(), SimTrack::noVertex(), setStatus_, CoreSimTrack::type(), SimTrack::vertIndex(), and L1BJetProducer_cff::vtx.

Referenced by findRef(), and produce().

219  {
220  // Make up a GenParticleCandidate from the GEANT track info.
221  int charge = static_cast<int>(tk.charge());
222  const Particle::LorentzVector &p4 = tk.momentum();
223  Particle::Point vtx; // = (0,0,0) by default
224  if (!tk.noVertex())
225  vtx = g.simvtxs[tk.vertIndex()].position();
226  GenParticle gp(charge, p4, vtx, tk.type(), setStatus_, true);
227  if (mother.isNonnull())
228  gp.addMother(mother);
229  return gp;
230 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
float charge() const
charge
Definition: CoreSimTrack.cc:17
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:19
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:22
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
Definition: SimTrack.h:33
bool noVertex() const
Definition: SimTrack.h:34
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: LeafCandidate.h:23
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:27

◆ produce()

void PATGenCandsFromSimTracksProducer::produce ( edm::Event event,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 232 of file PATGenCandsFromSimTracksProducer.cc.

References funct::abs(), HLT_2024v14_cff::cands, gather_cfg::cout, hcalRecHitTable_cff::depth, Exception, filter_, findGeantMother(), findRef(), firstEvent_, genBarcodesToken_, EgammaValidation_cff::genp, genParticlesToken_, edm::EventSetup::getData(), mps_fire::i, edm::OrphanHandleBase::id(), edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::isNonnull(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, edm::Ref< C, T, F >::key(), makeGenParticle_(), makeMotherLink_, motherPdgIds_, motherPdts_, eostools::move(), pdgIds_, pdts_, simTracksToken_, simVertexToken_, jetUpdater_cfi::sort, tableToken_, CoreSimTrack::type(), and writeAncestors_.

232  {
233  if (firstEvent_) {
234  auto const &pdt = iSetup.getData(tableToken_);
235  if (!pdts_.empty()) {
236  pdgIds_.clear();
237  for (vector<PdtEntry>::iterator itp = pdts_.begin(), edp = pdts_.end(); itp != edp; ++itp) {
238  itp->setup(pdt); // decode string->pdgId and vice-versa
239  pdgIds_.insert(std::abs(itp->pdgId()));
240  }
241  pdts_.clear();
242  }
243  if (!motherPdts_.empty()) {
244  motherPdgIds_.clear();
245  for (vector<PdtEntry>::iterator itp = motherPdts_.begin(), edp = motherPdts_.end(); itp != edp; ++itp) {
246  itp->setup(pdt); // decode string->pdgId and vice-versa
247  motherPdgIds_.insert(std::abs(itp->pdgId()));
248  }
249  motherPdts_.clear();
250  }
251  firstEvent_ = false;
252  }
253 
254  // Simulated tracks (i.e. GEANT particles).
255  Handle<SimTrackContainer> simtracks;
256  event.getByToken(simTracksToken_, simtracks);
257 
258  // Need to check that SimTrackContainer is sorted; otherwise, copy and sort :-(
259  std::unique_ptr<SimTrackContainer> simtracksTmp;
260  const SimTrackContainer *simtracksSorted = &*simtracks;
262  if (!__gnu_cxx::is_sorted(simtracks->begin(), simtracks->end(), LessById())) {
263  simtracksTmp = std::make_unique<SimTrackContainer>(*simtracks);
264  std::sort(simtracksTmp->begin(), simtracksTmp->end(), LessById());
265  simtracksSorted = &*simtracksTmp;
266  }
267  }
268 
269  // Get the associated vertices
270  Handle<SimVertexContainer> simvertices;
271  event.getByToken(simVertexToken_, simvertices);
272 
273  // Get the GenParticles and barcodes, if needed to set mother links
275  Handle<std::vector<int> > genBarcodes;
276  bool barcodesAreSorted = true;
277  if (makeMotherLink_) {
278  event.getByToken(genParticlesToken_, gens);
279  event.getByToken(genBarcodesToken_, genBarcodes);
280  if (gens->size() != genBarcodes->size())
281  throw cms::Exception("Corrupt data") << "Barcodes not of the same size as GenParticles!\n";
282  barcodesAreSorted = __gnu_cxx::is_sorted(genBarcodes->begin(), genBarcodes->end());
283  }
284 
285  // make the output collection
286  auto cands = std::make_unique<GenParticleCollection>();
287  edm::RefProd<GenParticleCollection> refprod = event.getRefBeforePut<GenParticleCollection>();
288 
289  GlobalContext globals(*simtracksSorted, *simvertices, gens, genBarcodes, barcodesAreSorted, *cands, refprod);
290 
291  for (SimTrackContainer::const_iterator isimtrk = simtracks->begin(); isimtrk != simtracks->end(); ++isimtrk) {
292  // Skip PYTHIA tracks.
293  if (isimtrk->genpartIndex() != -1)
294  continue;
295 
296  // Maybe apply the PdgId filter
297  if (!pdgIds_.empty()) { // if we have a filter on pdg ids
298  if (pdgIds_.find(std::abs(isimtrk->type())) == pdgIds_.end())
299  continue;
300  }
301 
303 
304  // Maybe apply filter on the particle
305  if (!(filter_(genp)))
306  continue;
307 
308  if (!motherPdgIds_.empty()) {
309  const SimTrack *motherSimTk = findGeantMother(*isimtrk, globals);
310  if (motherSimTk == nullptr)
311  continue;
312  if (motherPdgIds_.find(std::abs(motherSimTk->type())) == motherPdgIds_.end())
313  continue;
314  }
315 
317  Ref<GenParticleCollection> motherRef;
318  const SimTrack *mother = findGeantMother(*isimtrk, globals);
319  if (mother != nullptr)
320  motherRef = findRef(*mother, globals);
321  if (motherRef.isNonnull())
322  genp.addMother(motherRef);
323  }
324 
325  cands->push_back(genp);
326  }
327 
328  // Write to the Event, and get back a handle (which can be useful for debugging)
330 
331 #ifdef DEBUG_PATGenCandsFromSimTracksProducer
332  std::cout << "Produced a list of " << orphans->size() << " genParticles." << std::endl;
333  for (GenParticleCollection::const_iterator it = orphans->begin(), ed = orphans->end(); it != ed; ++it) {
334  std::cout << " ";
335  std::cout << "GenParticle #" << (it - orphans->begin()) << ": pdgId " << it->pdgId() << ", pt = " << it->pt()
336  << ", eta = " << it->eta() << ", phi = " << it->phi() << ", rho = " << it->vertex().Rho()
337  << ", z = " << it->vertex().Z() << std::endl;
338  edm::Ref<GenParticleCollection> mom = it->motherRef();
339  size_t depth = 2;
340  while (mom.isNonnull()) {
341  if (mom.id() == orphans.id()) {
342  // I need to re-make the ref because they are not working until this module returns.
343  mom = edm::Ref<GenParticleCollection>(orphans, mom.key());
344  }
345  for (size_t i = 0; i < depth; ++i)
346  std::cout << " ";
347  std::cout << "GenParticleRef [" << mom.id() << "/" << mom.key() << "]: pdgId " << mom->pdgId()
348  << ", status = " << mom->status() << ", pt = " << mom->pt() << ", eta = " << mom->eta()
349  << ", phi = " << mom->phi() << ", rho = " << mom->vertex().Rho() << ", z = " << mom->vertex().Z()
350  << std::endl;
351  if (mom.id() != orphans.id())
352  break;
353  if ((mom->motherRef().id() == mom.id()) && (mom->motherRef().key() == mom.key())) {
354  throw cms::Exception("Corrupt Data") << "A particle is it's own mother.\n";
355  }
356  mom = mom->motherRef();
357  depth++;
358  }
359  }
360  std::cout << std::endl;
361 #endif
362 }
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
genp
produce generated paricles in acceptance #
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::EDGetTokenT< reco::GenParticleCollection > genParticlesToken_
Collection of GenParticles I need to make refs to. It must also have its associated vector<int> of ba...
edm::EDGetTokenT< std::vector< int > > genBarcodesToken_
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
bool writeAncestors_
If true, I&#39;ll save GenParticles corresponding to the ancestors of this GEANT particle. Common ancestors are only written once.
key_type key() const
Accessor for product key.
Definition: Ref.h:250
edm::Ref< reco::GenParticleCollection > findRef(const SimTrack &tk, GlobalContext &g) const
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:22
reco::GenParticle makeGenParticle_(const SimTrack &tk, const edm::Ref< reco::GenParticleCollection > &mother, const GlobalContext &g) const
Make a GenParticle for this SimTrack, with a given mother.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool makeMotherLink_
If true, I&#39;ll try to make a link from the GEANT particle to a GenParticle.
ProductID id() const
edm::ESGetToken< HepPDT::ParticleDataTable, edm::DefaultRecord > tableToken_
edm::EDGetTokenT< edm::SimVertexContainer > simVertexToken_
edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken_
std::vector< SimTrack > SimTrackContainer
def move(src, dest)
Definition: eostools.py:511
const SimTrack * findGeantMother(const SimTrack &tk, const GlobalContext &g) const
Find the mother of a given GEANT track (or NULL if it can&#39;t be found).

Member Data Documentation

◆ filter_

const StrFilter pat::PATGenCandsFromSimTracksProducer::filter_
private

Definition at line 49 of file PATGenCandsFromSimTracksProducer.cc.

Referenced by produce().

◆ firstEvent_

bool pat::PATGenCandsFromSimTracksProducer::firstEvent_
private

Definition at line 39 of file PATGenCandsFromSimTracksProducer.cc.

Referenced by produce().

◆ genBarcodesToken_

edm::EDGetTokenT<std::vector<int> > pat::PATGenCandsFromSimTracksProducer::genBarcodesToken_
private

Definition at line 58 of file PATGenCandsFromSimTracksProducer.cc.

Referenced by produce().

◆ genParticlesToken_

edm::EDGetTokenT<reco::GenParticleCollection> pat::PATGenCandsFromSimTracksProducer::genParticlesToken_
private

Collection of GenParticles I need to make refs to. It must also have its associated vector<int> of barcodes, aligned with them.

Definition at line 57 of file PATGenCandsFromSimTracksProducer.cc.

Referenced by produce().

◆ makeMotherLink_

bool pat::PATGenCandsFromSimTracksProducer::makeMotherLink_
private

If true, I'll try to make a link from the GEANT particle to a GenParticle.

Definition at line 52 of file PATGenCandsFromSimTracksProducer.cc.

Referenced by findRef(), PATGenCandsFromSimTracksProducer(), and produce().

◆ motherPdgIds_

std::set<int> pat::PATGenCandsFromSimTracksProducer::motherPdgIds_
private

Definition at line 45 of file PATGenCandsFromSimTracksProducer.cc.

Referenced by produce().

◆ motherPdts_

std::vector<PdtEntry> pat::PATGenCandsFromSimTracksProducer::motherPdts_
private

◆ pdgIds_

std::set<int> pat::PATGenCandsFromSimTracksProducer::pdgIds_
private

Definition at line 43 of file PATGenCandsFromSimTracksProducer.cc.

Referenced by produce().

◆ pdts_

std::vector<PdtEntry> pat::PATGenCandsFromSimTracksProducer::pdts_
private

◆ setStatus_

int pat::PATGenCandsFromSimTracksProducer::setStatus_
private

Definition at line 42 of file PATGenCandsFromSimTracksProducer.cc.

Referenced by makeGenParticle_().

◆ simTracksToken_

edm::EDGetTokenT<edm::SimTrackContainer> pat::PATGenCandsFromSimTracksProducer::simTracksToken_
private

Definition at line 40 of file PATGenCandsFromSimTracksProducer.cc.

Referenced by produce().

◆ simVertexToken_

edm::EDGetTokenT<edm::SimVertexContainer> pat::PATGenCandsFromSimTracksProducer::simVertexToken_
private

Definition at line 41 of file PATGenCandsFromSimTracksProducer.cc.

Referenced by produce().

◆ tableToken_

edm::ESGetToken<HepPDT::ParticleDataTable, edm::DefaultRecord> pat::PATGenCandsFromSimTracksProducer::tableToken_
private

Definition at line 60 of file PATGenCandsFromSimTracksProducer.cc.

Referenced by produce().

◆ writeAncestors_

bool pat::PATGenCandsFromSimTracksProducer::writeAncestors_
private

If true, I'll save GenParticles corresponding to the ancestors of this GEANT particle. Common ancestors are only written once.

Definition at line 54 of file PATGenCandsFromSimTracksProducer.cc.

Referenced by findRef(), PATGenCandsFromSimTracksProducer(), and produce().