CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
TopDecaySubset Class Reference

Module to produce the subset of generator particles directly contained in top decay chains. More...

#include "TopQuarkAnalysis/TopEventProducers/interface/TopDecaySubset.h"

Inheritance diagram for TopDecaySubset:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

enum  FillMode { kStable, kME }
 
enum  RunMode { kRun1, kRun2 }
 supported modes to run the code More...
 
enum  ShowerModel {
  kStart = -1, kNone, kPythia, kHerwig,
  kPythia8, kSherpa
}
 classification of potential shower types More...
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

void produce (edm::Event &event, const edm::EventSetup &setup) override
 write output into the event More...
 
 TopDecaySubset (const edm::ParameterSet &cfg)
 default constructor More...
 
 ~TopDecaySubset () override
 default destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void addDaughters (int &idx, const reco::GenParticle::const_iterator part, reco::GenParticleCollection &target, bool recursive=true)
 recursively fill vector for all further decay particles of a given particle More...
 
void addRadiation (int &idx, const reco::GenParticle *part, reco::GenParticleCollection &target)
 
void addRadiation (int &idx, const reco::GenParticle::const_iterator part, reco::GenParticleCollection &target)
 fill vector including all radiations from quarks originating from W/top More...
 
ShowerModel checkShowerModel (const std::vector< const reco::GenParticle * > &tops) const
 check the decay chain for the used shower model More...
 
ShowerModel checkShowerModel (edm::Event &event)
 check the embedded MC information for the shower model More...
 
void checkWBosons (std::vector< const reco::GenParticle * > &tops) const
 check whether W bosons are contained in the original gen particle listing More...
 
void clearReferences ()
 clear references More...
 
void fillListing (const std::vector< const reco::GenParticle * > &primalTops, const std::vector< const reco::GenParticle * > &decayingTops, reco::GenParticleCollection &target)
 fill output vector for full decay chain More...
 
void fillListing (const std::vector< const reco::GenParticle * > &tops, reco::GenParticleCollection &target)
 fill output vector for full decay chain More...
 
void fillReferences (const reco::GenParticleRefProd &refProd, reco::GenParticleCollection &target)
 fill references for output vector More...
 
std::vector< const reco::GenParticle * > findDecayingTops (const reco::GenParticleCollection &parts)
 
const reco::GenParticlefindLastParticleInChain (const reco::GenParticle *p)
 
std::vector< const reco::GenParticle * > findPrimalTops (const reco::GenParticleCollection &parts)
 
const reco::GenParticlefindPrimalW (const reco::GenParticle *top)
 
std::vector< const reco::GenParticle * > findTops (const reco::GenParticleCollection &parts)
 find top quarks in list of input particles More...
 
reco::Particle::LorentzVector p4 (const reco::GenParticle::const_iterator part, int statusFlag)
 calculate lorentz vector from input More...
 
reco::Particle::LorentzVector p4 (const std::vector< const reco::GenParticle * >::const_iterator top, int statusFlag)
 calculate lorentz vector from input (dedicated to top reconstruction) More...
 

Private Attributes

bool addRadiation_
 add radiation or not? More...
 
FillMode fillMode_
 
edm::EDGetTokenT< GenEventInfoProductgenEventInfo_srcToken_
 input tag for the genEventInfo source More...
 
int motherPartIdx_
 
std::map< int, std::vector< int > > refs_
 management of daughter indices for fillRefs More...
 
RunMode runMode_
 run mode (Run1 || Run2) More...
 
ShowerModel showerModel_
 parton shower mode (filled in checkShowerModel) More...
 
edm::EDGetTokenT< reco::GenParticleCollectionsrcToken_
 input tag for the genParticle source More...
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Module to produce the subset of generator particles directly contained in top decay chains.

The module produces the subset of generator particles directly contained in top decay chains. The particles are saved as a collection of reco::GenParticles. Depending on the configuration of the module, the 4-vector kinematics can be taken from the status-3 particles (ME before parton showering) or from the status-2 particles (after parton showering), additionally radiated gluons may be considered during the creation of the subset or not.

Definition at line 28 of file TopDecaySubset.h.

Member Enumeration Documentation

◆ FillMode

supported modes to fill the new vectors of gen particles

Enumerator
kStable 
kME 

Definition at line 32 of file TopDecaySubset.h.

32 { kStable, kME };

◆ RunMode

supported modes to run the code

Enumerator
kRun1 
kRun2 

Definition at line 36 of file TopDecaySubset.h.

36 { kRun1, kRun2 };

◆ ShowerModel

classification of potential shower types

Enumerator
kStart 
kNone 
kPythia 
kHerwig 
kPythia8 
kSherpa 

Definition at line 34 of file TopDecaySubset.h.

Constructor & Destructor Documentation

◆ TopDecaySubset()

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

default constructor

Definition at line 10 of file TopDecaySubset.cc.

11  : srcToken_(consumes<reco::GenParticleCollection>(cfg.getParameter<edm::InputTag>("src"))),
12  genEventInfo_srcToken_(mayConsume<GenEventInfoProduct>(edm::InputTag("generator"))),
13  addRadiation_(cfg.getParameter<bool>("addRadiation")),
15  runMode_(kRun1) {
16  // mapping of the corresponding fillMode; see FillMode
17  // enumerator of TopDecaySubset for available modes
18  std::string mode = cfg.getParameter<std::string>("fillMode");
19  if (mode == "kME")
20  fillMode_ = kME;
21  else if (mode == "kStable")
23  else
24  throw cms::Exception("Configuration") << mode << " is not a supported FillMode!\n";
25 
26  mode = cfg.getParameter<std::string>("runMode");
27  if (mode == "Run1")
28  runMode_ = kRun1;
29  else if (mode == "Run2")
30  runMode_ = kRun2;
31  else
32  throw cms::Exception("Configuration") << mode << " is not a supported RunMode!\n";
33 
34  // produces a set of GenParticles following
35  // the decay branch of top quarks to the first level of
36  // stable decay products
37  produces<reco::GenParticleCollection>();
38 }

References looper::cfg, Exception, fillMode_, kME, kRun1, kRun2, kStable, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, runMode_, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~TopDecaySubset()

TopDecaySubset::~TopDecaySubset ( )
override

default destructor

Definition at line 41 of file TopDecaySubset.cc.

41 {}

Member Function Documentation

◆ addDaughters()

