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:303
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
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
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 890 of file PixelInactiveAreaFinder.cc.

References HltBtagPostValidation_cff::c, detWorks(), PVValHelper::ladder, pixelTopology::layer, callgraph::module, nBPixLadders, nModulesPerLadder, and trackerTopology_.

Referenced by reachableDetGroup().

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

◆ badAdjecentDetsEndcap()

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

Definition at line 916 of file PixelInactiveAreaFinder.cc.

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

Referenced by reachableDetGroup().

916  {
917  // this might be faster if adjecent
918  using std::ignore;
919  using std::tie;
920  DetGroup adj;
921  Span_t phiSpan, phiSpanComp;
922  float z, zComp;
923  unsigned int disk, diskComp;
924  auto const& detSurf = trackerGeometry_->idToDet(DetId(det))->surface();
925  phiSpan = detSurf.phiSpan();
926  tie(z, ignore) = detSurf.zSpan();
927  disk = trackerTopology_->pxfDisk(DetId(det));
928  // add detectors from same disk whose phi ranges overlap to the adjecent list
929  for (auto const& detComp : badPixelDetsEndcap_) {
930  auto const& detIdComp = DetId(detComp);
931  auto const& detSurfComp = trackerGeometry_->idToDet(detIdComp)->surface();
932  diskComp = trackerTopology_->pxfDisk(detIdComp);
933  phiSpanComp = detSurfComp.phiSpan();
934  tie(zComp, ignore) = detSurfComp.zSpan();
935  if (det != detComp && disk == diskComp && z * zComp > 0 && phiRangesOverlap(phiSpan, phiSpanComp)) {
936  adj.push_back(detComp);
937  }
938  }
939  return adj;
940 }
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 970 of file PixelInactiveAreaFinder.cc.

References badPixelDetsBarrel_, and reachableDetGroup().

Referenced by detGroupSpans(), and printBadDetGroups().

970  {
971  DetGroupContainer detGroups;
972  DetectorSet foundDets;
973  for (auto const& badDet : badPixelDetsBarrel_) {
974  if (foundDets.find(badDet) == foundDets.end()) {
975  detGroups.push_back(this->reachableDetGroup(badDet, foundDets));
976  }
977  }
978  return detGroups;
979 }
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 980 of file PixelInactiveAreaFinder.cc.

References badPixelDetsEndcap_, ignoreSingleFPixPanelModules_, and reachableDetGroup().

Referenced by detGroupSpans(), and printBadDetGroups().

980  {
981  DetGroupContainer detGroups;
982  DetectorSet foundDets;
983  for (auto const& badDet : badPixelDetsEndcap_) {
984  if (foundDets.find(badDet) == foundDets.end()) {
985  auto adjacentDets = this->reachableDetGroup(badDet, foundDets);
986  if (ignoreSingleFPixPanelModules_ && adjacentDets.size() == 1) {
987  // size==1 means that only a single panel of a blade was inactive
988  // because of the large overlap with the other panel (i.e.
989  // redundancy in the detectory) ignoring these may help to decrease fakes
990  continue;
991  }
992  detGroups.push_back(adjacentDets);
993  }
994  }
995  return detGroups;
996 }
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 844 of file PixelInactiveAreaFinder.cc.

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

Referenced by inactiveAreas().

844  {
845  // All detectors to file DETECTORS
846  Stream ss;
847  std::ofstream fsDet("DETECTORS.txt");
848  for (auto const& det : pixelDetsBarrel_) {
849  detInfo(det, ss);
850  ss << std::endl;
851  }
852  edm::LogPrint("PixelInactiveAreaFinder") << "Endcap detectors;";
853  for (auto const& det : pixelDetsEndcap_) {
854  detInfo(det, ss);
855  ss << std::endl;
856  }
857  fsDet << ss.rdbuf();
858  ss.str(std::string());
859  // Bad detectors
860  std::ofstream fsBadDet("BADDETECTORS.txt");
861  for (auto const& det : badPixelDetsBarrel_) {
862  detInfo(det, ss);
863  ss << std::endl;
864  }
865  for (auto const& det : badPixelDetsEndcap_) {
866  detInfo(det, ss);
867  ss << std::endl;
868  }
869  fsBadDet << ss.rdbuf();
870  ss.str(std::string());
871  // detgroupspans
872  std::ofstream fsSpans("DETGROUPSPANS.txt");
874  for (auto const& cspan : cspans.first) {
875  detGroupSpanInfo(cspan, ss);
876  ss << std::endl;
877  }
878  for (auto const& cspan : cspans.second) {
879  detGroupSpanInfo(cspan, ss);
880  ss << std::endl;
881  }
882  fsSpans << ss.rdbuf();
883  ss.str(std::string());
884 }
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 1133 of file PixelInactiveAreaFinder.cc.

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

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

