CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
OniaVtxReProducer Class Reference

#include <OniaVtxReProducer.h>

Public Member Functions

const edm::InputTaginputBeamSpot () const
 Get the InputTag of the BeamSpot used in the VertexProducer. More...
 
const edm::ParameterSetinputConfig () const
 Get the configuration used in the VertexProducer. More...
 
const edm::InputTaginputTracks () const
 Get the InputTag of the TrackCollection used in the VertexProducer. More...
 
std::vector< TransientVertexmakeVertices (const reco::TrackCollection &tracks, const reco::BeamSpot &bs, const edm::EventSetup &iSetup) const
 Make the vertices. More...
 
 OniaVtxReProducer (const edm::Handle< reco::VertexCollection > &configFromOriginalVertexCollection, const edm::Event &iEvent)
 This is the real constructor to be used. More...
 
 OniaVtxReProducer (const edm::ParameterSet &configByHand)
 This is only for testing. More...
 

Private Member Functions

void configure (const edm::ParameterSet &iConfig)
 

Private Attributes

std::auto_ptr
< PrimaryVertexProducerAlgorithm
algo_
 
edm::InputTag beamSpotTag_
 
edm::ParameterSet config_
 
edm::InputTag tracksTag_
 

Detailed Description

Definition at line 15 of file OniaVtxReProducer.h.

Constructor & Destructor Documentation

OniaVtxReProducer::OniaVtxReProducer ( const edm::Handle< reco::VertexCollection > &  configFromOriginalVertexCollection,
const edm::Event iEvent 
)

This is the real constructor to be used.

Definition at line 10 of file OniaVtxReProducer.cc.

References beamSpotTag_, configure(), Exception, edm::Provenance::friendlyClassName(), edm::Event::getProvenance(), HLT_25ns14e33_v1_cff::InputTag, edm::Provenance::moduleLabel(), edm::moduleName(), edm::parameterSet(), parents, edm::Provenance::parents(), edm::Provenance::processName(), edm::Provenance::productInstanceName(), edm::HandleBase::provenance(), and tracksTag_.

11 {
12  const edm::Provenance *prov = handle.provenance();
13  if (prov == 0) throw cms::Exception("CorruptData") << "Vertex handle doesn't have provenance.";
14 // edm::ParameterSetID psid = prov->psetID();
15 
16 // edm::pset::Registry *psregistry = edm::pset::Registry::instance();
17  edm::ParameterSet psetFromProvenance = edm::parameterSet(*prov);
18 // if (!psregistry->getMapped(psid, psetFromProvenance))
19 // throw cms::Exception("CorruptData") << "Vertex handle parameter set ID id = " << psid;
20 
21  if (edm::moduleName(*prov) != "RecoChargedRefCandidatePrimaryVertexSorter" )
22  //if (edm::moduleName(*prov) != "PrimaryVertexProducer")
23  throw cms::Exception("Configuration") << "Vertices to re-produce don't come from a PrimaryVertexProducer, but from a "
24  << edm::moduleName(*prov) <<".\n";
25 
26  configure(psetFromProvenance);
27 
28  // Now we also dig out the ProcessName used for the reco::Tracks and reco::Vertices
29  std::vector<edm::BranchID> parents = prov->parents();
30  bool foundTracks = false;
31  bool foundBeamSpot = false;
32  for (std::vector<edm::BranchID>::const_iterator it = parents.begin(), ed = parents.end(); it != ed; ++it) {
33  edm::Provenance parprov = iEvent.getProvenance(*it);
34  if (parprov.friendlyClassName() == "recoTracks") {
35  tracksTag_ = edm::InputTag(parprov.moduleLabel(), parprov.productInstanceName(), parprov.processName());
36  foundTracks = true;
37  } else if (parprov.friendlyClassName() == "recoBeamSpot") {
38  beamSpotTag_ = edm::InputTag(parprov.moduleLabel(), parprov.productInstanceName(), parprov.processName());
39  foundBeamSpot = true;
40  }
41  }
42  if (!foundTracks || !foundBeamSpot) {
43  edm::LogWarning("OniaVtxReProducer_MissingParentage") <<
44  "Can't find parentage info for vertex collection inputs: " <<
45  (foundTracks ? "" : "tracks ") << (foundBeamSpot ? "" : "beamSpot") << "\n";
46  }
47 }
TPRegexp parents
Definition: eve_filter.cc:21
std::string const & processName() const
Definition: Provenance.h:61
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
tuple handle
Definition: patZpeak.py:22
void configure(const edm::ParameterSet &iConfig)
std::string const & friendlyClassName() const
Definition: Provenance.h:63
std::vector< BranchID > const & parents() const
Definition: Provenance.h:70
std::string const & moduleLabel() const
Definition: Provenance.h:60
edm::InputTag tracksTag_
edm::InputTag beamSpotTag_
std::string const & productInstanceName() const
Definition: Provenance.h:62
Provenance getProvenance(BranchID const &theID) const
Definition: Event.cc:85
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
OniaVtxReProducer::OniaVtxReProducer ( const edm::ParameterSet configByHand)
inline

