CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
BaseCrystal Class Reference

#include <BaseCrystal.h>

Public Types

typedef ROOT::Math::Plane3D Plane3D
 
typedef math::XYZVector XYZPoint
 
typedef math::XYZVector XYZVector
 

Public Member Functions

 BaseCrystal ()=default
 Empty constructor. More...
 
 BaseCrystal (const DetId &cell)
 constructor from DetId More...
 
const XYZVectorexitingNormal (const CaloDirection &side) const
 normal exiting vector for the surface More...
 
const XYZVectorgetAxis () const
 get crystal axis More...
 
const XYZPointgetBackCenter () const
 get front center More...
 
const Plane3DgetBackPlane () const
 back plane More...
 
void getBackSide (XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
 Coordinates of the back side. More...
 
void getBackSide (std::vector< XYZPoint > &corners) const
 
const XYZPointgetCenter () const
 get 1/8*(Sum of corners) More...
 
const XYZPointgetCorner (unsigned i) const
 get the i-th corner More...
 
const DetIdgetDetId () const
 get the DetId More...
 
void getDrawingCoordinates (std::vector< float > &x, std::vector< float > &y, std::vector< float > &z) const
 for debugging. More...
 
const XYZVectorgetFifthEdge () const
 Direction of the fifth edge. More...
 
const XYZVectorgetFirstEdge () const
 Direction of the first edge. More...
 
const XYZPointgetFrontCenter () const
 get front center More...
 
const Plane3DgetFrontPlane () const
 front plane More...
 
void getFrontSide (XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
 coordinates of the front side More...
 
void getFrontSide (std::vector< XYZPoint > &corners) const
 
const XYZVectorgetLateralEdge (unsigned i) const
 lateral directions More...
 
void getLateralEdges (unsigned i, XYZPoint &, XYZPoint &) const
 get the lateral edges More...
 
const Plane3DgetLateralPlane (unsigned i) const
 lateral planes More...
 
void getLateralSide (unsigned i, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
 Coordinates of the i=th lateral side. More...
 
void getLateralSide (unsigned i, std::vector< XYZPoint > &corners) const
 
const Plane3DgetPlane (const CaloDirection &side) const
 generic access More...
 
void getSide (const CaloDirection &side, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
 generic access More...
 
void getSide (const CaloDirection &side, std::vector< XYZPoint > &corners) const
 
const int getSubdetNumber () const
 get the subdector More...
 
void print () const
 
void setCorners (const CaloCellGeometry::CornersVec &vec, const GlobalPoint &pos)
 
 ~BaseCrystal ()=default
 Copy constructor. More...
 

Static Public Member Functions

static unsigned oppositeDirection (unsigned iside)
 

Private Member Functions

void computeBasicProperties ()
 

Private Attributes

XYZPoint backcenter_
 
DetId cellid_
 
XYZPoint center_
 
XYZPoint corners_ [8]
 
XYZVector crystalaxis_
 
XYZVector exitingNormal_ [6]
 
XYZVector fifthedgedirection_
 
XYZVector firstedgedirection_
 
XYZPoint frontcenter_
 
XYZVector lateraldirection_ [4]
 
Plane3D lateralPlane_ [6]
 
int subdetn_
 

Detailed Description

Definition at line 19 of file BaseCrystal.h.

Member Typedef Documentation

◆ Plane3D

typedef ROOT::Math::Plane3D BaseCrystal::Plane3D

Definition at line 23 of file BaseCrystal.h.

◆ XYZPoint

Definition at line 22 of file BaseCrystal.h.

◆ XYZVector

Definition at line 21 of file BaseCrystal.h.

Constructor & Destructor Documentation

◆ BaseCrystal() [1/2]

BaseCrystal::BaseCrystal ( )
default

Empty constructor.

◆ BaseCrystal() [2/2]

BaseCrystal::BaseCrystal ( const DetId cell)

constructor from DetId

Definition at line 9 of file BaseCrystal.cc.

References cellid_, DetId::subdetId(), and subdetn_.

9 : cellid_(cell) { subdetn_ = cellid_.subdetId(); }
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
DetId cellid_
Definition: BaseCrystal.h:111

◆ ~BaseCrystal()

BaseCrystal::~BaseCrystal ( )
default

Copy constructor.

Member Function Documentation

◆ computeBasicProperties()

void BaseCrystal::computeBasicProperties ( )
private

Definition at line 72 of file BaseCrystal.cc.

References backcenter_, center_, corners_, crystalaxis_, exitingNormal_, fifthedgedirection_, firstedgedirection_, frontcenter_, mps_fire::i, lateraldirection_, and lateralPlane_.

Referenced by setCorners().

72  {
73  //if(corners_.size()==0) return;
74  center_ = XYZPoint(0., 0., 0.);
75  for (unsigned ic = 0; ic < 8; ++ic) {
76  center_ += corners_[ic];
77  }
78 
79  center_ *= 0.125;
80 
81  // std::cout << " Ncorners ? " << corners_.size() << std::endl;
82  frontcenter_ = 0.25 * (corners_[0] + corners_[1] + corners_[2] + corners_[3]);
83  backcenter_ = 0.25 * (corners_[4] + corners_[5] + corners_[6] + corners_[7]);
85  firstedgedirection_ = -(corners_[1] - corners_[0]).Unit();
86  fifthedgedirection_ = -(corners_[5] - corners_[4]).Unit();
87  // std::cout << " Direction laterales " << std::endl;
88  for (unsigned il = 0; il < 4; ++il) {
89  lateraldirection_[il] = -(corners_[(il + 1) % 4] - corners_[il]).Unit();
90  }
91 
92  Plane3D frontPlane((Point)corners_[0], (Point)corners_[1], (Point)corners_[2]);
93  Plane3D backPlane((Point)corners_[4], (Point)corners_[5], (Point)corners_[6]);
94  for (unsigned i = 0; i < 4; ++i) {
95  lateralPlane_[i] = Plane3D((Point)corners_[i], (Point)corners_[(i + 1) % 4], (Point)corners_[i + 4]);
96  }
97  // Front plane i=4 (UP)
98  lateralPlane_[4] = frontPlane;
99  // Back plane i =5 (DOWN)
100  lateralPlane_[5] = backPlane;
101 
102  for (unsigned i = 0; i < 6; ++i) {
103  exitingNormal_[i] = (lateralPlane_[i].Distance(Point(center_.X(), center_.Y(), center_.Z())) < 0.)
104  ? lateralPlane_[i].Normal().Unit()
105  : -lateralPlane_[i].Normal().Unit();
106  }
107 }
XYZPoint center_
Definition: BaseCrystal.h:113
XYZPoint backcenter_
Definition: BaseCrystal.h:115
XYZVector firstedgedirection_
Definition: BaseCrystal.h:116
XYZVector lateraldirection_[4]
Definition: BaseCrystal.h:119
XYZPoint corners_[8]
Definition: BaseCrystal.h:110
math::XYZVector XYZPoint
Definition: BaseCrystal.h:22
ROOT::Math::Plane3D Plane3D
Definition: BaseCrystal.h:23
XYZPoint frontcenter_
Definition: BaseCrystal.h:114
XYZVector exitingNormal_[6]
Definition: BaseCrystal.h:121
Plane3D lateralPlane_[6]
Definition: BaseCrystal.h:120
ROOT::Math::Plane3D::Point Point
Definition: BaseCrystal.cc:7
Structure Point Contains parameters of Gaussian fits to DMRs.
XYZVector fifthedgedirection_
Definition: BaseCrystal.h:117
XYZVector crystalaxis_
Definition: BaseCrystal.h:118
ROOT::Math::Plane3D Plane3D

◆ exitingNormal()

const XYZVector& BaseCrystal::exitingNormal ( const CaloDirection side) const
inline

normal exiting vector for the surface

Definition at line 92 of file BaseCrystal.h.

References exitingNormal_, CaloDirectionOperations::Side(), and ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::side().

Referenced by Crystal::exitingNormal().

92  {
94  };
XYZVector exitingNormal_[6]
Definition: BaseCrystal.h:121
static CaloDirection Side(unsigned i)
unsigned int -> Side conversion

◆ getAxis()

const XYZVector& BaseCrystal::getAxis ( ) const
inline

get crystal axis

Definition at line 102 of file BaseCrystal.h.

References crystalaxis_.

Referenced by Crystal::getAxis().

102 { return crystalaxis_; }
XYZVector crystalaxis_
Definition: BaseCrystal.h:118

◆ getBackCenter()

const XYZPoint& BaseCrystal::getBackCenter ( ) const
inline

get front center

Definition at line 52 of file BaseCrystal.h.

References backcenter_.

Referenced by Crystal::getBackCenter().

52 { return backcenter_; }
XYZPoint backcenter_
Definition: BaseCrystal.h:115

◆ getBackPlane()

const Plane3D& BaseCrystal::getBackPlane ( ) const
inline

back plane

Definition at line 80 of file BaseCrystal.h.

References lateralPlane_.

Referenced by Crystal::getBackPlane().

80 { return lateralPlane_[5]; }
Plane3D lateralPlane_[6]
Definition: BaseCrystal.h:120

◆ getBackSide() [1/2]

void BaseCrystal::getBackSide ( XYZPoint a,
XYZPoint b,
XYZPoint c,
XYZPoint d 
) const

Coordinates of the back side.

Definition at line 133 of file BaseCrystal.cc.

References a, b, DummyCfis::c, corners_, and ztail::d.

Referenced by Crystal::getBackSide(), and getSide().

133  {
134  a = corners_[4];
135  b = corners_[5];
136  c = corners_[6];
137  d = corners_[7];
138 }
XYZPoint corners_[8]
Definition: BaseCrystal.h:110
d
Definition: ztail.py:151
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

◆ getBackSide() [2/2]

void BaseCrystal::getBackSide ( std::vector< XYZPoint > &  corners) const

Definition at line 140 of file BaseCrystal.cc.

References corners_.

140  {
141  if (corners.size() == 4) {
142  corners[0] = corners_[4];
143  corners[1] = corners_[5];
144  corners[2] = corners_[6];
145  corners[3] = corners_[7];
146  }
147 }
XYZPoint corners_[8]
Definition: BaseCrystal.h:110

◆ getCenter()

const XYZPoint& BaseCrystal::getCenter ( ) const
inline

get 1/8*(Sum of corners)

Definition at line 48 of file BaseCrystal.h.

References center_.

Referenced by Crystal::getCenter().

48 { return center_; };
XYZPoint center_
Definition: BaseCrystal.h:113

◆ getCorner()

const XYZPoint& BaseCrystal::getCorner ( unsigned  i) const
inline

get the i-th corner

Definition at line 46 of file BaseCrystal.h.

References corners_, and mps_fire::i.

Referenced by Crystal::getCorner().

46 { return corners_[i]; };
XYZPoint corners_[8]
Definition: BaseCrystal.h:110

◆ getDetId()

const DetId& BaseCrystal::getDetId ( void  ) const
inline

get the DetId

Definition at line 58 of file BaseCrystal.h.

References cellid_.

58 { return cellid_; };
DetId cellid_
Definition: BaseCrystal.h:111

◆ getDrawingCoordinates()

void BaseCrystal::getDrawingCoordinates ( std::vector< float > &  x,
std::vector< float > &  y,
std::vector< float > &  z 
) const

for debugging.

Definition at line 167 of file BaseCrystal.cc.

References corners_, x, X, y, beamSpotPI::Y, z, and beamSpotPI::Z.

Referenced by Crystal::getDrawingCoordinates().

167  {
168  x.clear();
169  y.clear();
170  z.clear();
171 
172  x.push_back(corners_[0].X());
173  x.push_back(corners_[3].X());
174  x.push_back(corners_[2].X());
175  x.push_back(corners_[1].X());
176  x.push_back(corners_[5].X());
177  x.push_back(corners_[6].X());
178  x.push_back(corners_[7].X());
179  x.push_back(corners_[4].X());
180  x.push_back(corners_[0].X());
181  x.push_back(corners_[1].X());
182  x.push_back(corners_[2].X());
183  x.push_back(corners_[6].X());
184  x.push_back(corners_[5].X());
185  x.push_back(corners_[4].X());
186  x.push_back(corners_[7].X());
187  x.push_back(corners_[3].X());
188 
189  y.push_back(corners_[0].Y());
190  y.push_back(corners_[3].Y());
191  y.push_back(corners_[2].Y());
192  y.push_back(corners_[1].Y());
193  y.push_back(corners_[5].Y());
194  y.push_back(corners_[6].Y());
195  y.push_back(corners_[7].Y());
196  y.push_back(corners_[4].Y());
197  y.push_back(corners_[0].Y());
198  y.push_back(corners_[1].Y());
199  y.push_back(corners_[2].Y());
200  y.push_back(corners_[6].Y());
201  y.push_back(corners_[5].Y());
202  y.push_back(corners_[4].Y());
203  y.push_back(corners_[7].Y());
204  y.push_back(corners_[3].Y());
205 
206  z.push_back(corners_[0].Z());
207  z.push_back(corners_[3].Z());
208  z.push_back(corners_[2].Z());
209  z.push_back(corners_[1].Z());
210  z.push_back(corners_[5].Z());
211  z.push_back(corners_[6].Z());
212  z.push_back(corners_[7].Z());
213  z.push_back(corners_[4].Z());
214  z.push_back(corners_[0].Z());
215  z.push_back(corners_[1].Z());
216  z.push_back(corners_[2].Z());
217  z.push_back(corners_[6].Z());
218  z.push_back(corners_[5].Z());
219  z.push_back(corners_[4].Z());
220  z.push_back(corners_[7].Z());
221  z.push_back(corners_[3].Z());
222 }
#define X(str)
Definition: MuonsGrabber.cc:38
XYZPoint corners_[8]
Definition: BaseCrystal.h:110

◆ getFifthEdge()

const XYZVector& BaseCrystal::getFifthEdge ( ) const
inline

Direction of the fifth edge.

Definition at line 56 of file BaseCrystal.h.

References fifthedgedirection_.

Referenced by Crystal::getFifthEdge().

56 { return fifthedgedirection_; }
XYZVector fifthedgedirection_
Definition: BaseCrystal.h:117

◆ getFirstEdge()

const XYZVector& BaseCrystal::getFirstEdge ( ) const
inline

Direction of the first edge.

Definition at line 54 of file BaseCrystal.h.

References firstedgedirection_.

Referenced by Crystal::getFirstEdge().

54 { return firstedgedirection_; }
XYZVector firstedgedirection_
Definition: BaseCrystal.h:116

◆ getFrontCenter()

const XYZPoint& BaseCrystal::getFrontCenter ( ) const
inline

get front center

Definition at line 50 of file BaseCrystal.h.

References frontcenter_.

Referenced by Crystal::getFrontCenter().

50 { return frontcenter_; };
XYZPoint frontcenter_
Definition: BaseCrystal.h:114

◆ getFrontPlane()

const Plane3D& BaseCrystal::getFrontPlane ( ) const
inline

front plane

Definition at line 78 of file BaseCrystal.h.

References lateralPlane_.

Referenced by Crystal::getFrontPlane().

78 { return lateralPlane_[4]; }
Plane3D lateralPlane_[6]
Definition: BaseCrystal.h:120

◆ getFrontSide() [1/2]

void BaseCrystal::getFrontSide ( XYZPoint a,
XYZPoint b,
XYZPoint c,
XYZPoint d 
) const

coordinates of the front side

Definition at line 117 of file BaseCrystal.cc.

References a, b, DummyCfis::c, corners_, and ztail::d.

Referenced by Crystal::getFrontSide(), and getSide().

117  {
118  a = corners_[0];
119  b = corners_[1];
120  c = corners_[2];
121  d = corners_[3];
122 }
XYZPoint corners_[8]
Definition: BaseCrystal.h:110
d
Definition: ztail.py:151
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

◆ getFrontSide() [2/2]

void BaseCrystal::getFrontSide ( std::vector< XYZPoint > &  corners) const

Definition at line 124 of file BaseCrystal.cc.

References corners_.

124  {
125  if (corners.size() == 4) {
126  corners[0] = corners_[0];
127  corners[1] = corners_[1];
128  corners[2] = corners_[2];
129  corners[3] = corners_[3];
130  }
131 }
XYZPoint corners_[8]
Definition: BaseCrystal.h:110

◆ getLateralEdge()

const XYZVector& BaseCrystal::getLateralEdge ( unsigned  i) const
inline

lateral directions

Definition at line 89 of file BaseCrystal.h.

References mps_fire::i, and lateraldirection_.

Referenced by Crystal::getLateralEdge().

89 { return lateraldirection_[i]; };
XYZVector lateraldirection_[4]
Definition: BaseCrystal.h:119

◆ getLateralEdges()

void BaseCrystal::getLateralEdges ( unsigned  i,
XYZPoint a,
XYZPoint b 
) const

get the lateral edges

Definition at line 109 of file BaseCrystal.cc.

References a, b, corners_, mps_fire::i, and mitigatedMETSequence_cff::U.

Referenced by Crystal::getLateralEdges(), and getLateralSide().

109  {
110  if (i < 4U) // i >= 0, since i is unsigned
111  {
112  a = corners_[i];
113  b = corners_[i + 4];
114  }
115 }
XYZPoint corners_[8]
Definition: BaseCrystal.h:110
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

◆ getLateralPlane()

const Plane3D& BaseCrystal::getLateralPlane ( unsigned  i) const
inline

lateral planes

Definition at line 82 of file BaseCrystal.h.

References mps_fire::i, and lateralPlane_.

Referenced by Crystal::getLateralPlane().

82 { return lateralPlane_[i]; };
Plane3D lateralPlane_[6]
Definition: BaseCrystal.h:120

◆ getLateralSide() [1/2]

void BaseCrystal::getLateralSide ( unsigned  i,
XYZPoint a,
XYZPoint b,
XYZPoint c,
XYZPoint d 
) const

Coordinates of the i=th lateral side.

Definition at line 149 of file BaseCrystal.cc.

References a, b, DummyCfis::c, ztail::d, getLateralEdges(), mps_fire::i, and mitigatedMETSequence_cff::U.

Referenced by Crystal::getLateralSide(), and getSide().

149  {
150  if (i < 4U) // i >= 0, since i is unsigned
151  {
152  getLateralEdges(i, a, b);
153  getLateralEdges((i + 1) % 4, c, d);
154  }
155 }
void getLateralEdges(unsigned i, XYZPoint &, XYZPoint &) const
get the lateral edges
Definition: BaseCrystal.cc:109
d
Definition: ztail.py:151
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

◆ getLateralSide() [2/2]

void BaseCrystal::getLateralSide ( unsigned  i,
std::vector< XYZPoint > &  corners 
) const

Definition at line 157 of file BaseCrystal.cc.

References corners_, mps_fire::i, and mitigatedMETSequence_cff::U.

157  {
158  if (corners.size() == 4 && i < 4U) // i >= 0, since i is unsigned
159  {
160  corners[0] = corners_[i];
161  corners[1] = corners_[i + 4];
162  corners[2] = corners_[4 + (i + 1) % 4];
163  corners[3] = corners_[(i + 1) % 4];
164  }
165 }
XYZPoint corners_[8]
Definition: BaseCrystal.h:110

◆ getPlane()

const Plane3D& BaseCrystal::getPlane ( const CaloDirection side) const
inline

generic access

Definition at line 84 of file BaseCrystal.h.

References lateralPlane_, CaloDirectionOperations::Side(), and ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::side().

Referenced by Crystal::getPlane().

84  {
86  }
Plane3D lateralPlane_[6]
Definition: BaseCrystal.h:120
static CaloDirection Side(unsigned i)
unsigned int -> Side conversion

◆ getSide() [1/2]

void BaseCrystal::getSide ( const CaloDirection side,
XYZPoint a,
XYZPoint b,
XYZPoint c,
XYZPoint d 
) const

generic access

Definition at line 224 of file BaseCrystal.cc.

References a, b, DummyCfis::c, ztail::d, DOWN, getBackSide(), getFrontSide(), getLateralSide(), CaloDirectionOperations::Side(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::side(), and UP.

Referenced by Crystal::getSide().

224  {
225  switch (side) {
226  case UP:
227  getFrontSide(a, b, c, d);
228  break;
229  case DOWN:
230  getBackSide(a, b, c, d);
231  break;
232  default:
234  }
235 }
void getBackSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the back side.
Definition: BaseCrystal.cc:133
void getLateralSide(unsigned i, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the i=th lateral side.
Definition: BaseCrystal.cc:149
void getFrontSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
coordinates of the front side
Definition: BaseCrystal.cc:117
static CaloDirection Side(unsigned i)
unsigned int -> Side conversion
d
Definition: ztail.py:151
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

◆ getSide() [2/2]

void BaseCrystal::getSide ( const CaloDirection side,
std::vector< XYZPoint > &  corners 
) const

Definition at line 250 of file BaseCrystal.cc.

References DOWN, getBackSide(), getFrontSide(), getLateralSide(), CaloDirectionOperations::Side(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::side(), and UP.

250  {
251  switch (side) {
252  case UP:
253  getFrontSide(corners);
254  break;
255  case DOWN:
256  getBackSide(corners);
257  break;
258  default:
260  }
261 }
void getBackSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the back side.
Definition: BaseCrystal.cc:133
void getLateralSide(unsigned i, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the i=th lateral side.
Definition: BaseCrystal.cc:149
void getFrontSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
coordinates of the front side
Definition: BaseCrystal.cc:117
static CaloDirection Side(unsigned i)
unsigned int -> Side conversion

◆ getSubdetNumber()

const int BaseCrystal::getSubdetNumber ( ) const
inline

get the subdector

Definition at line 60 of file BaseCrystal.h.

References subdetn_.

Referenced by Crystal::getSubdetNumber().

60 { return subdetn_; }

◆ oppositeDirection()

static unsigned BaseCrystal::oppositeDirection ( unsigned  iside)
static

◆ print()

void BaseCrystal::print ( void  ) const

Definition at line 237 of file BaseCrystal.cc.

References backcenter_, cellid_, center_, corners_, gather_cfg::cout, exitingNormal_, frontcenter_, EcalPhiSymFlatTableProducers_cfi::id, and DetId::rawId().

Referenced by Crystal::print().

237  {
238  std::cout << "CellID " << cellid_.rawId() << std::endl;
239  std::cout << " Corners " << std::endl;
240  for (unsigned ic = 0; ic < 8; ++ic)
241  std::cout << corners_[ic] << std::endl;
242  std::cout << " Center " << center_ << std::endl;
243  std::cout << " Front Center " << frontcenter_ << std::endl;
244  std::cout << " Back Center " << backcenter_ << std::endl;
245  std::cout << " Normales sortantes " << std::endl;
246  for (unsigned id = 0; id < 6; ++id)
247  std::cout << exitingNormal_[id] << std::endl;
248 }
XYZPoint center_
Definition: BaseCrystal.h:113
XYZPoint backcenter_
Definition: BaseCrystal.h:115
XYZPoint corners_[8]
Definition: BaseCrystal.h:110
XYZPoint frontcenter_
Definition: BaseCrystal.h:114
XYZVector exitingNormal_[6]
Definition: BaseCrystal.h:121
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
DetId cellid_
Definition: BaseCrystal.h:111

◆ setCorners()

void BaseCrystal::setCorners ( const CaloCellGeometry::CornersVec vec,
const GlobalPoint pos 
)

Definition at line 11 of file BaseCrystal.cc.

References computeBasicProperties(), corners_, EcalBarrel, EcalEndcap, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, HLT_IsoTrack_cff::offset, EZArrayFL< T >::size(), subdetn_, x, y, and z.

Referenced by CaloGeometryHelper::buildCrystalArray().

11  {
12  unsigned ncorners = vec.size();
13  if (ncorners != 8)
14  return;
15 
16  // This is really a pity to have to make the conversion GlobalPoint to XYZPoint, but the latter have many
17  // useful properties (transformations, conversions....) that aren't implemented
18  // for the GlobalPoints and GlobalVectors.
19 
20  if (subdetn_ == EcalBarrel) {
21  if (pos.z() > 0.) {
22  for (unsigned ic = 0; ic < 8; ++ic) {
23  corners_[ic] = XYZPoint(vec[ic].x(), vec[ic].y(), vec[ic].z());
24  }
25  } else {
26  corners_[0] = XYZPoint(vec[2].x(), vec[2].y(), vec[2].z());
27  corners_[1] = XYZPoint(vec[3].x(), vec[3].y(), vec[3].z());
28  corners_[2] = XYZPoint(vec[0].x(), vec[0].y(), vec[0].z());
29  corners_[3] = XYZPoint(vec[1].x(), vec[1].y(), vec[1].z());
30  corners_[4] = XYZPoint(vec[6].x(), vec[6].y(), vec[6].z());
31  corners_[5] = XYZPoint(vec[7].x(), vec[7].y(), vec[7].z());
32  corners_[6] = XYZPoint(vec[4].x(), vec[4].y(), vec[4].z());
33  corners_[7] = XYZPoint(vec[5].x(), vec[5].y(), vec[5].z());
34  }
35  } else if (subdetn_ == EcalEndcap) {
36  double x = pos.x();
37  double y = pos.y();
38  double z = pos.z();
39  unsigned offset = 0;
40  int zsign = 1;
41  if (z > 0) {
42  if (x > 0 && y > 0)
43  offset = 1;
44  else if (x < 0 && y > 0)
45  offset = 2;
46  else if (x > 0 && y < 0)
47  offset = 0;
48  else if (x < 0 && y < 0)
49  offset = 3;
50  zsign = 1;
51  } else {
52  if (x > 0 && y > 0)
53  offset = 3;
54  else if (x < 0 && y > 0)
55  offset = 2;
56  else if (x > 0 && y < 0)
57  offset = 0;
58  else if (x < 0 && y < 0)
59  offset = 1;
60  zsign = -1;
61  }
62  for (unsigned ic = 0; ic < 4; ++ic) {
63  unsigned i1 = (unsigned)((zsign * ic + offset) % 4);
64  unsigned i2 = i1 + 4;
65  corners_[ic] = XYZPoint(vec[i1].x(), vec[i1].y(), vec[i1].z());
66  corners_[4 + ic] = XYZPoint(vec[i2].x(), vec[i2].y(), vec[i2].z());
67  }
68  }
70 }
size_type size() const
Definition: EZArrayFL.h:65
XYZPoint corners_[8]
Definition: BaseCrystal.h:110
math::XYZVector XYZPoint
Definition: BaseCrystal.h:22
void computeBasicProperties()
Definition: BaseCrystal.cc:72

Member Data Documentation

◆ backcenter_

XYZPoint BaseCrystal::backcenter_
private

Definition at line 115 of file BaseCrystal.h.

Referenced by computeBasicProperties(), getBackCenter(), and print().

◆ cellid_

DetId BaseCrystal::cellid_
private

Definition at line 111 of file BaseCrystal.h.

Referenced by BaseCrystal(), getDetId(), and print().

◆ center_

XYZPoint BaseCrystal::center_
private

Definition at line 113 of file BaseCrystal.h.

Referenced by computeBasicProperties(), getCenter(), and print().

◆ corners_

XYZPoint BaseCrystal::corners_[8]
private

◆ crystalaxis_

XYZVector BaseCrystal::crystalaxis_
private

Definition at line 118 of file BaseCrystal.h.

Referenced by computeBasicProperties(), and getAxis().

◆ exitingNormal_

XYZVector BaseCrystal::exitingNormal_[6]
private

Definition at line 121 of file BaseCrystal.h.

Referenced by computeBasicProperties(), exitingNormal(), and print().

◆ fifthedgedirection_

XYZVector BaseCrystal::fifthedgedirection_
private

Definition at line 117 of file BaseCrystal.h.

Referenced by computeBasicProperties(), and getFifthEdge().

◆ firstedgedirection_

XYZVector BaseCrystal::firstedgedirection_
private

Definition at line 116 of file BaseCrystal.h.

Referenced by computeBasicProperties(), and getFirstEdge().

◆ frontcenter_

XYZPoint BaseCrystal::frontcenter_
private

Definition at line 114 of file BaseCrystal.h.

Referenced by computeBasicProperties(), getFrontCenter(), and print().

◆ lateraldirection_

XYZVector BaseCrystal::lateraldirection_[4]
private

Definition at line 119 of file BaseCrystal.h.

Referenced by computeBasicProperties(), and getLateralEdge().

◆ lateralPlane_

Plane3D BaseCrystal::lateralPlane_[6]
private

◆ subdetn_

int BaseCrystal::subdetn_
private

Definition at line 112 of file BaseCrystal.h.

Referenced by BaseCrystal(), getSubdetNumber(), and setCorners().