CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 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 std::vector< XYZPoint > & getCorners () const
 
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 ()
 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_
 
std::vector< XYZPointcorners_
 
XYZVector crystalaxis_
 
std::vector< XYZVectorexitingNormal_
 
XYZVector fifthedgedirection_
 
XYZVector firstedgedirection_
 
XYZPoint frontcenter_
 
std::vector< XYZVectorlateraldirection_
 
std::vector< Plane3DlateralPlane_
 
int subdetn_
 

Detailed Description

Definition at line 19 of file BaseCrystal.h.

Member Typedef Documentation

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

Definition at line 26 of file BaseCrystal.h.

Definition at line 25 of file BaseCrystal.h.

Definition at line 24 of file BaseCrystal.h.

Constructor & Destructor Documentation

BaseCrystal::BaseCrystal ( )
inline

Empty constructor.

Definition at line 31 of file BaseCrystal.h.

31 {;};
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)
10 {
12 }
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
DetId cellid_
Definition: BaseCrystal.h:112
BaseCrystal::~BaseCrystal ( )
inline

Copy constructor.

Definition at line 42 of file BaseCrystal.h.

42 {;}

Member Function Documentation

void BaseCrystal::computeBasicProperties ( )
private

Definition at line 92 of file BaseCrystal.cc.

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

Referenced by setCorners().

93 {
94  if(corners_.size()==0) return;
95  center_=XYZPoint(0.,0.,0.);
96  for(unsigned ic=0;ic<8;++ic)
97  {
98  center_+=corners_[ic];
99  }
100 
101  center_*=0.125;
102 
103  // std::cout << " Ncorners ? " << corners_.size() << std::endl;
104  frontcenter_ = 0.25*(corners_[0]+corners_[1]+corners_[2]+corners_[3]);
105  backcenter_ = 0.25*(corners_[4]+corners_[5]+corners_[6]+corners_[7]);
107  firstedgedirection_=-(corners_[1]-corners_[0]).Unit();
108  fifthedgedirection_=-(corners_[5]-corners_[4]).Unit();
109  lateraldirection_.resize(4);
110  // std::cout << " Direction laterales " << std::endl;
111  for(unsigned il=0;il<4;++il)
112  {
113  lateraldirection_[il]=-(corners_[(il+1)%4]-corners_[il]).Unit();
114  }
115 
116  Plane3D frontPlane((Point)corners_[0],(Point)corners_[1],(Point)corners_[2]);
117  Plane3D backPlane ((Point)corners_[4],(Point)corners_[5],(Point)corners_[6]);
118  lateralPlane_.resize(6);
119  for(unsigned i=0;i<4;++i)
120  {
121  lateralPlane_[i]=
122  Plane3D((Point)corners_[i],(Point)corners_[(i+1)%4],(Point)corners_[i+4]);
123  }
124  // Front plane i=4 (UP)
125  lateralPlane_[4] = frontPlane;
126  // Back plane i =5 (DOWN)
127  lateralPlane_[5] = backPlane;
128 
129  exitingNormal_.resize(6);
130  for(unsigned i=0;i<6;++i)
131  {
132  exitingNormal_[i] =
133  (lateralPlane_[i].Distance(Point(center_.X(),center_.Y(),center_.Z())) < 0.) ?
134  lateralPlane_[i].Normal().Unit() : -lateralPlane_[i].Normal().Unit();
135  }
136 }
XYZPoint center_
Definition: BaseCrystal.h:114
XYZPoint backcenter_
Definition: BaseCrystal.h:116
int i
Definition: DBlmapReader.cc:9
XYZVector firstedgedirection_
Definition: BaseCrystal.h:117
std::vector< XYZVector > lateraldirection_
Definition: BaseCrystal.h:120
std::vector< XYZPoint > corners_
Definition: BaseCrystal.h:111
std::pair< double, double > Point
Definition: CaloEllipse.h:18
math::XYZVector XYZPoint
Definition: BaseCrystal.h:25
ROOT::Math::Plane3D Plane3D
Definition: BaseCrystal.h:26
std::vector< XYZVector > exitingNormal_
Definition: BaseCrystal.h:122
math::XYZPoint Point
XYZPoint frontcenter_
Definition: BaseCrystal.h:115
std::vector< Plane3D > lateralPlane_
Definition: BaseCrystal.h:121
XYZVector fifthedgedirection_
Definition: BaseCrystal.h:118
XYZVector crystalaxis_
Definition: BaseCrystal.h:119
ROOT::Math::Plane3D Plane3D
const XYZVector& BaseCrystal::exitingNormal ( const CaloDirection side) const
inline

