CMS 3D CMS Logo

VertexProducer.cc
Go to the documentation of this file.
15 
16 using namespace l1tVertexFinder;
17 using namespace std;
18 
20  : l1TracksToken_(consumes<TTTrackCollectionView>(iConfig.getParameter<edm::InputTag>("l1TracksInputTag"))),
21  trackerTopologyToken_(esConsumes<TrackerTopology, TrackerTopologyRcd>()),
22  outputCollectionName_(iConfig.getParameter<std::string>("l1VertexCollectionName")),
23  settings_(AlgoSettings(iConfig)) {
24  // Get configuration parameters
25 
26  switch (settings_.vx_algo()) {
27  case Algorithm::FastHisto:
28  edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using the FastHisto binning algorithm";
29  break;
30  case Algorithm::FastHistoLooseAssociation:
31  edm::LogInfo("VertexProducer")
32  << "VertexProducer::Finding vertices using the FastHistoLooseAssociation binning algorithm";
33  break;
34  case Algorithm::GapClustering:
35  edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using a gap clustering algorithm";
36  break;
37  case Algorithm::AgglomerativeHierarchical:
38  edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using a Simple Merge Clustering algorithm";
39  break;
40  case Algorithm::DBSCAN:
41  edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using a DBSCAN algorithm";
42  break;
43  case Algorithm::PVR:
44  edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using a PVR algorithm";
45  break;
46  case Algorithm::AdaptiveVertexReconstruction:
47  edm::LogInfo("VertexProducer")
48  << "VertexProducer::Finding vertices using an AdaptiveVertexReconstruction algorithm";
49  break;
50  case Algorithm::HPV:
51  edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using a Highest Pt Vertex algorithm";
52  break;
53  case Algorithm::Kmeans:
54  edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using a kmeans algorithm";
55  break;
56  }
57 
58  //--- Define EDM output to be written to file (if required)
59  produces<l1t::VertexCollection>(outputCollectionName_);
60 }
61 
64  iEvent.getByToken(l1TracksToken_, l1TracksHandle);
65 
66  std::vector<l1tVertexFinder::L1Track> l1Tracks;
67  l1Tracks.reserve(l1TracksHandle->size());
68  for (const auto& track : l1TracksHandle->ptrs()) {
69  auto l1track = L1Track(track);
70  // Check the minimum pT of the tracks
71  // This is left here because it represents the smallest pT to be sent by the track finding boards
72  // This has less to do with the algorithms than the constraints of what will be sent to the vertexing algorithm
73  if (l1track.pt() > settings_.vx_TrackMinPt()) {
74  l1Tracks.push_back(l1track);
75  }
76  }
77 
78  VertexFinder vf(l1Tracks, settings_);
79 
80  switch (settings_.vx_algo()) {
81  case Algorithm::FastHisto: {
82  edm::ESHandle<TrackerTopology> tTopoHandle = iSetup.getHandle(trackerTopologyToken_);
83  vf.fastHisto(tTopoHandle.product());
84  break;
85  }
86  case Algorithm::FastHistoLooseAssociation:
88  break;
89  case Algorithm::GapClustering:
90  vf.GapClustering();
91  break;
92  case Algorithm::AgglomerativeHierarchical:
94  break;
95  case Algorithm::DBSCAN:
96  vf.DBSCAN();
97  break;
98  case Algorithm::PVR:
99  vf.PVR();
100  break;
101  case Algorithm::AdaptiveVertexReconstruction:
103  break;
104  case Algorithm::HPV:
105  vf.HPV();
106  break;
107  case Algorithm::Kmeans:
108  vf.Kmeans();
109  break;
110  }
111 
112  vf.SortVerticesInPt();
113  vf.findPrimaryVertex();
114 
115  // //=== Store output EDM track and hardware stub collections.
116  std::unique_ptr<l1t::VertexCollection> lProduct(new std::vector<l1t::Vertex>());
117 
118  for (const auto& vtx : vf.vertices()) {
119  std::vector<edm::Ptr<l1t::Vertex::Track_t>> lVtxTracks;
120  lVtxTracks.reserve(vtx.tracks().size());
121  for (const auto& t : vtx.tracks())
122  lVtxTracks.push_back(t->getTTTrackPtr());
123  lProduct->emplace_back(l1t::Vertex(vtx.pt(), vtx.z0(), lVtxTracks));
124  }
125  iEvent.put(std::move(lProduct), outputCollectionName_);
126 }
127 
l1tVertexFinder
Definition: AlgoSettings.h:10
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
edm::StreamID
Definition: StreamID.h:30
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
MessageLogger.h
EDProducer.h
l1tVertexFinder::VertexFinder::Kmeans
void Kmeans()
Kmeans Algorithm.
Definition: VertexFinder.cc:396
TTTypes.h
l1t::Vertex
Definition: Vertex.h:15
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackerTopology
Definition: TrackerTopology.h:16
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
l1tVertexFinder::AlgoSettings::vx_algo
Algorithm vx_algo() const
Definition: AlgoSettings.h:31
l1tVertexFinder::VertexFinder::fastHistoLooseAssociation
void fastHistoLooseAssociation()
High pT Vertex Algorithm.
Definition: VertexFinder.cc:462
l1tVertexFinder::VertexFinder::DBSCAN
void DBSCAN()
DBSCAN algorithm.
Definition: VertexFinder.cc:177
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
RecoVertex.h
MakerMacros.h
TrackerTopology.h
l1tVertexFinder::VertexFinder::fastHisto
void fastHisto(const TrackerTopology *tTopo)
Histogramming algorithm.
Definition: VertexFinder.cc:486
TrackerTopologyRcd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
l1tVertexFinder::VertexFinder::PVR
void PVR()
Principal Vertex Reconstructor algorithm.
Definition: VertexFinder.cc:241
l1tVertexFinder::VertexFinder::SortVerticesInPt
void SortVerticesInPt()
Sort vertices in pT.
Definition: VertexFinder.h:90
l1tVertexFinder::VertexFinder::HPV
void HPV()
High pT Vertex Algorithm.
Definition: VertexFinder.cc:371
l1tVertexFinder::VertexFinder::GapClustering
void GapClustering()
Gap Clustering Algorithm.
Definition: VertexFinder.cc:60
VertexProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: VertexProducer.cc:62
edm::ESHandle< TrackerTopology >
L1Track
TTTrack< Ref_Phase2TrackerDigi_ > L1Track
Definition: L1Track.h:8
VertexProducer::settings_
l1tVertexFinder::AlgoSettings settings_
Definition: VertexProducer.h:42
l1tVertexFinder::VertexFinder::vertices
const std::vector< RecoVertex<> > & vertices() const
Returns the z positions of the reconstructed primary vertices.
Definition: VertexFinder.h:63
edm::View
Definition: CaloClusterFwd.h:14
edm::ParameterSet
Definition: ParameterSet.h:47
AlgoSettings.h
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
l1tVertexFinder::AlgoSettings
Definition: AlgoSettings.h:24
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
edm::EventSetup
Definition: EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
l1tVertexFinder::VertexFinder::findPrimaryVertex
void findPrimaryVertex()
Find the primary vertex.
Definition: VertexFinder.cc:440
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:19
VertexProducer.h
VertexProducer_cff.VertexProducer
VertexProducer
Definition: VertexProducer_cff.py:3
VertexFinder.h
EventSetup.h
l1tVertexFinder::VertexFinder
Definition: VertexFinder.h:21
VertexProducer::outputCollectionName_
const std::string outputCollectionName_
Definition: VertexProducer.h:40
l1tVertexFinder::VertexFinder::agglomerativeHierarchicalClustering
void agglomerativeHierarchicalClustering()
Simple Merge Algorithm.
Definition: VertexFinder.cc:124
l1tVertexFinder::VertexFinder::adaptiveVertexReconstruction
void adaptiveVertexReconstruction()
Adaptive Vertex Reconstruction algorithm.
Definition: VertexFinder.cc:306
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
ParameterSet.h
VertexProducer::VertexProducer
VertexProducer(const edm::ParameterSet &)
Definition: VertexProducer.cc:19
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
Vertex.h