CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
PixelInactiveAreaFinder Class Reference

#include <PixelInactiveAreaFinder.h>

Classes

struct  DetGroupSpan
 
class  InactiveAreas
 

Public Types

using Area = AreaSeededTrackingRegionsBuilder::Area
 
using DetGroupSpanContainer = std::vector< DetGroupSpan >
 
using LayerSetIndex = SeedingLayerSetsHits::LayerSetIndex
 
using SeedingLayerId = SeedingLayerSetsBuilder::SeedingLayerId
 

Public Member Functions

InactiveAreas inactiveAreas (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 PixelInactiveAreaFinder (const edm::ParameterSet &iConfig, const std::vector< SeedingLayerId > &seedingLayers, const SeedingLayerSetsLooper &seedingLayerSetsLooper, edm::ConsumesCollector &&iC)
 
 ~PixelInactiveAreaFinder ()=default
 

Static Public Member Functions

static void fillDescriptions (edm::ParameterSetDescription &desc)
 

Private Types

using det_t = uint32_t
 
using DetContainer = std::vector< uint32_t >
 
using DetectorSet = std::set< uint32_t >
 
using DetGroup = std::vector< uint32_t >
 
using DetGroupContainer = std::vector< DetGroup >
 
using DetGroupSpanContainerPair = std::pair< DetGroupSpanContainer, DetGroupSpanContainer >
 
using OverlapSpans = std::vector< DetGroupSpan >
 
using OverlapSpansContainer = std::vector< OverlapSpans >
 
using Stream = std::stringstream
 

Private Member Functions

DetGroup badAdjecentDetsBarrel (const det_t &det)
 
DetGroup badAdjecentDetsEndcap (const det_t &det)
 
DetGroupContainer badDetGroupsBarrel ()
 
DetGroupContainer badDetGroupsEndcap ()
 
void createPlottingFiles ()
 
DetGroupSpanContainerPair detGroupSpans ()
 
void detInfo (const det_t &det, Stream &ss)
 
bool detWorks (det_t det)
 
void getBadPixelDets (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
void getPhiSpanBarrel (const DetGroup &detGroup, DetGroupSpan &cspan)
 
void getPhiSpanEndcap (const DetGroup &detGroup, DetGroupSpan &cspan)
 
void getRSpan (const DetGroup &detGroup, DetGroupSpan &cspan)
 
void getSpan (const DetGroup &detGroup, DetGroupSpan &cspan)
 
void getZSpan (const DetGroup &detGroup, DetGroupSpan &cspan)
 
void printBadDetGroups ()
 
void printBadDetGroupSpans ()
 
void printBadPixelDets ()
 
void printPixelDets ()
 
DetGroup reachableDetGroup (const det_t &initDet, DetectorSet &foundDets)
 
void updatePixelDets (const edm::EventSetup &iSetup)
 

Private Attributes

DetContainer badPixelDetsBarrel_
 
DetContainer badPixelDetsEndcap_
 
std::vector< edm::EDGetTokenT< PixelFEDChannelCollection > > badPixelFEDChannelsTokens_
 
const bool createPlottingFiles_
 
const bool debug_
 
edm::ESWatcher< TrackerDigiGeometryRecordgeometryWatcher_
 
const bool ignoreSingleFPixPanelModules_
 
std::vector< SeedingLayerIdinactiveLayers_
 
std::vector< std::pair< unsigned short, unsigned short > > inactiveLayerSetIndices_
 
std::vector< edm::EDGetTokenT< DetIdCollection > > inactivePixelDetectorTokens_
 
std::vector< std::vector< LayerSetIndex > > layerSetIndexInactiveToActive_
 
std::array< unsigned short, 4 > nBPixLadders
 
unsigned short nModulesPerLadder
 
DetContainer pixelDetsBarrel_
 
DetContainer pixelDetsEndcap_
 
const SiPixelQualitypixelQuality_ = nullptr
 
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcdpixelQualityToken_
 
const TrackerGeometrytrackerGeometry_ = nullptr
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtrackerGeometryToken_
 
const TrackerTopologytrackerTopology_ = nullptr
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtrackerTopologyToken_
 

Detailed Description

Definition at line 23 of file PixelInactiveAreaFinder.h.

Member Typedef Documentation

◆ Area

Definition at line 25 of file PixelInactiveAreaFinder.h.

◆ det_t

using PixelInactiveAreaFinder::det_t = uint32_t
private

Definition at line 104 of file PixelInactiveAreaFinder.h.

◆ DetContainer

using PixelInactiveAreaFinder::DetContainer = std::vector<uint32_t>
private

Definition at line 105 of file PixelInactiveAreaFinder.h.

◆ DetectorSet

using PixelInactiveAreaFinder::DetectorSet = std::set<uint32_t>
private

Definition at line 108 of file PixelInactiveAreaFinder.h.

◆ DetGroup

using PixelInactiveAreaFinder::DetGroup = std::vector<uint32_t>
private

Definition at line 106 of file PixelInactiveAreaFinder.h.

◆ DetGroupContainer

Definition at line 107 of file PixelInactiveAreaFinder.h.

◆ DetGroupSpanContainer

Definition at line 38 of file PixelInactiveAreaFinder.h.

◆ DetGroupSpanContainerPair

Definition at line 97 of file PixelInactiveAreaFinder.h.

◆ LayerSetIndex

Definition at line 27 of file PixelInactiveAreaFinder.h.

◆ OverlapSpans

Definition at line 98 of file PixelInactiveAreaFinder.h.

◆ OverlapSpansContainer

Definition at line 99 of file PixelInactiveAreaFinder.h.

◆ SeedingLayerId

Definition at line 26 of file PixelInactiveAreaFinder.h.

◆ Stream

using PixelInactiveAreaFinder::Stream = std::stringstream
private

Definition at line 109 of file PixelInactiveAreaFinder.h.

Constructor & Destructor Documentation

◆ PixelInactiveAreaFinder()

PixelInactiveAreaFinder::PixelInactiveAreaFinder ( const edm::ParameterSet iConfig,
const std::vector< SeedingLayerId > &  seedingLayers,
const SeedingLayerSetsLooper seedingLayerSetsLooper,
edm::ConsumesCollector &&  iC 
)

Definition at line 459 of file PixelInactiveAreaFinder.cc.

References makeGlobalPositionRcd_cfg::tag.

464  : debug_(iConfig.getUntrackedParameter<bool>("debug")),
465  createPlottingFiles_(iConfig.getUntrackedParameter<bool>("createPlottingFiles")),
466  ignoreSingleFPixPanelModules_(iConfig.getParameter<bool>("ignoreSingleFPixPanelModules")),
468  edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag>>("inactivePixelDetectorLabels"),
469  [&](const auto& tag) { return iC.consumes<DetIdCollection>(tag); })),
471  edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag>>("badPixelFEDChannelCollectionLabels"),
472  [&](const auto& tag) { return iC.consumes<PixelFEDChannelCollection>(tag); })),
476 #ifdef EDM_ML_DEBUG
477  for (const auto& layer : seedingLayers) {
478  LogTrace("PixelInactiveAreaFinder") << "Input layer subdet " << std::get<0>(layer) << " side "
479  << static_cast<unsigned int>(std::get<1>(layer)) << " layer "
480  << std::get<2>(layer);
481  }
482 #endif
483 
484  auto findOrAdd = [&](SeedingLayerId layer) -> unsigned short {
485  auto found = std::find(inactiveLayers_.cbegin(), inactiveLayers_.cend(), layer);
486  if (found == inactiveLayers_.cend()) {
487  auto ret = inactiveLayers_.size();
488  inactiveLayers_.push_back(layer);
489  return ret;
490  }
491  return std::distance(inactiveLayers_.cbegin(), found);
492  };
493 
494  // mapping from active layer pairs to inactive layer pairs
495  const auto activeToInactiveMap = createActiveToInactiveMap();
496 
497  // convert input layer pairs (that are for active layers) to layer
498  // pairs to look for inactive areas
499  LayerSetIndex i = 0;
500  for (const auto& layerSet : seedingLayerSetsLooper.makeRange(seedingLayers)) {
501  assert(layerSet.size() == 2);
502  auto found = activeToInactiveMap.find(std::make_pair(layerSet[0], layerSet[1]));
503  if (found == activeToInactiveMap.end()) {
504  throw cms::Exception("Configuration")
505  << "Encountered layer pair " << layerSet[0] << "+" << layerSet[1]
506  << " not found from the internal 'active layer pairs' to 'inactive layer pairs' mapping; either fix the "
507  "input or the mapping (in PixelInactiveAreaFinder.cc)";
508  }
509 
510  LogTrace("PixelInactiveAreaFinder") << "Input layer set " << layerSet[0] << "+" << layerSet[1];
511  for (const auto& inactiveLayerSet : found->second) {
512  auto innerInd = findOrAdd(inactiveLayerSet.first);
513  auto outerInd = findOrAdd(inactiveLayerSet.second);
514 
515  auto found = std::find(
516  inactiveLayerSetIndices_.cbegin(), inactiveLayerSetIndices_.cend(), std::make_pair(innerInd, outerInd));
517  if (found == inactiveLayerSetIndices_.end()) {
518  inactiveLayerSetIndices_.emplace_back(innerInd, outerInd);
519  layerSetIndexInactiveToActive_.push_back(std::vector<LayerSetIndex>{i});
520  } else {
522  .push_back(i); // TODO: move to operator[] once finished
523  }
524 
525  LogTrace("PixelInactiveAreaFinder")
526  << " inactive layer set " << inactiveLayerSet.first << "+" << inactiveLayerSet.second;
527  }
528 
529  ++i;
530  }
531 
532 #ifdef EDM_ML_DEBUG
533  LogDebug("PixelInactiveAreaFinder") << "All inactive layer sets";
534  for (const auto& idxPair : inactiveLayerSetIndices_) {
535  LogTrace("PixelInactiveAreaFinder") << " " << inactiveLayers_[idxPair.first] << "+"
536  << inactiveLayers_[idxPair.second];
537  }
538 #endif
539 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
SeedingLayerSetsBuilder::SeedingLayerId SeedingLayerId
std::vector< edm::EDGetTokenT< DetIdCollection > > inactivePixelDetectorTokens_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
ret
prodAgent to be discontinued
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > pixelQualityToken_
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
assert(be >=bs)
#define LogTrace(id)
std::vector< std::pair< unsigned short, unsigned short > > inactiveLayerSetIndices_
T getUntrackedParameter(std::string const &, T const &) const
LayerSetRange< T > makeRange(const T &container) const
std::vector< edm::EDGetTokenT< PixelFEDChannelCollection > > badPixelFEDChannelsTokens_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
std::vector< std::vector< LayerSetIndex > > layerSetIndexInactiveToActive_
std::vector< SeedingLayerId > inactiveLayers_
SeedingLayerSetsHits::LayerSetIndex LayerSetIndex
#define LogDebug(id)

