CMS 3D CMS Logo

Public Member Functions

global_simpleAngular_2 Class Reference

#include <global_simpleAngular.h>

Inheritance diagram for global_simpleAngular_2:
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_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 ()

Detailed Description

Definition at line 99 of file global_simpleAngular.h.


Constructor & Destructor Documentation

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

Definition at line 313 of file global_simpleAngular.cc.

 : AlgoImpl(a,label)
{ }
global_simpleAngular_2::~global_simpleAngular_2 ( )

Definition at line 317 of file global_simpleAngular.cc.

{ }

Member Function Documentation

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 320 of file global_simpleAngular.cc.

References delta, AlgoImpl::err_, AlgoImpl::ParE_, query::result, and findQualityFiles::size.

{
  bool result = true;
                  
  // check for delta 
  if (ParE_["number"].size() == 0) {
    result = false; // don't select this implementation, because number is missing
  }               
  else {
    // check for valid number value
    if (ParE_["number"][0] == 0.) {
      err_ += "\tnumber must not be 0\n";
      result = false;
    }
  }
                  
  // check for presence of delta
  if (ParE_["delta"].size() == 0) {
    result = false; // don't select this implementation, because delta is missing.
  }               
  else {
    // check for valid delta value
    if (ParE_["delta"][0] == 0.) {
      err_ += "\tdelta must not be 0\n";
      result = false;
    }
  }

  double delta = ParE_["delta"][0];
  double number = ParE_["number"][0];
  if (delta * number > 360. * deg) {
    err_ += "\tat this time delta * number can not be greater than 360 degrees\n";
    result = false;
  }
  return result;   
}
void global_simpleAngular_2::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 452 of file global_simpleAngular.cc.

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

{
  //double delta = (360.0 / ParE_["number"][0]) * deg;
  //  if ((ParE_["offset"][0] + count_ * delta) / deg > 360.)
  if (count_ > ParE_["number"][0])
    terminate();
}
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 375 of file global_simpleAngular.cc.

References angle(), AlgoImpl::count_, gather_cfg::cout, delta, i, j, mergeVDriftHistosByStation::name, AlgoImpl::ParE_, AlgoImpl::ParS_, submit::rm, DDRotation::rotation(), and findQualityFiles::size.

{
  
//  double number = ParE_["number"][0];
  double delta = ParE_["delta"][0];
  if (ParS_["rotate"][0] == "T" || ParS_["rotate"][0] == "1"
      || ParS_["rotate"][0] == "True")
    {
      double angle = -(ParE_["offset"][0]/rad + (delta/rad) * (count_ - 1));
      DDRotationMatrix rm1;
      if (ParS_["orientation"].size() != 0)
        {
          std::string name=ParS_["orientation"][0];
          size_t foundColon = 0;
          std::string rn = "";
          std::string ns = "";
          while (foundColon < name.size() && name[foundColon] != ':')
            ++foundColon;
          if (foundColon != name.size())
            {
              for (size_t j = foundColon + 1; j < name.size(); ++j)
                rn = rn + name[j];
              for (size_t i = 0; i < foundColon; ++i)
                ns = ns + name[i];
            }
          if (rn != "" && ns != "")
            {
              DDRotation myDDRotation(DDName(rn, ns));
              rm1 = *(myDDRotation.rotation());
            }
          else
            std::cout << "MAJOR PROBLEM: expected a fully qualified DDName but got :" 
                 << name << std::endl;
        }
      ROOT::Math::RotationZ rm(angle);
      rm1.Invert(); 
      rm.Invert();
      return rm * rm1;
    }
  else if (ParS_["orientation"].size() != 0)
    {
      // return the orientation matrix
      std::string name=ParS_["orientation"][0];
      size_t foundColon = 0;
      std::string rn = "";
      std::string ns = "";
      while (foundColon < name.size() && name[foundColon] != ':')
        ++foundColon;
      if (foundColon != name.size())
        {
          for (size_t j = foundColon + 1; j < name.size(); ++j)
            rn = rn + name[j];
          for (size_t i = 0; i < foundColon; ++i)
            ns = ns + name[i];
        }
      if (rn != "" && ns != "")
        {
          
          DDRotation myDDRotation(DDName(rn, ns));
          return *(myDDRotation.rotation());
        }
      else
        std::cout << "MAJOR PROBLEM: expected a fully qualified DDName but got " 
             << name << " therefore could not look up the rotation." << std::endl;
      return DDRotationMatrix();
    }
  else
    {
      return DDRotationMatrix(); // return identity matrix.
    }
}   
void global_simpleAngular_2::stream ( std::ostream &  os) const

Definition at line 461 of file global_simpleAngular.cc.

{
  os << "global_simpleAngular_0::stream(): not implemented.";
}
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 358 of file global_simpleAngular.cc.

References funct::cos(), AlgoImpl::count_, delta, evf::evtn::offset(), AlgoImpl::ParE_, CosmicsPD_Skims::radius, and funct::sin().

{
    // we can safely fetch all parameters, because they
  // have been checked already ...
  double offset = ParE_["offset"][0];
//  double number = ParE_["number"][0];
  double delta = ParE_["delta"][0];
  double radius  = ParE_["radius"][0];
//  std::cout << "x = " << radius * cos(offset + delta * (count_ - 1)) << "  y = " << radius * sin(offset + delta * (count_ - 1)) << std::endl;
  DDTranslation trans(radius * cos(offset + delta * (count_ - 1)),
                      radius * sin(offset + delta * (count_ - 1)),
                      0. );
   
  return trans;
}