CMS 3D CMS Logo

global_angular_0 Class Reference

theta, phi, angle . More...

#include <DetectorDescription/Algorithm/src/global_angular.h>

Inheritance diagram for global_angular_0:

AlgoImpl

List of all members.

Public Member Functions

bool checkParameters ()
 subclass must check the supplied parameters ParE_, ParS_
void checkTermination ()
 for algorithms with incr_==0 the algorithm must check whether to terminate
int copyno () const
 copy-number calculation
 global_angular_0 (AlgoPos *, std::string label)
DDRotationMatrix rotation ()
 subclass must calculate a rotation matrix
void stream (std::ostream &) const
DDTranslation translation ()
 subclass must calculate a translation std::vector
 ~global_angular_0 ()

Public Attributes

bool alignSolid_
std::vector< double > center_
double delta_
int incrCopyNo_
int n_
DDRotationMatrix planeRot_
double radius_
double rangeAngle_
std::vector< double > rotate_
std::vector< double > rotateSolid_
DDRotationMatrix solidRot_
double startAngle_
int startCopyNo_


Detailed Description

theta, phi, angle .

.. axis of rotation. Object will be placed in a plane going through the origin having the axis (theta,phi) perpendicular to itself. startAngle, rangeAngle ... position rotated object starting at startAngle going to startAngle+rangeAngle. startAngle = 0 denotes the x-axis in the local frame in case of (phi=0 and theta=0), otherwise it denotes the

Definition at line 36 of file global_angular.h.


Constructor & Destructor Documentation

global_angular_0::global_angular_0 ( AlgoPos a,
std::string  label 
)

Definition at line 20 of file global_angular.cc.

References DCOUT.

00021  : AlgoImpl(a,label),
00022    rotate_(0), center_(3), rotateSolid_(0),
00023    alignSolid_(true), n_(1), startCopyNo_(1), incrCopyNo_(1),
00024    startAngle_(0), rangeAngle_(360.*deg)
00025 { 
00026   DCOUT('A', "Creating angular label=" << label);
00027 }

global_angular_0::~global_angular_0 (  ) 

Definition at line 29 of file global_angular.cc.

00030 { }


Member Function Documentation

bool global_angular_0::checkParameters (  )  [virtual]

subclass must check the supplied parameters ParE_, ParS_

whether they are correct and should select this paricular algorithm.

If the parameters are correct by should not select this particular algorithm, checkParamters must return false otherwise true.

The std::string err_ is to be used to be extended with error information in case any errors have been detected. Error information must be attached to err_ because of the possibility of already contained error information.

In case of errors: If an DDException is thrown by the algorithm implementation, further processing of any other implementations of the algorithm will be stopped. If no exception is thrown, checkParamters must return false. It's preferable not to throw an exception in case of errors. The algorithm implementation will throw if all checkParamters() of all registered algorithm implementations have returned false.

Implements AlgoImpl.

Definition at line 41 of file global_angular.cc.

References alignSolid_, center_, AlgoImpl::d2s(), DCOUT, delta_, AlgoImpl::err_, fUnitVector(), i, incrCopyNo_, int, n_, AlgoImpl::ParE_, AlgoImpl::ParS_, planeRot_, radius_, rangeAngle_, HLT_VtxMuL3::result, rotate_, rotateSolid_, solidRot_, startAngle_, startCopyNo_, and pyDBSRunClass::temp.

