21 theMedianVertexCollection(
23 theAdaptiveVertexCollection(
25 theUseFinalAdaptiveVertexCollection(ps.getParameter<
bool>(
"useFinalAdaptiveVertexCollection")) {
30 produces<reco::VertexCollection>();
42 desc.
add<
bool>(
"useFinalAdaptiveVertexCollection",
false);
45 descriptions.
add(
"hiSelectedPixelVertex", desc);
58 auto newVertexCollection = std::make_unique<reco::VertexCollection>();
65 if (vertices1->empty())
66 LogError(
"HeavyIonVertexing") <<
"adaptive vertex collection is empty!" << endl;
69 const double maxZError = 3.0;
70 bool hasFinalVertex =
false;
75 if (vertices0->empty())
76 LogInfo(
"HeavyIonVertexing") <<
"final adaptive vertex collection is empty!" << endl;
79 if (vertices0->begin()->zError() < maxZError) {
80 hasFinalVertex =
true;
81 auto const& vertex0 = vertices0->front();
82 newVertexCollection->push_back(vertex0);
83 LogInfo(
"HeavyIonVertexing") <<
"adaptive vertex:\n vz = (" << vertex0.x() <<
", " << vertex0.y() <<
", "
85 <<
"\n error = (" << vertex0.xError() <<
", " << vertex0.yError() <<
", "
86 << vertex0.zError() <<
")" << endl;
91 if (!hasFinalVertex) {
92 if (vertices1->begin()->zError() < maxZError) {
93 reco::VertexCollection::const_iterator vertex1 = vertices1->begin();
94 newVertexCollection->push_back(*vertex1);
96 LogInfo(
"HeavyIonVertexing") <<
"adaptive vertex:\n vz = (" << vertex1->x() <<
", " << vertex1->y() <<
", "
97 << vertex1->z() <<
")"
98 <<
"\n error = (" << vertex1->xError() <<
", " << vertex1->yError() <<
", "
99 << vertex1->zError() <<
")" << endl;
114 LogError(
"HeavyIonVertexing") <<
"no beamspot found " << endl;
116 if (!vertices2->empty()) {
117 reco::VertexCollection::const_iterator vertex2 = vertices2->begin();
121 err(2, 2) =
pow(vertex2->zError(), 2);
123 newVertexCollection->push_back(newVertex);
125 LogInfo(
"HeavyIonVertexing") <<
"median vertex + beamspot: \n position = (" << newVertex.x() <<
", "
126 << newVertex.y() <<
", " << newVertex.z() <<
")"
127 <<
"\n error = (" << newVertex.xError() <<
", " << newVertex.yError() <<
", "
128 << newVertex.zError() <<
")" << endl;
136 newVertexCollection->push_back(newVertex);
138 LogInfo(
"HeavyIonVertexing") <<
"beam spot: \n position = (" << newVertex.x() <<
", " << newVertex.y() <<
", "
139 << newVertex.z() <<
")"
140 <<
"\n error = (" << newVertex.xError() <<
", " << newVertex.yError() <<
", "
141 << newVertex.zError() <<
")" << endl;