#ifndef TOYHIT_HPP #define TOYHIT_HPP // // $Id: ToyHit.hpp,v 1.5 2005/04/03 15:36:38 shfu Exp $ // // File: ToyHit.hpp // Purpose: // Created: 29-APR-1998 John Hobbs // // Jan 20, 2005 by Shaohua Fu // added Layer0 // SFL0_Jan_2005 // // $Revision: 1.5 $ // // // Include files #include "silicon_geometry/utils/ToyCluster.hpp" #include "silicon_geometry/base/SiLadder.hpp" // Global definitions class ToyHit { public: ToyHit() {} // ToyHit(const int bar, const int layer, const int ladder, // cmt.out SFL0_Jan_2005 // const double r, const double phi, const double z): // _r(r), _phi(phi), _z(z), _ladder(ladder), _layer(layer), _barrel(bar) {} ToyHit(const int dettype, const int bar, const int layer, const int ladder, // added SFL0_Jan_2005 const double r, const double phi, const double z): _r(r), _phi(phi), _z(z), _ladder(ladder), _layer(layer), _barrel(bar), _dettype(dettype) {} ToyHit(const ToyCluster& tcl,const SiLadder& ladder) { dgs::CartesianCoordinate xl(tcl.xl(),0.0,tcl.zl()); dgs::CartesianCoordinate xg=ladder.local_to_global(xl); #ifndef DEFECT_CMATH_NOT_STD _r = std::sqrt(xg.x()*xg.x()+xg.y()*xg.y()); _phi = std::atan2((double)xg.y(),xg.x()+0.000000001); #else _r = sqrt(xg.x()*xg.x()+xg.y()*xg.y()); _phi = atan2((double)xg.y(),xg.x()+0.000000001); #endif _barrel = tcl.barrel(); _layer = tcl.layer(); _ladder = tcl.ladder(); _dettype = tcl.dettype(); // added SFL0_Jan_2005 } double r() const { return _r; } double phi() const { return _phi; } #ifndef DEFECT_CMATH_NOT_STD double x() const { return _r*std::cos(_phi); } double y() const { return _r*std::sin(_phi); } #else double x() const { return _r*cos(_phi); } double y() const { return _r*sin(_phi); } #endif double z() const { return _z; } int ladder() const { return _ladder; } int layer() const { return _layer; } int barrel() const { return _barrel; } int dettype() const { return _dettype; } // added SFL0_Jan_2005 private: double _r,_phi,_z; int _ladder, _layer,_barrel; int _dettype; // added SFL0_Jan_2005 }; #endif //TOYHIT_HPP