1133  {
1134  DetGroupSpanContainer cspansBarrel;
1135  DetGroupSpanContainer cspansEndcap;
1136  DetGroupContainer badDetGroupsBar = badDetGroupsBarrel();
1137  DetGroupContainer badDetGroupsEnd = badDetGroupsEndcap();
1138  for (auto const& detGroup : badDetGroupsBar) {
1139  DetGroupSpan cspan;
1140  getSpan(detGroup, cspan);
1141  cspansBarrel.push_back(cspan);
1142  }
1143  for (auto const& detGroup : badDetGroupsEnd) {
1144  DetGroupSpan cspan;
1145  getSpan(detGroup, cspan);
1146  cspansEndcap.push_back(cspan);
1147  }
1148  return DetGroupSpanContainerPair(cspansBarrel, cspansEndcap);
1149 }
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 730 of file PixelInactiveAreaFinder.cc.

References alignBH_cfg::fixed, TrackerGeometry::idToDet(), PVValHelper::ladder, pixelTopology::layer, callgraph::module, 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().

730  {
731  using std::fixed;
732  using std::left;
733  using std::noshowpos;
734  using std::right;
735  using std::setfill;
736  using std::setprecision;
737  using std::setw;
738  using std::showpos;
739  using std::tie;
740  std::string deli = "; ";
741  ss << "id:[" << det << "]" << deli;
742  ss << "subdetid:[" << DetId(det).subdetId() << "]" << deli;
743  if (DetId(det).subdetId() == PixelSubdetector::PixelBarrel) {
744  unsigned int layer = trackerTopology_->pxbLayer(DetId(det));
745  unsigned int ladder = trackerTopology_->pxbLadder(DetId(det));
746  unsigned int module = trackerTopology_->pxbModule(DetId(det));
747  ss << "layer:[" << layer << "]" << deli << "ladder:[" << right << setw(2) << ladder << "]" << deli << "module:["
748  << module << "]" << deli;
749  } else if (DetId(det).subdetId() == PixelSubdetector::PixelEndcap) {
750  unsigned int disk = trackerTopology_->pxfDisk(DetId(det));
751  unsigned int blade = trackerTopology_->pxfBlade(DetId(det));
752  unsigned int panel = trackerTopology_->pxfPanel(DetId(det));
753  ss << left << setw(6) << "disk:"
754  << "[" << right << disk << "]" << deli << left << setw(7) << "blade:"
755  << "[" << setw(2) << right << blade << "]" << deli << left << setw(7) << "panel:"
756  << "[" << right << panel << "]" << deli;
757  }
758  float phiA, phiB, zA, zB, rA, rB;
759  auto detSurface = trackerGeometry_->idToDet(DetId(det))->surface();
760  tie(phiA, phiB) = detSurface.phiSpan();
761  tie(zA, zB) = detSurface.zSpan();
762  tie(rA, rB) = detSurface.rSpan();
763  ss << setprecision(16) << fixed << showpos << setfill(' ') << "phi:[" << right << setw(12) << phiA << "," << left
764  << setw(12) << phiB << "]" << deli << "z:[" << right << setw(7) << zA << "," << left << setw(7) << zB << "]"
765  << deli << noshowpos << "r:[" << right << setw(10) << rA << "," << left << setw(10) << rB << "]" << deli;
766 }
unsigned int pxbLayer(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
unsigned int pxbLadder(const DetId &id) const
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
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 886 of file PixelInactiveAreaFinder.cc.

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

Referenced by badAdjecentDetsBarrel().

886  {
887  return std::find(badPixelDetsBarrel_.begin(), badPixelDetsBarrel_.end(), det) == badPixelDetsBarrel_.end() &&
889 }
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 684 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().

684  {
685  auto addDetId = [&](const auto id) {
686  const auto detid = DetId(id);
687  const auto subdet = detid.subdetId();
688  if (subdet == PixelSubdetector::PixelBarrel) {
689  badPixelDetsBarrel_.push_back(detid.rawId());
690  } else if (subdet == PixelSubdetector::PixelEndcap) {
691  badPixelDetsEndcap_.push_back(detid.rawId());
692  }
693  };
694 
695  // SiPixelQuality
696  auto const& pixelQuality = iSetup.getData(pixelQualityToken_);
697 
698  for (auto const& disabledModule : pixelQuality.getBadComponentList()) {
699  addDetId(disabledModule.DetID);
700  }
701 
702  // dynamic bad modules
703  for (const auto& token : inactivePixelDetectorTokens_) {
705  iEvent.getByToken(token, detIds);
706  for (const auto& id : *detIds) {
707  addDetId(id);
708  }
709  }
710 
711  // dynamic bad ROCs ("Fed25")
712  // TODO: consider moving to finer-grained areas for inactive ROCs
713  for (const auto& token : badPixelFEDChannelsTokens_) {
714  edm::Handle<PixelFEDChannelCollection> pixelFEDChannelCollectionHandle;
715  iEvent.getByToken(token, pixelFEDChannelCollectionHandle);
716  for (const auto& disabledChannels : *pixelFEDChannelCollectionHandle) {
717  addDetId(disabledChannels.detId());
718  }
719  }
720 
721  // remove duplicates
725  badPixelDetsBarrel_.end());
727  badPixelDetsEndcap_.end());
728 }
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 998 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().

