23 theAdaptiveVertexCollection(consumes<reco::VertexCollection>(ps.
getParameter<
edm::InputTag>(
"adaptiveVertexCollection"))),
24 theUseFinalAdaptiveVertexCollection(ps.
getParameter<
bool>(
"useFinalAdaptiveVertexCollection"))
26 if(theUseFinalAdaptiveVertexCollection){
27 theFinalAdaptiveVertexCollection = consumes<reco::VertexCollection>(ps.
getParameter<
edm::InputTag>(
"finalAdaptiveVertexCollection"));
29 produces<reco::VertexCollection>();
44 desc.
add<
bool>(
"useFinalAdaptiveVertexCollection",
false);
47 descriptions.
add(
"hiSelectedPixelVertex", desc);
65 auto newVertexCollection = std::make_unique<reco::VertexCollection>();
69 ev.
getByToken(theAdaptiveVertexCollection, vc1);
72 if(vertices1->size()==0)
73 LogError(
"HeavyIonVertexing") <<
"adaptive vertex collection is empty!" << endl;
76 const double maxZError = 3.0;
77 bool hasFinalVertex =
false;
78 if(theUseFinalAdaptiveVertexCollection){
80 ev.
getByToken(theFinalAdaptiveVertexCollection, vc0);
82 if(vertices0->size()==0)
83 LogInfo(
"HeavyIonVertexing") <<
"final adaptive vertex collection is empty!" << endl;
86 if(vertices0->begin()->zError() < maxZError){
87 hasFinalVertex =
true;
88 auto const& vertex0 = vertices0->front();
89 newVertexCollection->push_back(vertex0);
90 LogInfo(
"HeavyIonVertexing") <<
"adaptive vertex:\n vz = (" 91 << vertex0.x() <<
", " << vertex0.y() <<
", " << vertex0.z() <<
")" 93 << vertex0.xError() <<
", " << vertex0.yError() <<
", " 94 << vertex0.zError() <<
")" << endl;
100 if(vertices1->begin()->zError() < maxZError) {
102 reco::VertexCollection::const_iterator vertex1 = vertices1->begin();
103 newVertexCollection->push_back(*vertex1);
105 LogInfo(
"HeavyIonVertexing") <<
"adaptive vertex:\n vz = (" 106 << vertex1->x() <<
", " << vertex1->y() <<
", " << vertex1->z() <<
")" 108 << vertex1->xError() <<
", " << vertex1->yError() <<
", " 109 << vertex1->zError() <<
")" << endl;
114 ev.
getByToken(theMedianVertexCollection, vc2);
120 ev.
getByToken(theBeamSpotTag, beamSpotHandle);
123 beamSpot = *beamSpotHandle;
125 LogError(
"HeavyIonVertexing") <<
"no beamspot found " << endl;
127 if(vertices2->size() > 0) {
129 reco::VertexCollection::const_iterator vertex2 = vertices2->begin();
133 err(2,2)=
pow(vertex2->zError(),2);
136 newVertexCollection->push_back(newVertex);
138 LogInfo(
"HeavyIonVertexing") <<
"median vertex + beamspot: \n position = (" 139 << newVertex.x() <<
", " << newVertex.y() <<
", " << newVertex.z() <<
")" 141 << newVertex.xError() <<
", " << newVertex.yError() <<
", " 142 << newVertex.zError() <<
")" << endl;
152 newVertexCollection->push_back(newVertex);
154 LogInfo(
"HeavyIonVertexing") <<
"beam spot: \n position = (" 155 << newVertex.x() <<
", " << newVertex.y() <<
", " << newVertex.z() <<
")" 157 << newVertex.xError() <<
", " << newVertex.yError() <<
", " 158 << newVertex.zError() <<
")" << endl;
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
math::Error< dimension >::type Error
covariance error matrix (3x3)
std::vector< Vertex > VertexCollection
collection of Vertex objects
virtual void produce(edm::Event &ev, const edm::EventSetup &es) override
math::XYZPoint Point
point in the space
double BeamWidthX() const
beam width X
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
HIBestVertexProducer(const edm::ParameterSet &ps)
T const * product() const
double sigmaZ() const
sigma z
double BeamWidthY() const
beam width Y
void add(std::string const &label, ParameterSetDescription const &psetDescription)
double y0() const
y coordinate
const Point & position() const
position
Power< A, B >::type pow(const A &a, const B &b)
double x0() const
x coordinate