CMS 3D CMS Logo

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 }
Vector3DBase< float, LocalTag >
GeomDet::position
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
GeomDet::setDetId
void setDetId(DetId id)
Definition: GeomDet.h:99
ME0Chamber::ME0Chamber
ME0Chamber(ME0DetId id, const ReferenceCountingPointer< BoundPlane > &plane)
Constructor.
Definition: ME0Chamber.cc:6
GeomDet
Definition: GeomDet.h:27
ME0Chamber::detId_
ME0DetId detId_
Definition: ME0Chamber.h:70
ME0Chamber::components
std::vector< const GeomDet * > components() const override
Return the rolls in the chamber.
Definition: ME0Chamber.cc:18
ME0Layer::id
ME0DetId id() const
Return the ME0DetId of this layer.
Definition: ME0Layer.cc:11
ME0Chamber::add
void add(ME0Layer *layer)
Add Layer to the chamber which takes ownership.
Definition: ME0Chamber.cc:16
ME0Chamber::computeDeltaPhi
float computeDeltaPhi(const LocalPoint &position, const LocalVector &direction) const
Definition: ME0Chamber.cc:64
ReferenceCountingPointer
Definition: ReferenceCounted.h:60
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
DetId
Definition: DetId.h:17
ME0Chamber::nLayers
int nLayers() const
Retunr numbers of layers.
Definition: ME0Chamber.cc:26
ME0Chamber::etaPartition
const ME0EtaPartition * etaPartition(ME0DetId id) const
Definition: ME0Chamber.cc:50
ME0Chamber::component
const GeomDet * component(DetId id) const override
Return the sub-component (roll) with a given id in this chamber.
Definition: ME0Chamber.cc:22
Point3DBase< float, LocalTag >
ME0Chamber::layer
const ME0Layer * layer(ME0DetId id) const
Return the layer corresponding to the given id.
Definition: ME0Chamber.cc:28
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
ME0Chamber::~ME0Chamber
~ME0Chamber() override
Destructor.
Definition: ME0Chamber.cc:10
ME0Layer
Definition: ME0Layer.h:9
ME0Chamber::layers
const std::vector< const ME0Layer * > & layers() const
Return the layers.
Definition: ME0Chamber.cc:24
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
ME0Chamber
Definition: ME0Chamber.h:10
ME0DetId
Definition: ME0DetId.h:16
ME0Chamber::layers_
std::vector< const ME0Layer * > layers_
Definition: ME0Chamber.h:73
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
ME0EtaPartition.h
ME0Chamber::operator==
bool operator==(const ME0Chamber &ch) const
equal if the id is the same
Definition: ME0Chamber.cc:14
ME0Chamber.h
point
*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::etaPartitions_
std::vector< const ME0EtaPartition * > etaPartitions_
Definition: ME0Chamber.h:75
ME0DetId::layer
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
ME0Chamber::etaPartitions
const std::vector< const ME0EtaPartition * > & etaPartitions() const
Definition: ME0Chamber.cc:46
ME0Chamber::id
ME0DetId id() const
Return the ME0DetId of this chamber.
Definition: ME0Chamber.cc:12
ME0EtaPartition
Definition: ME0EtaPartition.h:12
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
ME0Chamber::nEtaPartitions
int nEtaPartitions() const
Definition: ME0Chamber.cc:48
ME0Layer.h