998  {
999  // find phiSpan using ordered vector of unique ladders in detGroup
1000  if (detGroup.empty()) {
1001  cspan = DetGroupSpan();
1002  return;
1003  } else {
1004  cspan.layer = trackerTopology_->pxbLayer(DetId(detGroup[0]));
1005  cspan.disk = 0;
1006  }
1007  using uint = unsigned int;
1008  using LadderSet = std::set<uint>;
1009  using LadVec = std::vector<uint>;
1010  LadderSet lads;
1011  for (auto const& det : detGroup) {
1012  lads.insert(trackerTopology_->pxbLadder(DetId(det)));
1013  }
1014  LadVec ladv(lads.begin(), lads.end());
1015  uint nLadders = nBPixLadders[cspan.layer];
1016  // find start ladder of detGroup
1017  uint i = 0;
1018  uint currentLadder = ladv[0];
1019  uint previousLadder = ladv[(ladv.size() + i - 1) % ladv.size()];
1020  // loop until discontinuity is found from vector
1021  while ((nLadders + currentLadder - 1) % nLadders == previousLadder) {
1022  ++i;
1023  currentLadder = ladv[i % ladv.size()];
1024  previousLadder = ladv[(ladv.size() + i - 1) % ladv.size()];
1025  if (i == ladv.size()) {
1026  cspan.phiSpan.first = std::numeric_limits<float>::epsilon();
1027  cspan.phiSpan.second = -std::numeric_limits<float>::epsilon();
1028  return;
1029  }
1030  }
1031  uint startLadder = currentLadder;
1032  uint endLadder = previousLadder;
1033  auto detStart = trackerTopology_->pxbDetId(cspan.layer, startLadder, 1);
1034  auto detEnd = trackerTopology_->pxbDetId(cspan.layer, endLadder, 1);
1035  cspan.phiSpan.first = trackerGeometry_->idToDet(detStart)->surface().phiSpan().first;
1036  cspan.phiSpan.second = trackerGeometry_->idToDet(detEnd)->surface().phiSpan().second;
1037 }
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 1038 of file PixelInactiveAreaFinder.cc.

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

Referenced by getSpan(), and printBadDetGroups().

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

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

Referenced by getSpan(), and printBadDetGroups().

