CMS 3D CMS Logo

PixelInactiveAreaFinder.h
Go to the documentation of this file.
1 #ifndef RecoTracker_TkTrackingRegions_PixelInactiveAreaFinder_H
2 #define RecoTracker_TkTrackingRegions_PixelInactiveAreaFinder_H
3 
6 
8 
12 
14 
15 class SiPixelQuality;
16 class TrackerGeometry;
17 class TrackerTopology;
18 
19 // Adapted from a summer student project of Niko Leskinen (HIP, Finland)
20 
22 public:
26 
27  struct DetGroupSpan {
28  int subdetId;
29  std::pair<float,float> phiSpan;
30  std::pair<float,float> zSpan;
31  std::pair<float,float> rSpan;
32  unsigned int layer;
33  unsigned int disk;
35  subdetId(0),
36  phiSpan(0,0),
37  zSpan(0,0),
38  rSpan(0,0),
39  layer(0),disk(0)
40  {}
41  };
42  using DetGroupSpanContainer = std::vector<DetGroupSpan>;
43 
44  class InactiveAreas {
45  public:
46  InactiveAreas(const std::vector<SeedingLayerId> *inactiveLayers,
47  std::vector<DetGroupSpanContainer>&& inactiveSpans,
48  const std::vector<std::pair<unsigned short, unsigned short> > *inactiveLayerPairIndices,
49  const std::vector<std::vector<LayerSetIndex> > *layerSetIndexInactiveToActive):
50  inactiveLayers_(inactiveLayers),
51  inactiveSpans_(std::move(inactiveSpans)),
52  inactiveLayerPairIndices_(inactiveLayerPairIndices),
53  layerSetIndexInactiveToActive_(layerSetIndexInactiveToActive)
54  {}
55 
56  template <typename T>
57  using VecArray2 = edm::VecArray<T, 2>; // 2 inactive layers (using VecArray for possible extension to 1 inactive layer, i.e. triplet mitigation)
58  std::vector<std::pair<VecArray2<Area>, std::vector<LayerSetIndex> > > areasAndLayerSets(const GlobalPoint& point, float zwidth) const;
59  std::vector<std::pair<VecArray2<DetGroupSpan>, std::vector<LayerSetIndex> > > spansAndLayerSets(const GlobalPoint& point, float zwidth) const;
60 
61  private:
62  const std::vector<SeedingLayerId> *inactiveLayers_; // pointer to PixelInactiveAreaFinder::layers_
63  std::vector<DetGroupSpanContainer> inactiveSpans_; // inactive areas for each layer, indexing corresponds to layers_
64  const std::vector<std::pair<unsigned short, unsigned short> > *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> > *layerSetIndexInactiveToActive_; // mapping from index in "inactive" seeding layers to "active" seeding layers
66  };
67 
68 
69  PixelInactiveAreaFinder(const edm::ParameterSet& iConfig, const std::vector<SeedingLayerId>& seedingLayers,
70  const SeedingLayerSetsLooper& seedingLayerSetsLooper,
72  ~PixelInactiveAreaFinder() = default;
73 
75 
77 
78 private:
79  // Configuration
80  const bool debug_;
83 
84  std::vector<SeedingLayerId> inactiveLayers_; // layers to check for inactive regions
85  std::vector<std::pair<unsigned short, unsigned short> > inactiveLayerSetIndices_; // indices within inactiveLayers_
86  std::vector<std::vector<LayerSetIndex> > layerSetIndexInactiveToActive_; // mapping from index in inactiveLayers_ to constructor seedingLayers+seedingLayerSetsLooper
87 
88 
89  std::vector<edm::EDGetTokenT<DetIdCollection> > inactivePixelDetectorTokens_;
90  std::vector<edm::EDGetTokenT<PixelFEDChannelCollection> > badPixelFEDChannelsTokens_;
91 
92  // Output type aliases
93  using DetGroupSpanContainerPair = std::pair<DetGroupSpanContainer,DetGroupSpanContainer>;
94  using OverlapSpans = std::vector<DetGroupSpan>;
95  using OverlapSpansContainer = std::vector<OverlapSpans>;
96  // static data members; TODO see if these could be obtained from the geometry
97  std::array<unsigned short, 4> nBPixLadders;
98  unsigned short nModulesPerLadder;
99  // type aliases
100  using det_t = uint32_t;
101  using DetContainer = std::vector<uint32_t>;
102  using DetGroup = std::vector<uint32_t>;
103  using DetGroupContainer = std::vector<DetGroup>;
104  using DetectorSet = std::set<uint32_t>;
105  using Stream = std::stringstream;
106  // data handles and containers;
108 
109  const SiPixelQuality *pixelQuality_ = nullptr;
112 
117  // functions for fetching date from handles
118  void updatePixelDets(const edm::EventSetup& iSetup);
119  void getBadPixelDets(const edm::Event& iEvent, const edm::EventSetup& iSetup);
120  // Printing functions
121  void detInfo(const det_t & det, Stream & ss);
122  void printPixelDets();
123  void printBadPixelDets();
124  void printBadDetGroups();
125  void printBadDetGroupSpans();
126  void createPlottingFiles();
127  // Functions for finding bad detGroups
128  bool detWorks(det_t det);
129  DetGroup badAdjecentDetsBarrel(const det_t & det);
130  DetGroup badAdjecentDetsEndcap(const det_t & det);
131  DetGroup reachableDetGroup(const det_t & initDet, DetectorSet & foundDets);
134  // Functions for finding ranges that detGroups cover
135  void getPhiSpanBarrel(const DetGroup & detGroup, DetGroupSpan & cspan);
136  void getPhiSpanEndcap(const DetGroup & detGroup, DetGroupSpan & cspan);
137  void getZSpan(const DetGroup & detGroup, DetGroupSpan & cspan);
138  void getRSpan(const DetGroup & detGroup, DetGroupSpan & cspan);
139  void getSpan(const DetGroup & detGroup, DetGroupSpan & cspan);
141 };
142 
143 #endif
std::pair< DetGroupSpanContainer, DetGroupSpanContainer > DetGroupSpanContainerPair
const std::vector< std::pair< unsigned short, unsigned short > > * inactiveLayerPairIndices_
SeedingLayerSetsBuilder::SeedingLayerId SeedingLayerId
const std::vector< std::vector< LayerSetIndex > > * layerSetIndexInactiveToActive_
std::vector< edm::EDGetTokenT< DetIdCollection > > inactivePixelDetectorTokens_
std::array< unsigned short, 4 > nBPixLadders
unsigned short LayerSetIndex
std::vector< OverlapSpans > OverlapSpansContainer
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:230
void getPhiSpanBarrel(const DetGroup &detGroup, DetGroupSpan &cspan)
void detInfo(const det_t &det, Stream &ss)
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
void getSpan(const DetGroup &detGroup, DetGroupSpan &cspan)
void getPhiSpanEndcap(const DetGroup &detGroup, DetGroupSpan &cspan)
~PixelInactiveAreaFinder()=default
DetGroupSpanContainerPair detGroupSpans()
DetGroup badAdjecentDetsEndcap(const det_t &det)
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_
def move(src, dest)
Definition: eostools.py:510
*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_
SeedingLayerSetsHits::LayerSetIndex LayerSetIndex
void getZSpan(const DetGroup &detGroup, DetGroupSpan &cspan)
edm::ESWatcher< TrackerDigiGeometryRecord > geometryWatcher_