normal exiting vector for the surface

Definition at line 95 of file BaseCrystal.h.

References exitingNormal_, and CaloDirectionOperations::Side().

Referenced by Crystal::exitingNormal().

std::vector< XYZVector > exitingNormal_
Definition: BaseCrystal.h:122
static CaloDirection Side(unsigned i)
unsigned int -&gt; Side conversion
const XYZVector& BaseCrystal::getAxis ( ) const
inline

get crystal axis

Definition at line 103 of file BaseCrystal.h.

References crystalaxis_.

Referenced by Crystal::getAxis().

103 { return crystalaxis_;}
XYZVector crystalaxis_
Definition: BaseCrystal.h:119
const XYZPoint& BaseCrystal::getBackCenter ( ) const
inline

get front center

Definition at line 55 of file BaseCrystal.h.

References backcenter_.

Referenced by Crystal::getBackCenter().

55 {return backcenter_;}
XYZPoint backcenter_
Definition: BaseCrystal.h:116
const Plane3D& BaseCrystal::getBackPlane ( ) const
inline

back plane

Definition at line 85 of file BaseCrystal.h.

References lateralPlane_.

Referenced by Crystal::getBackPlane().

85 {return lateralPlane_[5];}
std::vector< Plane3D > lateralPlane_
Definition: BaseCrystal.h:121
void BaseCrystal::getBackSide ( XYZPoint a,
XYZPoint b,
XYZPoint c,
XYZPoint d 
) const

Coordinates of the back side.

Definition at line 166 of file BaseCrystal.cc.

References corners_.

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

167 {
168  a=corners_[4];
169  b=corners_[5];
170  c=corners_[6];
171  d=corners_[7];
172 }
std::vector< XYZPoint > corners_
Definition: BaseCrystal.h:111
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
void BaseCrystal::getBackSide ( std::vector< XYZPoint > &  corners) const

Definition at line 174 of file BaseCrystal.cc.

References corners_.

175 {
176  if(corners.size()==4)
177  {
178  corners[0]=corners_[4];
179  corners[1]=corners_[5];
180  corners[2]=corners_[6];
181  corners[3]=corners_[7];
182  }
183 }
std::vector< XYZPoint > corners_
Definition: BaseCrystal.h:111
const XYZPoint& BaseCrystal::getCenter ( ) const
inline

get 1/8*(Sum of corners)

Definition at line 51 of file BaseCrystal.h.

References center_.

Referenced by Crystal::getCenter().

51 {return center_;};
XYZPoint center_
Definition: BaseCrystal.h:114
const XYZPoint& BaseCrystal::getCorner ( unsigned  i) const
inline

get the i-th corner

Definition at line 49 of file BaseCrystal.h.

References corners_, and i.

Referenced by Crystal::getCorner().

49 { return corners_[i];};
int i
Definition: DBlmapReader.cc:9
std::vector< XYZPoint > corners_
Definition: BaseCrystal.h:111
const std::vector<XYZPoint>& BaseCrystal::getCorners ( ) const
inline

Definition at line 46 of file BaseCrystal.h.

References corners_.

46 {return corners_;}
std::vector< XYZPoint > corners_
Definition: BaseCrystal.h:111
const DetId& BaseCrystal::getDetId ( void  ) const
inline

get the DetId

Definition at line 61 of file BaseCrystal.h.

References cellid_.

61 {return cellid_;};
DetId cellid_
Definition: BaseCrystal.h:112
void BaseCrystal::getDrawingCoordinates ( std::vector< float > &  x,
std::vector< float > &  y,
std::vector< float > &  z 
) const

for debugging.

Definition at line 205 of file BaseCrystal.cc.

References corners_, X, and Gflash::Z.

Referenced by Crystal::getDrawingCoordinates().

