#include <BaseCrystal.h>
Public Types | |
typedef ROOT::Math::Plane3D | Plane3D |
typedef math::XYZVector | XYZPoint |
typedef math::XYZVector | XYZVector |
Public Member Functions | |
BaseCrystal () | |
Empty constructor. | |
BaseCrystal (const DetId &cell) | |
constructor from DetId | |
const XYZVector & | exitingNormal (const CaloDirection &side) const |
normal exiting vector for the surface | |
const XYZVector & | getAxis () const |
get crystal axis | |
const XYZPoint & | getBackCenter () const |
get front center | |
const Plane3D & | getBackPlane () const |
back plane | |
void | getBackSide (XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const |
Coordinates of the back side. | |
void | getBackSide (std::vector< XYZPoint > &corners) const |
const XYZPoint & | getCenter () const |
get 1/8*(Sum of corners) | |
const XYZPoint & | getCorner (unsigned i) const |
get the i-th corner | |
const std::vector< XYZPoint > & | getCorners () const |
const DetId & | getDetId () const |
get the DetId | |
void | getDrawingCoordinates (std::vector< float > &x, std::vector< float > &y, std::vector< float > &z) const |
for debugging. | |
const XYZVector & | getFifthEdge () const |
Direction of the fifth edge. | |
const XYZVector & | getFirstEdge () const |
Direction of the first edge. | |
const XYZPoint & | getFrontCenter () const |
get front center | |
const Plane3D & | getFrontPlane () const |
front plane | |
void | getFrontSide (std::vector< XYZPoint > &corners) const |
void | getFrontSide (XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const |
coordinates of the front side | |
const XYZVector & | getLateralEdge (unsigned i) const |
lateral directions | |
void | getLateralEdges (unsigned i, XYZPoint &, XYZPoint &) const |
get the lateral edges | |
const Plane3D & | getLateralPlane (unsigned i) const |
lateral planes | |
void | getLateralSide (unsigned i, std::vector< XYZPoint > &corners) const |
void | getLateralSide (unsigned i, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const |
Coordinates of the i=th lateral side. | |
const Plane3D & | getPlane (const CaloDirection &side) const |
generic access | |
void | getSide (const CaloDirection &side, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const |
generic access | |
void | getSide (const CaloDirection &side, std::vector< XYZPoint > &corners) const |
const int | getSubdetNumber () const |
get the subdector | |
void | print () const |
void | setCorners (const CaloCellGeometry::CornersVec &vec, const GlobalPoint &pos) |
~BaseCrystal () | |
Copy constructor. | |
Static Public Member Functions | |
static unsigned | oppositeDirection (unsigned iside) |
Private Member Functions | |
void | computeBasicProperties () |
Private Attributes | |
XYZPoint | backcenter_ |
DetId | cellid_ |
XYZPoint | center_ |
std::vector< XYZPoint > | corners_ |
XYZVector | crystalaxis_ |
std::vector< XYZVector > | exitingNormal_ |
XYZVector | fifthedgedirection_ |
XYZVector | firstedgedirection_ |
XYZPoint | frontcenter_ |
std::vector< XYZVector > | lateraldirection_ |
std::vector< Plane3D > | lateralPlane_ |
int | subdetn_ |
Definition at line 19 of file BaseCrystal.h.
Definition at line 26 of file BaseCrystal.h.
typedef math::XYZVector BaseCrystal::XYZPoint |
Definition at line 25 of file BaseCrystal.h.
Definition at line 24 of file BaseCrystal.h.
BaseCrystal::BaseCrystal | ( | ) | [inline] |
BaseCrystal::BaseCrystal | ( | const DetId & | cell | ) |
constructor from DetId
Definition at line 9 of file BaseCrystal.cc.
References cellid_, DetId::subdetId(), and subdetn_.
BaseCrystal::~BaseCrystal | ( | ) | [inline] |
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().
{ if(corners_.size()==0) return; center_=XYZPoint(0.,0.,0.); for(unsigned ic=0;ic<8;++ic) { center_+=corners_[ic]; } center_*=0.125; // std::cout << " Ncorners ? " << corners_.size() << std::endl; frontcenter_ = 0.25*(corners_[0]+corners_[1]+corners_[2]+corners_[3]); backcenter_ = 0.25*(corners_[4]+corners_[5]+corners_[6]+corners_[7]); crystalaxis_ = backcenter_-frontcenter_; firstedgedirection_=-(corners_[1]-corners_[0]).Unit(); fifthedgedirection_=-(corners_[5]-corners_[4]).Unit(); lateraldirection_.resize(4); // std::cout << " Direction laterales " << std::endl; for(unsigned il=0;il<4;++il) { lateraldirection_[il]=-(corners_[(il+1)%4]-corners_[il]).Unit(); } Plane3D frontPlane((Point)corners_[0],(Point)corners_[1],(Point)corners_[2]); Plane3D backPlane ((Point)corners_[4],(Point)corners_[5],(Point)corners_[6]); lateralPlane_.resize(6); for(unsigned i=0;i<4;++i) { lateralPlane_[i]= Plane3D((Point)corners_[i],(Point)corners_[(i+1)%4],(Point)corners_[i+4]); } // Front plane i=4 (UP) lateralPlane_[4] = frontPlane; // Back plane i =5 (DOWN) lateralPlane_[5] = backPlane; exitingNormal_.resize(6); for(unsigned i=0;i<6;++i) { exitingNormal_[i] = (lateralPlane_[i].Distance(Point(center_.X(),center_.Y(),center_.Z())) < 0.) ? lateralPlane_[i].Normal().Unit() : -lateralPlane_[i].Normal().Unit(); } }
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_.
Referenced by Crystal::exitingNormal().
{return exitingNormal_[CaloDirectionOperations::Side(side)];};
const XYZVector& BaseCrystal::getAxis | ( | ) | const [inline] |
get crystal axis
Definition at line 103 of file BaseCrystal.h.
References crystalaxis_.
Referenced by Crystal::getAxis().
{ return crystalaxis_;}
const XYZPoint& BaseCrystal::getBackCenter | ( | ) | const [inline] |
get front center
Definition at line 55 of file BaseCrystal.h.
References backcenter_.
Referenced by Crystal::getBackCenter().
{return backcenter_;}
const Plane3D& BaseCrystal::getBackPlane | ( | ) | const [inline] |
back plane
Definition at line 85 of file BaseCrystal.h.
References lateralPlane_.
Referenced by Crystal::getBackPlane().
{return lateralPlane_[5];}
void BaseCrystal::getBackSide | ( | std::vector< XYZPoint > & | corners | ) | const |
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().
{return center_;};
const XYZPoint& BaseCrystal::getCorner | ( | unsigned | i | ) | const [inline] |
get the i-th corner
Definition at line 49 of file BaseCrystal.h.
Referenced by Crystal::getCorner().
const std::vector<XYZPoint>& BaseCrystal::getCorners | ( | ) | const [inline] |
const DetId& BaseCrystal::getDetId | ( | void | ) | const [inline] |
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().
{ x.clear(); y.clear(); z.clear(); x.push_back(corners_[0].X()); x.push_back(corners_[3].X()); x.push_back(corners_[2].X()); x.push_back(corners_[1].X()); x.push_back(corners_[5].X()); x.push_back(corners_[6].X()); x.push_back(corners_[7].X()); x.push_back(corners_[4].X()); x.push_back(corners_[0].X()); x.push_back(corners_[1].X()); x.push_back(corners_[2].X()); x.push_back(corners_[6].X()); x.push_back(corners_[5].X()); x.push_back(corners_[4].X()); x.push_back(corners_[7].X()); x.push_back(corners_[3].X()); y.push_back(corners_[0].Y()); y.push_back(corners_[3].Y()); y.push_back(corners_[2].Y()); y.push_back(corners_[1].Y()); y.push_back(corners_[5].Y()); y.push_back(corners_[6].Y()); y.push_back(corners_[7].Y()); y.push_back(corners_[4].Y()); y.push_back(corners_[0].Y()); y.push_back(corners_[1].Y()); y.push_back(corners_[2].Y()); y.push_back(corners_[6].Y()); y.push_back(corners_[5].Y()); y.push_back(corners_[4].Y()); y.push_back(corners_[7].Y()); y.push_back(corners_[3].Y()); z.push_back(corners_[0].Z()); z.push_back(corners_[3].Z()); z.push_back(corners_[2].Z()); z.push_back(corners_[1].Z()); z.push_back(corners_[5].Z()); z.push_back(corners_[6].Z()); z.push_back(corners_[7].Z()); z.push_back(corners_[4].Z()); z.push_back(corners_[0].Z()); z.push_back(corners_[1].Z()); z.push_back(corners_[2].Z()); z.push_back(corners_[6].Z()); z.push_back(corners_[5].Z()); z.push_back(corners_[4].Z()); z.push_back(corners_[7].Z()); z.push_back(corners_[3].Z()); }
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().
{return fifthedgedirection_;}
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().
{return firstedgedirection_;}
const XYZPoint& BaseCrystal::getFrontCenter | ( | ) | const [inline] |
get front center
Definition at line 53 of file BaseCrystal.h.
References frontcenter_.
Referenced by Crystal::getFrontCenter().
{return frontcenter_;};
const Plane3D& BaseCrystal::getFrontPlane | ( | ) | const [inline] |
front plane
Definition at line 83 of file BaseCrystal.h.
References lateralPlane_.
Referenced by Crystal::getFrontPlane().
{return lateralPlane_[4];}
void BaseCrystal::getFrontSide | ( | std::vector< XYZPoint > & | corners | ) | const |
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().
{return lateraldirection_[i];};
get the lateral edges
Definition at line 138 of file BaseCrystal.cc.
Referenced by Crystal::getLateralEdges(), and getLateralSide().
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().
{return lateralPlane_[i];};
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().
{ if(i<4U) // i >= 0, since i is unsigned { getLateralEdges(i,a,b); getLateralEdges((i+1)%4,c,d); } }
void BaseCrystal::getLateralSide | ( | unsigned | i, |
std::vector< XYZPoint > & | corners | ||
) | const |
const Plane3D& BaseCrystal::getPlane | ( | const CaloDirection & | side | ) | const [inline] |
generic access
Definition at line 89 of file BaseCrystal.h.
References lateralPlane_.
Referenced by Crystal::getPlane().
{return lateralPlane_[CaloDirectionOperations::Side(side)];}
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.
{ switch (side) { case UP: getFrontSide(corners); break; case DOWN: getBackSide(corners); break; default: getLateralSide(CaloDirectionOperations::Side(side),corners); } }
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().
{ switch (side) { case UP: getFrontSide(a,b,c,d); break; case DOWN: getBackSide(a,b,c,d); break; default: getLateralSide(CaloDirectionOperations::Side(side),a,b,c,d); } }
const int BaseCrystal::getSubdetNumber | ( | ) | const [inline] |
get the subdector
Definition at line 63 of file BaseCrystal.h.
References subdetn_.
Referenced by Crystal::getSubdetNumber().
{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().
{ std::cout << "CellID " << cellid_.rawId() << std::endl; std::cout << " Corners " << std::endl; for(unsigned ic=0;ic<corners_.size();++ic) std::cout << corners_[ic] << std::endl; std::cout << " Center " << center_ << std::endl; std::cout << " Front Center " << frontcenter_ << std::endl; std::cout << " Back Center " << backcenter_ << std::endl; std::cout << " Normales sortantes " << std::endl; for(unsigned id=0;id<exitingNormal_.size();++id) std::cout << exitingNormal_[id] << std::endl; }
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_, PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::z(), and z.
Referenced by CaloGeometryHelper::buildCrystalArray().
{ unsigned ncorners= vec.size(); if(ncorners!=8) return; // This is really a pity to have to make the conversion GlobalPoint to XYZPoint, but the latter have many // useful properties (transformations, conversions....) that aren't implemented // for the GlobalPoints and GlobalVectors. if(subdetn_==EcalBarrel) { if(pos.z()>0.) { corners_.clear(); corners_.resize(8); for(unsigned ic=0;ic<8;++ic) { corners_[ic]=XYZPoint(vec[ic].x(),vec[ic].y(),vec[ic].z()); } } else { corners_.clear(); corners_.resize(8); corners_[0]=XYZPoint(vec[2].x(),vec[2].y(),vec[2].z()); corners_[1]=XYZPoint(vec[3].x(),vec[3].y(),vec[3].z()); corners_[2]=XYZPoint(vec[0].x(),vec[0].y(),vec[0].z()); corners_[3]=XYZPoint(vec[1].x(),vec[1].y(),vec[1].z()); corners_[4]=XYZPoint(vec[6].x(),vec[6].y(),vec[6].z()); corners_[5]=XYZPoint(vec[7].x(),vec[7].y(),vec[7].z()); corners_[6]=XYZPoint(vec[4].x(),vec[4].y(),vec[4].z()); corners_[7]=XYZPoint(vec[5].x(),vec[5].y(),vec[5].z()); } } else if(subdetn_==EcalEndcap) { double x=pos.x(); double y=pos.y(); double z=pos.z(); unsigned offset=0; int zsign=1; if(z>0) { if(x>0&&y>0) offset=1; else if(x<0&&y>0) offset=2; else if(x>0&&y<0) offset=0; else if (x<0&&y<0) offset=3; zsign=1; } else { if(x>0&&y>0) offset=3; else if(x<0&&y>0) offset=2; else if(x>0&&y<0) offset=0; else if(x<0&&y<0) offset=1; zsign=-1; } corners_.clear(); corners_.resize(8); for(unsigned ic=0;ic<4;++ic) { unsigned i1=(unsigned)((zsign*ic+offset)%4); unsigned i2=i1+4; corners_[ic]=XYZPoint(vec[i1].x(),vec[i1].y(),vec[i1].z()); corners_[4+ic]=XYZPoint(vec[i2].x(),vec[i2].y(),vec[i2].z()); } } computeBasicProperties(); }
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] |
Definition at line 111 of file BaseCrystal.h.
Referenced by computeBasicProperties(), getBackSide(), getCorner(), getCorners(), getDrawingCoordinates(), getFrontSide(), getLateralEdges(), getLateralSide(), print(), and setCorners().
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] |
Definition at line 121 of file BaseCrystal.h.
Referenced by computeBasicProperties(), getBackPlane(), getFrontPlane(), getLateralPlane(), and getPlane().
int BaseCrystal::subdetn_ [private] |
Definition at line 113 of file BaseCrystal.h.
Referenced by BaseCrystal(), getSubdetNumber(), and setCorners().