CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
RecoTauPiZeroUnembedder Class Reference
Inheritance diagram for RecoTauPiZeroUnembedder:
edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &evt, const edm::EventSetup &es) override
 
 RecoTauPiZeroUnembedder (const edm::ParameterSet &pset)
 
 ~RecoTauPiZeroUnembedder () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::InputTag src_
 
edm::EDGetTokenT< reco::CandidateViewtoken
 

Additional Inherited Members

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

Detailed Description

Definition at line 29 of file RecoTauPiZeroUnembedder.cc.

Constructor & Destructor Documentation

◆ RecoTauPiZeroUnembedder()

RecoTauPiZeroUnembedder::RecoTauPiZeroUnembedder ( const edm::ParameterSet pset)

Definition at line 41 of file RecoTauPiZeroUnembedder.cc.

References muonDTDigis_cfi::pset, src_, and token.

41  {
42  src_ = pset.getParameter<edm::InputTag>("src");
43  token = consumes<reco::CandidateView>(src_);
44  produces<reco::RecoTauPiZeroCollection>("pizeros");
45  produces<reco::PFTauCollection>();
46 }
edm::EDGetTokenT< reco::CandidateView > token

◆ ~RecoTauPiZeroUnembedder()

RecoTauPiZeroUnembedder::~RecoTauPiZeroUnembedder ( )
inlineoverride

Definition at line 32 of file RecoTauPiZeroUnembedder.cc.

32 {}

Member Function Documentation

◆ fillDescriptions()

void RecoTauPiZeroUnembedder::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 93 of file RecoTauPiZeroUnembedder.cc.

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

93  {
94  // RecoTauPiZeroUnembedder
96  desc.add<edm::InputTag>("src", edm::InputTag("hpsPFTauProducerSansRefs"));
97  descriptions.add("RecoTauPiZeroUnembedder", desc);
98 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void RecoTauPiZeroUnembedder::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 47 of file RecoTauPiZeroUnembedder.cc.

References edm::Event::getByToken(), edm::Event::getRefBeforePut(), reco::PFTau::isolationPiZeroCandidates(), eostools::move(), edm::RefVector< C, T, F >::push_back(), edm::Event::put(), reco::PFTau::setIsolationPiZeroCandidatesRefs(), reco::PFTau::setSignalPiZeroCandidatesRefs(), reco::PFTau::signalPiZeroCandidates(), Tau3MuMonitor_cff::taus, and token.

47  {
48  auto piZerosOut = std::make_unique<reco::RecoTauPiZeroCollection>();
49  auto tausOut = std::make_unique<reco::PFTauCollection>();
50 
52  evt.getByToken(token, tauView);
53 
54  reco::PFTauRefVector taus = reco::tau::castView<reco::PFTauRefVector>(tauView);
55 
56  // Get the reference to the product of where the final pizeros will end up
58 
59  for (size_t iTau = 0; iTau < taus.size(); ++iTau) {
60  // Make a copy
61  reco::PFTau myTau = *taus[iTau];
62  // The ref vectors that will be filled
63  reco::RecoTauPiZeroRefVector signalPiZeroRefs;
64  reco::RecoTauPiZeroRefVector isolationPiZeroRefs;
65 
66  // Copy the PiZeros into the new vector, while updating what refs they will
67  // have
68  const reco::RecoTauPiZeroCollection& signalPiZeros = myTau.signalPiZeroCandidates();
69 
70  for (size_t iPiZero = 0; iPiZero < signalPiZeros.size(); ++iPiZero) {
71  piZerosOut->push_back(signalPiZeros[iPiZero]);
72  // Figure out what the ref for this pizero will be in the new coll.
73  signalPiZeroRefs.push_back(reco::RecoTauPiZeroRef(piZeroProd, piZerosOut->size() - 1));
74  }
75 
76  const reco::RecoTauPiZeroCollection& isolationPiZeroCandidates = myTau.isolationPiZeroCandidates();
77  for (size_t iPiZero = 0; iPiZero < isolationPiZeroCandidates.size(); ++iPiZero) {
78  piZerosOut->push_back(isolationPiZeroCandidates[iPiZero]);
79  // Figure out what the ref for this pizero will be in the new coll.
80  isolationPiZeroRefs.push_back(reco::RecoTauPiZeroRef(piZeroProd, piZerosOut->size() - 1));
81  }
82 
83  myTau.setSignalPiZeroCandidatesRefs(signalPiZeroRefs);
84  myTau.setIsolationPiZeroCandidatesRefs(isolationPiZeroRefs);
85 
86  tausOut->push_back(myTau);
87  }
88 
89  evt.put(std::move(piZerosOut), "pizeros");
90  evt.put(std::move(tausOut));
91 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const std::vector< RecoTauPiZero > & signalPiZeroCandidates() const
Retrieve the association of signal region gamma candidates into candidate PiZeros.
Definition: PFTau.cc:240
std::vector< RecoTauPiZero > RecoTauPiZeroCollection
collection of RecoTauPiZero objects
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:536
RefProd< PROD > getRefBeforePut()
Definition: Event.h:158
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
void setIsolationPiZeroCandidatesRefs(RecoTauPiZeroRefVector)
Definition: PFTau.cc:270
const std::vector< RecoTauPiZero > & isolationPiZeroCandidates() const
Retrieve the association of isolation region gamma candidates into candidate PiZeros.
Definition: PFTau.cc:259
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< reco::CandidateView > token
void setSignalPiZeroCandidatesRefs(RecoTauPiZeroRefVector)
Definition: PFTau.cc:255

Member Data Documentation

◆ src_

edm::InputTag RecoTauPiZeroUnembedder::src_
private

Definition at line 37 of file RecoTauPiZeroUnembedder.cc.

Referenced by RecoTauPiZeroUnembedder().

◆ token

edm::EDGetTokenT<reco::CandidateView> RecoTauPiZeroUnembedder::token
private

Definition at line 38 of file RecoTauPiZeroUnembedder.cc.

Referenced by produce(), and RecoTauPiZeroUnembedder().