1106  {
1107  auto cmpFun = [this](det_t detA, det_t detB) {
1108  return trackerGeometry_->idToDet(DetId(detA))->surface().rSpan().first <
1109  trackerGeometry_->idToDet(DetId(detB))->surface().rSpan().first;
1110  };
1111 
1112  auto minmaxIters = std::minmax_element(detGroup.begin(), detGroup.end(), cmpFun);
1113  cspan.rSpan.first = trackerGeometry_->idToDet(DetId(*(minmaxIters.first)))->surface().rSpan().first;
1114  cspan.rSpan.second = trackerGeometry_->idToDet(DetId(*(minmaxIters.second)))->surface().rSpan().second;
1115 }
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 1116 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().

1116  {
1117  auto firstDetIt = detGroup.begin();
1118  if (firstDetIt != detGroup.end()) {
1119  cspan.subdetId = DetId(*firstDetIt).subdetId();
1120  if (cspan.subdetId == 1) {
1121  cspan.layer = trackerTopology_->pxbLayer(DetId(*firstDetIt));
1122  cspan.disk = 0;
1123  getPhiSpanBarrel(detGroup, cspan);
1124  } else if (cspan.subdetId == 2) {
1125  cspan.disk = trackerTopology_->pxfDisk(DetId(*firstDetIt));
1126  cspan.layer = 0;
1127  getPhiSpanEndcap(detGroup, cspan);
1128  }
1129  getZSpan(detGroup, cspan);
1130  getRSpan(detGroup, cspan);
1131  }
1132 }
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 1096 of file PixelInactiveAreaFinder.cc.

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

Referenced by getSpan(), and printBadDetGroups().

1096  {
1097  auto cmpFun = [this](det_t detA, det_t detB) {
1098  return trackerGeometry_->idToDet(DetId(detA))->surface().zSpan().first <
1099  trackerGeometry_->idToDet(DetId(detB))->surface().zSpan().first;
1100  };
1101 
1102  auto minmaxIters = std::minmax_element(detGroup.begin(), detGroup.end(), cmpFun);
1103  cspan.zSpan.first = trackerGeometry_->idToDet(DetId(*(minmaxIters.first)))->surface().zSpan().first;
1104  cspan.zSpan.second = trackerGeometry_->idToDet(DetId(*(minmaxIters.second)))->surface().zSpan().second;
1105 }
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 Barrel, createPlottingFiles(), createPlottingFiles_, debug_, detGroupSpans(), HLT_2023v11_cff::distance, spr::find(), newFWLiteAna::found, getBadPixelDets(), edm::EventSetup::getData(), iEvent, inactiveLayers_, inactiveLayerSetIndices_, pixelTopology::layer, layerSetIndexInactiveToActive_, eostools::move(), NegEndcap, GeomDetEnumerators::PixelBarrel, PixelSubdetector::PixelBarrel, GeomDetEnumerators::PixelEndcap, PosEndcap, push_back(), runTheMatrix::ret, 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  getBadPixelDets(iEvent, iSetup);
563 
564  //write files for plotting
565  if (createPlottingFiles_) {
567  }
568 
569  // find detGroupSpans ie phi,r,z limits for detector detGroups that are not working
570  // returns pair where first is barrel spans and second endcap spans
572 
573  // map spans to a vector with consistent indexing with inactiveLayers_ and inactiveLayerSetIndices_
574  // TODO: try to move the inner logic towards this direction as well
575  std::vector<DetGroupSpanContainer> spans(inactiveLayers_.size());
576 
577  auto doWork = [&](const DetGroupSpanContainer& container) {
578  for (const auto& span : container) {
579  const auto subdet = span.subdetId == PixelSubdetector::PixelBarrel ? GeomDetEnumerators::PixelBarrel
581  const auto side = (subdet == GeomDetEnumerators::PixelBarrel
583  : (span.zSpan.first < 0 ? TrackerDetSide::NegEndcap : TrackerDetSide::PosEndcap));
584  const auto layer = subdet == GeomDetEnumerators::PixelBarrel ? span.layer : span.disk;
585  auto found = std::find(inactiveLayers_.begin(), inactiveLayers_.end(), SeedingLayerId(subdet, side, layer));
586  if (found != inactiveLayers_.end()) { // it is possible that this layer is ignored by the configuration
587  spans[std::distance(inactiveLayers_.begin(), found)].push_back(span);
588  }
589  }
590  };
591  doWork(cspans.first);
592  doWork(cspans.second);
593 
594  auto ret =
596 
597  if (debug_) {
598  printOverlapSpans(ret);
599  }
600 
601  return ret;
602 }
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_
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
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 797 of file PixelInactiveAreaFinder.cc.

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