00042 {
00043   bool result = true;
00044   
00045   planeRot_   = DDRotationMatrix();
00046   solidRot_   = DDRotationMatrix();
00047   
00048   radius_     = ParE_["radius"][0];
00049   
00050   startAngle_ = ParE_["startAngle"][0];
00051   rangeAngle_ = ParE_["rangeAngle"][0];
00052   n_          = int(ParE_["n"][0]);
00053   startCopyNo_ = int(ParE_["startCopyNo"][0]);
00054   incrCopyNo_ = int(ParE_["incrCopyNo"][0]);
00055   
00056   if (fabs(rangeAngle_-360.0*deg)<0.001*deg) { // a full 360deg range
00057     delta_    =   rangeAngle_/double(n_);
00058   }
00059   else {
00060     if (n_ > 1) {
00061     delta_    =   rangeAngle_/double(n_-1);
00062     }
00063     else {
00064       delta_ = 0.;
00065     }
00066   }  
00067   
00068   DCOUT('a', "  startA=" << startAngle_/deg << " rangeA=" << rangeAngle_/deg <<
00069              " n=" << n_ << " delta=" << delta_/deg);
00070 
00071   //======= collect data concerning the rotation of the solid 
00072   typedef parE_type::mapped_type::size_type sz_type;
00073   sz_type sz = ParE_["rotateSolid"].size();
00074   rotateSolid_.clear();
00075   rotateSolid_.resize(sz);
00076   if (sz%3) {
00077     err_ += "\trotateSolid must occur 3*n times (defining n subsequent rotations)\n";
00078     err_ += "\t  currently it appears " + d2s(sz) + " times!\n";
00079     result = false;
00080   }
00081   for (sz_type i=0; i<sz; ++i) {
00082     rotateSolid_[i] = ParE_["rotateSolid"][i];
00083   }
00084   for (sz_type i=0; i<sz; i += 3 ) {
00085     if ( (rotateSolid_[i] > 180.*deg) || (rotateSolid_[i] < 0.) ) {
00086       err_ += "\trotateSolid \'theta\' must be in range [0,180*deg]\n";
00087       err_ += "\t  currently it is " + d2s(rotateSolid_[i]/deg) 
00088             + "*deg in rotateSolid[" + d2s(double(i)) + "]!\n";
00089       result = false;       
00090     }
00091     DDAxisAngle temp(fUnitVector(rotateSolid_[i],rotateSolid_[i+1]),
00092                      rotateSolid_[i+2]);
00093     DCOUT('a', "  rotsolid[" << i <<  "] axis=" << temp.Axis() << " rot.angle=" << temp.Angle()/deg);
00094     solidRot_ = temp*solidRot_;                   
00095   }
00096   //  DCOUT('a', "  rotsolid axis=" << solidRot_.getAxis() << " rot.angle=" << solidRot_.delta()/deg);                      
00097   
00098   
00099   //======== collect data concerning the rotation of the x-y plane
00100   sz = ParE_["rotate"].size();
00101   rotate_.clear();
00102   rotate_.resize(sz);
00103   if (sz%3) {
00104     err_ += "\trotate must occur 3*n times (defining n subsequent rotations)\n";
00105     err_ += "\t  currently it appears " + d2s(sz) + " times!\n";
00106     result = false;
00107   }
00108   for (sz_type i=0; i<sz; ++i) {
00109     rotate_[i] = ParE_["rotate"][i];
00110   }
00111   for (sz_type i=0; i<sz; i += 3 ) {
00112     if ( (rotate_[i] > 180.*deg) || (rotate_[i] < 0) ) {
00113       err_ += "\trotate \'theta\' must be in range [0,180*deg]\n";
00114       err_ += "\t  currently it is " + d2s(rotate_[i]/deg) 
00115             + "*deg in rotate[" + d2s(double(i)) + "]!\n";
00116       result = false;       
00117     }  
00118     DDAxisAngle temp(fUnitVector(rotateSolid_[i],rotateSolid_[i+1]),
00119                      rotateSolid_[i+2]);
00120     DCOUT('a', "  rotsolid[" << i <<  "] axis=" << temp.Axis() << " rot.angle=" << temp.Angle()/deg);
00121     planeRot_ =  planeRot_*temp;
00122   }
00123   //  DCOUT('a', "  rotplane axis=" << planeRot_.getAxis() << " rot.angle=" << planeRot_.delta()/deg);
00124 
00125   center_[0]      = ParE_["center"][0];
00126   center_[1]      = ParE_["center"][1];
00127   center_[2]      = ParE_["center"][2];
00128   
00129   if (ParS_["alignSolid"][0] != "T") {
00130     DCOUT('a', "  alignSolid = false");
00131     alignSolid_ = false;
00132   }
00133   else {
00134     alignSolid_ = true;
00135   }  
00136   
00137   return result;
00138 }

void global_angular_0::checkTermination (  )  [virtual]

for algorithms with incr_==0 the algorithm must check whether to terminate

Overload this function in case the algorithm is a 'incr_==0' type. In this case provide some code which checks using perhaps the value of count_ and/or supplied algorithm parameters to check whether terminate() has to be called or not. If terminate() is called, the current iteration of the algorithm is not taken into account!

The default implementation will immidiately terminate the algorithm in case incr_==0.

In case of incr_!=0: checkTermination() is not called at all; the algorithm will terminate automatically when the specified range [start_, end_, incr_] has been covered or terminate() has been called from within translation() or rotation().

Reimplemented from AlgoImpl.

Definition at line 192 of file global_angular.cc.

References AlgoImpl::count_, n_, and AlgoImpl::terminate().

00193 {
00194  if ( (n_-count_) == -1 ) terminate();
00195 }

int global_angular_0::copyno (  )  const [virtual]

copy-number calculation

In case incr_==0 it makes sense to overload this method, otherwise the invocation-count count_ will be returned as copy-number

If incr_ !=0 the copy-number will be curr_, the actual position in the range [start_,end_,incr_], unless this methods is overloaded.

