CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ME0Chamber.cc
Go to the documentation of this file.
4 #include <iostream>
5 
7  setDetId(id);
8 }
9 
11 
12 ME0DetId ME0Chamber::id() const { return detId_; }
13 
14 bool ME0Chamber::operator==(const ME0Chamber& ch) const { return this->id() == ch.id(); }
15 
16 void ME0Chamber::add(ME0Layer* rl) { layers_.emplace_back(rl); }
17 
18 std::vector<const GeomDet*> ME0Chamber::components() const {
19  return std::vector<const GeomDet*>(layers_.begin(), layers_.end());
20 }
21 
22 const GeomDet* ME0Chamber::component(DetId id) const { return layer(ME0DetId(id.rawId())); }
23 
24 const std::vector<const ME0Layer*>& ME0Chamber::layers() const { return layers_; }
25 
26 int ME0Chamber::nLayers() const { return layers_.size(); }
27 
29  if (id.chamberId() != detId_)
30  return nullptr; // not in this layer!
31  return layer(id.layer());
32 }
33 
34 const ME0Layer* ME0Chamber::layer(int isl) const {
35  for (auto layer : layers_) {
36  if (layer->id().layer() == isl)
37  return layer;
38  }
39  return nullptr;
40 }
41 
42 // For the old ME0 Geometry (with one eta partition)
43 // we need to maintain this for a while
44 void ME0Chamber::add(ME0EtaPartition* rl) { etaPartitions_.emplace_back(rl); }
45 
46 const std::vector<const ME0EtaPartition*>& ME0Chamber::etaPartitions() const { return etaPartitions_; }
47 
48 int ME0Chamber::nEtaPartitions() const { return etaPartitions_.size(); }
49 
51  if (id.chamberId() != detId_)
52  return nullptr; // not in this eta partition!
53  return etaPartition(id.roll());
54 }
55 
57  for (auto roll : etaPartitions_) {
58  if (roll->id().roll() == isl)
59  return roll;
60  }
61  return nullptr;
62 }
63 
64 float ME0Chamber::computeDeltaPhi(const LocalPoint& position, const LocalVector& direction) const {
65  auto extrap = [](const LocalPoint& point, const LocalVector& dir, double extZ) -> LocalPoint {
66  double extX = point.x() + extZ * dir.x() / dir.z();
67  double extY = point.y() + extZ * dir.y() / dir.z();
68  return LocalPoint(extX, extY, extZ);
69  };
70  if (nLayers() < 2) {
71  return 0;
72  }
73 
74  const float beginOfChamber = layer(1)->position().z();
75  const float centerOfChamber = this->position().z();
76  const float endOfChamber = layer(nLayers())->position().z();
77 
78  LocalPoint projHigh =
79  extrap(position, direction, (centerOfChamber < 0 ? -1.0 : 1.0) * (endOfChamber - centerOfChamber));
80  LocalPoint projLow =
81  extrap(position, direction, (centerOfChamber < 0 ? -1.0 : 1.0) * (beginOfChamber - centerOfChamber));
82  auto globLow = toGlobal(projLow);
83  auto globHigh = toGlobal(projHigh);
84  return globHigh.phi() - globLow.phi(); //Geom::phi automatically normalizes to [-pi, pi]
85 }
int nLayers() const
Retunr numbers of layers.
Definition: ME0Chamber.cc:26
const std::vector< const ME0EtaPartition * > & etaPartitions() const
Definition: ME0Chamber.cc:46
int nEtaPartitions() const
Definition: ME0Chamber.cc:48
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
const ME0Layer * layer(ME0DetId id) const
Return the layer corresponding to the given id.
Definition: ME0Chamber.cc:28
std::vector< const GeomDet * > components() const override
Return the rolls in the chamber.
Definition: ME0Chamber.cc:18
std::vector< const ME0EtaPartition * > etaPartitions_
Definition: ME0Chamber.h:75
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
ME0DetId id() const
Return the ME0DetId of this chamber.
Definition: ME0Chamber.cc:12
void add(ME0Layer *layer)
Add Layer to the chamber which takes ownership.
Definition: ME0Chamber.cc:16
std::vector< const ME0Layer * > layers_
Definition: ME0Chamber.h:73
ME0DetId id() const
Return the ME0DetId of this layer.
Definition: ME0Layer.cc:11
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
Definition: ME0Chamber.cc:64
T z() const
Definition: PV3DBase.h:61
ME0Chamber(ME0DetId id, const ReferenceCountingPointer< BoundPlane > &plane)
Constructor.
Definition: ME0Chamber.cc:6
const ME0EtaPartition * etaPartition(ME0DetId id) const
Definition: ME0Chamber.cc:50
Definition: DetId.h:17
ME0DetId detId_
Definition: ME0Chamber.h:70
static int position[264][3]
Definition: ReadPGInfo.cc:289
bool operator==(const ME0Chamber &ch) const
equal if the id is the same
Definition: ME0Chamber.cc:14
const GeomDet * component(DetId id) const override
Return the sub-component (roll) with a given id in this chamber.
Definition: ME0Chamber.cc:22
const std::vector< const ME0Layer * > & layers() const
Return the layers.
Definition: ME0Chamber.cc:24
int layer() const
Layer id: each chamber has six layers of chambers: layer 1 is the inner layer and layer 6 is the oute...
Definition: ME0DetId.h:44
T x() const
Definition: PV3DBase.h:59
*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
~ME0Chamber() override
Destructor.
Definition: ME0Chamber.cc:10