CMS 3D CMS Logo

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
void setDetId(DetId id)
Definition: GeomDet.h:99
T z() const
Definition: PV3DBase.h:61
constexpr int chamber() const
Definition: GEMDetId.h:183
int nChambers() const
Return numbers of chambers.
~GEMSuperChamber() override
destructor
const GeomDet * component(DetId id) const override
Return the sub-component (chamber) with a given id in this super chamber.
double f[11][100]
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.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
GEMDetId id() const
Return the GEMDetId of this super chamber.
Definition: DetId.h:17
bool operator==(const GEMSuperChamber &sch) const
equal if the id is the same
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
float computeDeltaPhi(const LocalPoint &position, const LocalVector &direction) const
static int position[264][3]
Definition: ReadPGInfo.cc:289
const GEMChamber * chamber(GEMDetId id) const
Return the chamber corresponding to the given id.
GEMSuperChamber(GEMDetId id, const ReferenceCountingPointer< BoundPlane > &plane)
constructor
const std::vector< const GEMChamber * > & chambers() const
Return the chambers in the super chamber.
*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_