206 {
207  x.clear();
208  y.clear();
209  z.clear();
210 
211  x.push_back(corners_[0].X());
212  x.push_back(corners_[3].X());
213  x.push_back(corners_[2].X());
214  x.push_back(corners_[1].X());
215  x.push_back(corners_[5].X());
216  x.push_back(corners_[6].X());
217  x.push_back(corners_[7].X());
218  x.push_back(corners_[4].X());
219  x.push_back(corners_[0].X());
220  x.push_back(corners_[1].X());
221  x.push_back(corners_[2].X());
222  x.push_back(corners_[6].X());
223  x.push_back(corners_[5].X());
224  x.push_back(corners_[4].X());
225  x.push_back(corners_[7].X());
226  x.push_back(corners_[3].X());
227 
228  y.push_back(corners_[0].Y());
229  y.push_back(corners_[3].Y());
230  y.push_back(corners_[2].Y());
231  y.push_back(corners_[1].Y());
232  y.push_back(corners_[5].Y());
233  y.push_back(corners_[6].Y());
234  y.push_back(corners_[7].Y());
235  y.push_back(corners_[4].Y());
236  y.push_back(corners_[0].Y());
237  y.push_back(corners_[1].Y());
238  y.push_back(corners_[2].Y());
239  y.push_back(corners_[6].Y());
240  y.push_back(corners_[5].Y());
241  y.push_back(corners_[4].Y());
242  y.push_back(corners_[7].Y());
243  y.push_back(corners_[3].Y());
244 
245  z.push_back(corners_[0].Z());
246  z.push_back(corners_[3].Z());
247  z.push_back(corners_[2].Z());
248  z.push_back(corners_[1].Z());
249  z.push_back(corners_[5].Z());
250  z.push_back(corners_[6].Z());
251  z.push_back(corners_[7].Z());
252  z.push_back(corners_[4].Z());
253  z.push_back(corners_[0].Z());
254  z.push_back(corners_[1].Z());
255  z.push_back(corners_[2].Z());
256  z.push_back(corners_[6].Z());
257  z.push_back(corners_[5].Z());
258  z.push_back(corners_[4].Z());
259  z.push_back(corners_[7].Z());
260  z.push_back(corners_[3].Z());
261 }
const double Z[kNumberCalorimeter]
#define X(str)
Definition: MuonsGrabber.cc:48
std::vector< XYZPoint > corners_
Definition: BaseCrystal.h:111
float float float z
Definition: DDAxes.h:10
const XYZVector& BaseCrystal::getFifthEdge ( ) const
inline

Direction of the fifth edge.

Definition at line 59 of file BaseCrystal.h.

References fifthedgedirection_.

Referenced by Crystal::getFifthEdge().

59 {return fifthedgedirection_;}
XYZVector fifthedgedirection_
Definition: BaseCrystal.h:118
const XYZVector& BaseCrystal::getFirstEdge ( ) const
inline

Direction of the first edge.

Definition at line 57 of file BaseCrystal.h.

References firstedgedirection_.

Referenced by Crystal::getFirstEdge().

57 {return firstedgedirection_;}
XYZVector firstedgedirection_
Definition: BaseCrystal.h:117
const XYZPoint& BaseCrystal::getFrontCenter ( ) const
inline

get front center

Definition at line 53 of file BaseCrystal.h.

References frontcenter_.

Referenced by Crystal::getFrontCenter().

53 {return frontcenter_;};
XYZPoint frontcenter_
Definition: BaseCrystal.h:115
const Plane3D& BaseCrystal::getFrontPlane ( ) const
inline

front plane

Definition at line 83 of file BaseCrystal.h.

References lateralPlane_.

Referenced by Crystal::getFrontPlane().

83 {return lateralPlane_[4];}
std::vector< Plane3D > lateralPlane_
Definition: BaseCrystal.h:121
void BaseCrystal::getFrontSide ( XYZPoint a,
XYZPoint b,
XYZPoint c,
XYZPoint d 
) const

coordinates of the front side

Definition at line 147 of file BaseCrystal.cc.

References corners_.

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

148 {
149  a=corners_[0];
150  b=corners_[1];
151  c=corners_[2];
152  d=corners_[3];
153 }
std::vector< XYZPoint > corners_
Definition: BaseCrystal.h:111
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
void BaseCrystal::getFrontSide ( std::vector< XYZPoint > &  corners) const

Definition at line 155 of file BaseCrystal.cc.

References corners_.

