CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
PFTauSecondaryVertexProducer Class Reference
Inheritance diagram for PFTauSecondaryVertexProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

enum  Alg { useInputPV =0, usePVwithMaxSumPt, useTauPV }
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

 PFTauSecondaryVertexProducer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~PFTauSecondaryVertexProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::InputTag PFTauTag_
 
edm::EDGetTokenT< std::vector
< reco::PFTau > > 
PFTauToken_
 

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)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 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 50 of file PFTauSecondaryVertexProducer.cc.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Definition at line 62 of file PFTauSecondaryVertexProducer.cc.

62  :
63  PFTauToken_(consumes<std::vector<reco::PFTau> >(iConfig.getParameter<edm::InputTag>("PFTauTag")))
64 {
65  produces<edm::AssociationVector<PFTauRefProd, std::vector<std::vector<reco::VertexRef> > > >();
66  produces<VertexCollection>("PFTauSecondaryVertices");
67 }
T getParameter(std::string const &) const
edm::EDGetTokenT< std::vector< reco::PFTau > > PFTauToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
PFTauSecondaryVertexProducer::~PFTauSecondaryVertexProducer ( )

Definition at line 69 of file PFTauSecondaryVertexProducer.cc.

69  {
70 
71 }

Member Function Documentation

void PFTauSecondaryVertexProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 73 of file PFTauSecondaryVertexProducer.cc.

References edm::EventSetup::get(), edm::Event::getByToken(), edm::Event::getRefBeforePut(), TransientVertex::hasRefittedTracks(), edm::HandleBase::isValid(), getDQMSummary::iter, PFTauToken_, edm::Event::put(), TransientVertex::refittedTracks(), and KalmanVertexFitter::vertex().

73  {
74  // Obtain
75  edm::ESHandle<TransientTrackBuilder> transTrackBuilder;
76  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",transTrackBuilder);
77 
79  iEvent.getByToken(PFTauToken_,Tau);
80 
81  // Set Association Map
82  auto_ptr<edm::AssociationVector<PFTauRefProd, std::vector<std::vector<reco::VertexRef> > > > AVPFTauSV(new edm::AssociationVector<PFTauRefProd, std::vector<std::vector<reco::VertexRef> > >(PFTauRefProd(Tau)));
83  std::auto_ptr<VertexCollection> VertexCollection_out= std::auto_ptr<VertexCollection>(new VertexCollection);
84  reco::VertexRefProd VertexRefProd_out = iEvent.getRefBeforePut<reco::VertexCollection>("PFTauSecondaryVertices");
85 
86  // For each Tau Run Algorithim
87  if(Tau.isValid()) {
88  for(reco::PFTauCollection::size_type iPFTau = 0; iPFTau < Tau->size(); iPFTau++) {
89  reco::PFTauRef RefPFTau(Tau, iPFTau);
90  std::vector<reco::VertexRef> SV;
91  if(RefPFTau->decayMode()>=5){
93  // Get tracks form PFTau daugthers
94  std::vector<reco::TransientTrack> transTrk;
95  TransientVertex transVtx;
96  const std::vector<edm::Ptr<reco::PFCandidate> > cands = RefPFTau->signalPFChargedHadrCands();
97  for (std::vector<edm::Ptr<reco::PFCandidate> >::const_iterator iter = cands.begin(); iter!=cands.end(); ++iter) {
98  if(iter->get()->trackRef().isNonnull())transTrk.push_back(transTrackBuilder->build(iter->get()->trackRef()));
99  else if(iter->get()->gsfTrackRef().isNonnull())transTrk.push_back(transTrackBuilder->build(iter->get()->gsfTrackRef()));
100  }
102  // Fit the secondary vertex
103  bool FitOk(true);
104  KalmanVertexFitter kvf(true);
105  try{
106  transVtx = kvf.vertex(transTrk); //KalmanVertexFitter
107  }catch(...){
108  FitOk=false;
109  }
110  if(!transVtx.hasRefittedTracks()) FitOk=false;
111  if(transVtx.refittedTracks().size()!=transTrk.size()) FitOk=false;
112  if(FitOk){
113  SV.push_back(reco::VertexRef(VertexRefProd_out, VertexCollection_out->size()));
114  VertexCollection_out->push_back(transVtx);
115  }
116  }
117  AVPFTauSV->setValue(iPFTau, SV);
118  }
119  }
120  iEvent.put(VertexCollection_out,"PFTauSecondaryVertices");
121  iEvent.put(AVPFTauSV);
122 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
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
edm::EDGetTokenT< std::vector< reco::PFTau > > PFTauToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
bool isValid() const
Definition: HandleBase.h:75
RefProd< PROD > getRefBeforePut()
Definition: Event.h:133
const T & get() const
Definition: EventSetup.h:55
std::vector< reco::TransientTrack > const & refittedTracks() const

Member Data Documentation

edm::InputTag PFTauSecondaryVertexProducer::PFTauTag_
private

Definition at line 58 of file PFTauSecondaryVertexProducer.cc.

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

Definition at line 59 of file PFTauSecondaryVertexProducer.cc.

Referenced by produce().