57 auto newVertexCollection = std::make_unique<reco::VertexCollection>();
64 if (vertices1->empty())
65 LogError(
"HeavyIonVertexing") <<
"adaptive vertex collection is empty!" << endl;
68 const double maxZError = 3.0;
69 bool hasFinalVertex =
false;
74 if (vertices0->empty())
75 LogInfo(
"HeavyIonVertexing") <<
"final adaptive vertex collection is empty!" << endl;
78 if (vertices0->begin()->zError() < maxZError) {
79 hasFinalVertex =
true;
80 auto const& vertex0 = vertices0->front();
81 newVertexCollection->push_back(vertex0);
82 LogInfo(
"HeavyIonVertexing") <<
"adaptive vertex:\n vz = (" << vertex0.x() <<
", " << vertex0.y() <<
", " 84 <<
"\n error = (" << vertex0.xError() <<
", " << vertex0.yError() <<
", " 85 << vertex0.zError() <<
")" << endl;
90 if (!hasFinalVertex) {
91 if (vertices1->begin()->zError() < maxZError) {
92 reco::VertexCollection::const_iterator vertex1 = vertices1->begin();
93 newVertexCollection->push_back(*vertex1);
95 LogInfo(
"HeavyIonVertexing") <<
"adaptive vertex:\n vz = (" << vertex1->x() <<
", " << vertex1->y() <<
", " 96 << vertex1->z() <<
")" 97 <<
"\n error = (" << vertex1->xError() <<
", " << vertex1->yError() <<
", " 98 << vertex1->zError() <<
")" << endl;
113 LogError(
"HeavyIonVertexing") <<
"no beamspot found " << endl;
115 if (!vertices2->empty()) {
116 reco::VertexCollection::const_iterator vertex2 = vertices2->begin();
120 err(2, 2) =
pow(vertex2->zError(), 2);
122 newVertexCollection->push_back(newVertex);
124 LogInfo(
"HeavyIonVertexing") <<
"median vertex + beamspot: \n position = (" << newVertex.x() <<
", " 125 << newVertex.y() <<
", " << newVertex.z() <<
")" 126 <<
"\n error = (" << newVertex.xError() <<
", " << newVertex.yError() <<
", " 127 << newVertex.zError() <<
")" << endl;
135 newVertexCollection->push_back(newVertex);
137 LogInfo(
"HeavyIonVertexing") <<
"beam spot: \n position = (" << newVertex.x() <<
", " << newVertex.y() <<
", " 138 << newVertex.z() <<
")" 139 <<
"\n error = (" << newVertex.xError() <<
", " << newVertex.yError() <<
", " 140 << newVertex.zError() <<
")" << endl;
bool theUseFinalAdaptiveVertexCollection
T const * product() const
math::Error< dimension >::type Error
covariance error matrix (3x3)
std::vector< Vertex > VertexCollection
collection of Vertex objects
edm::EDGetTokenT< reco::VertexCollection > theAdaptiveVertexCollection
Log< level::Error, false > LogError
edm::EDGetTokenT< reco::BeamSpot > theBeamSpotTag
edm::EDGetTokenT< reco::VertexCollection > theFinalAdaptiveVertexCollection
math::XYZPoint Point
point in the space
Log< level::Info, false > LogInfo
edm::EDGetTokenT< reco::VertexCollection > theMedianVertexCollection