104 nearByClustersToken_(
106 trajTrackCollectionToken_(
110 dqm_path_(iConfig.getParameter<
std::
string>(
"dqmPath")),
111 reader_(
edm::FileInPath(iConfig.getParameter<
std::
string>(
"skimmedGeometryPath")).
fullPath()) {}
129 auto const&
muonTracks = *muonTrackCollectionHandle;
135 for (
unsigned int ij = 0; ij <
nMuons; ij++) {
136 auto muon = muonTrackCollectionHandle->ptrAt(ij);
138 const auto& distances = (*distancesToTrack)[trackRef];
140 LogDebug(
"SiPixelCalSingleMuonAnalyzer") <<
"distances size: " << distances.size() << std::endl;
143 double closestDR = 999.;
144 for (
const auto&
distance : distances) {
146 LogDebug(
"SiPixelCalSingleMuonAnalyzer")
148 if (distance < closestDR && distance > 0) {
159 unsigned int nClusGlobal = 0;
163 LogTrace(
"SiPixelCalSingleMuonAnalyzer") <<
"total ALCARECO clusters: " << nClusGlobal << std::endl;
168 unsigned int nNearByClusGlobal = 0;
169 countClusters(nearByClusterCollectionHandle, nNearByClusGlobal);
172 LogTrace(
"SiPixelCalSingleMuonAnalyzer") <<
"total close-by clusters: " << nNearByClusGlobal << std::endl;
177 if (!trajTrackCollectionHandle.isValid())
180 for (
const auto& pair : *trajTrackCollectionHandle) {
185 if (!measurement.updatedState().isValid())
199 if (!(trajStateOnSurface.
isValid()))
206 const auto& traj_lx = localPosition.
x();
207 const auto& traj_ly = localPosition.
y();
210 nearByClusterCollectionHandle, pixelCPE_, trackerGeometry_, r_rawId.
rawId(), traj_lx, traj_ly);
215 LogTrace(
"SiPixelCalSingleMuonAnalyzer")
216 <<
"RawID:" << r_rawId.
rawId() <<
" (valid hit), distance: " << dist << std::endl;
221 LogTrace(
"SiPixelCalSingleMuonAnalyzer")
222 <<
"RawID:" << r_rawId.
rawId() <<
" (missing hit), distance: " << dist << std::endl;
227 LogTrace(
"SiPixelCalSingleMuonAnalyzer")
228 <<
"RawID:" << r_rawId.
rawId() <<
" (inactive hit), distance: " << dist << std::endl;
240 "h_nALCARECOClusters",
"Number of Pixel clusters per event (ALCARECO) ;N_{clusters};events", 20, 0, 20);
242 "h_nCloseByClusters",
"Number of Pixel clusters per event (close-by) ;N_{clusters};events", 20, 0, 20);
246 iBooker.
book1D(
"h_distClosestValid",
247 "Distance of Closest cluster to trajectory (valid);distance (cm); valid trajectory measurements",
252 "h_distClosestMissing",
253 "Distance of Closest cluster to trajectory (missing);distance (cm);missing trajectory measurements",
258 "h_distClosestInactive",
259 "Distance of Closest cluster to trajectory (inactive);distance (cm);inactive trajectory measurements",
266 iBooker.
book1D(
"h_distClosestTrack",
267 "#DeltaR Distance of Closest track to the muon trajectory;#DeltaR distance; muon trajectories",
296 if (forwardPredictedState.isValid() && backwardPredictedState.isValid())
297 return trajStateCombiner(forwardPredictedState, backwardPredictedState);
299 else if (backwardPredictedState.isValid())
300 return backwardPredictedState;
302 else if (forwardPredictedState.isValid())
303 return forwardPredictedState;
305 edm::LogError(
"NearbyPixelClusterProducer") <<
"Error saving traj. measurement data." 306 <<
" Trajectory state on surface cannot be determined." << std::endl;
314 unsigned int& nClusGlobal)
317 for (
const auto& DSVItr : *
handle) {
318 uint32_t rawid(DSVItr.detId());
320 LogDebug(
"SiPixelCalSingleMuonAnalyzer") <<
"DetId: " <<
detId.rawId() <<
" size: " << DSVItr.size() << std::endl;
321 nClusGlobal += DSVItr.size();
340 auto loc = std::make_pair(-999., -999.);
350 <<
"ERROR: not a pixel cluster!!!" << std::endl;
356 for (; itCluster != itClusterSet->
end(); ++itCluster) {
357 LocalPoint lp(itCluster->x(), itCluster->y(), 0.);
361 float D = (lp.
x() - traj_lx) * (lp.
x() - traj_lx) + (lp.
y() - traj_ly) * (lp.
y() - traj_ly);
364 loc.first = (lp.
x() - traj_lx);
365 loc.second = (lp.
y() - traj_ly);
375 desc.setComment(
"Analysis of the closebyPixelClusters collections");
383 "SLHCUpgradeSimulations/Geometry/data/PhaseI/PixelSkimmedGeometry_phase1.txt");
~SiPixelCalSingleMuonAnalyzer() override=default
const edm::EDGetTokenT< edm::View< reco::Track > > muonTracksToken_
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< SiPixelClusterCollectionNew > nearByClustersToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
MonitorElement * book1I(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
LocalPoint localPosition() const
virtual void setCurrentFolder(std::string const &fullpath)
MonitorElement * h_distClosestValid
SiPixelCalSingleMuonAnalyzer(const edm::ParameterSet &)
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
constexpr unsigned int subDetId[21]
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
SiPixelDetInfoFileReader reader_
data_type const * const_iterator
const std::string dqm_path_
Log< level::Error, false > LogError
const edm::EDGetTokenT< TrajTrackAssociationCollection > trajTrackCollectionToken_
key_type key() const
Accessor for product key.
const edm::EDGetTokenT< edm::ValueMap< std::vector< float > > > distanceToken_
virtual ReturnType getParameters(const SiPixelCluster &cl, const GeomDetUnit &det) const =0
MonitorElement * h_nALCARECOClusters
dqm::reco::MonitorElement MonitorElement
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
MonitorElement * h_distClosestInactive
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
#define DEFINE_FWK_MODULE(type)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomEsTokenBR_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomEsToken_
const edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecord > pixelCPEEsToken_
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
DecomposeProduct< arg, typename Div::arg > D
constexpr uint32_t rawId() const
get the raw id
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * h_distClosestTrack
std::pair< float, float > findClosestCluster(const edm::Handle< SiPixelClusterCollectionNew > &handle, const PixelClusterParameterEstimator *pixelCPE_, const TrackerGeometry *trackerGeometry_, uint32_t rawId, float traj_lx, float traj_ly)
MonitorElement * h_nCloseByClusters
void countClusters(const edm::Handle< SiPixelClusterCollectionNew > &handle, unsigned int &nClusGlobal)
const bool detidIsOnPixel(const DetId &detid)
TrajectoryStateOnSurface getTrajectoryStateOnSurface(const TrajectoryMeasurement &measurement)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::tuple< LocalPoint, LocalError, SiPixelRecHitQuality::QualWordType > ReturnType
MonitorElement * h_distClosestMissing
const edm::EDGetTokenT< SiPixelClusterCollectionNew > clustersToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoEsTokenBR_