CMS 3D CMS Logo

PixelUnpackingRegions.h
Go to the documentation of this file.
1 #ifndef PixelUnpackingRegions_H
2 #define PixelUnpackingRegions_H
3 
12 
19 
20 #include <cmath>
21 #include <vector>
22 #include <set>
23 
33 public:
38  struct Region {
39  Region(const math::XYZVector& dir, float dphi = 0.5f, float maxz = 24.f) : v(dir), dPhi(dphi), maxZ(maxz) {
40  cosphi = v.x() / v.rho();
41  sinphi = v.y() / v.rho();
42  atantheta = v.z() / v.rho();
43  }
45  float dPhi, maxZ;
47  };
48 
50 
52 
54  void run(const edm::Event& e, const edm::EventSetup& es);
55 
57  bool mayUnpackFED(unsigned int fed_n) const;
58 
60  bool mayUnpackModule(unsigned int id) const;
61 
63  const std::set<unsigned int>* modulesToUnpack() const { return &modules_; }
64 
66  unsigned int nFEDs() const { return feds_.size(); }
67  unsigned int nModules() const { return modules_.size(); }
68  unsigned int nBarrelModules() const;
69  unsigned int nForwardModules() const;
70  unsigned int nRegions() const { return nreg_; }
71 
72  struct Module {
73  float phi;
74  float x, y, z;
75  unsigned int id;
76  unsigned int fed;
77 
78  Module() {}
79  Module(float ph) : phi(ph), x(0.f), y(0.f), z(0.f), id(0), fed(0) {}
80 
81  bool operator<(const Module& m) const {
82  if (phi < m.phi)
83  return true;
84  if (phi == m.phi && id < m.id)
85  return true;
86  return false;
87  }
88  };
89 
90 private:
91  // input parameters
92  std::vector<edm::InputTag> inputs_;
93  std::vector<double> dPhi_;
94  std::vector<double> maxZ_;
96 
98  std::vector<edm::EDGetTokenT<reco::CandidateView>> tCandidateView;
99 
100  std::set<unsigned int> feds_;
101  std::set<unsigned int> modules_;
102  unsigned int nreg_;
103 
105  void initialize(const edm::EventSetup& es);
106 
107  // add a new direction of a region of interest
108  void addRegion(Region& r);
109 
110  // gather info into feds_ and modules_ from a range of a Module vector
111  void gatherFromRange(Region& r, std::vector<Module>::const_iterator, std::vector<Module>::const_iterator);
112 
113  // addRegion for a local (BPIX or +-FPIX) container
114  void addRegionLocal(Region& r, std::vector<Module>& container, const Module& lo, const Module& hi);
115 
116  // local containers of barrel and endcaps Modules sorted by phi
117  std::vector<Module> phiBPIX_;
118  std::vector<Module> phiFPIXp_;
119  std::vector<Module> phiFPIXm_;
120 
121  std::unique_ptr<SiPixelFedCablingTree> cabling_;
123 
127 };
128 
129 #endif
PixelUnpackingRegions::Module::fed
unsigned int fed
Definition: PixelUnpackingRegions.h:76
PixelUnpackingRegions::Module::Module
Module(float ph)
Definition: PixelUnpackingRegions.h:79
PixelUnpackingRegions::beamSpotTag_
edm::InputTag beamSpotTag_
Definition: PixelUnpackingRegions.h:95
PixelUnpackingRegions::tBeamSpot
edm::EDGetTokenT< reco::BeamSpot > tBeamSpot
Definition: PixelUnpackingRegions.h:97
PixelUnpackingRegions::tCandidateView
std::vector< edm::EDGetTokenT< reco::CandidateView > > tCandidateView
Definition: PixelUnpackingRegions.h:98
PixelUnpackingRegions::beamSpot_
math::XYZPoint beamSpot_
Definition: PixelUnpackingRegions.h:122
TrackerGeometry.h
edm::ESWatcher< SiPixelFedCablingMapRcd >
PixelUnpackingRegions::modules_
std::set< unsigned int > modules_
Definition: PixelUnpackingRegions.h:101
PixelUnpackingRegions::dPhi_
std::vector< double > dPhi_
Definition: PixelUnpackingRegions.h:93
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
PixelUnpackingRegions::nModules
unsigned int nModules() const
Definition: PixelUnpackingRegions.h:67
PixelUnpackingRegions::cabling_
std::unique_ptr< SiPixelFedCablingTree > cabling_
Definition: PixelUnpackingRegions.h:121
PixelUnpackingRegions::nFEDs
unsigned int nFEDs() const
various informational accessors:
Definition: PixelUnpackingRegions.h:66
edm::EDGetTokenT< reco::BeamSpot >
PixelUnpackingRegions::Module::x
float x
Definition: PixelUnpackingRegions.h:74
PixelUnpackingRegions::Module::y
float y
Definition: PixelUnpackingRegions.h:74
PixelUnpackingRegions::mayUnpackFED
bool mayUnpackFED(unsigned int fed_n) const
check whether a FED has to be unpacked
Definition: PixelUnpackingRegions.cc:204
PixelUnpackingRegions::trackerGeomToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeomToken_
Definition: PixelUnpackingRegions.h:125
SiPixelFedCablingMap.h
PixelUnpackingRegions::cablingMapToken_
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > cablingMapToken_
Definition: PixelUnpackingRegions.h:126
SiPixelFedCablingTree.h
PixelUnpackingRegions::Module::Module
Module()
Definition: PixelUnpackingRegions.h:78
PixelUnpackingRegions::Region::v
math::XYZVector v
Definition: PixelUnpackingRegions.h:44
ESGetToken.h
PixelUnpackingRegions::maxZ_
std::vector< double > maxZ_
Definition: PixelUnpackingRegions.h:94
PixelUnpackingRegions::gatherFromRange
void gatherFromRange(Region &r, std::vector< Module >::const_iterator, std::vector< Module >::const_iterator)
Definition: PixelUnpackingRegions.cc:188
PixelUnpackingRegions::mayUnpackModule
bool mayUnpackModule(unsigned int id) const
check whether a module has to be unpacked
Definition: PixelUnpackingRegions.cc:210
BeamSpot.h
PixelUnpackingRegions::Region::atantheta
float atantheta
Definition: PixelUnpackingRegions.h:46
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:81
PixelUnpackingRegions::PixelUnpackingRegions
PixelUnpackingRegions(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
Definition: PixelUnpackingRegions.cc:28
LeafCandidate.h
PixelUnpackingRegions::phiBPIX_
std::vector< Module > phiBPIX_
Definition: PixelUnpackingRegions.h:117
PixelUnpackingRegions::phiFPIXm_
std::vector< Module > phiFPIXm_
Definition: PixelUnpackingRegions.h:119
PixelUnpackingRegions::Region::maxZ
float maxZ
Definition: PixelUnpackingRegions.h:45
PixelUnpackingRegions::Region::cosphi
float cosphi
Definition: PixelUnpackingRegions.h:46
PixelUnpackingRegions::nreg_
unsigned int nreg_
Definition: PixelUnpackingRegions.h:102
TrackerDigiGeometryRecord.h
edm::ParameterSet
Definition: ParameterSet.h:47
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:51
PixelUnpackingRegions::Region::Region
Region(const math::XYZVector &dir, float dphi=0.5f, float maxz=24.f)
Definition: PixelUnpackingRegions.h:39
PixelUnpackingRegions::addRegionLocal
void addRegionLocal(Region &r, std::vector< Module > &container, const Module &lo, const Module &hi)
Definition: PixelUnpackingRegions.cc:156
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:63
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord >
alignCSCRings.r
r
Definition: alignCSCRings.py:93
PixelUnpackingRegions::Module
Definition: PixelUnpackingRegions.h:72
hi
Definition: EPCuts.h:4
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:32
ESWatcher.h
PixelUnpackingRegions::Region::dPhi
float dPhi
Definition: PixelUnpackingRegions.h:45
PixelUnpackingRegions::nRegions
unsigned int nRegions() const
Definition: PixelUnpackingRegions.h:70
PixelUnpackingRegions::feds_
std::set< unsigned int > feds_
Definition: PixelUnpackingRegions.h:100
Point3D.h
EventSetup.h
PixelUnpackingRegions::nForwardModules
unsigned int nForwardModules() const
Definition: PixelUnpackingRegions.cc:220
PixelUnpackingRegions::Module::phi
float phi
Definition: PixelUnpackingRegions.h:73
PixelUnpackingRegions::Module::z
float z
Definition: PixelUnpackingRegions.h:74
ConsumesCollector.h
PixelUnpackingRegions::watcherSiPixelFedCablingMap_
edm::ESWatcher< SiPixelFedCablingMapRcd > watcherSiPixelFedCablingMap_
Definition: PixelUnpackingRegions.h:124
PixelUnpackingRegions::Region
Definition: PixelUnpackingRegions.h:38
edm::Event
Definition: Event.h:73
Vector3D.h
PixelUnpackingRegions::addRegion
void addRegion(Region &r)
Definition: PixelUnpackingRegions.cc:139
edm::InputTag
Definition: InputTag.h:15
PixelUnpackingRegions::phiFPIXp_
std::vector< Module > phiFPIXp_
Definition: PixelUnpackingRegions.h:118
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
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:75
PixelUnpackingRegions::Region::sinphi
float sinphi
Definition: PixelUnpackingRegions.h:46
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:92
PixelUnpackingRegions::nBarrelModules
unsigned int nBarrelModules() const
Definition: PixelUnpackingRegions.cc:216