#include <FastSimulation/CaloGeometryTools/interface/BaseCrystal.h>
Public Types | |
typedef ROOT::Math::Plane3D | Plane3D |
typedef math::XYZVector | XYZPoint |
typedef math::XYZVector | XYZVector |
Public Member Functions | |
BaseCrystal (const DetId &cell) | |
constructor from DetId | |
BaseCrystal () | |
Empty constructor. | |
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 (std::vector< XYZPoint > &corners) const |
void | getBackSide (XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const |
Coordinates of the back side. | |
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, std::vector< XYZPoint > &corners) const |
void | getSide (const CaloDirection &side, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const |
generic access | |
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().
00093 { 00094 if(corners_.size()==0) return; 00095 center_=XYZPoint(0.,0.,0.); 00096 for(unsigned ic=0;ic<8;++ic) 00097 { 00098 center_+=corners_[ic]; 00099 } 00100 00101 center_*=0.125; 00102 00103 // std::cout << " Ncorners ? " << corners_.size() << std::endl; 00104 frontcenter_ = 0.25*(corners_[0]+corners_[1]+corners_[2]+corners_[3]); 00105 backcenter_ = 0.25*(corners_[4]+corners_[5]+corners_[6]+corners_[7]); 00106 crystalaxis_ = backcenter_-frontcenter_; 00107 firstedgedirection_=-(corners_[1]-corners_[0]).Unit(); 00108 fifthedgedirection_=-(corners_[5]-corners_[4]).Unit(); 00109 lateraldirection_.resize(4); 00110 // std::cout << " Direction laterales " << std::endl; 00111 for(unsigned il=0;il<4;++il) 00112 { 00113 lateraldirection_[il]=-(corners_[(il+1)%4]-corners_[il]).Unit(); 00114 } 00115 00116 Plane3D frontPlane((Point)corners_[0],(Point)corners_[1],(Point)corners_[2]); 00117 Plane3D backPlane ((Point)corners_[4],(Point)corners_[5],(Point)corners_[6]); 00118 lateralPlane_.resize(6); 00119 for(unsigned i=0;i<4;++i) 00120 { 00121 lateralPlane_[i]= 00122 Plane3D((Point)corners_[i],(Point)corners_[(i+1)%4],(Point)corners_[i+4]); 00123 } 00124 // Front plane i=4 (UP) 00125 lateralPlane_[4] = frontPlane; 00126 // Back plane i =5 (DOWN) 00127 lateralPlane_[5] = backPlane; 00128 00129 exitingNormal_.resize(6); 00130 for(unsigned i=0;i<6;++i) 00131 { 00132 exitingNormal_[i] = 00133 (lateralPlane_[i].Distance(Point(center_.X(),center_.Y(),center_.Z())) < 0.) ? 00134 lateralPlane_[i].Normal().Unit() : -lateralPlane_[i].Normal().Unit(); 00135 } 00136 }
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().
00095 {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().
00103 { 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().
00055 {return backcenter_;}
const Plane3D& BaseCrystal::getBackPlane | ( | ) | const [inline] |
back plane
Definition at line 85 of file BaseCrystal.h.
References lateralPlane_.
Referenced by Crystal::getBackPlane().
00085 {return lateralPlane_[5];}
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().
00051 {return center_;};
const XYZPoint& BaseCrystal::getCorner | ( | unsigned | i | ) | const [inline] |
get the i-th corner
Definition at line 49 of file BaseCrystal.h.
References corners_.
Referenced by Crystal::getCorner().
const std::vector<XYZPoint>& BaseCrystal::getCorners | ( | ) | const [inline] |
const DetId& BaseCrystal::getDetId | ( | ) | const [inline] |
get the DetId
Definition at line 61 of file BaseCrystal.h.
References cellid_.
00061 {return cellid_;};
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.
Referenced by Crystal::getDrawingCoordinates().
00206 { 00207 x.clear(); 00208 y.clear(); 00209 z.clear(); 00210 00211 x.push_back(corners_[0].X()); 00212 x.push_back(corners_[3].X()); 00213 x.push_back(corners_[2].X()); 00214 x.push_back(corners_[1].X()); 00215 x.push_back(corners_[5].X()); 00216 x.push_back(corners_[6].X()); 00217 x.push_back(corners_[7].X()); 00218 x.push_back(corners_[4].X()); 00219 x.push_back(corners_[0].X()); 00220 x.push_back(corners_[1].X()); 00221 x.push_back(corners_[2].X()); 00222 x.push_back(corners_[6].X()); 00223 x.push_back(corners_[5].X()); 00224 x.push_back(corners_[4].X()); 00225 x.push_back(corners_[7].X()); 00226 x.push_back(corners_[3].X()); 00227 00228 y.push_back(corners_[0].Y()); 00229 y.push_back(corners_[3].Y()); 00230 y.push_back(corners_[2].Y()); 00231 y.push_back(corners_[1].Y()); 00232 y.push_back(corners_[5].Y()); 00233 y.push_back(corners_[6].Y()); 00234 y.push_back(corners_[7].Y()); 00235 y.push_back(corners_[4].Y()); 00236 y.push_back(corners_[0].Y()); 00237 y.push_back(corners_[1].Y()); 00238 y.push_back(corners_[2].Y()); 00239 y.push_back(corners_[6].Y()); 00240 y.push_back(corners_[5].Y()); 00241 y.push_back(corners_[4].Y()); 00242 y.push_back(corners_[7].Y()); 00243 y.push_back(corners_[3].Y()); 00244 00245 z.push_back(corners_[0].Z()); 00246 z.push_back(corners_[3].Z()); 00247 z.push_back(corners_[2].Z()); 00248 z.push_back(corners_[1].Z()); 00249 z.push_back(corners_[5].Z()); 00250 z.push_back(corners_[6].Z()); 00251 z.push_back(corners_[7].Z()); 00252 z.push_back(corners_[4].Z()); 00253 z.push_back(corners_[0].Z()); 00254 z.push_back(corners_[1].Z()); 00255 z.push_back(corners_[2].Z()); 00256 z.push_back(corners_[6].Z()); 00257 z.push_back(corners_[5].Z()); 00258 z.push_back(corners_[4].Z()); 00259 z.push_back(corners_[7].Z()); 00260 z.push_back(corners_[3].Z()); 00261 }
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().
00059 {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().
00057 {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().
00053 {return frontcenter_;};
const Plane3D& BaseCrystal::getFrontPlane | ( | ) | const [inline] |
front plane
Definition at line 83 of file BaseCrystal.h.
References lateralPlane_.
Referenced by Crystal::getFrontPlane().
00083 {return lateralPlane_[4];}
const XYZVector& BaseCrystal::getLateralEdge | ( | unsigned | i | ) | const [inline] |
lateral directions
Definition at line 92 of file BaseCrystal.h.
References lateraldirection_.
Referenced by Crystal::getLateralEdge().
00092 {return lateraldirection_[i];};
get the lateral edges
Definition at line 138 of file BaseCrystal.cc.
References corners_.
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 lateralPlane_.
Referenced by Crystal::getLateralPlane().
00087 {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().
00186 { 00187 if(i>=0&&i<4) 00188 { 00189 getLateralEdges(i,a,b); 00190 getLateralEdges((i+1)%4,c,d); 00191 } 00192 }
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().
00089 {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.
00295 { 00296 switch (side) 00297 { 00298 case UP: 00299 getFrontSide(corners); 00300 break; 00301 case DOWN: 00302 getBackSide(corners); 00303 break; 00304 default: 00305 getLateralSide(CaloDirectionOperations::Side(side),corners); 00306 } 00307 }
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().
00267 { 00268 switch (side) 00269 { 00270 case UP: 00271 getFrontSide(a,b,c,d); 00272 break; 00273 case DOWN: 00274 getBackSide(a,b,c,d); 00275 break; 00276 default: 00277 getLateralSide(CaloDirectionOperations::Side(side),a,b,c,d); 00278 } 00279 }
const int BaseCrystal::getSubdetNumber | ( | ) | const [inline] |
get the subdector
Definition at line 63 of file BaseCrystal.h.
References subdetn_.
Referenced by Crystal::getSubdetNumber().
00063 {return subdetn_;}
static unsigned BaseCrystal::oppositeDirection | ( | unsigned | iside | ) | [static] |
Definition at line 281 of file BaseCrystal.cc.
References backcenter_, cellid_, center_, corners_, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), exitingNormal_, frontcenter_, id, and DetId::rawId().
Referenced by Crystal::print().
00281 { 00282 std::cout << "CellID " << cellid_.rawId() << std::endl; 00283 std::cout << " Corners " << std::endl; 00284 for(unsigned ic=0;ic<corners_.size();++ic) 00285 std::cout << corners_[ic] << std::endl; 00286 std::cout << " Center " << center_ << std::endl; 00287 std::cout << " Front Center " << frontcenter_ << std::endl; 00288 std::cout << " Back Center " << backcenter_ << std::endl; 00289 std::cout << " Normales sortantes " << std::endl; 00290 for(unsigned id=0;id<exitingNormal_.size();++id) 00291 std::cout << exitingNormal_[id] << std::endl; 00292 }
void BaseCrystal::setCorners | ( | const CaloCellGeometry::CornersVec & | vec, | |
const GlobalPoint & | pos | |||
) |
Definition at line 14 of file BaseCrystal.cc.
References computeBasicProperties(), corners_, EcalBarrel, EcalEndcap, i1, i2, offset, EZArrayFL< T >::size(), subdetn_, PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
Referenced by CaloGeometryHelper::buildCrystalArray().
00015 { 00016 unsigned ncorners= vec.size(); 00017 if(ncorners!=8) return; 00018 00019 // This is really a pity to have to make the conversion GlobalPoint to XYZPoint, but the latter have many 00020 // useful properties (transformations, conversions....) that aren't implemented 00021 // for the GlobalPoints and GlobalVectors. 00022 00023 if(subdetn_==EcalBarrel) 00024 { 00025 if(pos.z()>0.) 00026 { 00027 corners_.clear(); 00028 corners_.resize(8); 00029 for(unsigned ic=0;ic<8;++ic) 00030 { 00031 corners_[ic]=XYZPoint(vec[ic].x(),vec[ic].y(),vec[ic].z()); 00032 } 00033 } 00034 else 00035 { 00036 corners_.clear(); 00037 corners_.resize(8); 00038 corners_[0]=XYZPoint(vec[2].x(),vec[2].y(),vec[2].z()); 00039 corners_[1]=XYZPoint(vec[3].x(),vec[3].y(),vec[3].z()); 00040 corners_[2]=XYZPoint(vec[0].x(),vec[0].y(),vec[0].z()); 00041 corners_[3]=XYZPoint(vec[1].x(),vec[1].y(),vec[1].z()); 00042 corners_[4]=XYZPoint(vec[6].x(),vec[6].y(),vec[6].z()); 00043 corners_[5]=XYZPoint(vec[7].x(),vec[7].y(),vec[7].z()); 00044 corners_[6]=XYZPoint(vec[4].x(),vec[4].y(),vec[4].z()); 00045 corners_[7]=XYZPoint(vec[5].x(),vec[5].y(),vec[5].z()); 00046 } 00047 } 00048 else if(subdetn_==EcalEndcap) 00049 { 00050 double x=pos.x(); 00051 double y=pos.y(); 00052 double z=pos.z(); 00053 unsigned offset=0; 00054 int zsign=1; 00055 if(z>0) 00056 { 00057 if(x>0&&y>0) 00058 offset=1; 00059 else if(x<0&&y>0) 00060 offset=2; 00061 else if(x>0&&y<0) 00062 offset=0; 00063 else if (x<0&&y<0) 00064 offset=3; 00065 zsign=1; 00066 } 00067 else 00068 { 00069 if(x>0&&y>0) 00070 offset=3; 00071 else if(x<0&&y>0) 00072 offset=2; 00073 else if(x>0&&y<0) 00074 offset=0; 00075 else if(x<0&&y<0) 00076 offset=1; 00077 zsign=-1; 00078 } 00079 corners_.clear(); 00080 corners_.resize(8); 00081 for(unsigned ic=0;ic<4;++ic) 00082 { 00083 unsigned i1=(unsigned)((zsign*ic+offset)%4); 00084 unsigned i2=i1+4; 00085 corners_[ic]=XYZPoint(vec[i1].x(),vec[i1].y(),vec[i1].z()); 00086 corners_[4+ic]=XYZPoint(vec[i2].x(),vec[i2].y(),vec[i2].z()); 00087 } 00088 } 00089 computeBasicProperties(); 00090 }
XYZPoint BaseCrystal::backcenter_ [private] |
Definition at line 116 of file BaseCrystal.h.
Referenced by computeBasicProperties(), getBackCenter(), and print().
DetId BaseCrystal::cellid_ [private] |
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().