◆ ~PixelInactiveAreaFinder()

PixelInactiveAreaFinder::~PixelInactiveAreaFinder ( )
default

Member Function Documentation

◆ badAdjecentDetsBarrel()

PixelInactiveAreaFinder::DetGroup PixelInactiveAreaFinder::badAdjecentDetsBarrel ( const det_t det)
private

Definition at line 894 of file PixelInactiveAreaFinder.cc.

References HltBtagPostValidation_cff::c, hcalRecHitTable_cff::detId, detWorks(), PVValHelper::ladder, nano_mu_digi_cff::layer, nBPixLadders, nModulesPerLadder, and trackerTopology_.

Referenced by reachableDetGroup().

894  {
895  using std::remove_if;
896 
897  DetGroup adj;
898  auto const tTopo = trackerTopology_;
899  auto const& detId = DetId(det);
900  unsigned int layer = tTopo->pxbLayer(detId);
901  unsigned int ladder = tTopo->pxbLadder(detId);
902  unsigned int module = tTopo->pxbModule(detId);
903  unsigned int nLads = nBPixLadders[layer];
904  //add detectors from next and previous ladder
905  adj.push_back(tTopo->pxbDetId(layer, ((ladder - 1) + 1) % nLads + 1, module)());
906  adj.push_back(tTopo->pxbDetId(layer, ((ladder - 1) - 1 + nLads) % nLads + 1, module)());
907  //add adjecent detectors from same ladder
908  if (module == 1) {
909  adj.push_back(tTopo->pxbDetId(layer, ladder, module + 1)());
910  } else if (module == nModulesPerLadder) {
911  adj.push_back(tTopo->pxbDetId(layer, ladder, module - 1)());
912  } else {
913  adj.push_back(tTopo->pxbDetId(layer, ladder, module + 1)());
914  adj.push_back(tTopo->pxbDetId(layer, ladder, module - 1)());
915  }
916  //remove working detectors from list
917  adj.erase(remove_if(adj.begin(), adj.end(), [&](auto c) { return this->detWorks(c); }), adj.end());
918  return adj;
919 }
std::array< unsigned short, 4 > nBPixLadders
Definition: DetId.h:17
const TrackerTopology * trackerTopology_

◆ badAdjecentDetsEndcap()

PixelInactiveAreaFinder::DetGroup PixelInactiveAreaFinder::badAdjecentDetsEndcap ( const det_t det)
private

Definition at line 920 of file PixelInactiveAreaFinder.cc.

References badPixelDetsEndcap_, TrackerGeometry::idToDet(), SequenceTypes::ignore(), Surface::phiSpan(), TrackerTopology::pxfDisk(), GeomDet::surface(), trackerGeometry_, trackerTopology_, and z.

Referenced by reachableDetGroup().

920  {
921  // this might be faster if adjecent
922  using std::ignore;
923  using std::tie;
924  DetGroup adj;
925  Span_t phiSpan, phiSpanComp;
926  float z, zComp;
927  unsigned int disk, diskComp;
928  auto const& detSurf = trackerGeometry_->idToDet(DetId(det))->surface();
929  phiSpan = detSurf.phiSpan();
930  tie(z, ignore) = detSurf.zSpan();
931  disk = trackerTopology_->pxfDisk(DetId(det));
932  // add detectors from same disk whose phi ranges overlap to the adjecent list
933  for (auto const& detComp : badPixelDetsEndcap_) {
934  auto const& detIdComp = DetId(detComp);
935  auto const& detSurfComp = trackerGeometry_->idToDet(detIdComp)->surface();
936  diskComp = trackerTopology_->pxfDisk(detIdComp);
937  phiSpanComp = detSurfComp.phiSpan();
938  tie(zComp, ignore) = detSurfComp.zSpan();
939  if (det != detComp && disk == diskComp && z * zComp > 0 && phiRangesOverlap(phiSpan, phiSpanComp)) {
940  adj.push_back(detComp);
941  }
942  }
943  return adj;
944 }
unsigned int pxfDisk(const DetId &id) const
std::pair< float, float > const & phiSpan() const
Definition: Surface.h:90
const TrackerGeometry * trackerGeometry_
const TrackerGeomDet * idToDet(DetId) const override
def ignore(seq)
Definition: DetId.h:17
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const TrackerTopology * trackerTopology_