This is only for testing.

Definition at line 20 of file OniaVtxReProducer.h.

References configure().

20 { configure(configByHand); }
void configure(const edm::ParameterSet &iConfig)

Member Function Documentation

void OniaVtxReProducer::configure ( const edm::ParameterSet iConfig)
private

Definition at line 50 of file OniaVtxReProducer.cc.

References algo_, beamSpotTag_, config_, edm::ParameterSet::getParameter(), and tracksTag_.

Referenced by OniaVtxReProducer().

51 {
52  config_ = iConfig;
53  tracksTag_ = iConfig.getParameter<edm::InputTag>("TrackLabel");
54  beamSpotTag_ = iConfig.getParameter<edm::InputTag>("beamSpotLabel");
55  algo_.reset(new PrimaryVertexProducerAlgorithm(iConfig));
56 }
T getParameter(std::string const &) const
std::auto_ptr< PrimaryVertexProducerAlgorithm > algo_
edm::ParameterSet config_
edm::InputTag tracksTag_
edm::InputTag beamSpotTag_
const edm::InputTag& OniaVtxReProducer::inputBeamSpot ( ) const
inline

Get the InputTag of the BeamSpot used in the VertexProducer.

Definition at line 32 of file OniaVtxReProducer.h.

References beamSpotTag_.

Referenced by Onia2MuMuPAT::produce().

32 { return beamSpotTag_; }
edm::InputTag beamSpotTag_
const edm::ParameterSet& OniaVtxReProducer::inputConfig ( ) const
inline

Get the configuration used in the VertexProducer.

Definition at line 26 of file OniaVtxReProducer.h.

References config_.

26 { return config_; }
edm::ParameterSet config_
const edm::InputTag& OniaVtxReProducer::inputTracks ( ) const
inline

Get the InputTag of the TrackCollection used in the VertexProducer.

Definition at line 29 of file OniaVtxReProducer.h.

References tracksTag_.

Referenced by Onia2MuMuPAT::produce().

29 { return tracksTag_; }
edm::InputTag tracksTag_
std::vector< TransientVertex > OniaVtxReProducer::makeVertices ( const reco::TrackCollection tracks,
const reco::BeamSpot bs,
const edm::EventSetup iSetup 
) const

Make the vertices.

Definition at line 59 of file OniaVtxReProducer.cc.

References algo_, and edm::EventSetup::get().

Referenced by Onia2MuMuPAT::produce().

62 {
64  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theB);
65 
66  std::vector<reco::TransientTrack> t_tks; t_tks.reserve(tracks.size());
67  for (reco::TrackCollection::const_iterator it = tracks.begin(), ed = tracks.end(); it != ed; ++it) {
68  t_tks.push_back((*theB).build(*it));
69  t_tks.back().setBeamSpot(bs);
70  }
71 
72  return algo_->vertices(t_tks, bs,"KalmanVertexFitter");
73 }
std::auto_ptr< PrimaryVertexProducerAlgorithm > algo_
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:56

Member Data Documentation

std::auto_ptr<PrimaryVertexProducerAlgorithm> OniaVtxReProducer::algo_
private

Definition at line 39 of file OniaVtxReProducer.h.

Referenced by configure(), and makeVertices().

edm::InputTag OniaVtxReProducer::beamSpotTag_
private

Definition at line 38 of file OniaVtxReProducer.h.

Referenced by configure(), inputBeamSpot(), and OniaVtxReProducer().

edm::ParameterSet OniaVtxReProducer::config_
private

Definition at line 36 of file OniaVtxReProducer.h.

Referenced by configure(), and inputConfig().

edm::InputTag OniaVtxReProducer::tracksTag_
private

Definition at line 37 of file OniaVtxReProducer.h.

Referenced by configure(), inputTracks(), and OniaVtxReProducer().