void TopDecaySubset::addDaughters ( int &  idx,
const reco::GenParticle::const_iterator  part,
reco::GenParticleCollection target,
bool  recursive = true 
)
private

recursively fill vector for all further decay particles of a given particle

Definition at line 636 of file TopDecaySubset.cc.

639  {
640  std::vector<int> daughters;
641  int idxBuffer = idx;
642  for (reco::GenParticle::const_iterator daughter = part->begin(); daughter != part->end(); ++daughter) {
643  std::unique_ptr<reco::GenParticle> ptr(new reco::GenParticle(
644  daughter->threeCharge(), daughter->p4(), daughter->vertex(), daughter->pdgId(), daughter->status(), false));
645  target.push_back(*ptr);
646  // increment & push index of daughter
647  daughters.push_back(++idx);
648  // continue recursively if desired
649  if (recursive) {
650  addDaughters(idx, daughter, target);
651  }
652  }
653  if (!daughters.empty()) {
654  refs_[idxBuffer] = daughters;
655  }
656 }

References BPhysicsValidation_cfi::daughters, heavyIonCSV_trainingSettings::idx, postprocess-scan-build::recursive, refs_, and filterCSVwithJSON::target.

Referenced by fillListing().

◆ addRadiation() [1/2]

void TopDecaySubset::addRadiation ( int &  idx,
const reco::GenParticle part,
reco::GenParticleCollection target 
)
private

Definition at line 617 of file TopDecaySubset.cc.

617  {
618  std::vector<int> daughters;
619  int idxBuffer = idx;
620  for (reco::GenParticle::const_iterator daughter = part->begin(); daughter != part->end(); ++daughter) {
621  // either pick daughters as long as they are different
622  // to the initial particle
623  if (daughter->pdgId() != part->pdgId()) {
624  std::unique_ptr<reco::GenParticle> ptr(new reco::GenParticle(
625  daughter->threeCharge(), daughter->p4(), daughter->vertex(), daughter->pdgId(), daughter->status(), false));
626  target.push_back(*ptr);
627  daughters.push_back(++idx); //push index of daughter
628  }
629  }
630  if (!daughters.empty()) {
631  refs_[idxBuffer] = daughters;
632  }
633 }

References BPhysicsValidation_cfi::daughters, heavyIonCSV_trainingSettings::idx, refs_, and filterCSVwithJSON::target.

◆ addRadiation() [2/2]

void TopDecaySubset::addRadiation ( int &  idx,
const reco::GenParticle::const_iterator  part,
reco::GenParticleCollection target 
)
private

fill vector including all radiations from quarks originating from W/top

Definition at line 596 of file TopDecaySubset.cc.

598  {
599  std::vector<int> daughters;
600  int idxBuffer = idx;
601  for (reco::GenParticle::const_iterator daughter = part->begin(); daughter != part->end(); ++daughter) {
602  if (daughter->status() <= TopDecayID::stable && daughter->pdgId() != part->pdgId()) {
603  // skip comment lines and make sure that
604  // the particle is not double counted as
605  // daughter of itself
606  std::unique_ptr<reco::GenParticle> ptr(new reco::GenParticle(
607  daughter->threeCharge(), daughter->p4(), daughter->vertex(), daughter->pdgId(), daughter->status(), false));
608  target.push_back(*ptr);
609  daughters.push_back(++idx); //push index of daughter
610  }
611  }
612  if (!daughters.empty()) {
613  refs_[idxBuffer] = daughters;
614  }
615 }

References BPhysicsValidation_cfi::daughters, heavyIonCSV_trainingSettings::idx, refs_, TopDecayID::stable, and filterCSVwithJSON::target.

Referenced by fillListing().

◆ checkShowerModel() [1/2]

TopDecaySubset::ShowerModel TopDecaySubset::checkShowerModel ( const std::vector< const reco::GenParticle * > &  tops) const
private

check the decay chain for the used shower model

check the decay chain for the exploited shower model

Definition at line 202 of file TopDecaySubset.cc.

202  {
203  for (std::vector<const reco::GenParticle*>::const_iterator it = tops.begin(); it != tops.end(); ++it) {
204  const reco::GenParticle* top = *it;
205  // check for kHerwig type showers: here the status 3 top quark will
206  // have a single status 2 top quark as daughter, which has again 3
207  // or more status 2 daughters
208  if (top->numberOfDaughters() == 1) {
209  if (top->begin()->pdgId() == top->pdgId() && top->begin()->status() == TopDecayID::stable &&
210  top->begin()->numberOfDaughters() > 1)
211  return kHerwig;
212  }
213  // check for kPythia type showers: here the status 3 top quark will
214  // have all decay products and a status 2 top quark as daughters
215  // the status 2 top quark will be w/o further daughters
216  if (top->numberOfDaughters() > 1) {
217  bool containsWBoson = false, containsQuarkDaughter = false;
218  for (reco::GenParticle::const_iterator td = top->begin(); td != top->end(); ++td) {
219  if (std::abs(td->pdgId()) < TopDecayID::tID)
220  containsQuarkDaughter = true;
221  if (std::abs(td->pdgId()) == TopDecayID::WID)
222  containsWBoson = true;
223  }
224  if (containsQuarkDaughter && containsWBoson)
225  return kPythia;
226  }
227  }
228  // if neither Herwig nor Pythia like
229  if (tops.empty())
230  edm::LogInfo("decayChain") << " Failed to find top quarks in decay chain. Will assume that this a \n"
231  << " non-top sample and produce an empty decaySubset.\n";
232  else
234  " Can not find back any of the supported hadronization models. Models \n"
235  " which are supported are: \n"
236  " Pythia LO(+PS): Top(status 3) --> WBoson(status 3), Quark(status 3)\n"
237  " Herwig NLO(+PS): Top(status 2) --> Top(status 3) --> Top(status 2) \n");
238  return kNone;
239 }

References funct::abs(), reco::Candidate::begin(), reco::Candidate::end(), Exception, kHerwig, kNone, kPythia, edm::errors::LogicError, reco::CompositeRefCandidateT< D >::numberOfDaughters(), reco::LeafCandidate::pdgId(), TopDecayID::stable, TopDecayID::tID, and TopDecayID::WID.

Referenced by produce().

◆ checkShowerModel() [2/2]

TopDecaySubset::ShowerModel TopDecaySubset::checkShowerModel ( edm::Event event)
private

check the embedded MC information for the shower model

Definition at line 242 of file TopDecaySubset.cc.