◆ badDetGroupsBarrel()

PixelInactiveAreaFinder::DetGroupContainer PixelInactiveAreaFinder::badDetGroupsBarrel ( )
private

Definition at line 974 of file PixelInactiveAreaFinder.cc.

References badPixelDetsBarrel_, and reachableDetGroup().

Referenced by detGroupSpans(), and printBadDetGroups().

974  {
975  DetGroupContainer detGroups;
976  DetectorSet foundDets;
977  for (auto const& badDet : badPixelDetsBarrel_) {
978  if (foundDets.find(badDet) == foundDets.end()) {
979  detGroups.push_back(this->reachableDetGroup(badDet, foundDets));
980  }
981  }
982  return detGroups;
983 }
DetGroup reachableDetGroup(const det_t &initDet, DetectorSet &foundDets)
std::set< uint32_t > DetectorSet
std::vector< DetGroup > DetGroupContainer

◆ badDetGroupsEndcap()

PixelInactiveAreaFinder::DetGroupContainer PixelInactiveAreaFinder::badDetGroupsEndcap ( )
private

Definition at line 984 of file PixelInactiveAreaFinder.cc.

References badPixelDetsEndcap_, ignoreSingleFPixPanelModules_, and reachableDetGroup().

Referenced by detGroupSpans(), and printBadDetGroups().

984  {
985  DetGroupContainer detGroups;
986  DetectorSet foundDets;
987  for (auto const& badDet : badPixelDetsEndcap_) {
988  if (foundDets.find(badDet) == foundDets.end()) {
989  auto adjacentDets = this->reachableDetGroup(badDet, foundDets);
990  if (ignoreSingleFPixPanelModules_ && adjacentDets.size() == 1) {
991  // size==1 means that only a single panel of a blade was inactive
992  // because of the large overlap with the other panel (i.e.
993  // redundancy in the detectory) ignoring these may help to decrease fakes
994  continue;
995  }
996  detGroups.push_back(adjacentDets);
997  }
998  }
999  return detGroups;
1000 }
DetGroup reachableDetGroup(const det_t &initDet, DetectorSet &foundDets)
std::set< uint32_t > DetectorSet
std::vector< DetGroup > DetGroupContainer

◆ createPlottingFiles()

void PixelInactiveAreaFinder::createPlottingFiles ( )
private

Definition at line 848 of file PixelInactiveAreaFinder.cc.

References badPixelDetsBarrel_, badPixelDetsEndcap_, detGroupSpans(), detInfo(), pixelDetsBarrel_, pixelDetsEndcap_, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by inactiveAreas().

848  {
849  // All detectors to file DETECTORS
850  Stream ss;
851  std::ofstream fsDet("DETECTORS.txt");
852  for (auto const& det : pixelDetsBarrel_) {
853  detInfo(det, ss);
854  ss << std::endl;
855  }
856  edm::LogPrint("PixelInactiveAreaFinder") << "Endcap detectors;";
857  for (auto const& det : pixelDetsEndcap_) {
858  detInfo(det, ss);
859  ss << std::endl;
860  }
861  fsDet << ss.rdbuf();
862  ss.str(std::string());
863  // Bad detectors
864  std::ofstream fsBadDet("BADDETECTORS.txt");
865  for (auto const& det : badPixelDetsBarrel_) {
866  detInfo(det, ss);
867  ss << std::endl;
868  }
869  for (auto const& det : badPixelDetsEndcap_) {
870  detInfo(det, ss);
871  ss << std::endl;
872  }
873  fsBadDet << ss.rdbuf();
874  ss.str(std::string());
875  // detgroupspans
876  std::ofstream fsSpans("DETGROUPSPANS.txt");
878  for (auto const& cspan : cspans.first) {
879  detGroupSpanInfo(cspan, ss);
880  ss << std::endl;
881  }
882  for (auto const& cspan : cspans.second) {
883  detGroupSpanInfo(cspan, ss);
884  ss << std::endl;
885  }
886  fsSpans << ss.rdbuf();
887  ss.str(std::string());
888 }
void detInfo(const det_t &det, Stream &ss)
Log< level::Warning, true > LogPrint
DetGroupSpanContainerPair detGroupSpans()
std::pair< DetGroupSpanContainer, DetGroupSpanContainer > DetGroupSpanContainerPair

◆ detGroupSpans()

PixelInactiveAreaFinder::DetGroupSpanContainerPair PixelInactiveAreaFinder::detGroupSpans ( )
private

Definition at line 1137 of file PixelInactiveAreaFinder.cc.

References badDetGroupsBarrel(), badDetGroupsEndcap(), and getSpan().

Referenced by createPlottingFiles(), inactiveAreas(), and printBadDetGroupSpans().

1137  {
1138  DetGroupSpanContainer cspansBarrel;
1139  DetGroupSpanContainer cspansEndcap;
1140  DetGroupContainer badDetGroupsBar = badDetGroupsBarrel();
1141  DetGroupContainer badDetGroupsEnd = badDetGroupsEndcap();
1142  for (auto const& detGroup : badDetGroupsBar) {
1143  DetGroupSpan cspan;
1144  getSpan(detGroup, cspan);
1145  cspansBarrel.push_back(cspan);
1146  }
1147  for (auto const& detGroup : badDetGroupsEnd) {
1148  DetGroupSpan cspan;
1149  getSpan(detGroup, cspan);
1150  cspansEndcap.push_back(cspan);
1151  }
1152  return DetGroupSpanContainerPair(cspansBarrel, cspansEndcap);
1153 }
DetGroupContainer badDetGroupsEndcap()
DetGroupContainer badDetGroupsBarrel()
std::vector< DetGroup > DetGroupContainer
std::vector< DetGroupSpan > DetGroupSpanContainer
void getSpan(const DetGroup &detGroup, DetGroupSpan &cspan)
std::pair< DetGroupSpanContainer, DetGroupSpanContainer > DetGroupSpanContainerPair

◆ detInfo()

void PixelInactiveAreaFinder::detInfo ( const det_t det,
Stream ss 
)
private

Definition at line 734 of file PixelInactiveAreaFinder.cc.

