![]() |
![]() |
#include <DetectorDescription/Algorithm/src/global_simpleAngular.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 | |
global_simpleAngular_2 (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_simpleAngular_2 () |
Definition at line 99 of file global_simpleAngular.h.
global_simpleAngular_2::global_simpleAngular_2 | ( | AlgoPos * | a, | |
std::string | label | |||
) |
global_simpleAngular_2::~global_simpleAngular_2 | ( | ) |
bool global_simpleAngular_2::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 324 of file global_simpleAngular.cc.
References AlgoImpl::err_, AlgoImpl::ParE_, HLT_VtxMuL3::result, and size.
00325 { 00326 bool result = true; 00327 00328 // check for delta 00329 if (ParE_["number"].size() == 0) { 00330 result = false; // don't select this implementation, because number is missing 00331 } 00332 else { 00333 // check for valid number value 00334 if (ParE_["number"][0] == 0.) { 00335 err_ += "\tnumber must not be 0\n"; 00336 result = false; 00337 } 00338 } 00339 00340 // check for presence of delta 00341 if (ParE_["delta"].size() == 0) { 00342 result = false; // don't select this implementation, because delta is missing. 00343 } 00344 else { 00345 // check for valid delta value 00346 if (ParE_["delta"][0] == 0.) { 00347 err_ += "\tdelta must not be 0\n"; 00348 result = false; 00349 } 00350 } 00351 00352 double delta = ParE_["delta"][0]; 00353 double number = ParE_["number"][0]; 00354 if (delta * number > 360. * deg) { 00355 err_ += "\tat this time delta * number can not be greater than 360 degrees\n"; 00356 result = false; 00357 } 00358 return result; 00359 }
void global_simpleAngular_2::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 457 of file global_simpleAngular.cc.
References AlgoImpl::count_, AlgoImpl::ParE_, and AlgoImpl::terminate().
00458 { 00459 //double delta = (360.0 / ParE_["number"][0]) * deg; 00460 // if ((ParE_["offset"][0] + count_ * delta) / deg > 360.) 00461 if (count_ > ParE_["number"][0]) 00462 terminate(); 00463 }
DDRotationMatrix global_simpleAngular_2::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 379 of file global_simpleAngular.cc.
References angle(), AlgoImpl::count_, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), i, j, name, AlgoImpl::ParE_, AlgoImpl::ParS_, DDRotation::rotation(), and size.
00380 { 00381 00382 // double number = ParE_["number"][0]; 00383 double delta = ParE_["delta"][0]; 00384 if (ParS_["rotate"][0] == "T" || ParS_["rotate"][0] == "1" 00385 || ParS_["rotate"][0] == "True") 00386 { 00387 double angle = -(ParE_["offset"][0]/rad + (delta/rad) * (count_ - 1)); 00388 DDRotationMatrix rm1; 00389 if (ParS_["orientation"].size() != 0) 00390 { 00391 std::string name=ParS_["orientation"][0]; 00392 size_t foundColon = 0; 00393 std::string rn = ""; 00394 std::string ns = ""; 00395 while (foundColon < name.size() && name[foundColon] != ':') 00396 ++foundColon; 00397 if (foundColon != name.size()) 00398 { 00399 for (size_t j = foundColon + 1; j < name.size(); ++j) 00400 rn = rn + name[j]; 00401 for (size_t i = 0; i < foundColon; ++i) 00402 ns = ns + name[i]; 00403 } 00404 if (rn != "" && ns != "") 00405 { 00406 DDRotation myDDRotation(DDName(rn, ns)); 00407 rm1 = *(myDDRotation.rotation()); 00408 } 00409 else 00410 std::cout << "MAJOR PROBLEM: expected a fully qualified DDName but got :" 00411 << name << std::endl; 00412 } 00413 ROOT::Math::RotationZ rm(angle); 00414 rm1.Invert(); 00415 rm.Invert(); 00416 return rm * rm1; 00417 } 00418 else if (ParS_["orientation"].size() != 0) 00419 { 00420 // return the orientation matrix 00421 std::string name=ParS_["orientation"][0]; 00422 size_t foundColon = 0; 00423 std::string rn = ""; 00424 std::string ns = ""; 00425 while (foundColon < name.size() && name[foundColon] != ':') 00426 ++foundColon; 00427 if (foundColon != name.size()) 00428 { 00429 for (size_t j = foundColon + 1; j < name.size(); ++j) 00430 rn = rn + name[j]; 00431 for (size_t i = 0; i < foundColon; ++i) 00432 ns = ns + name[i]; 00433 } 00434 if (rn != "" && ns != "") 00435 { 00436 00437 DDRotation myDDRotation(DDName(rn, ns)); 00438 DDRotationMatrix rm = *(myDDRotation.rotation()); 00439 return *(myDDRotation.rotation()); 00440 } 00441 else 00442 std::cout << "MAJOR PROBLEM: expected a fully qualified DDName but got " 00443 << name << " therefore could not look up the rotation." << std::endl; 00444 return DDRotationMatrix(); 00445 } 00446 else 00447 { 00448 return DDRotationMatrix(); // return identity matrix. 00449 } 00450 }
void global_simpleAngular_2::stream | ( | std::ostream & | os | ) | const |
DDTranslation global_simpleAngular_2::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 362 of file global_simpleAngular.cc.
References funct::cos(), AlgoImpl::count_, offset, AlgoImpl::ParE_, radius(), and funct::sin().
00363 { 00364 // we can safely fetch all parameters, because they 00365 // have been checked already ... 00366 double offset = ParE_["offset"][0]; 00367 // double number = ParE_["number"][0]; 00368 double delta = ParE_["delta"][0]; 00369 double radius = ParE_["radius"][0]; 00370 // std::cout << "x = " << radius * cos(offset + delta * (count_ - 1)) << " y = " << radius * sin(offset + delta * (count_ - 1)) << std::endl; 00371 DDTranslation trans(radius * cos(offset + delta * (count_ - 1)), 00372 radius * sin(offset + delta * (count_ - 1)), 00373 0. ); 00374 00375 return trans; 00376 }