CMS 3D CMS Logo

ME0Chamber.cc
Go to the documentation of this file.
4 #include <iostream>
5 
7  GeomDet(plane), detId_(id)
8 {
9  setDetId(id);
10 }
11 
13 
15  return detId_;
16 }
17 
18 bool ME0Chamber::operator==(const ME0Chamber& ch) const {
19  return this->id()==ch.id();
20 }
21 
23  layers_.push_back(rl);
24 }
25 
26 std::vector<const GeomDet*> ME0Chamber::components() const {
27  return std::vector<const GeomDet*>(layers_.begin(), layers_.end());
28 }
29 
31  return layer(ME0DetId(id.rawId()));
32 }
33 
34 const std::vector<const ME0Layer*>& ME0Chamber::layers() const {
35  return layers_;
36 }
37 
38 int ME0Chamber::nLayers() const {
39  return layers_.size();
40 }
41 
43  if (id.chamberId()!=detId_) return 0; // not in this layer!
44  return layer(id.layer());
45 }
46 
47 const ME0Layer* ME0Chamber::layer(int isl) const {
48  for (auto layer : layers_){
49  if (layer->id().layer()==isl)
50  return layer;
51  }
52  return 0;
53 }
54 
55 // For the old ME0 Geometry (with one eta partition)
56 // we need to maintain this for a while
58  etaPartitions_.push_back(rl);
59 }
60 
61 const std::vector<const ME0EtaPartition*>& ME0Chamber::etaPartitions() const {
62  return etaPartitions_;
63 }
64 
66  return etaPartitions_.size();
67 }
68 
70  if (id.chamberId()!=detId_) return 0; // not in this eta partition!
71  return etaPartition(id.roll());
72 }
73 
75  for (auto roll : etaPartitions_){
76  if (roll->id().roll()==isl)
77  return roll;
78  }
79  return 0;
80 }
81 
82 float ME0Chamber::computeDeltaPhi(const LocalPoint& position, const LocalVector& direction ) const {
83  auto extrap = [] (const LocalPoint& point, const LocalVector& dir, double extZ) -> LocalPoint {
84  double extX = point.x()+extZ*dir.x()/dir.z();
85  double extY = point.y()+extZ*dir.y()/dir.z();
86  return LocalPoint(extX,extY,extZ);
87  };
88  if(nLayers() < 2){return 0;}
89 
90  const float beginOfChamber = layer(1)->position().z();
91  const float centerOfChamber = this->position().z();
92  const float endOfChamber = layer(nLayers())->position().z();
93 
94  LocalPoint projHigh = extrap(position,direction, (centerOfChamber < 0 ? -1.0 : 1.0) * ( endOfChamber- centerOfChamber));
95  LocalPoint projLow = extrap(position,direction, (centerOfChamber < 0 ? -1.0 : 1.0) *( beginOfChamber- centerOfChamber));
96  auto globLow = toGlobal(projLow );
97  auto globHigh = toGlobal(projHigh);
98  return globHigh.phi() - globLow.phi(); //Geom::phi automatically normalizes to [-pi, pi]
99 
100 }
int nLayers() const
Retunr numbers of layers.
Definition: ME0Chamber.cc:38
const std::vector< const ME0EtaPartition * > & etaPartitions() const
Definition: ME0Chamber.cc:61
int nEtaPartitions() const
Definition: ME0Chamber.cc:65
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
virtual std::vector< const GeomDet * > components() const
Return the rolls in the chamber.
Definition: ME0Chamber.cc:26
const ME0Layer * layer(ME0DetId id) const
Return the layer corresponding to the given id.
Definition: ME0Chamber.cc:42
std::vector< const ME0EtaPartition * > etaPartitions_
Definition: ME0Chamber.h:79
void setDetId(DetId id)
Definition: GeomDet.h:120
virtual ~ME0Chamber()
Destructor.
Definition: ME0Chamber.cc:12
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
T y() const
Definition: PV3DBase.h:63
ME0DetId id() const
Return the ME0DetId of this chamber.
Definition: ME0Chamber.cc:14
void add(ME0Layer *layer)
Add Layer to the chamber which takes ownership.
Definition: ME0Chamber.cc:22
std::vector< const ME0Layer * > layers_
Definition: ME0Chamber.h:77
ME0DetId id() const
Return the ME0DetId of this layer.
Definition: ME0Layer.cc:13
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:48
float computeDeltaPhi(const LocalPoint &position, const LocalVector &direction) const
Definition: ME0Chamber.cc:82
T z() const
Definition: PV3DBase.h:64
ME0Chamber(ME0DetId id, const ReferenceCountingPointer< BoundPlane > &plane)
Constructor.
Definition: ME0Chamber.cc:6
const ME0EtaPartition * etaPartition(ME0DetId id) const
Definition: ME0Chamber.cc:69
Definition: DetId.h:18
ME0DetId detId_
Definition: ME0Chamber.h:74
bool operator==(const ME0Chamber &ch) const
equal if the id is the same
Definition: ME0Chamber.cc:18
virtual const GeomDet * component(DetId id) const
Return the sub-component (roll) with a given id in this chamber.
Definition: ME0Chamber.cc:30
const std::vector< const ME0Layer * > & layers() const
Return the layers.
Definition: ME0Chamber.cc:34
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:56
dbl *** dir
Definition: mlp_gen.cc:35
T x() const
Definition: PV3DBase.h:62
*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