CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
GenVisTauProducer Class Reference
Inheritance diagram for GenVisTauProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 GenVisTauProducer (const edm::ParameterSet &params)
 
void produce (edm::StreamID id, edm::Event &evt, const edm::EventSetup &es) const override
 
 ~GenVisTauProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, 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::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

const GreaterByPt< reco::GenParticlepTComparator_
 
const edm::EDGetTokenT< reco::GenJetCollectionsrc_
 
const edm::EDGetTokenT< reco::GenParticleCollectionsrcGenParticles_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 19 of file GenVisTauProducer.cc.

Constructor & Destructor Documentation

◆ GenVisTauProducer()

GenVisTauProducer::GenVisTauProducer ( const edm::ParameterSet params)
inline

Definition at line 21 of file GenVisTauProducer.cc.

22  : src_(consumes<reco::GenJetCollection>(params.getParameter<edm::InputTag>("src"))),
23  srcGenParticles_(consumes<reco::GenParticleCollection>(params.getParameter<edm::InputTag>("srcGenParticles"))),
24  pTComparator_() {
25  produces<reco::GenParticleCollection>();
26  }
const edm::EDGetTokenT< reco::GenParticleCollection > srcGenParticles_
const edm::EDGetTokenT< reco::GenJetCollection > src_
const GreaterByPt< reco::GenParticle > pTComparator_

◆ ~GenVisTauProducer()

GenVisTauProducer::~GenVisTauProducer ( )
inlineoverride

Definition at line 28 of file GenVisTauProducer.cc.

28 {}

Member Function Documentation

◆ fillDescriptions()

static void GenVisTauProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 91 of file GenVisTauProducer.cc.

References edm::ConfigurationDescriptions::add(), and submitPVResolutionJobs::desc.

91  {
93  desc.add<edm::InputTag>("src")->setComment("collection of visible gen taus (as reco::GenJetCollection)");
94  desc.add<edm::InputTag>("srcGenParticles")->setComment("collections of gen particles");
95  descriptions.add("genVisTaus", desc);
96  }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void GenVisTauProducer::produce ( edm::StreamID  id,
edm::Event evt,
const edm::EventSetup es 
) const
inlineoverridevirtual

Implements edm::global::EDProducerBase.

Definition at line 30 of file GenVisTauProducer.cc.

References funct::abs(), reco::CompositeRefCandidateT< D >::daughterRefVector(), boostedTaus_cff::decayMode, HLTMuonOfflineAnalyzer_cfi::deltaR2, ALPAKA_ACCELERATOR_NAMESPACE::dR2(), MillePedeFileConverter_cfg::e, AJJGenJetFilter_cfi::genParticles, JetMCTagUtils::genTauDecayMode(), taus_cff::genVisTaus, edm::Event::getByToken(), reco::PFTau::kNull, reco::PFTau::kOneProng0PiZero, reco::PFTau::kOneProng1PiZero, reco::PFTau::kOneProng2PiZero, reco::PFTau::kRareDecayMode, reco::PFTau::kThreeProng0PiZero, reco::PFTau::kThreeProng1PiZero, eostools::move(), EgammaValidation_cff::pdgId, reco::LeafCandidate::pdgId(), pTComparator_, edm::Event::put(), jetUpdater_cfi::sort, src_, srcGenParticles_, reco::LeafCandidate::status(), and AlCaHLTBitMon_QueryRunRegistry::string.

30  {
32  evt.getByToken(src_, genTauJets);
33 
36  size_t numGenParticles = genParticles->size();
37 
38  auto genVisTaus = std::make_unique<reco::GenParticleCollection>();
39 
40  for (const auto& genTauJet : *genTauJets) {
41  std::string decayMode_string = JetMCTagUtils::genTauDecayMode(genTauJet);
42  // CV: store hadronic tau decays only
43  if (decayMode_string == "electron" || decayMode_string == "muon")
44  continue;
46  if (decayMode_string == "oneProng0Pi0")
48  else if (decayMode_string == "oneProng1Pi0")
50  else if (decayMode_string == "oneProng2Pi0")
52  else if (decayMode_string == "threeProng0Pi0")
54  else if (decayMode_string == "threeProng1Pi0")
56  else
58 
59  int pdgId = (genTauJet.charge() > 0) ? -15 : +15;
60 
61  // CV: store decayMode in status flag of GenParticle object
62  reco::GenParticle genVisTau(genTauJet.charge(), genTauJet.p4(), genTauJet.vertex(), pdgId, decayMode, true);
63 
64  // CV: find tau lepton "mother" particle
65  for (size_t idxGenParticle = 0; idxGenParticle < numGenParticles; ++idxGenParticle) {
66  const reco::GenParticle& genTau = (*genParticles)[idxGenParticle];
67  if (abs(genTau.pdgId()) == 15 && genTau.status() == 2) {
68  reco::Candidate::LorentzVector daughterVisP4;
69  for (const reco::GenParticleRef& daughter : genTau.daughterRefVector()) {
70  int abs_pdgId = abs(daughter->pdgId());
71  // CV: skip neutrinos
72  if (abs_pdgId == 12 || abs_pdgId == 14 || abs_pdgId == 16)
73  continue;
74  daughterVisP4 += daughter->p4();
75  }
76  double dR2 = deltaR2(daughterVisP4, genVisTau);
77  if (dR2 < 1.e-4) {
78  genVisTau.addMother(reco::GenParticleRef(genParticles, idxGenParticle));
79  break;
80  }
81  }
82  }
83 
84  genVisTaus->push_back(genVisTau);
85  }
86 
87  std::sort(genVisTaus->begin(), genVisTaus->end(), pTComparator_);
88  evt.put(std::move(genVisTaus));
89  }
std::string genTauDecayMode(const reco::CompositePtrCandidate &c)
Definition: JetMCTag.cc:70
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
int status() const final
status word
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:526
const daughters & daughterRefVector() const
references to daughtes
int pdgId() const final
PDG identifier.
ALPAKA_FN_ACC static ALPAKA_FN_INLINE float dR2(Position4 pos1, Position4 pos2)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const edm::EDGetTokenT< reco::GenParticleCollection > srcGenParticles_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
const edm::EDGetTokenT< reco::GenJetCollection > src_
const GreaterByPt< reco::GenParticle > pTComparator_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ pTComparator_

const GreaterByPt<reco::GenParticle> GenVisTauProducer::pTComparator_
private

Definition at line 101 of file GenVisTauProducer.cc.

Referenced by produce().

◆ src_

const edm::EDGetTokenT<reco::GenJetCollection> GenVisTauProducer::src_
private

Definition at line 99 of file GenVisTauProducer.cc.

Referenced by produce().

◆ srcGenParticles_

const edm::EDGetTokenT<reco::GenParticleCollection> GenVisTauProducer::srcGenParticles_
private

Definition at line 100 of file GenVisTauProducer.cc.

Referenced by produce().