242  {
243  edm::Handle<GenEventInfoProduct> genEvtInfoProduct;
244  event.getByToken(genEventInfo_srcToken_, genEvtInfoProduct);
245 
246  std::string moduleName = "";
247  if (genEvtInfoProduct.isValid()) {
248  const edm::StableProvenance& prov = event.getStableProvenance(genEvtInfoProduct.id());
249  moduleName = edm::moduleName(prov, event.processHistory());
250  if (moduleName == "ExternalGeneratorFilter") {
251  moduleName = edm::parameterSet(prov, event.processHistory()).getParameter<std::string>("@external_type");
252  edm::LogInfo("SpecialModule") << "GEN events are produced by ExternalGeneratorFilter, "
253  << "which is a wrapper of the original module: " << moduleName;
254  }
255  }
256 
257  ShowerModel shower(kStart);
258  if (moduleName.find("Pythia6") != std::string::npos)
259  shower = kPythia;
260  else if (moduleName.find("Pythia8") != std::string::npos)
261  shower = kPythia8;
262  else if (moduleName.find("Herwig6") != std::string::npos)
263  shower = kHerwig;
264  else if (moduleName.find("ThePEG") != std::string::npos)
265  // Herwig++
266  shower = kHerwig;
267  else if (moduleName.find("Sherpa") != std::string::npos)
268  shower = kSherpa;
269  else
270  shower = kNone;
271  return shower;
272 }

References genEventInfo_srcToken_, edm::HandleBase::id(), edm::HandleBase::isValid(), kHerwig, kNone, kPythia, kPythia8, kSherpa, kStart, EcalCalibMonitorClient_cfi::moduleName, edm::moduleName(), edm::parameterSet(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ checkWBosons()

void TopDecaySubset::checkWBosons ( std::vector< const reco::GenParticle * > &  tops) const
private

check whether W bosons are contained in the original gen particle listing

check whether the W boson is contained in the original gen particle listing

Definition at line 274 of file TopDecaySubset.cc.

274  {
275  unsigned nTops = tops.size();
276  for (std::vector<const reco::GenParticle*>::iterator it = tops.begin(); it != tops.end();) {
277  const reco::GenParticle* top = *it;
278  bool isContained = false;
279  bool expectedStatus = false;
280  if (showerModel_ != kPythia && top->begin() == top->end())
281  throw edm::Exception(edm::errors::LogicError, "showerModel_!=kPythia && top->begin()==top->end()\n");
282  for (reco::GenParticle::const_iterator td = ((showerModel_ == kPythia) ? top->begin() : top->begin()->begin());
283  td != ((showerModel_ == kPythia) ? top->end() : top->begin()->end());
284  ++td) {
285  if (std::abs(td->pdgId()) == TopDecayID::WID) {
286  isContained = true;
287  if (((showerModel_ == kPythia) ? td->status() == TopDecayID::unfrag : td->status() == TopDecayID::stable)) {
288  expectedStatus = true;
289  break;
290  }
291  }
292  }
293  if (!expectedStatus) {
294  it = tops.erase(it);
295  if (isContained)
296  edm::LogInfo("decayChain") << " W boson does not have the expected status. This happens, e.g., \n"
297  << " with MC@NLO in the case of additional ttbar pairs from radiated \n"
298  << " gluons. We hope everything is fine, remove the correspdonding top \n"
299  << " quark from our list since it is not part of the primary ttbar pair \n"
300  << " and try to continue. \n";
301  } else
302  it++;
303  }
304  if (tops.empty() && nTops != 0)
306  " Did not find a W boson with appropriate status for any of the top \n"
307  " quarks in this event. This means that the hadronization of the W \n"
308  " boson might be screwed up or there is another problem with the \n"
309  " particle listing in this MC sample. Please contact an expert. \n");
310 }

References funct::abs(), reco::Candidate::begin(), reco::Candidate::end(), kPythia, edm::errors::LogicError, showerModel_, TopDecayID::stable, TopDecayID::unfrag, and TopDecayID::WID.

Referenced by produce().

◆ clearReferences()

void TopDecaySubset::clearReferences ( )
private

clear references

Definition at line 659 of file TopDecaySubset.cc.

659  {
660  // clear vector of references
661  refs_.clear();
662  // set idx for mother particles to a start value
663  // of -1 (the first entry will raise it to 0)
664  motherPartIdx_ = -1;
665 }

References motherPartIdx_, and refs_.

Referenced by produce().

◆ fillListing() [1/2]

void TopDecaySubset::fillListing ( const std::vector< const reco::GenParticle * > &  primalTops,
const std::vector< const reco::GenParticle * > &  decayingTops,
reco::GenParticleCollection target 
)
private

fill output vector for full decay chain

Definition at line 432 of file TopDecaySubset.cc.