156 {
157  if(corners.size()==4)
158  {
159  corners[0]=corners_[0];
160  corners[1]=corners_[1];
161  corners[2]=corners_[2];
162  corners[3]=corners_[3];
163  }
164 }
std::vector< XYZPoint > corners_
Definition: BaseCrystal.h:111
const XYZVector& BaseCrystal::getLateralEdge ( unsigned  i) const
inline

lateral directions

Definition at line 92 of file BaseCrystal.h.

References i, and lateraldirection_.

Referenced by Crystal::getLateralEdge().

92 {return lateraldirection_[i];};
int i
Definition: DBlmapReader.cc:9
std::vector< XYZVector > lateraldirection_
Definition: BaseCrystal.h:120
void BaseCrystal::getLateralEdges ( unsigned  i,
XYZPoint a,
XYZPoint b 
) const

get the lateral edges

Definition at line 138 of file BaseCrystal.cc.

References corners_, and i.

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

139 {
140  if(i<4U) // i >= 0, since i is unsigned
141  {
142  a=corners_[i];
143  b=corners_[i+4];
144  }
145 }
int i
Definition: DBlmapReader.cc:9
std::vector< XYZPoint > corners_
Definition: BaseCrystal.h:111
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
const Plane3D& BaseCrystal::getLateralPlane ( unsigned  i) const
inline

lateral planes

Definition at line 87 of file BaseCrystal.h.

References i, and lateralPlane_.

Referenced by Crystal::getLateralPlane().

87 {return lateralPlane_[i];};
int i
Definition: DBlmapReader.cc:9
std::vector< Plane3D > lateralPlane_
Definition: BaseCrystal.h:121
void BaseCrystal::getLateralSide ( unsigned  i,
XYZPoint a,
XYZPoint b,
XYZPoint c,
XYZPoint d 
) const

Coordinates of the i=th lateral side.

Definition at line 185 of file BaseCrystal.cc.

References getLateralEdges().

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

186 {
187  if(i<4U) // i >= 0, since i is unsigned
188  {
189  getLateralEdges(i,a,b);
190  getLateralEdges((i+1)%4,c,d);
191  }
192 }
int i
Definition: DBlmapReader.cc:9
void getLateralEdges(unsigned i, XYZPoint &, XYZPoint &) const
get the lateral edges
Definition: BaseCrystal.cc:138
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
void BaseCrystal::getLateralSide ( unsigned  i,
std::vector< XYZPoint > &  corners 
) const

Definition at line 194 of file BaseCrystal.cc.

References corners_, and i.

195 {
196  if(corners.size()==4&&i<4U) // i >= 0, since i is unsigned
197  {
198  corners[0]=corners_[i];
199  corners[1]=corners_[i+4];
200  corners[2]=corners_[4+(i+1)%4];
201  corners[3]=corners_[(i+1)%4];
202  }
203 }
int i
Definition: DBlmapReader.cc:9
std::vector< XYZPoint > corners_
Definition: BaseCrystal.h:111
const Plane3D& BaseCrystal::getPlane ( const CaloDirection side) const
inline

generic access

Definition at line 89 of file BaseCrystal.h.

References lateralPlane_, and CaloDirectionOperations::Side().

Referenced by Crystal::getPlane().

static CaloDirection Side(unsigned i)
unsigned int -&gt; Side conversion
std::vector< Plane3D > lateralPlane_
Definition: BaseCrystal.h:121
void BaseCrystal::getSide ( const CaloDirection side,
XYZPoint a,
XYZPoint b,
XYZPoint c,
XYZPoint d 
) const

generic access

Definition at line 266 of file BaseCrystal.cc.

References DOWN, getBackSide(), getFrontSide(), getLateralSide(), CaloDirectionOperations::Side(), and UP.

Referenced by Crystal::getSide().