References alignBH_cfg::fixed, TrackerGeometry::idToDet(), PVValHelper::ladder, nano_mu_digi_cff::layer, Surface::phiSpan(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TrackerTopology::pxbLadder(), TrackerTopology::pxbLayer(), TrackerTopology::pxbModule(), TrackerTopology::pxfBlade(), TrackerTopology::pxfDisk(), TrackerTopology::pxfPanel(), contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, DetId::subdetId(), GeomDet::surface(), trackerGeometry_, and trackerTopology_.

Referenced by createPlottingFiles(), printBadDetGroups(), printBadPixelDets(), and printPixelDets().

734  {
735  using std::fixed;
736  using std::left;
737  using std::noshowpos;
738  using std::right;
739  using std::setfill;
740  using std::setprecision;
741  using std::setw;
742  using std::showpos;
743  using std::tie;
744  std::string deli = "; ";
745  ss << "id:[" << det << "]" << deli;
746  ss << "subdetid:[" << DetId(det).subdetId() << "]" << deli;
747  if (DetId(det).subdetId() == PixelSubdetector::PixelBarrel) {
748  unsigned int layer = trackerTopology_->pxbLayer(DetId(det));
749  unsigned int ladder = trackerTopology_->pxbLadder(DetId(det));
750  unsigned int module = trackerTopology_->pxbModule(DetId(det));
751  ss << "layer:[" << layer << "]" << deli << "ladder:[" << right << setw(2) << ladder << "]" << deli << "module:["
752  << module << "]" << deli;
753  } else if (DetId(det).subdetId() == PixelSubdetector::PixelEndcap) {
754  unsigned int disk = trackerTopology_->pxfDisk(DetId(det));
755  unsigned int blade = trackerTopology_->pxfBlade(DetId(det));
756  unsigned int panel = trackerTopology_->pxfPanel(DetId(det));
757  ss << left << setw(6) << "disk:"
758  << "[" << right << disk << "]" << deli << left << setw(7) << "blade:"
759  << "[" << setw(2) << right << blade << "]" << deli << left << setw(7) << "panel:"
760  << "[" << right << panel << "]" << deli;
761  }
762  float phiA, phiB, zA, zB, rA, rB;
763  auto detSurface = trackerGeometry_->idToDet(DetId(det))->surface();
764  tie(phiA, phiB) = detSurface.phiSpan();
765  tie(zA, zB) = detSurface.zSpan();
766  tie(rA, rB) = detSurface.rSpan();
767  ss << setprecision(16) << fixed << showpos << setfill(' ') << "phi:[" << right << setw(12) << phiA << "," << left
768  << setw(12) << phiB << "]" << deli << "z:[" << right << setw(7) << zA << "," << left << setw(7) << zB << "]"
769  << deli << noshowpos << "r:[" << right << setw(10) << rA << "," << left << setw(10) << rB << "]" << deli;
770 }
unsigned int pxbLayer(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
unsigned int pxbLadder(const DetId &id) const
unsigned int pxfDisk(const DetId &id) const
std::pair< float, float > const & phiSpan() const
Definition: Surface.h:90
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
const TrackerGeometry * trackerGeometry_
const TrackerGeomDet * idToDet(DetId) const override
unsigned int pxfPanel(const DetId &id) const
Definition: DetId.h:17
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const TrackerTopology * trackerTopology_
unsigned int pxbModule(const DetId &id) const

◆ detWorks()

bool PixelInactiveAreaFinder::detWorks ( det_t  det)
private

Definition at line 890 of file PixelInactiveAreaFinder.cc.

References badPixelDetsBarrel_, badPixelDetsEndcap_, and spr::find().

Referenced by badAdjecentDetsBarrel().

890  {
891  return std::find(badPixelDetsBarrel_.begin(), badPixelDetsBarrel_.end(), det) == badPixelDetsBarrel_.end() &&
893 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

◆ fillDescriptions()

void PixelInactiveAreaFinder::fillDescriptions ( edm::ParameterSetDescription desc)
static

Definition at line 541 of file PixelInactiveAreaFinder.cc.

References submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

Referenced by PixelInactiveAreaTrackingRegionsSeedingLayersProducer::fillDescriptions().

541  {
542  desc.add<std::vector<edm::InputTag>>("inactivePixelDetectorLabels",
543  std::vector<edm::InputTag>{{edm::InputTag("siPixelDigis")}})
544  ->setComment("One or more DetIdCollections of modules to mask on the fly for a given event");
545  desc.add<std::vector<edm::InputTag>>("badPixelFEDChannelCollectionLabels",
546  std::vector<edm::InputTag>{{edm::InputTag("siPixelDigis")}})
547  ->setComment("One or more PixelFEDChannelCollections of modules+ROCs to mask on the fly for a given event");
548  desc.add<bool>("ignoreSingleFPixPanelModules", false);
549 
550  desc.addUntracked<bool>("debug", false);
551  desc.addUntracked<bool>("createPlottingFiles", false);
552 }

◆ getBadPixelDets()

void PixelInactiveAreaFinder::getBadPixelDets ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 688 of file PixelInactiveAreaFinder.cc.

References badPixelDetsBarrel_, badPixelDetsEndcap_, badPixelFEDChannelsTokens_, edm::EventSetup::getData(), l1ctLayer2EG_cff::id, iEvent, inactivePixelDetectorTokens_, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, pixelQualityToken_, jetUpdater_cfi::sort, unpackBuffers-CaloStage2::token, and tier0::unique().

Referenced by inactiveAreas().

688  {
689  auto addDetId = [&](const auto id) {
690  const auto detid = DetId(id);
691  const auto subdet = detid.subdetId();
692  if (subdet == PixelSubdetector::PixelBarrel) {
693  badPixelDetsBarrel_.push_back(detid.rawId());
694  } else if (subdet == PixelSubdetector::PixelEndcap) {
695  badPixelDetsEndcap_.push_back(detid.rawId());
696  }
697  };
698 
699  // SiPixelQuality
700  auto const& pixelQuality = iSetup.getData(pixelQualityToken_);
701 
702  for (auto const& disabledModule : pixelQuality.getBadComponentList()) {
703  addDetId(disabledModule.DetID);
704  }
705 
706  // dynamic bad modules
707  for (const auto& token : inactivePixelDetectorTokens_) {
709  iEvent.getByToken(token, detIds);
710  for (const auto& id : *detIds) {
711  addDetId(id);
712  }
713  }
714 
715  // dynamic bad ROCs ("Fed25")
716  // TODO: consider moving to finer-grained areas for inactive ROCs
717  for (const auto& token : badPixelFEDChannelsTokens_) {
718  edm::Handle<PixelFEDChannelCollection> pixelFEDChannelCollectionHandle;
719  iEvent.getByToken(token, pixelFEDChannelCollectionHandle);
720  for (const auto& disabledChannels : *pixelFEDChannelCollectionHandle) {
721  addDetId(disabledChannels.detId());
722  }
723  }
724 
725  // remove duplicates
729  badPixelDetsBarrel_.end());
731  badPixelDetsEndcap_.end());
732 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::vector< edm::EDGetTokenT< DetIdCollection > > inactivePixelDetectorTokens_
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > pixelQualityToken_
int iEvent
Definition: GenABIO.cc:224
def unique(seq, keepstr=True)
Definition: tier0.py:24
std::vector< edm::EDGetTokenT< PixelFEDChannelCollection > > badPixelFEDChannelsTokens_
Definition: DetId.h:17

◆ getPhiSpanBarrel()

void PixelInactiveAreaFinder::getPhiSpanBarrel ( const DetGroup detGroup,
DetGroupSpan cspan 
)
private

Definition at line 1002 of file PixelInactiveAreaFinder.cc.

References PixelInactiveAreaFinder::DetGroupSpan::disk, geometryDiff::epsilon, mps_fire::i, TrackerGeometry::idToDet(), createfilelist::int, PixelInactiveAreaFinder::DetGroupSpan::layer, nBPixLadders, PixelInactiveAreaFinder::DetGroupSpan::phiSpan, Surface::phiSpan(), TrackerTopology::pxbDetId(), TrackerTopology::pxbLadder(), TrackerTopology::pxbLayer(), GeomDet::surface(), trackerGeometry_, trackerTopology_, and parallelization::uint.

Referenced by getSpan(), and printBadDetGroups().

1002  {
1003  // find phiSpan using ordered vector of unique ladders in detGroup
1004  if (detGroup.empty()) {
1005  cspan = DetGroupSpan();
1006  return;
1007  } else {
1008  cspan.layer = trackerTopology_->pxbLayer(DetId(detGroup[0]));
1009  cspan.disk = 0;
1010  }
1011  using uint = unsigned int;
1012  using LadderSet = std::set<uint>;
1013  using LadVec = std::vector<uint>;
1014  LadderSet lads;
1015  for (auto const& det : detGroup) {
1016  lads.insert(trackerTopology_->pxbLadder(DetId(det)));
1017  }
1018  LadVec ladv(lads.begin(), lads.end());
1019  uint nLadders = nBPixLadders[cspan.layer];
1020  // find start ladder of detGroup
1021  uint i = 0;
1022  uint currentLadder = ladv[0];
1023  uint previousLadder = ladv[(ladv.size() + i - 1) % ladv.size()];
1024  // loop until discontinuity is found from vector
1025  while ((nLadders + currentLadder - 1) % nLadders == previousLadder) {
1026  ++i;
1027  currentLadder = ladv[i % ladv.size()];
1028  previousLadder = ladv[(ladv.size() + i - 1) % ladv.size()];
1029  if (i == ladv.size()) {
1030  cspan.phiSpan.first = std::numeric_limits<float>::epsilon();
1031  cspan.phiSpan.second = -std::numeric_limits<float>::epsilon();
1032  return;
1033  }
1034  }
1035  uint startLadder = currentLadder;
1036  uint endLadder = previousLadder;
1037  auto detStart = trackerTopology_->pxbDetId(cspan.layer, startLadder, 1);
1038  auto detEnd = trackerTopology_->pxbDetId(cspan.layer, endLadder, 1);
1039  cspan.phiSpan.first = trackerGeometry_->idToDet(detStart)->surface().phiSpan().first;
1040  cspan.phiSpan.second = trackerGeometry_->idToDet(detEnd)->surface().phiSpan().second;
1041 }
unsigned int pxbLayer(const DetId &id) const
std::array< unsigned short, 4 > nBPixLadders
unsigned int pxbLadder(const DetId &id) const
std::pair< float, float > const & phiSpan() const
Definition: Surface.h:90
const TrackerGeometry * trackerGeometry_
DetId pxbDetId(uint32_t layer, uint32_t ladder, uint32_t module) const
const TrackerGeomDet * idToDet(DetId) const override
Definition: DetId.h:17
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const TrackerTopology * trackerTopology_

◆ getPhiSpanEndcap()

void PixelInactiveAreaFinder::getPhiSpanEndcap ( const DetGroup detGroup,
DetGroupSpan cspan 
)
private

Definition at line 1042 of file PixelInactiveAreaFinder.cc.

References counter, geometryDiff::epsilon, newFWLiteAna::found, PixelInactiveAreaFinder::DetGroupSpan::phiSpan, contentValuesCheck::ss, and trackerGeometry_.

Referenced by getSpan(), and printBadDetGroups().

1042  {
1043  // this is quite naive/bruteforce method
1044  // 1) it starts by taking one detector from detGroup and starts to compare it to others
1045  // 2) when it finds overlapping detector in clockwise direction it starts comparing
1046  // found detector to others
1047  // 3) search stops until no overlapping detectors in clockwise detector or all detectors
1048  // have been work detector
1049  Stream ss;
1050  bool found = false;
1051  auto const tGeom = trackerGeometry_;
1052  DetGroup::const_iterator startDetIter = detGroup.begin();
1053  Span_t phiSpan, phiSpanComp;
1054  unsigned int counter = 0;
1055  while (!found) {
1056  phiSpan = tGeom->idToDet(DetId(*startDetIter))->surface().phiSpan();
1057  for (DetGroup::const_iterator compDetIter = detGroup.begin(); compDetIter != detGroup.end(); ++compDetIter) {
1058  phiSpanComp = tGeom->idToDet(DetId(*compDetIter))->surface().phiSpan();
1059  if (phiRangesOverlap(phiSpan, phiSpanComp) && phiMoreClockwise(phiSpanComp.first, phiSpan.first) &&
1060  startDetIter != compDetIter) {
1061  ++counter;
1062  if (counter > detGroup.size()) {
1063  cspan.phiSpan.first = std::numeric_limits<float>::epsilon();
1064  cspan.phiSpan.second = -std::numeric_limits<float>::epsilon();
1065  return;
1066  }
1067  startDetIter = compDetIter;
1068  break;
1069  } else if (compDetIter == detGroup.end() - 1) {
1070  found = true;
1071  }
1072  }
1073  }
1074  cspan.phiSpan.first = phiSpan.first;
1075  // second with same method}
1076  found = false;
1077  DetGroup::const_iterator endDetIter = detGroup.begin();
1078  counter = 0;
1079  while (!found) {
1080  phiSpan = tGeom->idToDet(DetId(*endDetIter))->surface().phiSpan();
1081  for (DetGroup::const_iterator compDetIter = detGroup.begin(); compDetIter != detGroup.end(); ++compDetIter) {
1082  phiSpanComp = tGeom->idToDet(DetId(*compDetIter))->surface().phiSpan();
1083  if (phiRangesOverlap(phiSpan, phiSpanComp) && phiMoreCounterclockwise(phiSpanComp.second, phiSpan.second) &&
1084  endDetIter != compDetIter) {
1085  ++counter;
1086  if (counter > detGroup.size()) {
1087  cspan.phiSpan.first = std::numeric_limits<float>::epsilon();
1088  cspan.phiSpan.second = -std::numeric_limits<float>::epsilon();
1089  return;
1090  }
1091  endDetIter = compDetIter;
1092  break;
1093  } else if (compDetIter == detGroup.end() - 1) {
1094  found = true;
1095  }
1096  }
1097  }
1098  cspan.phiSpan.second = phiSpan.second;
1099 }
const TrackerGeometry * trackerGeometry_
Definition: DetId.h:17
static std::atomic< unsigned int > counter

◆ getRSpan()

void PixelInactiveAreaFinder::getRSpan ( const DetGroup detGroup,
DetGroupSpan cspan 
)
private

Definition at line 1110 of file PixelInactiveAreaFinder.cc.

References TrackerGeometry::idToDet(), PixelInactiveAreaFinder::DetGroupSpan::rSpan, Surface::rSpan(), GeomDet::surface(), and trackerGeometry_.

Referenced by getSpan(), and printBadDetGroups().

1110  {
1111  auto cmpFun = [this](det_t detA, det_t detB) {
1112  return trackerGeometry_->idToDet(DetId(detA))->surface().rSpan().first <
1113  trackerGeometry_->idToDet(DetId(detB))->surface().rSpan().first;
1114  };
1115 
1116  auto minmaxIters = std::minmax_element(detGroup.begin(), detGroup.end(), cmpFun);
1117  cspan.rSpan.first = trackerGeometry_->idToDet(DetId(*(minmaxIters.first)))->surface().rSpan().first;
1118  cspan.rSpan.second = trackerGeometry_->idToDet(DetId(*(minmaxIters.second)))->surface().rSpan().second;
1119 }
std::pair< float, float > const & rSpan() const
Definition: Surface.h:92
const TrackerGeometry * trackerGeometry_
const TrackerGeomDet * idToDet(DetId) const override
Definition: DetId.h:17
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37

◆ getSpan()

void PixelInactiveAreaFinder::getSpan ( const DetGroup detGroup,
DetGroupSpan cspan 
)
private

Definition at line 1120 of file PixelInactiveAreaFinder.cc.

References PixelInactiveAreaFinder::DetGroupSpan::disk, getPhiSpanBarrel(), getPhiSpanEndcap(), getRSpan(), getZSpan(), PixelInactiveAreaFinder::DetGroupSpan::layer, TrackerTopology::pxbLayer(), TrackerTopology::pxfDisk(), PixelInactiveAreaFinder::DetGroupSpan::subdetId, DetId::subdetId(), and trackerTopology_.

Referenced by detGroupSpans().

1120  {
1121  auto firstDetIt = detGroup.begin();
1122  if (firstDetIt != detGroup.end()) {
1123  cspan.subdetId = DetId(*firstDetIt).subdetId();
1124  if (cspan.subdetId == 1) {
1125  cspan.layer = trackerTopology_->pxbLayer(DetId(*firstDetIt));
1126  cspan.disk = 0;
1127  getPhiSpanBarrel(detGroup, cspan);
1128  } else if (cspan.subdetId == 2) {
1129  cspan.disk = trackerTopology_->pxfDisk(DetId(*firstDetIt));
1130  cspan.layer = 0;
1131  getPhiSpanEndcap(detGroup, cspan);
1132  }
1133  getZSpan(detGroup, cspan);
1134  getRSpan(detGroup, cspan);
1135  }
1136 }
unsigned int pxbLayer(const DetId &id) const
void getRSpan(const DetGroup &detGroup, DetGroupSpan &cspan)
void getPhiSpanBarrel(const DetGroup &detGroup, DetGroupSpan &cspan)
unsigned int pxfDisk(const DetId &id) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: DetId.h:17
const TrackerTopology * trackerTopology_
void getPhiSpanEndcap(const DetGroup &detGroup, DetGroupSpan &cspan)
void getZSpan(const DetGroup &detGroup, DetGroupSpan &cspan)

◆ getZSpan()

void PixelInactiveAreaFinder::getZSpan ( const DetGroup detGroup,
DetGroupSpan cspan 
)
private

Definition at line 1100 of file PixelInactiveAreaFinder.cc.

References TrackerGeometry::idToDet(), GeomDet::surface(), trackerGeometry_, PixelInactiveAreaFinder::DetGroupSpan::zSpan, and Surface::zSpan().

Referenced by getSpan(), and printBadDetGroups().

1100  {
1101  auto cmpFun = [this](det_t detA, det_t detB) {
1102  return trackerGeometry_->idToDet(DetId(detA))->surface().zSpan().first <
1103  trackerGeometry_->idToDet(DetId(detB))->surface().zSpan().first;
1104  };
1105 
1106  auto minmaxIters = std::minmax_element(detGroup.begin(), detGroup.end(), cmpFun);
1107  cspan.zSpan.first = trackerGeometry_->idToDet(DetId(*(minmaxIters.first)))->surface().zSpan().first;
1108  cspan.zSpan.second = trackerGeometry_->idToDet(DetId(*(minmaxIters.second)))->surface().zSpan().second;
1109 }
std::pair< float, float > const & zSpan() const
Definition: Surface.h:91
const TrackerGeometry * trackerGeometry_
const TrackerGeomDet * idToDet(DetId) const override
Definition: DetId.h:17
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37

◆ inactiveAreas()

PixelInactiveAreaFinder::InactiveAreas PixelInactiveAreaFinder::inactiveAreas ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)

Definition at line 554 of file PixelInactiveAreaFinder.cc.

References badPixelDetsBarrel_, badPixelDetsEndcap_, Barrel, createPlottingFiles(), createPlottingFiles_, debug_, detGroupSpans(), HLT_2024v11_cff::distance, spr::find(), newFWLiteAna::found, getBadPixelDets(), edm::EventSetup::getData(), iEvent, inactiveLayers_, inactiveLayerSetIndices_, nano_mu_digi_cff::layer, layerSetIndexInactiveToActive_, eostools::move(), NegEndcap, GeomDetEnumerators::PixelBarrel, PixelSubdetector::PixelBarrel, GeomDetEnumerators::PixelEndcap, PosEndcap, push_back(), runTheMatrix::ret, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::side(), trackerGeometry_, trackerGeometryToken_, trackerTopology_, trackerTopologyToken_, and updatePixelDets().

Referenced by PixelInactiveAreaTrackingRegionsSeedingLayersProducer::produce().

555  {
556  // Set data to handles
559 
560  // assign data to instance variables
561  updatePixelDets(iSetup);
562 
563  // clear the list of bad pixel modules at each event!
564  badPixelDetsBarrel_.clear();
565  badPixelDetsEndcap_.clear();
566  getBadPixelDets(iEvent, iSetup);
567 
568  //write files for plotting
569  if (createPlottingFiles_) {
571  }
572 
573  // find detGroupSpans ie phi,r,z limits for detector detGroups that are not working
574  // returns pair where first is barrel spans and second endcap spans
576 
577  // map spans to a vector with consistent indexing with inactiveLayers_ and inactiveLayerSetIndices_
578  // TODO: try to move the inner logic towards this direction as well
579  std::vector<DetGroupSpanContainer> spans(inactiveLayers_.size());
580 
581  auto doWork = [&](const DetGroupSpanContainer& container) {
582  for (const auto& span : container) {
583  const auto subdet = span.subdetId == PixelSubdetector::PixelBarrel ? GeomDetEnumerators::PixelBarrel
585  const auto side = (subdet == GeomDetEnumerators::PixelBarrel
587  : (span.zSpan.first < 0 ? TrackerDetSide::NegEndcap : TrackerDetSide::PosEndcap));
588  const auto layer = subdet == GeomDetEnumerators::PixelBarrel ? span.layer : span.disk;
589  auto found = std::find(inactiveLayers_.begin(), inactiveLayers_.end(), SeedingLayerId(subdet, side, layer));
590  if (found != inactiveLayers_.end()) { // it is possible that this layer is ignored by the configuration
591  spans[std::distance(inactiveLayers_.begin(), found)].push_back(span);
592  }
593  }
594  };
595  doWork(cspans.first);
596  doWork(cspans.second);
597 
598  auto ret =
600 
601  if (debug_) {
602  printOverlapSpans(ret);
603  }
604 
605  return ret;
606 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
SeedingLayerSetsBuilder::SeedingLayerId SeedingLayerId
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
ret
prodAgent to be discontinued
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
void updatePixelDets(const edm::EventSetup &iSetup)
std::vector< std::pair< unsigned short, unsigned short > > inactiveLayerSetIndices_
int iEvent
Definition: GenABIO.cc:224
const TrackerGeometry * trackerGeometry_
void getBadPixelDets(const edm::Event &iEvent, const edm::EventSetup &iSetup)
const TrackerTopology * trackerTopology_
std::vector< DetGroupSpan > DetGroupSpanContainer
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
DetGroupSpanContainerPair detGroupSpans()
std::pair< DetGroupSpanContainer, DetGroupSpanContainer > DetGroupSpanContainerPair
std::vector< std::vector< LayerSetIndex > > layerSetIndexInactiveToActive_
def move(src, dest)
Definition: eostools.py:511
std::vector< SeedingLayerId > inactiveLayers_

◆ printBadDetGroups()

void PixelInactiveAreaFinder::printBadDetGroups ( )
private

Definition at line 801 of file PixelInactiveAreaFinder.cc.

References badDetGroupsBarrel(), badDetGroupsEndcap(), detInfo(), getPhiSpanBarrel(), getPhiSpanEndcap(), getRSpan(), getZSpan(), and contentValuesCheck::ss.

801  {
802  DetGroupContainer badDetGroupsBar = badDetGroupsBarrel();
803  DetGroupContainer badDetGroupsEnd = badDetGroupsEndcap();
804  Stream ss;
805  for (auto const& detGroup : badDetGroupsBar) {
806  ss << std::setfill(' ') << std::left << std::setw(16) << "DetGroup:";
807  DetGroupSpan cspan;
808  getPhiSpanBarrel(detGroup, cspan);
809  getZSpan(detGroup, cspan);
810  getRSpan(detGroup, cspan);
811  detGroupSpanInfo(cspan, ss);
812  ss << std::endl;
813  for (auto const& det : detGroup) {
814  detInfo(det, ss);
815  ss << std::endl;
816  }
817  ss << std::endl;
818  }
819  for (auto const& detGroup : badDetGroupsEnd) {
820  ss << std::setfill(' ') << std::left << std::setw(16) << "DetGroup:";
821  DetGroupSpan cspan;
822  getPhiSpanEndcap(detGroup, cspan);
823  getZSpan(detGroup, cspan);
824  getRSpan(detGroup, cspan);
825  detGroupSpanInfo(cspan, ss);
826  ss << std::endl;
827  for (auto const& det : detGroup) {
828  detInfo(det, ss);
829  ss << std::endl;
830  }
831  ss << std::endl;
832  }
833  edm::LogPrint("PixelInactiveAreaFinder") << ss.str();
834 }
void getRSpan(const DetGroup &detGroup, DetGroupSpan &cspan)
DetGroupContainer badDetGroupsEndcap()
void getPhiSpanBarrel(const DetGroup &detGroup, DetGroupSpan &cspan)
void detInfo(const det_t &det, Stream &ss)
DetGroupContainer badDetGroupsBarrel()
Log< level::Warning, true > LogPrint
std::vector< DetGroup > DetGroupContainer
void getPhiSpanEndcap(const DetGroup &detGroup, DetGroupSpan &cspan)
void getZSpan(const DetGroup &detGroup, DetGroupSpan &cspan)

◆ printBadDetGroupSpans()

void PixelInactiveAreaFinder::printBadDetGroupSpans ( )
private

Definition at line 835 of file PixelInactiveAreaFinder.cc.

References detGroupSpans(), and contentValuesCheck::ss.

835  {
837  Stream ss;
838  for (auto const& cspan : cspans.first) {
839  detGroupSpanInfo(cspan, ss);
840  ss << std::endl;
841  }
842  for (auto const& cspan : cspans.second) {
843  detGroupSpanInfo(cspan, ss);
844  ss << std::endl;
845  }
846  edm::LogPrint("PixelInactiveAreaFinder") << ss.str();
847 }
Log< level::Warning, true > LogPrint
DetGroupSpanContainerPair detGroupSpans()
std::pair< DetGroupSpanContainer, DetGroupSpanContainer > DetGroupSpanContainerPair

◆ printBadPixelDets()

void PixelInactiveAreaFinder::printBadPixelDets ( )
private

Definition at line 786 of file PixelInactiveAreaFinder.cc.

References badPixelDetsBarrel_, badPixelDetsEndcap_, detInfo(), contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

786  {
787  edm::LogPrint("PixelInactiveAreaFinder") << "Bad barrel detectors:";
788  Stream ss;
789  for (auto const& det : badPixelDetsBarrel_) {
790  detInfo(det, ss);
791  edm::LogPrint("PixelInactiveAreaFinder") << ss.str();
792  ss.str(std::string());
793  }
794  edm::LogPrint("PixelInactiveAreaFinder") << "Endcap detectors;";
795  for (auto const& det : badPixelDetsEndcap_) {
796  detInfo(det, ss);
797  edm::LogPrint("PixelInactiveAreaFinder") << ss.str();
798  ss.str(std::string());
799  }
800 }
void detInfo(const det_t &det, Stream &ss)
Log< level::Warning, true > LogPrint

◆ printPixelDets()

void PixelInactiveAreaFinder::printPixelDets ( )
private

Definition at line 771 of file PixelInactiveAreaFinder.cc.

References detInfo(), pixelDetsBarrel_, pixelDetsEndcap_, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

771  {
772  edm::LogPrint("PixelInactiveAreaFinder") << "Barrel detectors:";
773  Stream ss;
774  for (auto const& det : pixelDetsBarrel_) {
775  detInfo(det, ss);
776  edm::LogPrint("PixelInactiveAreaFinder") << ss.str();
777  ss.str(std::string());
778  }
779  edm::LogPrint("PixelInactiveAreaFinder") << "Endcap detectors;";
780  for (auto const& det : pixelDetsEndcap_) {
781  detInfo(det, ss);
782  edm::LogPrint("PixelInactiveAreaFinder") << ss.str();
783  ss.str(std::string());
784  }
785 }
void detInfo(const det_t &det, Stream &ss)
Log< level::Warning, true > LogPrint

◆ reachableDetGroup()

PixelInactiveAreaFinder::DetGroup PixelInactiveAreaFinder::reachableDetGroup ( const det_t initDet,
DetectorSet foundDets 
)
private

Definition at line 945 of file PixelInactiveAreaFinder.cc.

References badAdjecentDetsBarrel(), badAdjecentDetsEndcap(), PixelSubdetector::PixelBarrel, and PixelSubdetector::PixelEndcap.

Referenced by badDetGroupsBarrel(), and badDetGroupsEndcap().

946  {
948  std::queue<det_t> workQueue;
949  det_t workDet;
950  DetGroup badAdjDets;
951  foundDets.insert(initDet);
952  workQueue.push(initDet);
953  reachableDetGroup.push_back(initDet);
954  while (!workQueue.empty()) {
955  workDet = workQueue.front();
956  workQueue.pop();
957  if (DetId(workDet).subdetId() == PixelSubdetector::PixelBarrel) {
958  badAdjDets = this->badAdjecentDetsBarrel(workDet);
959  } else if (DetId(workDet).subdetId() == PixelSubdetector::PixelEndcap) {
960  badAdjDets = this->badAdjecentDetsEndcap(workDet);
961  } else {
962  badAdjDets = {};
963  }
964  for (auto const& badDet : badAdjDets) {
965  if (foundDets.find(badDet) == foundDets.end()) {
966  reachableDetGroup.push_back(badDet);
967  foundDets.insert(badDet);
968  workQueue.push(badDet);
969  }
970  }
971  }
972  return reachableDetGroup;
973 }
DetGroup reachableDetGroup(const det_t &initDet, DetectorSet &foundDets)
DetGroup badAdjecentDetsBarrel(const det_t &det)
Definition: DetId.h:17
DetGroup badAdjecentDetsEndcap(const det_t &det)

◆ updatePixelDets()

void PixelInactiveAreaFinder::updatePixelDets ( const edm::EventSetup iSetup)
private

Definition at line 609 of file PixelInactiveAreaFinder.cc.

References edm::ESWatcher< T >::check(), dqmiodumpmetadata::counts, createPlottingFiles_, TrackerGeometry::detsPXB(), TrackerGeometry::detsPXF(), mps_fire::end, Exception, geometryWatcher_, PVValHelper::ladder, nano_mu_digi_cff::layer, TrackerTopology::layer(), LogDebug, LogTrace, nBPixLadders, nModulesPerLadder, TrackerGeometry::numberOfLayers(), PixelSubdetector::PixelBarrel, pixelDetsBarrel_, pixelDetsEndcap_, PixelSubdetector::PixelEndcap, TrackerTopology::pxbLadder(), jetUpdater_cfi::sort, trackerGeometry_, trackerTopology_, and heppy_batch::val.

Referenced by inactiveAreas().

609  {
610  if (!geometryWatcher_.check(iSetup))
611  return;
612 
613  // deduce the number of ladders per layer and the number of modules per ladder
614  {
615  // sanity checks
617  throw cms::Exception("NotImplemented")
618  << "This module supports only a detector with 4 pixel barrel layers, the current geometry has "
620  }
622  throw cms::Exception("NotImplemented")
623  << "This module supports only a detector with 3 pixel forward disks, the current geometry has "
625  }
626 
627  std::array<std::array<unsigned short, 100>, 4> counts = {}; // assume at most 100 ladders per layer
628  for (const auto& det : trackerGeometry_->detsPXB()) {
629  const auto layer = trackerTopology_->layer(det->geographicalId());
630  const auto ladder = trackerTopology_->pxbLadder(det->geographicalId());
631  if (ladder >= 100) {
632  throw cms::Exception("LogicError")
633  << "Got a ladder with number " << ladder
634  << " while the expected maximum was 100; either something is wrong or the maximum has to be increased.";
635  }
636  counts[layer - 1][ladder - 1] += 1; // numbering of layer and ladder starts at 1
637  }
638 
639  // take number of modules per ladder from the first ladder of the first layer (such better exist)
640  // other ladders better have the same number
641  nModulesPerLadder = counts[0][0];
642  if (nModulesPerLadder == 0) {
643  throw cms::Exception("LogicError") << "Ladder 1 of layer 1 has 0 modules, something fishy is going on.";
644  }
645 
646  LogDebug("PixelInactiveAreaFinder") << "Number of modules per ladder " << nModulesPerLadder
647  << "; below are number of ladders per layer";
648 
649  // number of ladders
650  for (unsigned layer = 0; layer < 4; ++layer) {
652  std::count_if(counts[layer].begin(), counts[layer].end(), [](unsigned short val) { return val > 0; });
653  LogTrace("PixelInactiveAreaFinder")
654  << "BPix layer " << (layer + 1) << " has " << nBPixLadders[layer] << " ladders";
655 
656  auto fail = std::count_if(counts[layer].begin(), counts[layer].end(), [&](unsigned short val) {
657  return val != nModulesPerLadder && val > 0;
658  });
659  if (fail != 0) {
660  throw cms::Exception("LogicError")
661  << "Layer " << (layer + 1) << " had " << fail
662  << " ladders whose number of modules/ladder differed from the ladder 1 of layer 1 (" << nModulesPerLadder
663  << "). Something fishy is going on.";
664  }
665  }
666  }
667 
668  // don't bother with the rest if not needed
670  return;
671 
672  pixelDetsBarrel_.clear();
673  pixelDetsEndcap_.clear();
674 
675  for (auto const& geomDetPtr : trackerGeometry_->detsPXB()) {
676  if (geomDetPtr->geographicalId().subdetId() == PixelSubdetector::PixelBarrel) {
677  pixelDetsBarrel_.push_back(geomDetPtr->geographicalId().rawId());
678  }
679  }
680  for (auto const& geomDetPtr : trackerGeometry_->detsPXF()) {
681  if (geomDetPtr->geographicalId().subdetId() == PixelSubdetector::PixelEndcap) {
682  pixelDetsEndcap_.push_back(geomDetPtr->geographicalId().rawId());
683  }
684  }
687 }
const DetContainer & detsPXB() const
unsigned int numberOfLayers(int subdet) const
std::array< unsigned short, 4 > nBPixLadders
const DetContainer & detsPXF() const
unsigned int pxbLadder(const DetId &id) const
unsigned int layer(const DetId &id) const
#define LogTrace(id)
const TrackerGeometry * trackerGeometry_
const TrackerTopology * trackerTopology_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
#define LogDebug(id)
edm::ESWatcher< TrackerDigiGeometryRecord > geometryWatcher_