434  {
435  std::vector<const reco::GenParticle*>::const_iterator top_start;
436  std::vector<const reco::GenParticle*>::const_iterator top_end;
437  if (fillMode_ == kME) {
438  top_start = primalTops.begin();
439  top_end = primalTops.end();
440  } else {
441  top_start = decayingTops.begin();
442  top_end = decayingTops.end();
443  }
444  for (std::vector<const reco::GenParticle*>::const_iterator it = top_start; it != top_end; ++it) {
445  const reco::GenParticle* t = *it;
446  // summation might happen here
447  std::unique_ptr<reco::GenParticle> topPtr(
448  new reco::GenParticle(t->threeCharge(), t->p4(), t->vertex(), t->pdgId(), t->status(), false));
449  target.push_back(*topPtr);
450  ++motherPartIdx_;
451 
452  // keep the top index for the map to manage the daughter refs
453  int iTop = motherPartIdx_;
454  std::vector<int> topDaughters;
455  // define the W boson index (to be set later) for the map to
456  // manage the daughter refs
457  int iW = 0;
458  std::vector<int> wDaughters;
459  const reco::GenParticle* final_top = findLastParticleInChain(t);
460 
461  //iterate over top daughters
462  for (reco::GenParticle::const_iterator td = final_top->begin(); td != final_top->end(); ++td) {
463  if (std::abs(td->pdgId()) <= TopDecayID::bID) {
464  // if particle is beauty or other quark
465  std::unique_ptr<reco::GenParticle> qPtr(
466  new reco::GenParticle(td->threeCharge(), td->p4(), td->vertex(), td->pdgId(), td->status(), false));
467  target.push_back(*qPtr);
468  // increment & push index of the top daughter
469  topDaughters.push_back(++motherPartIdx_);
470  if (addRadiation_) {
471  // for radation to be added we first need to
472  // pick the last quark in the MC chain
473  const reco::GenParticle* last_q = findLastParticleInChain(static_cast<const reco::GenParticle*>(&*td));
475  }
476  } else if (std::abs(td->pdgId()) == TopDecayID::WID) {
477  // ladies and gentleman, we have a W boson
478  std::unique_ptr<reco::GenParticle> WPtr(
479  new reco::GenParticle(td->threeCharge(), td->p4(), td->vertex(), td->pdgId(), td->status(), false));
480  target.push_back(*WPtr);
481  // increment & push index of the top daughter
482  topDaughters.push_back(++motherPartIdx_);
483  iW = motherPartIdx_;
484 
485  // next are the daughers of our W boson
486  // for Pythia 6 this is wrong as the last W has no daughters at all!
487  // instead the status 3 W has 3 daughters: q qbar' and W (WTF??!)
488  const reco::GenParticle* decaying_W = findLastParticleInChain(static_cast<const reco::GenParticle*>(&*td));
489  for (reco::GenParticle::const_iterator wd = decaying_W->begin(); wd != decaying_W->end(); ++wd) {
490  if (!(std::abs(wd->pdgId()) == TopDecayID::WID)) {
491  std::unique_ptr<reco::GenParticle> qPtr(
492  new reco::GenParticle(wd->threeCharge(), wd->p4(), wd->vertex(), wd->pdgId(), wd->status(), false));
493  target.push_back(*qPtr);
494  // increment & push index of the top daughter
495  wDaughters.push_back(++motherPartIdx_);
496  const reco::GenParticle* last_q = findLastParticleInChain(static_cast<const reco::GenParticle*>(&*wd));
498  if (std::abs(wd->pdgId()) == TopDecayID::tauID) {
499  // add tau daughters
500  // currently it adds k-mesons etc as well, which
501  // is not what we want.
503  }
504  }
505  }
506 
507  } else {
508  if (addRadiation_ && (td->pdgId() == TopDecayID::glueID || std::abs(td->pdgId()) < TopDecayID::bID)) {
509  // collect additional radiation from the top
510  std::unique_ptr<reco::GenParticle> radPtr(
511  new reco::GenParticle(td->threeCharge(), td->p4(), td->vertex(), td->pdgId(), td->status(), false));
512  target.push_back(*radPtr);
513  }
514  //other top daughters like Zq for FCNC
515  // for pythia 6 many gluons end up here
516  //std::cout << "other top daughters: to be implemented"
517  // << std::endl;
518  }
519  }
520 
521  // fill the map for the administration
522  // of daughter indices
523  refs_[iTop] = topDaughters;
524  refs_[iW] = wDaughters;
525  }
526 }

References funct::abs(), addDaughters(), addRadiation(), addRadiation_, reco::Candidate::begin(), TopDecayID::bID, reco::Candidate::end(), fillMode_, findLastParticleInChain(), TopDecayID::glueID, kME, motherPartIdx_, refs_, submitPVValidationJobs::t, filterCSVwithJSON::target, TopDecayID::tauID, and TopDecayID::WID.

◆ fillListing() [2/2]

void TopDecaySubset::fillListing ( const std::vector< const reco::GenParticle * > &  tops,
reco::GenParticleCollection target 
)
private

fill output vector for full decay chain

Definition at line 313 of file TopDecaySubset.cc.

