CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GEMSuperChamber.cc
Go to the documentation of this file.
3 
5  : GeomDet(plane), detId_(id) {
6  setDetId(id);
7 }
8 
10 
11 GEMDetId GEMSuperChamber::id() const { return detId_; }
12 
13 bool GEMSuperChamber::operator==(const GEMSuperChamber& sch) const { return this->id() == sch.id(); }
14 
15 void GEMSuperChamber::add(const GEMChamber* ch) { chambers_.emplace_back(ch); }
16 
17 std::vector<const GeomDet*> GEMSuperChamber::components() const {
18  return std::vector<const GeomDet*>(chambers_.begin(), chambers_.end());
19 }
20 
21 const GeomDet* GEMSuperChamber::component(DetId id) const { return chamber(GEMDetId(id.rawId())); }
22 
23 const std::vector<const GEMChamber*>& GEMSuperChamber::chambers() const { return chambers_; }
24 
25 int GEMSuperChamber::nChambers() const { return chambers_.size(); }
26 
28  if (id.chamber() != detId_.chamber())
29  return nullptr; // not in this super chamber!
30  return chamber(id.layer());
31 }
32 
33 const GEMChamber* GEMSuperChamber::chamber(int isl) const {
34  for (auto ch : chambers_) {
35  if (ch->id().layer() == isl)
36  return ch;
37  }
38  return nullptr;
39 }
40 
41 float GEMSuperChamber::computeDeltaPhi(const LocalPoint& position, const LocalVector& direction) const {
42  auto extrap = [](const LocalPoint& point, const LocalVector& dir, double extZ) -> LocalPoint {
43  if (dir.z() == 0)
44  return LocalPoint(0.f, 0.f, extZ);
45  double extX = point.x() + extZ * dir.x() / dir.z();
46  double extY = point.y() + extZ * dir.y() / dir.z();
47  return LocalPoint(extX, extY, extZ);
48  };
49  if (nChambers() < 2) {
50  return 0.f;
51  }
52 
53  const float beginOfChamber = chamber(1)->position().z();
54  const float centerOfChamber = this->position().z();
55  const float endOfChamber = chamber(nChambers())->position().z();
56 
57  LocalPoint projHigh =
58  extrap(position, direction, (centerOfChamber < 0 ? -1.0 : 1.0) * (endOfChamber - centerOfChamber));
59  LocalPoint projLow =
60  extrap(position, direction, (centerOfChamber < 0 ? -1.0 : 1.0) * (beginOfChamber - centerOfChamber));
61  auto globLow = toGlobal(projLow);
62  auto globHigh = toGlobal(projHigh);
63  return globHigh.phi() - globLow.phi(); //Geom::phi automatically normalizes to [-pi, pi]
64 }
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
float computeDeltaPhi(const LocalPoint &position, const LocalVector &direction) const
const GEMChamber * chamber(GEMDetId id) const
Return the chamber corresponding to the given id.
void setDetId(DetId id)
Definition: GeomDet.h:99
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
T y() const
Definition: PV3DBase.h:60
bool operator==(const GEMSuperChamber &sch) const
equal if the id is the same
constexpr std::array< uint8_t, layerIndexSize > layer
~GEMSuperChamber() override
destructor
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
const GeomDet * component(DetId id) const override
Return the sub-component (chamber) with a given id in this super chamber.
T z() const
Definition: PV3DBase.h:61
std::vector< const GeomDet * > components() const override
Return the chambers in the super chamber.
void add(const GEMChamber *ch)
Add chamber to the super chamber which takes ownership.
Definition: DetId.h:17
constexpr int chamber() const
Definition: GEMDetId.h:183
int nChambers() const
Return numbers of chambers.
GEMDetId id() const
Return the GEMDetId of this super chamber.
static int position[264][3]
Definition: ReadPGInfo.cc:289
const std::vector< const GEMChamber * > & chambers() const
Return the chambers in the super chamber.
T x() const
Definition: PV3DBase.h:59
GEMSuperChamber(GEMDetId id, const ReferenceCountingPointer< BoundPlane > &plane)
constructor
*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< const GEMChamber * > chambers_