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
TrackVertexArbitrator Class Reference
Inheritance diagram for TrackVertexArbitrator:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &event, const edm::EventSetup &es)
 
 TrackVertexArbitrator (const edm::ParameterSet &params)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
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
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

bool trackFilter (const reco::TrackRef &track) const
 

Private Attributes

edm::InputTag beamSpotCollection
 
edm::InputTag primaryVertexCollection
 
edm::InputTag secondaryVertexCollection
 
TrackVertexArbitrationtheArbitrator
 
edm::InputTag trackCollection
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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 45 of file TrackVertexArbitrator.cc.

Constructor & Destructor Documentation

TrackVertexArbitrator::TrackVertexArbitrator ( const edm::ParameterSet params)

Definition at line 62 of file TrackVertexArbitrator.cc.

References theArbitrator.

62  :
63  primaryVertexCollection (params.getParameter<edm::InputTag>("primaryVertices")),
64  secondaryVertexCollection (params.getParameter<edm::InputTag>("secondaryVertices")),
65  trackCollection (params.getParameter<edm::InputTag>("tracks")),
66  beamSpotCollection (params.getParameter<edm::InputTag>("beamSpot"))
67 {
68  produces<reco::VertexCollection>();
70 }
T getParameter(std::string const &) const
edm::InputTag primaryVertexCollection
edm::InputTag secondaryVertexCollection
TrackVertexArbitration * theArbitrator

Member Function Documentation

void TrackVertexArbitrator::produce ( edm::Event event,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 73 of file TrackVertexArbitrator.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, beamSpotCollection, edm::EventSetup::get(), primaryVertexCollection, edm::RefVector< C, T, F >::push_back(), L1Trigger_dataformats::reco, secondaryVertexCollection, theArbitrator, trackCollection, testEve_cfg::tracks, and TrackVertexArbitration::trackVertexArbitrator().

74 {
75  using namespace reco;
76 
77  edm::Handle<VertexCollection> secondaryVertices;
78  event.getByLabel(secondaryVertexCollection, secondaryVertices);
79  VertexCollection theSecVertexColl = *(secondaryVertices.product());
80 
81  edm::Handle<VertexCollection> primaryVertices;
82  event.getByLabel(primaryVertexCollection, primaryVertices);
83 
84  std::auto_ptr<VertexCollection> recoVertices(new VertexCollection);
85  if(primaryVertices->size()!=0){
86  const reco::Vertex &pv = (*primaryVertices)[0];
87 
89  event.getByLabel(trackCollection, tracks);
90 
92  es.get<TransientTrackRecord>().get("TransientTrackBuilder",
93  trackBuilder);
94 
96  event.getByLabel(beamSpotCollection, beamSpot);
97 
98 
99  edm::RefVector< TrackCollection > selectedTracks;
100  for(TrackCollection::const_iterator track = tracks->begin();
101  track != tracks->end(); ++track) {
102  TrackRef ref(tracks, track - tracks->begin());
103  selectedTracks.push_back(ref);
104 
105  }
106 
107 
108  const edm::RefVector< TrackCollection > tracksForArbitration= selectedTracks;
109  reco::VertexCollection theRecoVertices = theArbitrator->trackVertexArbitrator(beamSpot, pv, trackBuilder, tracksForArbitration,
110  theSecVertexColl);
111 
112  for(unsigned int ivtx=0; ivtx < theRecoVertices.size(); ivtx++){
113  recoVertices->push_back(theRecoVertices[ivtx]);
114  }
115 
116  }
117  event.put(recoVertices);
118 
119 
120 
121 }
reco::VertexCollection trackVertexArbitrator(edm::Handle< reco::BeamSpot > &beamSpot, const reco::Vertex &pv, edm::ESHandle< TransientTrackBuilder > &trackBuilder, const edm::RefVector< reco::TrackCollection > &selectedTracks, reco::VertexCollection &secondaryVertices)
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::InputTag primaryVertexCollection
edm::InputTag secondaryVertexCollection
TrackVertexArbitration * theArbitrator
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:55
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:64
bool TrackVertexArbitrator::trackFilter ( const reco::TrackRef track) const
private

Member Data Documentation

edm::InputTag TrackVertexArbitrator::beamSpotCollection
private

Definition at line 58 of file TrackVertexArbitrator.cc.

Referenced by produce().

edm::InputTag TrackVertexArbitrator::primaryVertexCollection
private

Definition at line 55 of file TrackVertexArbitrator.cc.

Referenced by produce().

edm::InputTag TrackVertexArbitrator::secondaryVertexCollection
private

Definition at line 56 of file TrackVertexArbitrator.cc.

Referenced by produce().

TrackVertexArbitration* TrackVertexArbitrator::theArbitrator
private

Definition at line 59 of file TrackVertexArbitrator.cc.

Referenced by produce(), and TrackVertexArbitrator().

edm::InputTag TrackVertexArbitrator::trackCollection
private

Definition at line 57 of file TrackVertexArbitrator.cc.

Referenced by produce().