314  {
315  unsigned int statusFlag;
316  // determine status flag of the new
317  // particle depending on the FillMode
318  fillMode_ == kME ? statusFlag = 3 : statusFlag = 2;
319 
320  for (std::vector<const reco::GenParticle*>::const_iterator it = tops.begin(); it != tops.end(); ++it) {
321  const reco::GenParticle* t = *it;
322  // if particle is top or anti-top
323  std::unique_ptr<reco::GenParticle> topPtr(
324  new reco::GenParticle(t->threeCharge(), p4(it, statusFlag), t->vertex(), t->pdgId(), statusFlag, false));
325  target.push_back(*topPtr);
326  ++motherPartIdx_;
327  // keep the top index for the map to manage the daughter refs
328  int iTop = motherPartIdx_;
329  std::vector<int> topDaughters;
330  // define the W boson index (to be set later) for the map to
331  // manage the daughter refs
332  int iW = 0;
333  std::vector<int> wDaughters;
334  // sanity check
335  if (showerModel_ != kPythia && t->begin() == t->end())
336  throw edm::Exception(edm::errors::LogicError, "showerModel_!=kPythia && t->begin()==t->end()\n");
337  //iterate over top daughters
338  for (reco::GenParticle::const_iterator td = ((showerModel_ == kPythia) ? t->begin() : t->begin()->begin());
339  td != ((showerModel_ == kPythia) ? t->end() : t->begin()->end());
340  ++td) {
341  if (td->status() == TopDecayID::unfrag && std::abs(td->pdgId()) <= TopDecayID::bID) {
342  // if particle is beauty or other quark
343  std::unique_ptr<reco::GenParticle> bPtr(
344  new reco::GenParticle(td->threeCharge(), p4(td, statusFlag), td->vertex(), td->pdgId(), statusFlag, false));
345  target.push_back(*bPtr);
346  // increment & push index of the top daughter
347  topDaughters.push_back(++motherPartIdx_);
348  if (addRadiation_) {
350  }
351  }
352  // sanity check
353  if (showerModel_ != kPythia && td->begin() == td->end())
354  throw edm::Exception(edm::errors::LogicError, "showerModel_!=kPythia && td->begin()==td->end()\n");
356  if (buffer->status() == TopDecayID::unfrag && std::abs(buffer->pdgId()) == TopDecayID::WID) {
357  // if particle is a W boson
358  std::unique_ptr<reco::GenParticle> wPtr(new reco::GenParticle(
359  buffer->threeCharge(), p4(buffer, statusFlag), buffer->vertex(), buffer->pdgId(), statusFlag, true));
360  target.push_back(*wPtr);
361  // increment & push index of the top daughter
362  topDaughters.push_back(++motherPartIdx_);
363  // keep the W idx for the map
364  iW = motherPartIdx_;
365  if (addRadiation_) {
367  }
368  if (showerModel_ != kPythia && buffer->begin() == buffer->end())
369  throw edm::Exception(edm::errors::LogicError, "showerModel_!=kPythia && buffer->begin()==buffer->end()\n");
370  // iterate over W daughters
372  ((showerModel_ == kPythia) ? buffer->begin() : buffer->begin()->begin());
373  wd != ((showerModel_ == kPythia) ? buffer->end() : buffer->begin()->end());
374  ++wd) {
375  // make sure the W daughter is of status unfrag and not the W itself
376  if (wd->status() == TopDecayID::unfrag && !(std::abs(wd->pdgId()) == TopDecayID::WID)) {
377  std::unique_ptr<reco::GenParticle> qPtr(new reco::GenParticle(
378  wd->threeCharge(), p4(wd, statusFlag), wd->vertex(), wd->pdgId(), statusFlag, false));
379  target.push_back(*qPtr);
380  // increment & push index of the top daughter
381  wDaughters.push_back(++motherPartIdx_);
382  if (wd->status() == TopDecayID::unfrag && std::abs(wd->pdgId()) == TopDecayID::tauID) {
383  // add tau daughters if the particle is a tau pass
384  // the daughter of the tau which is of status 2
385  //addDaughters(motherPartIdx_, wd->begin(), target);
386  // add tau daughters if the particle is a tau pass
387  // the tau itself, which may add a tau daughter of
388  // of status 2 to the listing
390  }
391  }
392  }
393  }
394  if (addRadiation_ && buffer->status() == TopDecayID::stable &&
395  (buffer->pdgId() == TopDecayID::glueID || std::abs(buffer->pdgId()) < TopDecayID::bID)) {
396  // collect additional radiation from the top
397  std::unique_ptr<reco::GenParticle> radPtr(new reco::GenParticle(
398  buffer->threeCharge(), buffer->p4(), buffer->vertex(), buffer->pdgId(), statusFlag, false));
399  target.push_back(*radPtr);
400  // increment & push index of the top daughter
401  topDaughters.push_back(++motherPartIdx_);
402  }
403  }
404  // add potential sisters of the top quark;
405  // only for top to prevent double counting
406  if (t->numberOfMothers() > 0 && t->pdgId() == TopDecayID::tID) {
407  for (reco::GenParticle::const_iterator ts = t->mother()->begin(); ts != t->mother()->end(); ++ts) {
408  // loop over all daughters of the top mother i.e.
409  // the two top quarks and their potential sisters
410  if (std::abs(ts->pdgId()) != t->pdgId() && ts->pdgId() != t->mother()->pdgId()) {
411  // add all further particles but the two top quarks and potential
412  // cases where the mother of the top has itself as daughter
414  new reco::GenParticle(ts->threeCharge(), ts->p4(), ts->vertex(), ts->pdgId(), ts->status(), false);
415  std::unique_ptr<reco::GenParticle> sPtr(cand);
416  target.push_back(*sPtr);
417  if (ts->begin() != ts->end()) {
418  // in case the sister has daughters increment
419  // and add the first generation of daughters
420  addDaughters(++motherPartIdx_, ts->begin(), target, false);
421  }
422  }
423  }
424  }
425  // fill the map for the administration
426  // of daughter indices
427  refs_[iTop] = topDaughters;
428  refs_[iW] = wDaughters;
429  }
430 }

References funct::abs(), addDaughters(), addRadiation(), addRadiation_, TopDecayID::bID, edmScanValgrind::buffer, fillMode_, GenParticle::GenParticle, TopDecayID::glueID, kME, kPythia, edm::errors::LogicError, motherPartIdx_, p4(), refs_, showerModel_, TopDecayID::stable, submitPVValidationJobs::t, filterCSVwithJSON::target, TopDecayID::tauID, TopDecayID::tID, TopDecayID::unfrag, and TopDecayID::WID.

Referenced by produce().

◆ fillReferences()

void TopDecaySubset::fillReferences ( const reco::GenParticleRefProd refProd,
reco::GenParticleCollection target 
)
private

fill references for output vector

Definition at line 668 of file TopDecaySubset.cc.

668  {
669  int idx = 0;
670  for (reco::GenParticleCollection::iterator p = sel.begin(); p != sel.end(); ++p, ++idx) {
671  //find daughter reference vectors in refs_ and add daughters
672  std::map<int, std::vector<int> >::const_iterator daughters = refs_.find(idx);
673  if (daughters != refs_.end()) {
674  for (std::vector<int>::const_iterator daughter = daughters->second.begin(); daughter != daughters->second.end();
675  ++daughter) {
676  reco::GenParticle* part = dynamic_cast<reco::GenParticle*>(&(*p));
677  if (part == nullptr) {
678  throw edm::Exception(edm::errors::InvalidReference, "Not a GenParticle");
679  }
680  part->addDaughter(reco::GenParticleRef(ref, *daughter));
681  sel[*daughter].addMother(reco::GenParticleRef(ref, idx));
682  }
683  }
684  }
685 }

References BPhysicsValidation_cfi::daughters, Exception, heavyIonCSV_trainingSettings::idx, edm::errors::InvalidReference, AlCaHLTBitMon_ParallelJobs::p, refs_, and EgammaValidation_Wenu_cff::sel.

Referenced by produce().

◆ findDecayingTops()

std::vector< const reco::GenParticle * > TopDecaySubset::findDecayingTops ( const reco::GenParticleCollection parts)
private

find decaying top quarks (quarks that decay to qW) for Pythia6 this is identical to findPrimalTops

Definition at line 132 of file TopDecaySubset.cc.

132  {
133  std::vector<const reco::GenParticle*> tops;
134  for (reco::GenParticleCollection::const_iterator t = parts.begin(); t != parts.end(); ++t) {
135  if (std::abs(t->pdgId()) != TopDecayID::tID)
136  continue;
137 
138  bool hasTopDaughter = false;
139  for (unsigned idx = 0; idx < t->numberOfDaughters(); ++idx) {
140  if (std::abs(t->daughter(idx)->pdgId()) == TopDecayID::tID)
141  hasTopDaughter = true;
142  }
143 
144  if (hasTopDaughter) // not a decaying top
145  continue;
146  tops.push_back(&(*t));
147  }
148 
149  return tops;
150 }

References funct::abs(), heavyIonCSV_trainingSettings::idx, contentValuesFiles::parts, submitPVValidationJobs::t, and TopDecayID::tID.

Referenced by produce().

◆ findLastParticleInChain()

const reco::GenParticle * TopDecaySubset::findLastParticleInChain ( const reco::GenParticle p)
private

