CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PixelInactiveAreaFinder.h
Go to the documentation of this file.
1 #ifndef RecoTracker_TkTrackingRegions_PixelInactiveAreaFinder_H
2 #define RecoTracker_TkTrackingRegions_PixelInactiveAreaFinder_H
3 
6 
8 
14 
16 
17 class SiPixelQuality;
18 class TrackerGeometry;
19 class TrackerTopology;
20 
21 // Adapted from a summer student project of Niko Leskinen (HIP, Finland)
22 
24 public:
28 
29  struct DetGroupSpan {
30  int subdetId;
31  std::pair<float, float> phiSpan;
32  std::pair<float, float> zSpan;
33  std::pair<float, float> rSpan;
34  unsigned int layer;
35  unsigned int disk;
36  DetGroupSpan() : subdetId(0), phiSpan(0, 0), zSpan(0, 0), rSpan(0, 0), layer(0), disk(0) {}
37  };
38  using DetGroupSpanContainer = std::vector<DetGroupSpan>;
39 
40  class InactiveAreas {
41  public:
42  InactiveAreas(const std::vector<SeedingLayerId>* inactiveLayers,
43  std::vector<DetGroupSpanContainer>&& inactiveSpans,
44  const std::vector<std::pair<unsigned short, unsigned short> >* inactiveLayerPairIndices,
45  const std::vector<std::vector<LayerSetIndex> >* layerSetIndexInactiveToActive)
46  : inactiveLayers_(inactiveLayers),
47  inactiveSpans_(std::move(inactiveSpans)),
48  inactiveLayerPairIndices_(inactiveLayerPairIndices),
49  layerSetIndexInactiveToActive_(layerSetIndexInactiveToActive) {}
50 
51  template <typename T>
52  using VecArray2 = edm::VecArray<
53  T,
54  2>; // 2 inactive layers (using VecArray for possible extension to 1 inactive layer, i.e. triplet mitigation)
55  std::vector<std::pair<VecArray2<Area>, std::vector<LayerSetIndex> > > areasAndLayerSets(const GlobalPoint& point,
56  float zwidth) const;
57  std::vector<std::pair<VecArray2<DetGroupSpan>, std::vector<LayerSetIndex> > > spansAndLayerSets(
58  const GlobalPoint& point, float zwidth) const;
59 
60  private:
61  const std::vector<SeedingLayerId>* inactiveLayers_; // pointer to PixelInactiveAreaFinder::layers_
62  std::vector<DetGroupSpanContainer> inactiveSpans_; // inactive areas for each layer, indexing corresponds to layers_
63  const std::vector<std::pair<unsigned short, unsigned short> >*
64  inactiveLayerPairIndices_; // indices to the layer pair within the input SeedingLayerSetsHits for pairs of layers to check for correlated inactive regions
65  const std::vector<std::vector<LayerSetIndex> >*
66  layerSetIndexInactiveToActive_; // mapping from index in "inactive" seeding layers to "active" seeding layers
67  };
68 
70  const std::vector<SeedingLayerId>& seedingLayers,
71  const SeedingLayerSetsLooper& seedingLayerSetsLooper,
73  ~PixelInactiveAreaFinder() = default;
74 
76 
78 
79 private:
80  // Configuration
81  const bool debug_;
84 
85  std::vector<SeedingLayerId> inactiveLayers_; // layers to check for inactive regions
86  std::vector<std::pair<unsigned short, unsigned short> > inactiveLayerSetIndices_; // indices within inactiveLayers_
87  std::vector<std::vector<LayerSetIndex> >
88  layerSetIndexInactiveToActive_; // mapping from index in inactiveLayers_ to constructor seedingLayers+seedingLayerSetsLooper
89 
90  std::vector<edm::EDGetTokenT<DetIdCollection> > inactivePixelDetectorTokens_;
91  std::vector<edm::EDGetTokenT<PixelFEDChannelCollection> > badPixelFEDChannelsTokens_;
95 
96  // Output type aliases
97  using DetGroupSpanContainerPair = std::pair<DetGroupSpanContainer, DetGroupSpanContainer>;
98  using OverlapSpans = std::vector<DetGroupSpan>;
99  using OverlapSpansContainer = std::vector<OverlapSpans>;
100  // static data members; TODO see if these could be obtained from the geometry
101  std::array<unsigned short, 4> nBPixLadders;
102  unsigned short nModulesPerLadder;
103  // type aliases
104  using det_t = uint32_t;
105  using DetContainer = std::vector<uint32_t>;
106  using DetGroup = std::vector<uint32_t>;
107  using DetGroupContainer = std::vector<DetGroup>;
108  using DetectorSet = std::set<uint32_t>;
109  using Stream = std::stringstream;
110  // data handles and containers;
112 
113  const SiPixelQuality* pixelQuality_ = nullptr;
116 
121  // functions for fetching date from handles
122  void updatePixelDets(const edm::EventSetup& iSetup);
123  void getBadPixelDets(const edm::Event& iEvent, const edm::EventSetup& iSetup);
124  // Printing functions
125  void detInfo(const det_t& det, Stream& ss);
126  void printPixelDets();
127  void printBadPixelDets();
128  void printBadDetGroups();
129  void printBadDetGroupSpans();
130  void createPlottingFiles();
131  // Functions for finding bad detGroups
132  bool detWorks(det_t det);
135  DetGroup reachableDetGroup(const det_t& initDet, DetectorSet& foundDets);
138  // Functions for finding ranges that detGroups cover
139  void getPhiSpanBarrel(const DetGroup& detGroup, DetGroupSpan& cspan);
140  void getPhiSpanEndcap(const DetGroup& detGroup, DetGroupSpan& cspan);
141  void getZSpan(const DetGroup& detGroup, DetGroupSpan& cspan);
142  void getRSpan(const DetGroup& detGroup, DetGroupSpan& cspan);
143  void getSpan(const DetGroup& detGroup, DetGroupSpan& cspan);
145 };
146 
147 #endif
const std::vector< std::pair< unsigned short, unsigned short > > * inactiveLayerPairIndices_
SeedingLayerSetsBuilder::SeedingLayerId SeedingLayerId
std::vector< std::pair< VecArray2< Area >, std::vector< LayerSetIndex > > > areasAndLayerSets(const GlobalPoint &point, float zwidth) const
const std::vector< std::vector< LayerSetIndex > > * layerSetIndexInactiveToActive_
std::vector< edm::EDGetTokenT< DetIdCollection > > inactivePixelDetectorTokens_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
std::array< unsigned short, 4 > nBPixLadders
unsigned short LayerSetIndex
std::vector< OverlapSpans > OverlapSpansContainer
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > pixelQualityToken_
void updatePixelDets(const edm::EventSetup &iSetup)
static void fillDescriptions(edm::ParameterSetDescription &desc)
const SiPixelQuality * pixelQuality_
DetGroup reachableDetGroup(const det_t &initDet, DetectorSet &foundDets)
std::vector< std::pair< unsigned short, unsigned short > > inactiveLayerSetIndices_
void getRSpan(const DetGroup &detGroup, DetGroupSpan &cspan)
const std::vector< SeedingLayerId > * inactiveLayers_
DetGroupContainer badDetGroupsEndcap()
std::tuple< GeomDetEnumerators::SubDetector, TrackerDetSide, int > SeedingLayerId
int iEvent
Definition: GenABIO.cc:224
void getPhiSpanBarrel(const DetGroup &detGroup, DetGroupSpan &cspan)
void detInfo(const det_t &det, Stream &ss)
def move
Definition: eostools.py:511
std::vector< DetGroupSpanContainer > inactiveSpans_
std::set< uint32_t > DetectorSet
DetGroupContainer badDetGroupsBarrel()
DetGroup badAdjecentDetsBarrel(const det_t &det)
InactiveAreas inactiveAreas(const edm::Event &iEvent, const edm::EventSetup &iSetup)
const TrackerGeometry * trackerGeometry_
void getBadPixelDets(const edm::Event &iEvent, const edm::EventSetup &iSetup)
std::vector< DetGroup > DetGroupContainer
std::vector< edm::EDGetTokenT< PixelFEDChannelCollection > > badPixelFEDChannelsTokens_
std::vector< uint32_t > DetContainer
PixelInactiveAreaFinder(const edm::ParameterSet &iConfig, const std::vector< SeedingLayerId > &seedingLayers, const SeedingLayerSetsLooper &seedingLayerSetsLooper, edm::ConsumesCollector &&iC)
const TrackerTopology * trackerTopology_
std::vector< DetGroupSpan > DetGroupSpanContainer
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
void getSpan(const DetGroup &detGroup, DetGroupSpan &cspan)
void getPhiSpanEndcap(const DetGroup &detGroup, DetGroupSpan &cspan)
~PixelInactiveAreaFinder()=default
DetGroupSpanContainerPair detGroupSpans()
DetGroup badAdjecentDetsEndcap(const det_t &det)
long double T
std::pair< DetGroupSpanContainer, DetGroupSpanContainer > DetGroupSpanContainerPair
InactiveAreas(const std::vector< SeedingLayerId > *inactiveLayers, std::vector< DetGroupSpanContainer > &&inactiveSpans, const std::vector< std::pair< unsigned short, unsigned short > > *inactiveLayerPairIndices, const std::vector< std::vector< LayerSetIndex > > *layerSetIndexInactiveToActive)
std::vector< DetGroupSpan > OverlapSpans
std::vector< std::vector< LayerSetIndex > > layerSetIndexInactiveToActive_
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
std::vector< SeedingLayerId > inactiveLayers_
std::vector< std::pair< VecArray2< DetGroupSpan >, std::vector< LayerSetIndex > > > spansAndLayerSets(const GlobalPoint &point, float zwidth) const
SeedingLayerSetsHits::LayerSetIndex LayerSetIndex
void getZSpan(const DetGroup &detGroup, DetGroupSpan &cspan)
edm::ESWatcher< TrackerDigiGeometryRecord > geometryWatcher_