CMS 3D CMS Logo

global_simpleAngular_0 Class Reference

(. More...

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

Inheritance diagram for global_simpleAngular_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
 global_simpleAngular_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_simpleAngular_0 ()


Detailed Description

(.

..THIS COULD BE DOXYGEN CONFORMANT ...) Angular positioning according to the formula:

offset ... an angle offset from which to start the positioning

radius ... an offset distance in the radial direction.

delta ... angular delta between each position.

number ... number of times to position within the range rotate ... boolean text, T or F, True or False, 1 or zero. Use this to indicate if the self logical part should be rotated. Since the DDD uses double or std::string, I'm using std::string. default = "T" orientation ... std::string: rotation matrix name to be used to orient the part within the mother. This is a DDLrRotation.

The algorithm has (at least) two implementations.

The first is selected if delta is specified and number is NOT specified. In this algorithm, the positioning is relatively straight-forward.

The second is selected if number is specified and delta is NOT specified. This should use the first one by specifying a delta based on dividing up 360 degrees by the number of positionings desired. For this one, CheckTermination is used to determine when to stop making them.

Some methods are only specific to this algorithm (I HOPE)

Definition at line 57 of file global_simpleAngular.h.


Constructor & Destructor Documentation

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

Definition at line 21 of file global_simpleAngular.cc.

00022  : AlgoImpl(a,label)
00023 { }

global_simpleAngular_0::~global_simpleAngular_0 (  ) 

Definition at line 25 of file global_simpleAngular.cc.

00026 { }


Member Function Documentation

bool global_simpleAngular_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 28 of file global_simpleAngular.cc.

References AlgoImpl::err_, AlgoImpl::ParE_, HLT_VtxMuL3::result, and size.

00029 {
00030 /* besides the automatic generated checking for the input params, 
00031      we have to decide, whether the params are correct and should
00032      select this implementation 
00033   */
00034                   
00035   bool result = true;   
00036                   
00037   // check for presence of delta
00038   if (ParE_["delta"].size() == 0) {
00039     result = false; // don't select this implementation, because delta is missing
00040   }
00041   else {
00042     // check for valid delta-value
00043     if (ParE_["delta"][0] == 0.) {
00044       err_ += "\tdelta can not be zero\n";
00045       result = false;
00046     }
00047   }
00048 
00049   // check for presence of number
00050   if (ParE_["number"].size() != 0) {
00051 //    err_ += "\tcan not specify a delta and a number\n";
00052     result = false;
00053   }  
00054   return result;  
00055 }

void global_simpleAngular_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 149 of file global_simpleAngular.cc.

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

00150 {
00151   // initially I thought of ending our rotation algorithm at the vertical
00152   // (+x), but decided it should always go full circle.
00153   //  if ((ParE_["offset"][0] + ParE_["delta"][0] * count_ / deg) > 360.)
00154   if (ParE_["delta"][0] * count_ / deg > 360.)
00155     terminate();
00156 
00157 }

DDRotationMatrix global_simpleAngular_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 72 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.

00073 {
00074   std::cout << "ParS_[\"rotate\"][0] = " << ParS_["rotate"][0] << std::endl; 
00075   if (ParS_["rotate"][0] == "T" || ParS_["rotate"][0] == "1"
00076       || ParS_["rotate"][0] == "True")
00077     {
00078       double angle = -(ParE_["offset"][0]/rad + (ParE_["delta"][0]/rad) * (count_ - 1));
00079       DDRotationMatrix rm1;
00080       if (ParS_["orientation"].size() != 0)
00081         {
00082           std::string name=ParS_["orientation"][0];
00083           size_t foundColon = 0;
00084           std::string rn = "";
00085           std::string ns = "";
00086           while (foundColon < name.size() && name[foundColon] != ':')
00087             ++foundColon;
00088           if (foundColon != name.size())
00089             {
00090               for (size_t j = foundColon + 1; j < name.size(); ++j)
00091                 rn = rn + name[j];
00092               for (size_t i = 0; i < foundColon; ++i)
00093                 ns = ns + name[i];
00094             }
00095           if (rn != "" && ns != "")
00096             {
00097               DDRotation myDDRotation(DDName(rn, ns));
00098               rm1 = *(myDDRotation.rotation());
00099             }
00100           else
00101             std::cout << "MAJOR PROBLEM: expected a fully qualified DDName but got :" 
00102                  << name << std::endl;
00103         }
00104       ROOT::Math::RotationZ rm(angle);
00105       rm1.Invert(); 
00106       rm.Invert();
00107       return rm * rm1;
00108     }
00109   else if (ParS_["orientation"].size() != 0)
00110     {
00111       // return the orientation matrix
00112       std::string name=ParS_["orientation"][0];
00113       size_t foundColon = 0;
00114       std::string rn = "";
00115       std::string ns = "";
00116       while (foundColon < name.size() && name[foundColon] != ':')
00117         ++foundColon;
00118       if (foundColon != name.size())
00119         {
00120           for (size_t j = foundColon + 1; j < name.size(); ++j)
00121             rn = rn + name[j];
00122           for (size_t i = 0; i < foundColon; ++i)
00123             ns = ns + name[i];
00124         }
00125       if (rn != "" && ns != "")
00126         {
00127           
00128           DDRotation myDDRotation(DDName(rn, ns));
00129           std::cout << "about to return *(myDDRotation.rotation())" << std::endl;
00130           std::cout << *myDDRotation.rotation() << std::endl;
00131           return *(myDDRotation.rotation());
00132         }
00133       else
00134         std::cout << "MAJOR PROBLEM: expected a fully qualified DDName but got " 
00135              << name << " therefore could not look up the rotation." << std::endl;
00136       return DDRotationMatrix();
00137     }
00138   else
00139     {
00140       return DDRotationMatrix(); // return identity matrix.
00141     }
00142 }   

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

Definition at line 160 of file global_simpleAngular.cc.

00161 {
00162   os << "global_simplesimpleAngular_0::stream(): not implemented.";
00163 }

DDTranslation global_simpleAngular_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 58 of file global_simpleAngular.cc.

References funct::cos(), AlgoImpl::count_, offset, AlgoImpl::ParE_, radius(), and funct::sin().

00059 {
00060   double offset  = ParE_["offset"][0]/rad;
00061   double delta   = ParE_["delta"][0]/rad;
00062   double radius  = ParE_["radius"][0];
00063 //  std::cout << "x = " << radius * cos(offset + delta * (count_ - 1)) << "  y = " << radius * sin(offset + delta * (count_ - 1)) << std::endl;
00064   DDTranslation trans(radius * cos(offset + delta * (count_ - 1)),
00065                       radius * sin(offset + delta * (count_ - 1)),
00066                       0. );
00067                  
00068   return trans;
00069 }


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