Member Data Documentation

◆ badPixelDetsBarrel_

DetContainer PixelInactiveAreaFinder::badPixelDetsBarrel_
private

◆ badPixelDetsEndcap_

DetContainer PixelInactiveAreaFinder::badPixelDetsEndcap_
private

◆ badPixelFEDChannelsTokens_

std::vector<edm::EDGetTokenT<PixelFEDChannelCollection> > PixelInactiveAreaFinder::badPixelFEDChannelsTokens_
private

Definition at line 91 of file PixelInactiveAreaFinder.h.

Referenced by getBadPixelDets().

◆ createPlottingFiles_

const bool PixelInactiveAreaFinder::createPlottingFiles_
private

Definition at line 82 of file PixelInactiveAreaFinder.h.

Referenced by inactiveAreas(), and updatePixelDets().

◆ debug_

const bool PixelInactiveAreaFinder::debug_
private

Definition at line 81 of file PixelInactiveAreaFinder.h.

Referenced by inactiveAreas().

◆ geometryWatcher_

edm::ESWatcher<TrackerDigiGeometryRecord> PixelInactiveAreaFinder::geometryWatcher_
private

Definition at line 111 of file PixelInactiveAreaFinder.h.

Referenced by updatePixelDets().

◆ ignoreSingleFPixPanelModules_

