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;
34  DetGroupSpan() : subdetId(0), phiSpan(0, 0), zSpan(0, 0), rSpan(0, 0), layer(0), disk(0) {}
35  };
36  using DetGroupSpanContainer = std::vector<DetGroupSpan>;
37 
38  class InactiveAreas {
39  public:
40  InactiveAreas(const std::vector<SeedingLayerId>* inactiveLayers,
41  std::vector<DetGroupSpanContainer>&& inactiveSpans,
42  const std::vector<std::pair<unsigned short, unsigned short> >* inactiveLayerPairIndices,
43  const std::vector<std::vector<LayerSetIndex> >* layerSetIndexInactiveToActive)
44  : inactiveLayers_(inactiveLayers),
45  inactiveSpans_(std::move(inactiveSpans)),
46  inactiveLayerPairIndices_(inactiveLayerPairIndices),
47  layerSetIndexInactiveToActive_(layerSetIndexInactiveToActive) {}
48 
49  template <typename T>
50  using VecArray2 = edm::VecArray<
51  T,
52  2>; // 2 inactive layers (using VecArray for possible extension to 1 inactive layer, i.e. triplet mitigation)
53  std::vector<std::pair<VecArray2<Area>, std::vector<LayerSetIndex> > > areasAndLayerSets(const GlobalPoint& point,
54  float zwidth) const;
55  std::vector<std::pair<VecArray2<DetGroupSpan>, std::vector<LayerSetIndex> > > spansAndLayerSets(
56  const GlobalPoint& point, float zwidth) const;
57 
58  private:
59  const std::vector<SeedingLayerId>* inactiveLayers_; // pointer to PixelInactiveAreaFinder::layers_
60  std::vector<DetGroupSpanContainer> inactiveSpans_; // inactive areas for each layer, indexing corresponds to layers_
61  const std::vector<std::pair<unsigned short, unsigned short> >*
62  inactiveLayerPairIndices_; // indices to the layer pair within the input SeedingLayerSetsHits for pairs of layers to check for correlated inactive regions
63  const std::vector<std::vector<LayerSetIndex> >*
64  layerSetIndexInactiveToActive_; // mapping from index in "inactive" seeding layers to "active" seeding layers
65  };
66 
68  const std::vector<SeedingLayerId>& seedingLayers,
69  const SeedingLayerSetsLooper& seedingLayerSetsLooper,
71  ~PixelInactiveAreaFinder() = default;
72 
74 
76 
77 private:
78  // Configuration
79  const bool debug_;
82 
83  std::vector<SeedingLayerId> inactiveLayers_; // layers to check for inactive regions
84  std::vector<std::pair<unsigned short, unsigned short> > inactiveLayerSetIndices_; // indices within inactiveLayers_
85  std::vector<std::vector<LayerSetIndex> >
86  layerSetIndexInactiveToActive_; // mapping from index in inactiveLayers_ to constructor seedingLayers+seedingLayerSetsLooper
87 
88  std::vector<edm::EDGetTokenT<DetIdCollection> > inactivePixelDetectorTokens_;
89  std::vector<edm::EDGetTokenT<PixelFEDChannelCollection> > badPixelFEDChannelsTokens_;
90 
91  // Output type aliases
92  using DetGroupSpanContainerPair = std::pair<DetGroupSpanContainer, DetGroupSpanContainer>;
93  using OverlapSpans = std::vector<DetGroupSpan>;
94  using OverlapSpansContainer = std::vector<OverlapSpans>;
95  // static data members; TODO see if these could be obtained from the geometry
96  std::array<unsigned short, 4> nBPixLadders;
97  unsigned short nModulesPerLadder;
98  // type aliases
99  using det_t = uint32_t;
100  using DetContainer = std::vector<uint32_t>;
101  using DetGroup = std::vector<uint32_t>;
102  using DetGroupContainer = std::vector<DetGroup>;
103  using DetectorSet = std::set<uint32_t>;
104  using Stream = std::stringstream;
105  // data handles and containers;
107 
108  const SiPixelQuality* pixelQuality_ = nullptr;
111 
116  // functions for fetching date from handles
117  void updatePixelDets(const edm::EventSetup& iSetup);
118  void getBadPixelDets(const edm::Event& iEvent, const edm::EventSetup& iSetup);
119  // Printing functions
120  void detInfo(const det_t& det, Stream& ss);
121  void printPixelDets();
122  void printBadPixelDets();
123  void printBadDetGroups();
124  void printBadDetGroupSpans();
125  void createPlottingFiles();
126  // Functions for finding bad detGroups
127  bool detWorks(det_t det);
130  DetGroup reachableDetGroup(const det_t& initDet, DetectorSet& foundDets);
133  // Functions for finding ranges that detGroups cover
134  void getPhiSpanBarrel(const DetGroup& detGroup, DetGroupSpan& cspan);
135  void getPhiSpanEndcap(const DetGroup& detGroup, DetGroupSpan& cspan);
136  void getZSpan(const DetGroup& detGroup, DetGroupSpan& cspan);
137  void getRSpan(const DetGroup& detGroup, DetGroupSpan& cspan);
138  void getSpan(const DetGroup& detGroup, DetGroupSpan& cspan);
140 };
141 
142 #endif
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:224
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)
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_
def move(src, dest)
Definition: eostools.py:511
*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_