76 unsigned int& nClusGlobal);
125 nearByClustersToken_(
127 trajTrackCollectionToken_(
151 auto const& muonTracks = *muonTrackCollectionHandle;
156 unsigned int nMuons = muonTracks.size();
157 for (
unsigned int ij = 0; ij <
nMuons; ij++) {
158 auto muon = muonTrackCollectionHandle->ptrAt(ij);
160 const auto& distances = (*distancesToTrack)[trackRef];
162 LogDebug(
"NearbyPixelClustersAnalyzer") <<
"distances size: " << distances.size() << std::endl;
165 double closestDR = 999.;
166 for (
const auto&
distance : distances) {
168 LogDebug(
"NearbyPixelClustersAnalyzer")
170 if (distance < closestDR && distance > 0) {
181 unsigned int nClusGlobal = 0;
185 edm::LogInfo(
"NearbyPixelClustersAnalyzer") <<
"total ALCARECO clusters: " << nClusGlobal << std::endl;
190 unsigned int nNearByClusGlobal = 0;
191 countClusters(nearByClusterCollectionHandle, nNearByClusGlobal);
194 edm::LogInfo(
"NearbyPixelClustersAnalyzer") <<
"total close-by clusters: " << nNearByClusGlobal << std::endl;
202 if (!trajTrackCollectionHandle.isValid())
205 for (
const auto& pair : *trajTrackCollectionHandle) {
210 if (!measurement.updatedState().isValid())
224 if (!(trajStateOnSurface.
isValid()))
231 const auto& traj_lx = localPosition.
x();
232 const auto& traj_ly = localPosition.
y();
235 nearByClusterCollectionHandle, pixelCPE_, trackerGeometry_, r_rawId.
rawId(), traj_lx, traj_ly);
237 float dist = (loc.first != -999.) ?
std::sqrt(loc.first * loc.first + loc.second * loc.second) : -0.1;
241 <<
"RawID:" << r_rawId.
rawId() <<
" (valid hit), distance: " << dist << std::endl;
247 <<
"RawID:" << r_rawId.
rawId() <<
" (missing hit), distance: " << dist << std::endl;
253 <<
"RawID:" << r_rawId.
rawId() <<
" (inactive hit), distance: " << dist << std::endl;
264 "h_nALCARECOClusters",
"Number of Pixel clusters per event (ALCARECO) ;N_{clusters};events", 20, 0, 20);
266 "h_nCloseByClusters",
"Number of Pixel clusters per event (close-by) ;N_{clusters};events", 20, 0, 20);
270 "h_distClosestValid",
271 "Distance of Closest cluster to trajectory (valid);distance (cm); valid trajectory measurements",
276 "h_distClosestMissing",
277 "Distance of Closest cluster to trajectory (missing);distance (cm);missing trajectory measurements",
282 "h_distClosestInactive",
283 "Distance of Closest cluster to trajectory (inactive);distance (cm);inactive trajectory measurements",
290 "h_distClosestTrack",
291 "#DeltaR Distance of Closest track to the muon trajectory;#DeltaR distance; muon trajectories",
325 if (forwardPredictedState.isValid() && backwardPredictedState.isValid())
326 return trajStateCombiner(forwardPredictedState, backwardPredictedState);
328 else if (backwardPredictedState.isValid())
329 return backwardPredictedState;
331 else if (forwardPredictedState.isValid())
332 return forwardPredictedState;
334 edm::LogError(
"NearbyPixelClusterProducer") <<
"Error saving traj. measurement data." 335 <<
" Trajectory state on surface cannot be determined." << std::endl;
343 unsigned int& nClusGlobal)
346 for (
const auto& DSVItr : *
handle) {
347 uint32_t rawid(DSVItr.detId());
349 LogDebug(
"NearbyPixelClustersAnalyzer") <<
"DetId: " << detId.rawId() <<
" size: " << DSVItr.size() << std::endl;
350 nClusGlobal += DSVItr.size();
369 auto loc = std::make_pair(-999., -999.);
371 for (; itClusterSet != clusterCollection.
end(); itClusterSet++) {
372 DetId detId(itClusterSet->id());
373 if (detId.rawId() != rawId)
376 unsigned int subDetId = detId.subdetId();
379 <<
"ERROR: not a pixel cluster!!!" << std::endl;
385 for (; itCluster != itClusterSet->
end(); ++itCluster) {
386 LocalPoint lp(itCluster->x(), itCluster->y(), 0.);
390 float D =
sqrt((lp.
x() - traj_lx) * (lp.
x() - traj_lx) + (lp.
y() - traj_ly) * (lp.
y() - traj_ly));
393 loc.first = (lp.
x() - traj_lx);
394 loc.second = (lp.
y() - traj_ly);
405 for (; itClusterSet != clusterCollection.
end(); itClusterSet++) {
406 DetId detId(itClusterSet->id());
409 for (; itCluster != itClusterSet->end(); ++itCluster) {
410 const std::vector<SiPixelCluster::Pixel> pixelsVec = (*itCluster).pixels();
411 for (
unsigned int i = 0;
i < pixelsVec.size(); ++
i) {
412 float pixx = pixelsVec[
i].x;
413 float pixy = pixelsVec[
i].y;
414 float pixel_charge = pixelsVec[
i].adc;
415 histoMap_[detId.rawId()]->Fill(pixy, pixx, pixel_charge);
426 <<
"@SUB=NearbyPixelClustersAnalyzer::beginRun() before booking histoMap_.size(): " <<
histoMap_.size()
438 unsigned nPixelDets = 0;
439 for (
const auto& it : pDD_->
detUnits()) {
441 if (mit !=
nullptr) {
447 if (detIds.size() != nPixelDets) {
449 <<
"The size of the detId list specified from file (" << detIds.size()
450 <<
") differs from the one in TrackerGeometry (" << nPixelDets <<
")! Please cross-check" << std::endl;
453 for (
const auto& it : detIds) {
460 LogDebug(
"NearbyPixelClustersAnalyzer") <<
"booking " << thePart << std::endl;
470 <<
"@SUB=NearbyPixelClusterAnalyzer::beginRun() After booking histoMap_.size(): " <<
histoMap_.size()
479 int subdetId_(-999),
layer_(-999), side_(-999);
493 ret += (side_ == 1) ? Form(
"P_disk%i",
layer_) : Form(
"M_disk%i",
layer_);
496 edm::LogError(
"NearbyPixelClusterAnalyzer") <<
"we should never be here!" << std::endl;
500 return std::make_tuple(
ret, subdetId_,
layer_, side_);
507 std::map<uint32_t, TH2F*> hd;
510 for (
const auto& it : detIds) {
512 if (it == 0 || it == 0xFFFFFFFF) {
514 <<
"Wrong det id: " << it <<
" ... neglecting!" << std::endl;
531 Form(
"Cluster Map for module %s;n. cols;n. rows;pixel charge [ADC counts]",
moduleName.c_str()),
546 desc.setComment(
"Analysis of the closebyPixelClusters collections");
553 "SLHCUpgradeSimulations/Geometry/data/PhaseI/PixelSkimmedGeometry_phase1.txt");
static const std::string kSharedResource
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomEsToken_
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
static const char layer_[]
TH1I * h_nALCARECOClusters
unsigned int pxbLayer(const DetId &id) const
std::map< std::string, TFileDirectory > outputFolders_
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
LocalPoint localPosition() const
TH1F * h_distClosestTrack
edm::EDGetTokenT< edm::ValueMap< std::vector< float > > > distanceToken_
ret
prodAgent to be discontinued
#define DEFINE_FWK_MODULE(type)
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
constexpr unsigned int subDetId[21]
void endRun(edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< TrajTrackAssociationCollection > trajTrackCollectionToken_
data_type const * const_iterator
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Log< level::Error, false > LogError
constexpr Detector det() const
get the detector field from this detid
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomEsTokenBR_
TrajectoryStateOnSurface getTrajectoryStateOnSurface(const TrajectoryMeasurement &measurement)
key_type key() const
Accessor for product key.
const_iterator end(bool update=false) const
virtual ReturnType getParameters(const SiPixelCluster &cl, const GeomDetUnit &det) const =0
edm::EDGetTokenT< SiPixelClusterCollectionNew > clustersToken_
T * make(const Args &...args) const
make new ROOT object
bool detidIsOnPixel(const DetId &detid)
SiPixelDetInfoFileReader reader_
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
bool isThere(GeomDetEnumerators::SubDetector subdet) const
std::string name() const override
from base class
void analyze(const edm::Event &, const edm::EventSetup &) override
unsigned int pxfDisk(const DetId &id) const
std::map< uint32_t, TH2F * > bookModuleHistograms(const TrackerTopology *tTopo)
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoEsTokenBR_
bool getData(T &iHolder) const
edm::Service< TFileService > fs
void fillClusterFrames(const edm::Handle< SiPixelClusterCollectionNew > &handle)
TH1F * h_distClosestMissing
edm::EDGetTokenT< SiPixelClusterCollectionNew > nearByClustersToken_
const edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecord > pixelCPEEsToken_
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)
Log< level::Info, false > LogInfo
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
unsigned int pxfSide(const DetId &id) const
const std::pair< int, int > & getDetUnitDimensions(uint32_t detId) const
const_iterator begin(bool update=false) const
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
DecomposeProduct< arg, typename Div::arg > D
constexpr uint32_t rawId() const
get the raw id
std::string name() const override
from base class
TH1I * h_nCloseByClusters
std::tuple< std::string, int, int, int > setTopoInfo(uint32_t detId, const TrackerTopology *tTopo)
void beginRun(edm::Run const &, edm::EventSetup const &) override
const std::vector< uint32_t > & getAllDetIds() const
edm::EDGetTokenT< edm::View< reco::Track > > muonTracksToken_
void countClusters(const edm::Handle< SiPixelClusterCollectionNew > &handle, unsigned int &nClusGlobal)
std::map< uint32_t, TH2F * > histoMap_
TH1F * h_distClosestInactive
NearbyPixelClustersAnalyzer(const edm::ParameterSet &)
TH1F * h_distClosestValid
std::tuple< LocalPoint, LocalError, SiPixelRecHitQuality::QualWordType > ReturnType
~NearbyPixelClustersAnalyzer() override=default