const bool PixelInactiveAreaFinder::ignoreSingleFPixPanelModules_
private

Definition at line 83 of file PixelInactiveAreaFinder.h.

Referenced by badDetGroupsEndcap().

◆ inactiveLayers_

std::vector<SeedingLayerId> PixelInactiveAreaFinder::inactiveLayers_
private

Definition at line 85 of file PixelInactiveAreaFinder.h.

Referenced by inactiveAreas().

◆ inactiveLayerSetIndices_

std::vector<std::pair<unsigned short, unsigned short> > PixelInactiveAreaFinder::inactiveLayerSetIndices_
private

Definition at line 86 of file PixelInactiveAreaFinder.h.

Referenced by inactiveAreas().

◆ inactivePixelDetectorTokens_

std::vector<edm::EDGetTokenT<DetIdCollection> > PixelInactiveAreaFinder::inactivePixelDetectorTokens_
private

Definition at line 90 of file PixelInactiveAreaFinder.h.

Referenced by getBadPixelDets().

◆ layerSetIndexInactiveToActive_

std::vector<std::vector<LayerSetIndex> > PixelInactiveAreaFinder::layerSetIndexInactiveToActive_
private

◆ nBPixLadders

std::array<unsigned short, 4> PixelInactiveAreaFinder::nBPixLadders
private

