CMS 3D CMS Logo

PixelUnpackingRegions.h
Go to the documentation of this file.
1 #ifndef PixelUnpackingRegions_H
2 #define PixelUnpackingRegions_H
3 
11 
16 
17 #include <cmath>
18 #include <vector>
19 #include <set>
20 
30 public:
35  struct Region {
36  Region(const math::XYZVector& dir, float dphi = 0.5f, float maxz = 24.f) : v(dir), dPhi(dphi), maxZ(maxz) {
37  cosphi = v.x() / v.rho();
38  sinphi = v.y() / v.rho();
39  atantheta = v.z() / v.rho();
40  }
42  float dPhi, maxZ;
44  };
45 
47 
49 
51  void run(const edm::Event& e, const edm::EventSetup& es);
52 
54  bool mayUnpackFED(unsigned int fed_n) const;
55 
57  bool mayUnpackModule(unsigned int id) const;
58 
60  const std::set<unsigned int>* modulesToUnpack() const { return &modules_; }
61 
63  unsigned int nFEDs() const { return feds_.size(); }
64  unsigned int nModules() const { return modules_.size(); }
65  unsigned int nBarrelModules() const;
66  unsigned int nForwardModules() const;
67  unsigned int nRegions() const { return nreg_; }
68 
69  struct Module {
70  float phi;
71  float x, y, z;
72  unsigned int id;
73  unsigned int fed;
74 
75  Module() {}
76  Module(float ph) : phi(ph), x(0.f), y(0.f), z(0.f), id(0), fed(0) {}
77 
78  bool operator<(const Module& m) const {
79  if (phi < m.phi)
80  return true;
81  if (phi == m.phi && id < m.id)
82  return true;
83  return false;
84  }
85  };
86 
87 private:
88  // input parameters
89  std::vector<edm::InputTag> inputs_;
90  std::vector<double> dPhi_;
91  std::vector<double> maxZ_;
93 
95  std::vector<edm::EDGetTokenT<reco::CandidateView>> tCandidateView;
96 
97  std::set<unsigned int> feds_;
98  std::set<unsigned int> modules_;
99  unsigned int nreg_;
100 
102  void initialize(const edm::EventSetup& es);
103 
104  // add a new direction of a region of interest
105  void addRegion(Region& r);
106 
107  // gather info into feds_ and modules_ from a range of a Module vector
108  void gatherFromRange(Region& r, std::vector<Module>::const_iterator, std::vector<Module>::const_iterator);
109 
110  // addRegion for a local (BPIX or +-FPIX) container
111  void addRegionLocal(Region& r, std::vector<Module>& container, const Module& lo, const Module& hi);
112 
113  // local containers of barrel and endcaps Modules sorted by phi
114  std::vector<Module> phiBPIX_;
115  std::vector<Module> phiFPIXp_;
116  std::vector<Module> phiFPIXm_;
117 
118  std::unique_ptr<SiPixelFedCablingTree> cabling_;
120 
122 };
123 
124 #endif
bool mayUnpackModule(unsigned int id) const
check whether a module has to be unpacked
void addRegionLocal(Region &r, std::vector< Module > &container, const Module &lo, const Module &hi)
unsigned int nRegions() const
std::vector< edm::EDGetTokenT< reco::CandidateView > > tCandidateView
void gatherFromRange(Region &r, std::vector< Module >::const_iterator, std::vector< Module >::const_iterator)
const std::set< unsigned int > * modulesToUnpack() const
full set of module ids to unpack
PixelUnpackingRegions(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
std::vector< Module > phiFPIXm_
std::unique_ptr< SiPixelFedCablingTree > cabling_
edm::ESWatcher< SiPixelFedCablingMapRcd > watcherSiPixelFedCablingMap_
double f[11][100]
unsigned int nBarrelModules() const
void run(const edm::Event &e, const edm::EventSetup &es)
has to be run during each event
unsigned int nModules() const
std::vector< edm::InputTag > inputs_
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
std::vector< Module > phiFPIXp_
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
unsigned int nForwardModules() const
unsigned int nFEDs() const
various informational accessors:
bool mayUnpackFED(unsigned int fed_n) const
check whether a FED has to be unpacked
std::vector< double > dPhi_
void initialize(const edm::EventSetup &es)
run by the run method: (re)initialize the cabling data when it&#39;s necessary
std::vector< double > maxZ_
Region(const math::XYZVector &dir, float dphi=0.5f, float maxz=24.f)
std::vector< Module > phiBPIX_
edm::EDGetTokenT< reco::BeamSpot > tBeamSpot
std::set< unsigned int > feds_
bool operator<(const Module &m) const
std::set< unsigned int > modules_