267 {
268  switch (side)
269  {
270  case UP:
271  getFrontSide(a,b,c,d);
272  break;
273  case DOWN:
274  getBackSide(a,b,c,d);
275  break;
276  default:
278  }
279 }
void getBackSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the back side.
Definition: BaseCrystal.cc:166
void getLateralSide(unsigned i, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the i=th lateral side.
Definition: BaseCrystal.cc:185
static CaloDirection Side(unsigned i)
unsigned int -&gt; Side conversion
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
void getFrontSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
coordinates of the front side
Definition: BaseCrystal.cc:147
void BaseCrystal::getSide ( const CaloDirection side,
std::vector< XYZPoint > &  corners 
) const

Definition at line 294 of file BaseCrystal.cc.

References DOWN, getBackSide(), getFrontSide(), getLateralSide(), CaloDirectionOperations::Side(), and UP.

295 {
296  switch (side)
297  {
298  case UP:
299  getFrontSide(corners);
300  break;
301  case DOWN:
302  getBackSide(corners);
303  break;
304  default:
306  }
307 }
void getBackSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the back side.
Definition: BaseCrystal.cc:166
void getLateralSide(unsigned i, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the i=th lateral side.
Definition: BaseCrystal.cc:185
static CaloDirection Side(unsigned i)
unsigned int -&gt; Side conversion
void getFrontSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
coordinates of the front side
Definition: BaseCrystal.cc:147
const int BaseCrystal::getSubdetNumber ( ) const
inline

get the subdector

Definition at line 63 of file BaseCrystal.h.

References subdetn_.

Referenced by Crystal::getSubdetNumber().

63 {return subdetn_;}
static unsigned BaseCrystal::oppositeDirection ( unsigned  iside)
static
void BaseCrystal::print ( void  ) const

Definition at line 281 of file BaseCrystal.cc.

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

Referenced by Crystal::print().

281  {
282  std::cout << "CellID " << cellid_.rawId() << std::endl;
283  std::cout << " Corners " << std::endl;
284  for(unsigned ic=0;ic<corners_.size();++ic)
285  std::cout << corners_[ic] << std::endl;
286  std::cout << " Center " << center_ << std::endl;
287  std::cout << " Front Center " << frontcenter_ << std::endl;
288  std::cout << " Back Center " << backcenter_ << std::endl;
289  std::cout << " Normales sortantes " << std::endl;
290  for(unsigned id=0;id<exitingNormal_.size();++id)
291  std::cout << exitingNormal_[id] << std::endl;
292 }
XYZPoint center_
Definition: BaseCrystal.h:114
XYZPoint backcenter_
Definition: BaseCrystal.h:116
std::vector< XYZPoint > corners_
Definition: BaseCrystal.h:111
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
std::vector< XYZVector > exitingNormal_
Definition: BaseCrystal.h:122
XYZPoint frontcenter_
Definition: BaseCrystal.h:115
tuple cout
Definition: gather_cfg.py:121
DetId cellid_
Definition: BaseCrystal.h:112
void BaseCrystal::setCorners ( const CaloCellGeometry::CornersVec vec,
const GlobalPoint pos 
)

Definition at line 14 of file BaseCrystal.cc.

References computeBasicProperties(), corners_, EcalBarrel, EcalEndcap, evf::evtn::offset(), EZArrayFL< T >::size(), subdetn_, x, PV3DBase< T, PVType, FrameType >::x(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by CaloGeometryHelper::buildCrystalArray().

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

Member Data Documentation

XYZPoint BaseCrystal::backcenter_
private

Definition at line 116 of file BaseCrystal.h.

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

DetId BaseCrystal::cellid_
private

Definition at line 112 of file BaseCrystal.h.

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

XYZPoint BaseCrystal::center_
private

Definition at line 114 of file BaseCrystal.h.

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

std::vector<XYZPoint> BaseCrystal::corners_
private
XYZVector BaseCrystal::crystalaxis_
private

Definition at line 119 of file BaseCrystal.h.

Referenced by computeBasicProperties(), and getAxis().

std::vector<XYZVector> BaseCrystal::exitingNormal_
private

Definition at line 122 of file BaseCrystal.h.

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

XYZVector BaseCrystal::fifthedgedirection_
private

Definition at line 118 of file BaseCrystal.h.

Referenced by computeBasicProperties(), and getFifthEdge().

XYZVector BaseCrystal::firstedgedirection_
private

Definition at line 117 of file BaseCrystal.h.

Referenced by computeBasicProperties(), and getFirstEdge().

XYZPoint BaseCrystal::frontcenter_
private

Definition at line 115 of file BaseCrystal.h.

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

std::vector<XYZVector> BaseCrystal::lateraldirection_
private

Definition at line 120 of file BaseCrystal.h.

Referenced by computeBasicProperties(), and getLateralEdge().

std::vector<Plane3D> BaseCrystal::lateralPlane_
private
int BaseCrystal::subdetn_
private

Definition at line 113 of file BaseCrystal.h.

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