◆ nModulesPerLadder

unsigned short PixelInactiveAreaFinder::nModulesPerLadder
private

Definition at line 102 of file PixelInactiveAreaFinder.h.

Referenced by badAdjecentDetsBarrel(), and updatePixelDets().

◆ pixelDetsBarrel_

DetContainer PixelInactiveAreaFinder::pixelDetsBarrel_
private

Definition at line 117 of file PixelInactiveAreaFinder.h.

Referenced by createPlottingFiles(), printPixelDets(), and updatePixelDets().

◆ pixelDetsEndcap_

DetContainer PixelInactiveAreaFinder::pixelDetsEndcap_
private

Definition at line 118 of file PixelInactiveAreaFinder.h.

Referenced by createPlottingFiles(), printPixelDets(), and updatePixelDets().

◆ pixelQuality_

const SiPixelQuality* PixelInactiveAreaFinder::pixelQuality_ = nullptr
private

Definition at line 113 of file PixelInactiveAreaFinder.h.

◆ pixelQualityToken_

edm::ESGetToken<SiPixelQuality, SiPixelQualityRcd> PixelInactiveAreaFinder::pixelQualityToken_
private

Definition at line 94 of file PixelInactiveAreaFinder.h.

Referenced by getBadPixelDets().

◆ trackerGeometry_

const TrackerGeometry* PixelInactiveAreaFinder::trackerGeometry_ = nullptr
private

◆ trackerGeometryToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> PixelInactiveAreaFinder::trackerGeometryToken_
private

Definition at line 92 of file PixelInactiveAreaFinder.h.

Referenced by inactiveAreas().

◆ trackerTopology_

const TrackerTopology* PixelInactiveAreaFinder::trackerTopology_ = nullptr
private

◆ trackerTopologyToken_

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> PixelInactiveAreaFinder::trackerTopologyToken_
private

Definition at line 93 of file PixelInactiveAreaFinder.h.

Referenced by inactiveAreas().