78 const std::vector<LocalPoint>& vLocalPos);
113 : throwBadComponents_(iConfig.getParameter<
bool>(
"throwBadComponents")),
114 dumpWholeDetId_(iConfig.getParameter<
bool>(
"dumpWholeDetIds")),
119 trajTrackCollectionToken_(
123 edm::LogPrint(
"NearbyPixelClustersProducer") <<
"WARNING: selected to dump the whole DetId's worth of clusters.\n "
124 "This will have consequences on the event size!"
137 auto outputClusters = std::make_unique<SiPixelClusterCollectionNew>();
153 if (!trajTrackCollectionHandle.isValid())
159 LogDebug(
"NearbyPixelClustersProducer") << allCrossings.size() << std::endl;
162 for (
const auto& [
id, vLocalPos] : allCrossings) {
167 const auto& clustersOnDet = clusterCollection.
find(
DetId(
id));
169 if (clustersOnDet == clusterCollection.
end())
173 if (!(*clustersOnDet).isValid())
186 for (
const auto& cluster : clustersToPut) {
205 std::vector<uint32_t> treatedIds;
207 for (
const auto& pair : *trajTrackCollectionHandle) {
212 if (!measurement.updatedState().isValid())
219 const auto& rawId = recHitDetid.
rawId();
227 if (!(trajStateOnSurface.
isValid()))
234 if (
std::find(treatedIds.begin(), treatedIds.end(), rawId) != treatedIds.end()) {
235 crossings.at(rawId).push_back(localPosition);
237 crossings.insert(std::pair<uint32_t, std::vector<LocalPoint>>(rawId, {localPosition}));
238 treatedIds.push_back(rawId);
249 const uint32_t rawId,
250 const std::vector<LocalPoint>& vLocalPos)
253 std::vector<edmNew::DetSet<SiPixelCluster>::const_iterator>
outputClusters;
255 static constexpr
unsigned int k_maxClustersInDet = 1024;
258 if ((*clusterSet).size() > k_maxClustersInDet) {
260 << __func__ <<
"() number of clusters in det " << rawId <<
" is " << (*clusterSet).size()
261 <<
", which is larger than maximum (1024).\n Something funny with the data is going on!" << std::endl;
270 for (; itCluster != clusterSet->
end(); ++itCluster) {
277 for (
const auto& localPos : vLocalPos) {
280 const auto& traj_lx = localPos.x();
281 const auto& traj_ly = localPos.y();
287 LogDebug(
"NearbyPixelClustersProducer")
288 << __func__ << rawId <<
" count: " <<
count <<
" n. clusters: " << (*clusterSet).size() << std::endl;
290 for (; itCluster != clusterSet->
end(); ++itCluster) {
291 LocalPoint lp(itCluster->x(), itCluster->y(), 0.);
295 float D =
sqrt((lp.
x() - traj_lx) * (lp.
x() - traj_lx) + (lp.
y() - traj_ly) * (lp.
y() - traj_ly));
314 const uint32_t rawId,
315 const std::vector<LocalPoint>& vLocalPos)
318 std::vector<edmNew::DetSet<SiPixelCluster>::const_iterator>
outputClusters;
321 for (
const auto& localPos : vLocalPos) {
325 const auto& traj_lx = localPos.x();
326 const auto& traj_ly = localPos.y();
331 for (; itClusterSet != clusterCollection.
end(); itClusterSet++) {
332 DetId detId(itClusterSet->id());
333 if (detId.rawId() != rawId)
336 unsigned int subDetId = detId.subdetId();
339 <<
"ERROR: not a pixel cluster!!!" << std::endl;
347 for (; itCluster != itClusterSet->
end(); ++itCluster) {
354 LogDebug(
"NearbyPixelClustersProducer")
355 << __func__ << rawId <<
" count: " <<
count <<
" n. clusters: " << (*itClusterSet).size() << std::endl;
361 for (; itCluster != itClusterSet->
end(); ++itCluster) {
362 LocalPoint lp(itCluster->x(), itCluster->y(), 0.);
366 float D =
sqrt((lp.
x() - traj_lx) * (lp.
x() - traj_lx) + (lp.
y() - traj_ly) * (lp.
y() - traj_ly));
405 if (forwardPredictedState.isValid() && backwardPredictedState.isValid())
406 return trajStateCombiner(forwardPredictedState, backwardPredictedState);
408 else if (backwardPredictedState.isValid())
409 return backwardPredictedState;
411 else if (forwardPredictedState.isValid())
412 return forwardPredictedState;
414 edm::LogError(
"NearbyPixelClustersProducer") <<
"Error saving traj. measurement data."
415 <<
" Trajectory state on surface cannot be determined." << std::endl;
424 "Produces the collection of SiPixelClusters closest, hit by hit, to the trajectory measurements of a given "
426 desc.add<
bool>(
"throwBadComponents",
false)
428 "do not consider modules flagged as bad components. Careful, it changes the efficiency denominator!");
429 desc.add<
bool>(
"dumpWholeDetIds",
false)
430 ->setComment(
"put in the event all the pixel cluster on the impacted module, by default only the closest");