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
 
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::vector< ModuleDescription const * > &modules, 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
 
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 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>
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 631 of file TopDecaySubset.cc.

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

References BPhysicsValidation_cfi::daughters, charmTagsComputerCvsB_cfi::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 612 of file TopDecaySubset.cc.

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

References BPhysicsValidation_cfi::daughters, charmTagsComputerCvsB_cfi::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 591 of file TopDecaySubset.cc.

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

References BPhysicsValidation_cfi::daughters, charmTagsComputerCvsB_cfi::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::Provenance& prov = event.getProvenance(genEvtInfoProduct.id());
249  moduleName = edm::moduleName(prov, event.processHistory());
250  }
251 
252  ShowerModel shower(kStart);
253  if (moduleName.find("Pythia6") != std::string::npos)
254  shower = kPythia;
255  else if (moduleName.find("Pythia8") != std::string::npos)
256  shower = kPythia8;
257  else if (moduleName.find("Herwig6") != std::string::npos)
258  shower = kHerwig;
259  else if (moduleName.find("ThePEG") != std::string::npos)
260  // Herwig++
261  shower = kHerwig;
262  else if (moduleName.find("Sherpa") != std::string::npos)
263  shower = kSherpa;
264  else
265  shower = kNone;
266  return shower;
267 }

References genEventInfo_srcToken_, edm::HandleBase::id(), edm::HandleBase::isValid(), kHerwig, kNone, kPythia, kPythia8, kSherpa, kStart, EcalCalibMonitorClient_cfi::moduleName, edm::moduleName(), 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 269 of file TopDecaySubset.cc.

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

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 654 of file TopDecaySubset.cc.

654  {
655  // clear vector of references
656  refs_.clear();
657  // set idx for mother particles to a start value
658  // of -1 (the first entry will raise it to 0)
659  motherPartIdx_ = -1;
660 }

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 427 of file TopDecaySubset.cc.

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

References funct::abs(), addDaughters(), addRadiation(), addRadiation_, reco::Candidate::begin(), TopDecayID::bID, reco::Candidate::end(), fillMode_, findLastParticleInChain(), TopDecayID::glueID, kME, motherPartIdx_, refs_, OrderedSet::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 308 of file TopDecaySubset.cc.

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

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, OrderedSet::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 663 of file TopDecaySubset.cc.

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

References BPhysicsValidation_cfi::daughters, Exception, charmTagsComputerCvsB_cfi::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(), charmTagsComputerCvsB_cfi::idx, contentValuesFiles::parts, OrderedSet::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(), charmTagsComputerCvsB_cfi::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(), charmTagsComputerCvsB_cfi::idx, contentValuesFiles::parts, OrderedSet::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(), charmTagsComputerCvsB_cfi::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, OrderedSet::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 562 of file TopDecaySubset.cc.

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

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 524 of file TopDecaySubset.cc.

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

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
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
TopDecayID::bID
static const int bID
Definition: TopGenEvent.h:13
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
edm::LogInfo
Definition: MessageLogger.h:254
reco::GenParticleCollection
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
Definition: GenParticleFwd.h:13
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:524
TopDecaySubset::genEventInfo_srcToken_
edm::EDGetTokenT< GenEventInfoProduct > genEventInfo_srcToken_
input tag for the genEventInfo source
Definition: TopDecaySubset.h:98
charmTagsComputerCvsB_cfi.idx
idx
Definition: charmTagsComputerCvsB_cfi.py:108
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:631
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
edm::Exception
Definition: EDMException.h:77
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
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
OrderedSet.t
t
Definition: OrderedSet.py:90
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
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TopDecaySubset::clearReferences
void clearReferences()
clear references
Definition: TopDecaySubset.cc:654
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
reco::LeafCandidate::pdgId
int pdgId() const final
PDG identifier.
Definition: LeafCandidate.h:176
cand
Definition: decayParser.h:34
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.
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:663
looper.cfg
cfg
Definition: looper.py:297
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:246
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:10
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:269
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::moduleName
std::string moduleName(Provenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:27
edm::Provenance
Definition: Provenance.h:34
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
event
Definition: event.py:1
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:13
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:591
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:308