24 #undef PIXVERTEX_DEBUG_PRODUCE
48 tokenIndToEdm_(consumes<
IndToEdm>(conf.getParameter<edm::
InputTag>(
"TrackCollection"))) {
49 produces<reco::VertexCollection>();
59 descriptions.
add(
"pixelVertexFromSoA", desc);
63 auto vertexes = std::make_unique<reco::VertexCollection>();
66 auto tracksSize = tracksHandle->size();
70 float x0 = 0, y0 = 0, z0 = 0,
dxdz = 0,
dydz = 0;
71 std::vector<int32_t> itrk;
73 if (!bsHandle.isValid()) {
74 edm::LogWarning(
"PixelVertexProducer") <<
"No beamspot found. returning vertexes with (0,0,Z) ";
88 #ifdef PIXVERTEX_DEBUG_PRODUCE
89 std::cout <<
"converting " << nv <<
" vertices "
90 <<
" from " << indToEdm.size() <<
" tracks" << std::endl;
91 #endif // PIXVERTEX_DEBUG_PRODUCE
93 std::set<uint16_t> uind;
94 for (
int j = nv - 1;
j >= 0; --
j) {
107 for (
auto k = 0U;
k < indToEdm.size(); ++
k) {
111 auto nt = itrk.size();
113 #ifdef PIXVERTEX_DEBUG_PRODUCE
114 std::cout <<
"vertex " <<
i <<
" with no tracks..." << std::endl;
115 #endif // PIXVERTEX_DEBUG_PRODUCE
123 auto &
v = (*vertexes).back();
124 v.reserve(itrk.size());
125 for (
auto it : itrk) {
126 assert(it <
int(indToEdm.size()));
127 auto k = indToEdm[it];
128 if (
k > tracksSize) {
129 edm::LogWarning(
"PixelVertexProducer") <<
"oops track " << it <<
" does not exists on CPU " <<
k;
138 LogDebug(
"PixelVertexProducer") <<
": Found " << vertexes->size() <<
" vertexes\n";
139 for (
unsigned int i = 0;
i < vertexes->size(); ++
i) {
140 LogDebug(
"PixelVertexProducer") <<
"Vertex number " <<
i <<
" has " << (*vertexes)[
i].tracksSize()
141 <<
" tracks with a position of " << (*vertexes)[
i].z() <<
" +- "
142 <<
std::sqrt((*vertexes)[
i].covariance(2, 2));
146 if (vertexes->empty() && bsHandle.isValid()) {
150 if ((bse.cxx() <= 0.) || (bse.cyy() <= 0.) || (bse.czz() <= 0.)) {
157 edm::LogInfo(
"PixelVertexProducer") <<
"No vertices found. Beamspot with invalid errors " << bse.matrix()
158 <<
"\nWill put Vertex derived from dummy-fake BeamSpot into Event.\n"
159 << (*vertexes)[0].x() <<
"\n"
160 << (*vertexes)[0].y() <<
"\n"
161 << (*vertexes)[0].z() <<
"\n";
165 edm::LogInfo(
"PixelVertexProducer") <<
"No vertices found. Will put Vertex derived from BeamSpot into Event:\n"
166 << (*vertexes)[0].x() <<
"\n"
167 << (*vertexes)[0].y() <<
"\n"
168 << (*vertexes)[0].z() <<
"\n";
170 }
else if (vertexes->empty() && !bsHandle.isValid()) {
171 edm::LogWarning(
"PixelVertexProducer") <<
"No beamspot and no vertex found. No vertex returned.";
double z0() const
z coordinate
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< ZVertexHeterogeneous > tokenVertex_
std::vector< Track > TrackCollection
collection of Tracks
math::Error< dimension >::type Error
covariance error matrix (3x3)
std::vector< uint16_t > IndToEdm
edm::EDGetTokenT< reco::BeamSpot > tokenBeamSpot_
~PixelVertexProducerFromSoA() override=default
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
double dydz() const
dydz slope
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
void produce(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
edm::EDGetTokenT< reco::TrackCollection > tokenTracks_
bool get(ProductID const &oid, Handle< PROD > &result) const
math::XYZPoint Point
point in the space
edm::EDGetTokenT< IndToEdm > tokenIndToEdm_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double dxdz() const
dxdz slope
Log< level::Info, false > LogInfo
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
void add(std::string const &label, ParameterSetDescription const &psetDescription)
double y0() const
y coordinate
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
const Point & position() const
position
Covariance3DMatrix rotatedCovariance3D() const
Log< level::Warning, false > LogWarning
double x0() const
x coordinate
PixelVertexProducerFromSoA(const edm::ParameterSet &iConfig)