CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
global_linear_0 Class Reference

#include <global_linear.h>

Inheritance diagram for global_linear_0:
AlgoImpl

Public Member Functions

bool checkParameters ()
 subclass must check the supplied parameters ParE_, ParS_ More...
 
 global_linear_0 (AlgoPos *, std::string label)
 
DDRotationMatrix rotation ()
 subclass must calculate a rotation matrix More...
 
void stream (std::ostream &) const
 
DDTranslation translation ()
 subclass must calculate a translation std::vector More...
 
 ~global_linear_0 ()
 
- Public Member Functions inherited from AlgoImpl
 AlgoImpl (AlgoPos *, std::string label)
 subclass must provide a similar constructor and call this one More...
 

Additional Inherited Members

- Protected Member Functions inherited from AlgoImpl
virtual void checkTermination ()
 for algorithms with incr_==0 the algorithm must check whether to terminate More...
 
virtual int copyno () const
 copy-number calculation More...
 
void terminate ()
 stop the current iteration of the algorithm (for incr_==0 types of algorithms) More...
 
virtual ~AlgoImpl ()
 
- Static Protected Member Functions inherited from AlgoImpl
static std::string d2s (double x)
 ahh, converts a double into a std::string ... yet another one of this kind! More...
 
- Protected Attributes inherited from AlgoImpl
const int & count_
 
const int & curr_
 
const int & end_
 
std::string & err_
 
const int & incr_
 
std::string label_
 
parE_typeParE_
 
parS_typeParS_
 
const int & start_
 
bool & terminate_
 

Detailed Description

Linear positioning according to the formula: c = {s, s+i, s+2*i, .. <=e} ... current number in alg.range dir[theta,phi] ... unit-std::vector 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.

Constructor & Destructor Documentation

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

Definition at line 20 of file global_linear.cc.

21  : AlgoImpl(a,label)
22 { }
AlgoImpl(AlgoPos *, std::string label)
subclass must provide a similar constructor and call this one
Definition: AlgoImpl.cc:6
global_linear_0::~global_linear_0 ( )

Definition at line 24 of file global_linear.cc.

25 { }

Member Function Documentation

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 27 of file global_linear.cc.

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

28 {
29 
30  bool result = true;
31 
32  // check for valid delta-value
33  if (ParE_["delta"][0] == 0.) {
34  err_ += "\tdelta must not be 0\n";
35  result = false;
36  }
37 
38  // check for presence of base
39  if (!ParE_["base"].size()) {
40  result = false; // don't select this implementation, because base is missing
41  }
42 
43  return result;
44 
45 }
parE_type & ParE_
Definition: AlgoImpl.h:113
std::string & err_
Definition: AlgoImpl.h:120
tuple result
Definition: query.py:137
tuple size
Write out results.
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 71 of file global_linear.cc.

72 {
73 
74  return DDRotationMatrix();
75 
76 }
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
void global_linear_0::stream ( std::ostream &  os) const

Definition at line 84 of file global_linear.cc.

85 {
86  os << "global_linear_0::stream(): not implemented.";
87 }
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 48 of file global_linear.cc.

References newFWLiteAna::base, funct::cos(), AlgoImpl::curr_, delta, evf::evtn::offset(), AlgoImpl::ParE_, phi, funct::sin(), and theta().

49 {
50 
51  // we can safely fetch all parameters, because they
52  // have been checked already ...
53  double theta = ParE_["theta"][0]/rad;
54  double phi = ParE_["phi"][0]/rad;
55  double offset = ParE_["offset"][0];
56  double delta = ParE_["delta"][0];
57 
58  DDTranslation direction( sin(theta)*cos(phi),
59  sin(theta)*sin(phi),
60  cos(theta) );
61 
62  DDTranslation base(ParE_["base"][0],
63  ParE_["base"][1],
64  ParE_["base"][2]);
65 
66  return base + (offset + double(curr_)*delta)*direction;
67 
68 }
dbl * delta
Definition: mlp_gen.cc:36
tuple base
Main Program
Definition: newFWLiteAna.py:92
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
parE_type & ParE_
Definition: AlgoImpl.h:113
const int & curr_
Definition: AlgoImpl.h:117
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
unsigned int offset(bool)
Definition: DDAxes.h:10