find W bosons that come from top quark decays and decay themselves (end of the MC chain) for Pythia6 this is identical to findPrimalW find the last particle in a (potentially) long chain of state transitions e.g. top[status==22]-> top[status==44 -> top[status==44] -> top[status==44] -> top[status==62] this function would pick the top with status 62

Definition at line 177 of file TopDecaySubset.cc.

177  {
178  int particleID = std::abs(p->pdgId());
179  bool containsItself = false;
180  unsigned int d_idx = 0;
181  for (unsigned idx = 0; idx < p->numberOfDaughters(); ++idx) {
182  if (std::abs(p->daughter(idx)->pdgId()) == particleID) {
183  containsItself = true;
184  d_idx = idx;
185  }
186  }
187 
188  if (!containsItself)
189  return p;
190  else {
191  if (showerModel_ == kPythia) {
192  // Pythia6 has a weird idea of W bosons (and maybe other particles)
193  // W (status == 3) -> q qbar' W. The new W is status 2 and has no daughters
194  if (p->status() == 3)
195  return p;
196  }
197  return findLastParticleInChain(static_cast<const reco::GenParticle*>(p->daughter(d_idx)));
198  }
199 }

References funct::abs(), heavyIonCSV_trainingSettings::idx, kPythia, AlCaHLTBitMon_ParallelJobs::p, EgammaObjectsElectrons_cfi::particleID, and showerModel_.

Referenced by fillListing().

◆ findPrimalTops()

std::vector< const reco::GenParticle * > TopDecaySubset::findPrimalTops ( const reco::GenParticleCollection parts)
private

find primal top quarks (top quarks from the hard interaction) for Pythia6 this is identical to findDecayingTops

Definition at line 110 of file TopDecaySubset.cc.

110  {
111  std::vector<const reco::GenParticle*> tops;
112  for (reco::GenParticleCollection::const_iterator t = parts.begin(); t != parts.end(); ++t) {
113  if (std::abs(t->pdgId()) != TopDecayID::tID)
114  continue;
115 
116  bool hasTopMother = false;
117  for (unsigned idx = 0; idx < t->numberOfMothers(); ++idx) {
118  if (std::abs(t->mother(idx)->pdgId()) == TopDecayID::tID)
119  hasTopMother = true;
120  }
121 
122  if (hasTopMother) // not a primal top
123  continue;
124  tops.push_back(&(*t));
125  }
126 
127  return tops;
128 }

References funct::abs(), heavyIonCSV_trainingSettings::idx, contentValuesFiles::parts, submitPVValidationJobs::t, and TopDecayID::tID.

Referenced by produce().

◆ findPrimalW()

const reco::GenParticle * TopDecaySubset::findPrimalW ( const reco::GenParticle top)
private

find W bosons that come from top quark decays for Pythia6 this is identical to findDecayingW

Definition at line 154 of file TopDecaySubset.cc.

154  {
155  unsigned int w_index = 0;
156  for (unsigned idx = 0; idx < top->numberOfDaughters(); ++idx) {
157  if (std::abs(top->daughter(idx)->pdgId()) == TopDecayID::WID) {
158  w_index = idx;
159  break;
160  }
161  }
162  return static_cast<const reco::GenParticle*>(top->daughter(w_index));
163 }

References funct::abs(), reco::CompositeRefCandidateT< D >::daughter(), heavyIonCSV_trainingSettings::idx, reco::CompositeRefCandidateT< D >::numberOfDaughters(), reco::Candidate::pdgId(), and TopDecayID::WID.

◆ findTops()

std::vector< const reco::GenParticle * > TopDecaySubset::findTops ( const reco::GenParticleCollection parts)
private

find top quarks in list of input particles

Definition at line 99 of file TopDecaySubset.cc.

99  {
100  std::vector<const reco::GenParticle*> tops;
101  for (reco::GenParticleCollection::const_iterator t = parts.begin(); t != parts.end(); ++t) {
102  if (std::abs(t->pdgId()) == TopDecayID::tID && t->status() == TopDecayID::unfrag)
103  tops.push_back(&(*t));
104  }
105  return tops;
106 }

References funct::abs(), contentValuesFiles::parts, submitPVValidationJobs::t, TopDecayID::tID, and TopDecayID::unfrag.

Referenced by produce().

◆ p4() [1/2]

reco::Particle::LorentzVector TopDecaySubset::p4 ( const reco::GenParticle::const_iterator  part,
int  statusFlag 
)
private

calculate lorentz vector from input

calculate lorentz vector from input (dedicated to top reconstruction)

Definition at line 567 of file TopDecaySubset.cc.

567  {
568  // calculate the four vector for all top daughters from
569  // their daughters including additional radiation
570  if (statusFlag == TopDecayID::unfrag) {
571  // return 4 momentum as it is
572  return part->p4();
573  }
575  for (reco::GenParticle::const_iterator p = part->begin(); p != part->end(); ++p) {
576  if (p->status() <= TopDecayID::stable && std::abs(p->pdgId()) == TopDecayID::WID) {
577  vec = p->p4();
578  } else {
579  if (p->status() <= TopDecayID::stable) {
580  // sum up the p4 of all stable particles
581  // (of status 1 or 2)
582  vec += p->p4();
583  } else {
584  if (p->status() == TopDecayID::unfrag) {
585  // if the particle is unfragmented (i.e.
586  // status 3) descend by one level
587  vec += p4(p, statusFlag);
588  }
589  }
590  }
591  }
592  return vec;
593 }

References funct::abs(), AlCaHLTBitMon_ParallelJobs::p, p4(), TopDecayID::stable, TopDecayID::unfrag, and TopDecayID::WID.

Referenced by Tau.Tau::dxy_approx(), Tau.Tau::dz(), and Lepton.Lepton::p4WithFSR().

◆ p4() [2/2]

reco::Particle::LorentzVector TopDecaySubset::p4 ( const std::vector< const reco::GenParticle * >::const_iterator  top,
int  statusFlag 
)
private

calculate lorentz vector from input (dedicated to top reconstruction)

calculate lorentz vector from input

Definition at line 529 of file TopDecaySubset.cc.

530  {
531  // calculate the four vector for top/anti-top quarks from
532  // the W boson and the b quark plain or including all
533  // additional radiation depending on switch 'plain'
534  if (statusFlag == TopDecayID::unfrag) {
535  // return 4 momentum as it is
536  return (*top)->p4();
537  }
539  for (reco::GenParticle::const_iterator p = (*top)->begin(); p != (*top)->end(); ++p) {
540  if (p->status() == TopDecayID::unfrag) {
541  // descend by one level for each
542  // status 3 particle on the way
543  vec += p4(p, statusFlag);
544  } else {
545  if (std::abs((*top)->pdgId()) == TopDecayID::WID) {
546  // in case of a W boson skip the status
547  // 2 particle to prevent double counting
548  if (std::abs(p->pdgId()) != TopDecayID::WID)
549  vec += p->p4();
550  } else {
551  // add all four vectors for each stable
552  // particle (status 1 or 2) on the way
553  vec += p->p4();
554  if (vec.mass() - (*top)->mass() > 0) {
555  // continue adding up gluons and qqbar pairs on the top
556  // line untill the nominal top mass is reached; then
557  // break in order to prevent picking up virtualities
558  break;
559  }
560  }
561  }
562  }
563  return vec;
564 }

References funct::abs(), AlCaHLTBitMon_ParallelJobs::p, TopDecayID::unfrag, and TopDecayID::WID.

Referenced by Tau.Tau::dxy_approx(), Tau.Tau::dz(), fillListing(), p4(), and Lepton.Lepton::p4WithFSR().

◆ produce()

void TopDecaySubset::produce ( edm::Event event,
const edm::EventSetup setup 
)
overridevirtual

write output into the event

Implements edm::EDProducer.

Definition at line 44 of file TopDecaySubset.cc.

44  {
45  // create target vector
46  std::unique_ptr<reco::GenParticleCollection> target(new reco::GenParticleCollection);
47 
48  // get source collection
50  event.getByToken(srcToken_, src);
51 
52  // find out what generator we are dealing with
53  if (showerModel_ == kStart && runMode_ == kRun2) {
55  }
56 
57  // find top quarks in list of input particles
58  std::vector<const reco::GenParticle*> tops;
59  if (runMode_ == kRun1)
60  tops = findTops(*src);
61  else
62  tops = findPrimalTops(*src);
63 
64  // determine shower model (only in first event)
65  if (showerModel_ == kStart && runMode_ == kRun1)
67 
68  if (showerModel_ != kNone) {
69  // check sanity of W bosons
70  if (runMode_ == kRun1)
71  checkWBosons(tops);
72  else {
73  // nothing for the moment
74  }
75 
76  // get ref product from the event
77  const reco::GenParticleRefProd ref = event.getRefBeforePut<reco::GenParticleCollection>();
78  // clear existing refs
80  if (runMode_ == kRun1) {
81  // fill output
82  fillListing(tops, *target);
83  // fill references
84  fillReferences(ref, *target);
85  } else {
86  std::vector<const reco::GenParticle*> decaying_tops = findDecayingTops(*src);
87  // fill output
88  fillListing(tops, decaying_tops, *target);
89  // fill references
90  fillReferences(ref, *target);
91  }
92  }
93 
94  // write vectors to the event
95  event.put(std::move(target));
96 }

References checkShowerModel(), checkWBosons(), clearReferences(), fillListing(), fillReferences(), findDecayingTops(), findPrimalTops(), findTops(), kNone, kRun1, kRun2, kStart, eostools::move(), runMode_, showerModel_, TrackRefitter_38T_cff::src, srcToken_, and filterCSVwithJSON::target.

Member Data Documentation

◆ addRadiation_

bool TopDecaySubset::addRadiation_
private

add radiation or not?

Definition at line 100 of file TopDecaySubset.h.

Referenced by fillListing().

◆ fillMode_

FillMode TopDecaySubset::fillMode_
private

print the whole list of input particles or not? mode of decaySubset creation

Definition at line 103 of file TopDecaySubset.h.

Referenced by fillListing(), and TopDecaySubset().

◆ genEventInfo_srcToken_

edm::EDGetTokenT<GenEventInfoProduct> TopDecaySubset::genEventInfo_srcToken_
private

input tag for the genEventInfo source

Definition at line 98 of file TopDecaySubset.h.

Referenced by checkShowerModel().

◆ motherPartIdx_

int TopDecaySubset::motherPartIdx_
private

index in new evt listing of parts with daughters; has to be set to -1 in produce to deliver consistent results!

Definition at line 112 of file TopDecaySubset.h.

Referenced by clearReferences(), and fillListing().

◆ refs_

std::map<int, std::vector<int> > TopDecaySubset::refs_
private

management of daughter indices for fillRefs

Definition at line 114 of file TopDecaySubset.h.

Referenced by addDaughters(), addRadiation(), clearReferences(), fillListing(), and fillReferences().

◆ runMode_

RunMode TopDecaySubset::runMode_
private

run mode (Run1 || Run2)

Definition at line 107 of file TopDecaySubset.h.

Referenced by produce(), and TopDecaySubset().

◆ showerModel_

ShowerModel TopDecaySubset::showerModel_
private

parton shower mode (filled in checkShowerModel)

Definition at line 105 of file TopDecaySubset.h.

Referenced by checkWBosons(), fillListing(), findLastParticleInChain(), and produce().

◆ srcToken_

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

input tag for the genParticle source

Definition at line 96 of file TopDecaySubset.h.

Referenced by produce().

edm::RefProd< GenParticleCollection >
TopDecaySubset::kStable
Definition: TopDecaySubset.h:32
reco::CompositeRefCandidateT::numberOfDaughters
size_t numberOfDaughters() const override
number of daughters
TopDecaySubset::findLastParticleInChain
const reco::GenParticle * findLastParticleInChain(const reco::GenParticle *p)
Definition: TopDecaySubset.cc:177
edm::errors::InvalidReference
Definition: EDMException.h:39
TopDecaySubset::fillMode_
FillMode fillMode_
Definition: TopDecaySubset.h:103
edm::errors::LogicError
Definition: EDMException.h:37
reco::GenParticle
Definition: GenParticle.h:21
TopDecaySubset::findTops
std::vector< const reco::GenParticle * > findTops(const reco::GenParticleCollection &parts)
find top quarks in list of input particles
Definition: TopDecaySubset.cc:99
TopDecayID::bID
static const int bID
Definition: TopGenEvent.h:13
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
reco::GenParticleCollection
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
Definition: GenParticleFwd.h:13
edm::moduleName
std::string moduleName(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:27
reco::candidate::const_iterator
Definition: const_iterator.h:14
TopDecaySubset::p4
reco::Particle::LorentzVector p4(const std::vector< const reco::GenParticle * >::const_iterator top, int statusFlag)
calculate lorentz vector from input (dedicated to top reconstruction)
Definition: TopDecaySubset.cc:529
TopDecaySubset::genEventInfo_srcToken_
edm::EDGetTokenT< GenEventInfoProduct > genEventInfo_srcToken_
input tag for the genEventInfo source
Definition: TopDecaySubset.h:98
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
TopDecaySubset::addDaughters
void addDaughters(int &idx, const reco::GenParticle::const_iterator part, reco::GenParticleCollection &target, bool recursive=true)
recursively fill vector for all further decay particles of a given particle
Definition: TopDecaySubset.cc:636
edm::Handle
Definition: AssociativeIterator.h:50
reco::Particle::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
edm::Ref< GenParticleCollection >
TopDecaySubset::kRun1
Definition: TopDecaySubset.h:36
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
edm::Exception
Definition: EDMException.h:77
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
edm::parameterSet
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
TopDecaySubset::showerModel_
ShowerModel showerModel_
parton shower mode (filled in checkShowerModel)
Definition: TopDecaySubset.h:105
TopDecayID::glueID
static const int glueID
Definition: TopGenEvent.h:14
TopDecaySubset::kNone
Definition: TopDecaySubset.h:34
TopDecaySubset::findPrimalTops
std::vector< const reco::GenParticle * > findPrimalTops(const reco::GenParticleCollection &parts)
Definition: TopDecaySubset.cc:110
contentValuesFiles.parts
parts
Definition: contentValuesFiles.py:58
TopDecaySubset::kPythia
Definition: TopDecaySubset.h:34
part
part
Definition: HCALResponse.h:20
TopDecaySubset::srcToken_
edm::EDGetTokenT< reco::GenParticleCollection > srcToken_
input tag for the genParticle source
Definition: TopDecaySubset.h:96
EgammaObjectsElectrons_cfi.particleID
particleID
Definition: EgammaObjectsElectrons_cfi.py:4
BPhysicsValidation_cfi.daughters
daughters
Definition: BPhysicsValidation_cfi.py:11
TopDecaySubset::kME
Definition: TopDecaySubset.h:32
TopDecayID::tID
static const int tID
Definition: TopGenEvent.h:12
TopDecaySubset::ShowerModel
ShowerModel
classification of potential shower types
Definition: TopDecaySubset.h:34
TopDecaySubset::checkShowerModel
ShowerModel checkShowerModel(const std::vector< const reco::GenParticle * > &tops) const
check the decay chain for the used shower model
Definition: TopDecaySubset.cc:202
TopDecaySubset::clearReferences
void clearReferences()
clear references
Definition: TopDecaySubset.cc:659
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
reco::Candidate::end
const_iterator end() const
last daughter const_iterator
Definition: Candidate.h:145
edm::StableProvenance
Definition: StableProvenance.h:30
reco::LeafCandidate::pdgId
int pdgId() const final
PDG identifier.
Definition: LeafCandidate.h:176
cand
Definition: decayParser.h:32
TopDecaySubset::kStart
Definition: TopDecaySubset.h:34
EcalCalibMonitorClient_cfi.moduleName
moduleName
Definition: EcalCalibMonitorClient_cfi.py:17
TopDecaySubset::findDecayingTops
std::vector< const reco::GenParticle * > findDecayingTops(const reco::GenParticleCollection &parts)
Definition: TopDecaySubset.cc:132
reco::Candidate::pdgId
virtual int pdgId() const =0
PDG identifier.
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TopDecaySubset::addRadiation_
bool addRadiation_
add radiation or not?
Definition: TopDecaySubset.h:100
TopDecaySubset::fillReferences
void fillReferences(const reco::GenParticleRefProd &refProd, reco::GenParticleCollection &target)
fill references for output vector
Definition: TopDecaySubset.cc:668
looper.cfg
cfg
Definition: looper.py:296
TopDecayID::WID
static const int WID
Definition: TopGenEvent.h:17
TopDecayID::tauID
static const int tauID
Definition: TopGenEvent.h:20
GenParticle.GenParticle
GenParticle
Definition: GenParticle.py:18
eostools.move
def move(src, dest)
Definition: eostools.py:511
TopDecaySubset::refs_
std::map< int, std::vector< int > > refs_
management of daughter indices for fillRefs
Definition: TopDecaySubset.h:114
Exception
Definition: hltDiff.cc:245
TopDecaySubset::runMode_
RunMode runMode_
run mode (Run1 || Run2)
Definition: TopDecaySubset.h:107
TopDecaySubset::kHerwig
Definition: TopDecaySubset.h:34
reco::CompositeRefCandidateT::daughter
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode)
TopDecayID::stable
static const int stable
Definition: TopGenEvent.h:10
TopDecayID::unfrag
static const int unfrag
Definition: TopGenEvent.h:11
filterCSVwithJSON.target
target
Definition: filterCSVwithJSON.py:32
postprocess-scan-build.recursive
recursive
Definition: postprocess-scan-build.py:11
TopDecaySubset::kPythia8
Definition: TopDecaySubset.h:34
TopDecaySubset::kRun2
Definition: TopDecaySubset.h:36
TopDecaySubset::checkWBosons
void checkWBosons(std::vector< const reco::GenParticle * > &tops) const
check whether W bosons are contained in the original gen particle listing
Definition: TopDecaySubset.cc:274
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TopDecaySubset::kSherpa
Definition: TopDecaySubset.h:34
EgammaValidation_Wenu_cff.sel
sel
Definition: EgammaValidation_Wenu_cff.py:33
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
event
Definition: event.py:1
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
edm::Log
Definition: MessageLogger.h:70
TopDecaySubset::motherPartIdx_
int motherPartIdx_
Definition: TopDecaySubset.h:112
reco::Candidate::begin
const_iterator begin() const
first daughter const_iterator
Definition: Candidate.h:143
edm::HandleBase::id
ProductID id() const
Definition: HandleBase.cc:29
TopDecaySubset::addRadiation
void addRadiation(int &idx, const reco::GenParticle::const_iterator part, reco::GenParticleCollection &target)
fill vector including all radiations from quarks originating from W/top
Definition: TopDecaySubset.cc:596
edm::InputTag
Definition: InputTag.h:15
TopDecaySubset::fillListing
void fillListing(const std::vector< const reco::GenParticle * > &tops, reco::GenParticleCollection &target)
fill output vector for full decay chain
Definition: TopDecaySubset.cc:313