797  {
798  DetGroupContainer badDetGroupsBar = badDetGroupsBarrel();
799  DetGroupContainer badDetGroupsEnd = badDetGroupsEndcap();
800  Stream ss;
801  for (auto const& detGroup : badDetGroupsBar) {
802  ss << std::setfill(' ') << std::left << std::setw(16) << "DetGroup:";
803  DetGroupSpan cspan;
804  getPhiSpanBarrel(detGroup, cspan);
805  getZSpan(detGroup, cspan);
806  getRSpan(detGroup, cspan);
807  detGroupSpanInfo(cspan, ss);
808  ss << std::endl;
809  for (auto const& det : detGroup) {
810  detInfo(det, ss);
811  ss << std::endl;
812  }
813  ss << std::endl;
814  }
815  for (auto const& detGroup : badDetGroupsEnd) {
816  ss << std::setfill(' ') << std::left << std::setw(16) << "DetGroup:";
817  DetGroupSpan cspan;
818  getPhiSpanEndcap(detGroup, cspan);
819  getZSpan(detGroup, cspan);
820  getRSpan(detGroup, cspan);
821  detGroupSpanInfo(cspan, ss);
822  ss << std::endl;
823  for (auto const& det : detGroup) {
824  detInfo(det, ss);
825  ss << std::endl;
826  }
827  ss << std::endl;
828  }
829  edm::LogPrint("PixelInactiveAreaFinder") << ss.str();
830 }
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 831 of file PixelInactiveAreaFinder.cc.

References detGroupSpans(), and contentValuesCheck::ss.

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

◆ printBadPixelDets()

void PixelInactiveAreaFinder::printBadPixelDets ( )
private

Definition at line 782 of file PixelInactiveAreaFinder.cc.

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

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

◆ printPixelDets()

void PixelInactiveAreaFinder::printPixelDets ( )
private

Definition at line 767 of file PixelInactiveAreaFinder.cc.

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

767  {
768  edm::LogPrint("PixelInactiveAreaFinder") << "Barrel detectors:";
769  Stream ss;
770  for (auto const& det : pixelDetsBarrel_) {
771  detInfo(det, ss);
772  edm::LogPrint("PixelInactiveAreaFinder") << ss.str();
773  ss.str(std::string());
774  }
775  edm::LogPrint("PixelInactiveAreaFinder") << "Endcap detectors;";
776  for (auto const& det : pixelDetsEndcap_) {
777  detInfo(det, ss);
778  edm::LogPrint("PixelInactiveAreaFinder") << ss.str();
779  ss.str(std::string());
780  }
781 }
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 941 of file PixelInactiveAreaFinder.cc.

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

Referenced by badDetGroupsBarrel(), and badDetGroupsEndcap().

942  {
944  std::queue<det_t> workQueue;
945  det_t workDet;
946  DetGroup badAdjDets;
947  foundDets.insert(initDet);
948  workQueue.push(initDet);
949  reachableDetGroup.push_back(initDet);
950  while (!workQueue.empty()) {
951  workDet = workQueue.front();
952  workQueue.pop();
953  if (DetId(workDet).subdetId() == PixelSubdetector::PixelBarrel) {
954  badAdjDets = this->badAdjecentDetsBarrel(workDet);
955  } else if (DetId(workDet).subdetId() == PixelSubdetector::PixelEndcap) {
956  badAdjDets = this->badAdjecentDetsEndcap(workDet);
957  } else {
958  badAdjDets = {};
959  }
960  for (auto const& badDet : badAdjDets) {
961  if (foundDets.find(badDet) == foundDets.end()) {
962  reachableDetGroup.push_back(badDet);
963  foundDets.insert(badDet);
964  workQueue.push(badDet);
965  }
966  }
967  }
968  return reachableDetGroup;
969 }
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 605 of file PixelInactiveAreaFinder.cc.

References edm::ESWatcher< T >::check(), dqmiodumpmetadata::counts, createPlottingFiles_, TrackerGeometry::detsPXB(), TrackerGeometry::detsPXF(), mps_fire::end, Exception, geometryWatcher_, PVValHelper::ladder, pixelTopology::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().

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