#include <DetectorDescription/Algorithm/src/global_linear.h>
Public Member Functions | |
bool | checkParameters () |
subclass must check the supplied parameters ParE_, ParS_ | |
global_linear_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_linear_0 () |
. <=e} ... current number in alg.range dir[theta,phi] ... unit-stdvector in direction theta,phi offset ... an offset distance in direction dir(theta,phi) delta ... distance between two subsequent positions along dir[theta,phi] base ... a 3d-point where the offset is calculated from base is optional, if omitted base=(0,0,0) 3Dpoint(c) = base + (offset + c*delta)*dir[theta,phi]
The algorithm will have 2 implementations: The first will be selected if base is not present in the input parameters, the second will be selected if base is present in the input parameters. (This is just an example and 2 implementations are not really necessary. They are only here to demonstrate the capability of having mulitiple implementations of the same algorithm)
Definition at line 44 of file global_linear.h.
global_linear_0::global_linear_0 | ( | AlgoPos * | a, | |
std::string | label | |||
) |
global_linear_0::~global_linear_0 | ( | ) |
bool global_linear_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 29 of file global_linear.cc.
References AlgoImpl::err_, AlgoImpl::ParE_, HLT_VtxMuL3::result, and size.
00030 { 00031 00032 bool result = true; 00033 00034 // check for valid delta-value 00035 if (ParE_["delta"][0] == 0.) { 00036 err_ += "\tdelta must not be 0\n"; 00037 result = false; 00038 } 00039 00040 // check for presence of base 00041 if (!ParE_["base"].size()) { 00042 result = false; // don't select this implementation, because base is missing 00043 } 00044 00045 return result; 00046 00047 }
DDRotationMatrix global_linear_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 73 of file global_linear.cc.
00074 { 00075 00076 return DDRotationMatrix(); 00077 00078 }
void global_linear_0::stream | ( | std::ostream & | os | ) | const |
DDTranslation global_linear_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 50 of file global_linear.cc.
References pyDBSguiBaseClass::base, funct::cos(), AlgoImpl::curr_, direction, offset, AlgoImpl::ParE_, phi, funct::sin(), and theta.
00051 { 00052 00053 // we can safely fetch all parameters, because they 00054 // have been checked already ... 00055 double theta = ParE_["theta"][0]/rad; 00056 double phi = ParE_["phi"][0]/rad; 00057 double offset = ParE_["offset"][0]; 00058 double delta = ParE_["delta"][0]; 00059 00060 DDTranslation direction( sin(theta)*cos(phi), 00061 sin(theta)*sin(phi), 00062 cos(theta) ); 00063 00064 DDTranslation base(ParE_["base"][0], 00065 ParE_["base"][1], 00066 ParE_["base"][2]); 00067 00068 return base + (offset + double(curr_)*delta)*direction; 00069 00070 }