#include <global_angular.h>
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_ |
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.
global_angular_0::global_angular_0 | ( | AlgoPos * | a, |
std::string | label | ||
) |
Definition at line 20 of file global_angular.cc.
References DCOUT.
: AlgoImpl(a,label), rotate_(0), center_(3), rotateSolid_(0), alignSolid_(true), n_(1), startCopyNo_(1), incrCopyNo_(1), startAngle_(0), rangeAngle_(360.*deg) { DCOUT('A', "Creating angular label=" << label); }
global_angular_0::~global_angular_0 | ( | ) |
Definition at line 29 of file global_angular.cc.
{ }
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_, n_, AlgoImpl::ParE_, AlgoImpl::ParS_, planeRot_, radius_, rangeAngle_, query::result, rotate_, rotateSolid_, solidRot_, startAngle_, startCopyNo_, and cond::rpcobtemp::temp.
{ bool result = true; planeRot_ = DDRotationMatrix(); solidRot_ = DDRotationMatrix(); radius_ = ParE_["radius"][0]; startAngle_ = ParE_["startAngle"][0]; rangeAngle_ = ParE_["rangeAngle"][0]; n_ = int(ParE_["n"][0]); startCopyNo_ = int(ParE_["startCopyNo"][0]); incrCopyNo_ = int(ParE_["incrCopyNo"][0]); if (fabs(rangeAngle_-360.0*deg)<0.001*deg) { // a full 360deg range delta_ = rangeAngle_/double(n_); } else { if (n_ > 1) { delta_ = rangeAngle_/double(n_-1); } else { delta_ = 0.; } } DCOUT('a', " startA=" << startAngle_/deg << " rangeA=" << rangeAngle_/deg << " n=" << n_ << " delta=" << delta_/deg); //======= collect data concerning the rotation of the solid typedef parE_type::mapped_type::size_type sz_type; sz_type sz = ParE_["rotateSolid"].size(); rotateSolid_.clear(); rotateSolid_.resize(sz); if (sz%3) { err_ += "\trotateSolid must occur 3*n times (defining n subsequent rotations)\n"; err_ += "\t currently it appears " + d2s(sz) + " times!\n"; result = false; } for (sz_type i=0; i<sz; ++i) { rotateSolid_[i] = ParE_["rotateSolid"][i]; } for (sz_type i=0; i<sz; i += 3 ) { if ( (rotateSolid_[i] > 180.*deg) || (rotateSolid_[i] < 0.) ) { err_ += "\trotateSolid \'theta\' must be in range [0,180*deg]\n"; err_ += "\t currently it is " + d2s(rotateSolid_[i]/deg) + "*deg in rotateSolid[" + d2s(double(i)) + "]!\n"; result = false; } DDAxisAngle temp(fUnitVector(rotateSolid_[i],rotateSolid_[i+1]), rotateSolid_[i+2]); DCOUT('a', " rotsolid[" << i << "] axis=" << temp.Axis() << " rot.angle=" << temp.Angle()/deg); solidRot_ = temp*solidRot_; } // DCOUT('a', " rotsolid axis=" << solidRot_.getAxis() << " rot.angle=" << solidRot_.delta()/deg); //======== collect data concerning the rotation of the x-y plane sz = ParE_["rotate"].size(); rotate_.clear(); rotate_.resize(sz); if (sz%3) { err_ += "\trotate must occur 3*n times (defining n subsequent rotations)\n"; err_ += "\t currently it appears " + d2s(sz) + " times!\n"; result = false; } for (sz_type i=0; i<sz; ++i) { rotate_[i] = ParE_["rotate"][i]; } for (sz_type i=0; i<sz; i += 3 ) { if ( (rotate_[i] > 180.*deg) || (rotate_[i] < 0) ) { err_ += "\trotate \'theta\' must be in range [0,180*deg]\n"; err_ += "\t currently it is " + d2s(rotate_[i]/deg) + "*deg in rotate[" + d2s(double(i)) + "]!\n"; result = false; } DDAxisAngle temp(fUnitVector(rotateSolid_[i],rotateSolid_[i+1]), rotateSolid_[i+2]); DCOUT('a', " rotsolid[" << i << "] axis=" << temp.Axis() << " rot.angle=" << temp.Angle()/deg); planeRot_ = planeRot_*temp; } // DCOUT('a', " rotplane axis=" << planeRot_.getAxis() << " rot.angle=" << planeRot_.delta()/deg); center_[0] = ParE_["center"][0]; center_[1] = ParE_["center"][1]; center_[2] = ParE_["center"][2]; if (ParS_["alignSolid"][0] != "T") { DCOUT('a', " alignSolid = false"); alignSolid_ = false; } else { alignSolid_ = true; } return result; }
void global_angular_0::checkTermination | ( | void | ) | [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().
int global_angular_0::copyno | ( | void | ) | 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 incrCopyNo_, and startCopyNo_.
{ // for the moment rely on the automatic copy-number generation // ( copy-no == invocation count count_ ) int factor = AlgoImpl::copyno() - 1; return startCopyNo_ + factor*incrCopyNo_; }
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_, rotate_, solidRot_, and startAngle_.
{ //your code here DDRotationMatrix rot = solidRot_; if (alignSolid_) { // rotate the solid as well double angle = startAngle_+ double(count_-1)*delta_; ROOT::Math::RotationZ r2(angle); rot = r2*rot; } // DCOUT('A', " rot.axis=" << rot.getAxis() << " rot.angle=" << rot.delta()/deg); if (rotate_[2]!=0) { rot = planeRot_*rot; //rot = rot*planeRot_.inverse(); //rot = planeRot_.inverse()*rot; } return rot; }
void global_angular_0::stream | ( | std::ostream & | os | ) | const |
Definition at line 198 of file global_angular.cc.
{
os << "global_angular_0::stream(): not implemented.";
}
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.
{ double angle = startAngle_+ double(count_-1)*delta_; DD3Vector v = fUnitVector(90*deg,angle)*radius_ ; if (rotate_[2]!=0) { //v = planeRot_.inverse()*v; v = planeRot_*v; } v += DD3Vector(center_[0], center_[1], center_[2]); // offset DCOUT('A', " angle=" << angle/deg << " translation=" << v << " count_=" << count_); return v; }
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().
Definition at line 56 of file global_angular.h.
Referenced by checkParameters(), and copyno().
Definition at line 56 of file global_angular.h.
Referenced by checkParameters(), and checkTermination().
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().
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().
Definition at line 59 of file global_angular.h.
Referenced by checkParameters(), and rotation().
Definition at line 57 of file global_angular.h.
Referenced by checkParameters(), rotation(), and translation().
Definition at line 56 of file global_angular.h.
Referenced by checkParameters(), and copyno().