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
PixelUnpackingRegions::Module::fed
unsigned int fed
Definition: PixelUnpackingRegions.h:73
PixelUnpackingRegions::Module::Module
Module(float ph)
Definition: PixelUnpackingRegions.h:76
PixelUnpackingRegions::beamSpotTag_
edm::InputTag beamSpotTag_
Definition: PixelUnpackingRegions.h:92
PixelUnpackingRegions::tBeamSpot
edm::EDGetTokenT< reco::BeamSpot > tBeamSpot
Definition: PixelUnpackingRegions.h:94
PixelUnpackingRegions::tCandidateView
std::vector< edm::EDGetTokenT< reco::CandidateView > > tCandidateView
Definition: PixelUnpackingRegions.h:95
PixelUnpackingRegions::beamSpot_
math::XYZPoint beamSpot_
Definition: PixelUnpackingRegions.h:119
edm::ESWatcher< SiPixelFedCablingMapRcd >
PixelUnpackingRegions::modules_
std::set< unsigned int > modules_
Definition: PixelUnpackingRegions.h:98
PixelUnpackingRegions::dPhi_
std::vector< double > dPhi_
Definition: PixelUnpackingRegions.h:90
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
PixelUnpackingRegions::nModules
unsigned int nModules() const
Definition: PixelUnpackingRegions.h:64
PixelUnpackingRegions::cabling_
std::unique_ptr< SiPixelFedCablingTree > cabling_
Definition: PixelUnpackingRegions.h:118
PixelUnpackingRegions::nFEDs
unsigned int nFEDs() const
various informational accessors:
Definition: PixelUnpackingRegions.h:63
edm::EDGetTokenT< reco::BeamSpot >
PixelUnpackingRegions::Module::x
float x
Definition: PixelUnpackingRegions.h:71
PixelUnpackingRegions::Module::y
float y
Definition: PixelUnpackingRegions.h:71
PixelUnpackingRegions::mayUnpackFED
bool mayUnpackFED(unsigned int fed_n) const
check whether a FED has to be unpacked
Definition: PixelUnpackingRegions.cc:206
SiPixelFedCablingMap.h
SiPixelFedCablingTree.h
PixelUnpackingRegions::Module::Module
Module()
Definition: PixelUnpackingRegions.h:75
PixelUnpackingRegions::Region::v
math::XYZVector v
Definition: PixelUnpackingRegions.h:41
PixelUnpackingRegions::maxZ_
std::vector< double > maxZ_
Definition: PixelUnpackingRegions.h:91
PixelUnpackingRegions::gatherFromRange
void gatherFromRange(Region &r, std::vector< Module >::const_iterator, std::vector< Module >::const_iterator)
Definition: PixelUnpackingRegions.cc:190
PixelUnpackingRegions::mayUnpackModule
bool mayUnpackModule(unsigned int id) const
check whether a module has to be unpacked
Definition: PixelUnpackingRegions.cc:212
BeamSpot.h
PixelUnpackingRegions::Region::atantheta
float atantheta
Definition: PixelUnpackingRegions.h:43
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
PixelUnpackingRegions::Module::operator<
bool operator<(const Module &m) const
Definition: PixelUnpackingRegions.h:78
PixelUnpackingRegions::PixelUnpackingRegions
PixelUnpackingRegions(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
Definition: PixelUnpackingRegions.cc:30
LeafCandidate.h
PixelUnpackingRegions::phiBPIX_
std::vector< Module > phiBPIX_
Definition: PixelUnpackingRegions.h:114
PixelUnpackingRegions::phiFPIXm_
std::vector< Module > phiFPIXm_
Definition: PixelUnpackingRegions.h:116
PixelUnpackingRegions::Region::maxZ
float maxZ
Definition: PixelUnpackingRegions.h:42
PixelUnpackingRegions::Region::cosphi
float cosphi
Definition: PixelUnpackingRegions.h:43
PixelUnpackingRegions::nreg_
unsigned int nreg_
Definition: PixelUnpackingRegions.h:99
edm::ParameterSet
Definition: ParameterSet.h:36
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
Event.h
SiPixelFedCablingMapRcd.h
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
PixelUnpackingRegions::~PixelUnpackingRegions
~PixelUnpackingRegions()
Definition: PixelUnpackingRegions.h:48
PixelUnpackingRegions::Region::Region
Region(const math::XYZVector &dir, float dphi=0.5f, float maxz=24.f)
Definition: PixelUnpackingRegions.h:36
PixelUnpackingRegions::addRegionLocal
void addRegionLocal(Region &r, std::vector< Module > &container, const Module &lo, const Module &hi)
Definition: PixelUnpackingRegions.cc:158
edm::EventSetup
Definition: EventSetup.h:57
PixelUnpackingRegions::modulesToUnpack
const std::set< unsigned int > * modulesToUnpack() const
full set of module ids to unpack
Definition: PixelUnpackingRegions.h:60
alignCSCRings.r
r
Definition: alignCSCRings.py:93
PixelUnpackingRegions::Module
Definition: PixelUnpackingRegions.h:69
hi
Definition: HiEvtPlaneList.h:38
PixelUnpackingRegions::initialize
void initialize(const edm::EventSetup &es)
run by the run method: (re)initialize the cabling data when it's necessary
Definition: PixelUnpackingRegions.cc:76
PixelUnpackingRegions
Definition: PixelUnpackingRegions.h:29
ESWatcher.h
PixelUnpackingRegions::Region::dPhi
float dPhi
Definition: PixelUnpackingRegions.h:42
PixelUnpackingRegions::nRegions
unsigned int nRegions() const
Definition: PixelUnpackingRegions.h:67
PixelUnpackingRegions::feds_
std::set< unsigned int > feds_
Definition: PixelUnpackingRegions.h:97
Point3D.h
EventSetup.h
PixelUnpackingRegions::nForwardModules
unsigned int nForwardModules() const
Definition: PixelUnpackingRegions.cc:222
PixelUnpackingRegions::Module::phi
float phi
Definition: PixelUnpackingRegions.h:70
PixelUnpackingRegions::Module::z
float z
Definition: PixelUnpackingRegions.h:71
ConsumesCollector.h
PixelUnpackingRegions::watcherSiPixelFedCablingMap_
edm::ESWatcher< SiPixelFedCablingMapRcd > watcherSiPixelFedCablingMap_
Definition: PixelUnpackingRegions.h:121
PixelUnpackingRegions::Region
Definition: PixelUnpackingRegions.h:35
edm::Event
Definition: Event.h:73
Vector3D.h
PixelUnpackingRegions::addRegion
void addRegion(Region &r)
Definition: PixelUnpackingRegions.cc:141
edm::InputTag
Definition: InputTag.h:15
PixelUnpackingRegions::phiFPIXp_
std::vector< Module > phiFPIXp_
Definition: PixelUnpackingRegions.h:115
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
PixelUnpackingRegions::run
void run(const edm::Event &e, const edm::EventSetup &es)
has to be run during each event
Definition: PixelUnpackingRegions.cc:48
PixelUnpackingRegions::Module::id
unsigned int id
Definition: PixelUnpackingRegions.h:72
PixelUnpackingRegions::Region::sinphi
float sinphi
Definition: PixelUnpackingRegions.h:43
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
PixelUnpackingRegions::inputs_
std::vector< edm::InputTag > inputs_
Definition: PixelUnpackingRegions.h:89
PixelUnpackingRegions::nBarrelModules
unsigned int nBarrelModules() const
Definition: PixelUnpackingRegions.cc:218