41 : tokenVertex_(consumes(conf.getParameter<
edm::
InputTag>(
"src"))),
42 tokenBeamSpot_(consumes(conf.getParameter<
edm::
InputTag>(
"beamSpot"))),
43 tokenTracks_(consumes(conf.getParameter<
edm::
InputTag>(
"TrackCollection"))),
44 tokenIndToEdm_(consumes(conf.getParameter<
edm::
InputTag>(
"TrackCollection"))) {
45 produces<reco::VertexCollection>();
55 descriptions.
add(
"pixelVertexFromSoAAlpaka",
desc);
61 auto vertexes = std::make_unique<reco::VertexCollection>();
68 float x0 = 0, y0 = 0,
z0 = 0,
dxdz = 0,
dydz = 0;
69 std::vector<int32_t> itrk;
71 if (!bsHandle.isValid()) {
72 edm::LogWarning(
"PixelVertexProducer") <<
"No beamspot found. returning vertexes with (0,0,Z) ";
84 int nv =
soa.view().nvFinal();
86 #ifdef PIXVERTEX_DEBUG_PRODUCE 87 std::cout <<
"converting " << nv <<
" vertices " 88 <<
" from " << indToEdm.size() <<
" tracks" << std::endl;
89 #endif // PIXVERTEX_DEBUG_PRODUCE 91 std::set<uint32_t> uind;
92 for (
int j = nv - 1;
j >= 0; --
j) {
93 auto i =
soa.view()[
j].sortInd();
97 auto z =
soa.view()[
i].zv();
102 err(2, 2) = 1.f /
soa.view()[
i].wv();
105 for (
auto k = 0
U;
k < indToEdm.size(); ++
k) {
106 if (
soa.view()[
k].idv() == int16_t(
i))
109 auto nt = itrk.size();
111 #ifdef PIXVERTEX_DEBUG_PRODUCE 112 std::cout <<
"vertex " <<
i <<
" with no tracks..." << std::endl;
113 #endif // PIXVERTEX_DEBUG_PRODUCE 121 auto &
v = (*vertexes).back();
122 v.reserve(itrk.size());
123 for (
auto it : itrk) {
125 auto k = indToEdm[
it];
127 edm::LogWarning(
"PixelVertexProducer") <<
"oops track " <<
it <<
" does not exists on CPU " <<
k;
136 LogDebug(
"PixelVertexProducer") <<
": Found " <<
vertexes->size() <<
" vertexes\n";
137 for (
unsigned int i = 0;
i <
vertexes->size(); ++
i) {
138 LogDebug(
"PixelVertexProducer") <<
"Vertex number " <<
i <<
" has " << (*vertexes)[
i].tracksSize()
139 <<
" tracks with a position of " << (*vertexes)[
i].z() <<
" +- " 144 if (
vertexes->empty() && bsHandle.isValid()) {
148 if ((bse.cxx() <= 0.) || (bse.cyy() <= 0.) || (bse.czz() <= 0.)) {
155 edm::LogInfo(
"PixelVertexProducer") <<
"No vertices found. Beamspot with invalid errors " << bse.matrix()
156 <<
"\nWill put Vertex derived from dummy-fake BeamSpot into Event.\n" 157 << (*vertexes)[0].x() <<
"\n" 158 << (*vertexes)[0].y() <<
"\n" 159 << (*vertexes)[0].z() <<
"\n";
163 edm::LogInfo(
"PixelVertexProducer") <<
"No vertices found. Will put Vertex derived from BeamSpot into Event:\n" 164 << (*vertexes)[0].x() <<
"\n" 165 << (*vertexes)[0].y() <<
"\n" 166 << (*vertexes)[0].z() <<
"\n";
168 }
else if (
vertexes->empty() && !bsHandle.isValid()) {
169 edm::LogWarning(
"PixelVertexProducer") <<
"No beamspot and no vertex found. No vertex returned.";
void produce(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
math::Error< dimension >::type Error
covariance error matrix (3x3)
edm::EDGetTokenT< IndToEdm > tokenIndToEdm_
edm::EDGetTokenT< ZVertexHost > tokenVertex_
edm::EDGetTokenT< reco::BeamSpot > tokenBeamSpot_
PixelVertexProducerFromSoAAlpaka(const edm::ParameterSet &iConfig)
math::XYZPoint Point
point in the space
#define DEFINE_FWK_MODULE(type)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
~PixelVertexProducerFromSoAAlpaka() override=default
std::vector< uint32_t > IndToEdm
Log< level::Info, false > LogInfo
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
void add(std::string const &label, ParameterSetDescription const &psetDescription)
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
edm::EDGetTokenT< reco::TrackCollection > tokenTracks_
Log< level::Warning, false > LogWarning