CMS 3D CMS Logo

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

Public Types

enum  Alg { useInputPV =0, usePVwithMaxSumPt, useTauPV }
 
- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase 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

 PFTauSecondaryVertexProducer (const edm::ParameterSet &iConfig)
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
 ~PFTauSecondaryVertexProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const 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
 
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)
 
 ~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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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)
 

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 edm::InputTag PFTauTag_
 
const edm::EDGetTokenT< std::vector< reco::PFTau > > PFTauToken_
 

Additional Inherited Members

- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 
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)
 

Detailed Description

Definition at line 54 of file PFTauSecondaryVertexProducer.cc.

Member Enumeration Documentation

Constructor & Destructor Documentation

PFTauSecondaryVertexProducer::PFTauSecondaryVertexProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 68 of file PFTauSecondaryVertexProducer.cc.

68  :
69  PFTauTag_(iConfig.getParameter<edm::InputTag>("PFTauTag")),
70  PFTauToken_(consumes<std::vector<reco::PFTau> >(iConfig.getParameter<edm::InputTag>("PFTauTag")))
71 {
72  produces<edm::AssociationVector<PFTauRefProd, std::vector<std::vector<reco::VertexRef> > > >();
73  produces<VertexCollection>("PFTauSecondaryVertices");
74 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< std::vector< reco::PFTau > > PFTauToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
PFTauSecondaryVertexProducer::~PFTauSecondaryVertexProducer ( )
override

Member Function Documentation

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

Definition at line 149 of file PFTauSecondaryVertexProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and DEFINE_FWK_MODULE.

149  {
150  // PFTauSecondaryVertexProducer
152  desc.add<edm::InputTag>("PFTauTag", edm::InputTag("hpsPFTauProducer"));
153  descriptions.add("PFTauSecondaryVertexProducer", desc);
154 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void PFTauSecondaryVertexProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
override

Definition at line 95 of file PFTauSecondaryVertexProducer.cc.

References TransientTrackBuilder::build(), egammaForCoreTracking_cff::cands, edm::EventSetup::get(), edm::Event::getByToken(), edm::Event::getRefBeforePut(), getTrack(), TransientVertex::hasRefittedTracks(), edm::HandleBase::isValid(), eostools::move(), PFTauToken_, edm::Event::put(), TransientVertex::refittedTracks(), nanoDQM_cff::SV, HiIsolationCommonParameters_cff::track, and KalmanVertexFitter::vertex().

95  {
96  // Obtain
97  edm::ESHandle<TransientTrackBuilder> transTrackBuilder;
98  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",transTrackBuilder);
99 
101  iEvent.getByToken(PFTauToken_,Tau);
102 
103  // Set Association Map
104  auto AVPFTauSV = std::make_unique<edm::AssociationVector<PFTauRefProd, std::vector<std::vector<reco::VertexRef>>>>(PFTauRefProd(Tau));
105  auto VertexCollection_out = std::make_unique<VertexCollection>();
106  reco::VertexRefProd VertexRefProd_out = iEvent.getRefBeforePut<reco::VertexCollection>("PFTauSecondaryVertices");
107 
108  // For each Tau Run Algorithim
109  if(Tau.isValid()) {
110  for(reco::PFTauCollection::size_type iPFTau = 0; iPFTau < Tau->size(); iPFTau++) {
111  reco::PFTauRef RefPFTau(Tau, iPFTau);
112  std::vector<reco::VertexRef> SV;
113  if(RefPFTau->decayMode()>=5){
115  // Get tracks form PFTau daugthers
116  std::vector<reco::TransientTrack> transTrk;
117  TransientVertex transVtx;
118  const std::vector<edm::Ptr<reco::Candidate> > cands = RefPFTau->signalChargedHadrCands();
119  for (const auto& cand : cands) {
120  if (cand.isNull()) continue;
121  const reco::Track* track = getTrack(*cand);
122  if (track != nullptr)
123  transTrk.push_back(transTrackBuilder->build(*track));
124  }
126  // Fit the secondary vertex
127  bool FitOk(true);
128  KalmanVertexFitter kvf(true);
129  if(transTrk.size() > 1) {
130  transVtx = kvf.vertex(transTrk); //KalmanVertexFitter
131  } else {
132  FitOk = false;
133  }
134  if(!transVtx.hasRefittedTracks()) FitOk=false;
135  if(transVtx.refittedTracks().size()!=transTrk.size()) FitOk=false;
136  if(FitOk){
137  SV.push_back(reco::VertexRef(VertexRefProd_out, VertexCollection_out->size()));
138  VertexCollection_out->push_back(transVtx);
139  }
140  }
141  AVPFTauSV->setValue(iPFTau, SV);
142  }
143  }
144  iEvent.put(std::move(VertexCollection_out),"PFTauSecondaryVertices");
145  iEvent.put(std::move(AVPFTauSV));
146 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
const edm::EDGetTokenT< std::vector< reco::PFTau > > PFTauToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
reco::TransientTrack build(const reco::Track *p) const
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
bool hasRefittedTracks() const
edm::RefProd< PFTauCollection > PFTauRefProd
references to PFTau collection
Definition: PFTauFwd.h:15
uint16_t size_type
bool isValid() const
Definition: HandleBase.h:74
RefProd< PROD > getRefBeforePut()
Definition: Event.h:150
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
T get() const
Definition: EventSetup.h:71
std::vector< reco::TransientTrack > const & refittedTracks() const
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

const edm::InputTag PFTauSecondaryVertexProducer::PFTauTag_
private

Definition at line 64 of file PFTauSecondaryVertexProducer.cc.

const edm::EDGetTokenT<std::vector<reco::PFTau> > PFTauSecondaryVertexProducer::PFTauToken_
private

Definition at line 65 of file PFTauSecondaryVertexProducer.cc.

Referenced by produce().