Reimplemented from AlgoImpl.

Definition at line 181 of file global_angular.cc.

References AlgoImpl::copyno(), incrCopyNo_, and startCopyNo_.

00182 {
00183   // for the moment rely on the automatic copy-number generation
00184   //  ( copy-no == invocation count count_ )
00185   int factor = AlgoImpl::copyno() - 1;
00186   return startCopyNo_ + factor*incrCopyNo_;
00187 }

DDRotationMatrix global_angular_0::rotation (  )  [virtual]

subclass must calculate a rotation matrix

depending on the current position curr_ in the range [start_,end_,incr_] and the user supplied parameters ParE_, ParS_

Implements AlgoImpl.

Definition at line 159 of file global_angular.cc.

References alignSolid_, angle(), AlgoImpl::count_, delta_, planeRot_, r2, rot, rotate_, solidRot_, and startAngle_.

00160 {
00161   //your code here
00162   DDRotationMatrix rot = solidRot_;
00163 
00164   if (alignSolid_) { // rotate the solid as well
00165     double angle = startAngle_+ double(count_-1)*delta_;
00166     ROOT::Math::RotationZ r2(angle);
00167     rot = r2*rot;
00168   }
00169   // DCOUT('A', "  rot.axis=" << rot.getAxis() << " rot.angle=" << rot.delta()/deg);
00170 
00171   if (rotate_[2]!=0) {
00172     rot = planeRot_*rot;
00173     //rot = rot*planeRot_.inverse();
00174     //rot = planeRot_.inverse()*rot;
00175   }
00176 
00177   return rot;
00178 }

void global_angular_0::stream ( std::ostream &  os  )  const

Definition at line 198 of file global_angular.cc.

00199 {
00200   os << "global_angular_0::stream(): not implemented.";
00201 }

DDTranslation global_angular_0::translation (  )  [virtual]

subclass must calculate a translation std::vector

depending on the current position curr_ in the range [start_,end_,incr_] and the user supplied parameters ParE_, ParS_

Implements AlgoImpl.

Definition at line 141 of file global_angular.cc.

References angle(), center_, AlgoImpl::count_, DCOUT, delta_, fUnitVector(), planeRot_, radius_, rotate_, startAngle_, and v.

00142 {
00143   double angle = startAngle_+ double(count_-1)*delta_;
00144   
00145   DD3Vector v = fUnitVector(90*deg,angle)*radius_ ;
00146   
00147   if (rotate_[2]!=0) {
00148     //v = planeRot_.inverse()*v;
00149     v = planeRot_*v;
00150   }
00151   
00152   v += DD3Vector(center_[0], center_[1], center_[2]); // offset
00153   
00154   DCOUT('A', "  angle=" << angle/deg << " translation=" << v << "  count_=" << count_);
00155   return v;
00156 }


Member Data Documentation

bool global_angular_0::alignSolid_

Definition at line 55 of file global_angular.h.

Referenced by checkParameters(), and rotation().

std::vector<double> global_angular_0::center_

Definition at line 54 of file global_angular.h.

Referenced by checkParameters(), and translation().

double global_angular_0::delta_

Definition at line 58 of file global_angular.h.

Referenced by checkParameters(), rotation(), and translation().

int global_angular_0::incrCopyNo_

Definition at line 56 of file global_angular.h.

Referenced by checkParameters(), and copyno().

int global_angular_0::n_

Definition at line 56 of file global_angular.h.

Referenced by checkParameters(), and checkTermination().

DDRotationMatrix global_angular_0::planeRot_

Definition at line 60 of file global_angular.h.

Referenced by checkParameters(), rotation(), and translation().

double global_angular_0::radius_

Definition at line 57 of file global_angular.h.

Referenced by checkParameters(), and translation().

double global_angular_0::rangeAngle_

Definition at line 57 of file global_angular.h.

Referenced by checkParameters().

std::vector<double> global_angular_0::rotate_

Definition at line 54 of file global_angular.h.

Referenced by checkParameters(), rotation(), and translation().

std::vector<double> global_angular_0::rotateSolid_

Definition at line 54 of file global_angular.h.

Referenced by checkParameters().

DDRotationMatrix global_angular_0::solidRot_

Definition at line 59 of file global_angular.h.

Referenced by checkParameters(), and rotation().

double global_angular_0::startAngle_

Definition at line 57 of file global_angular.h.

Referenced by checkParameters(), rotation(), and translation().

int global_angular_0::startCopyNo_

Definition at line 56 of file global_angular.h.

Referenced by checkParameters(), and copyno().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:21:24 2009 for CMSSW by  doxygen 1.5.4