CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DDHCalXtalAlgo Class Reference

#include <DDHCalXtalAlgo.h>

Inheritance diagram for DDHCalXtalAlgo:

Public Member Functions

 DDHCalXtalAlgo ()
 
void execute (DDCompactView &cpv) override
 
void initialize (const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
 
 ~DDHCalXtalAlgo () override
 

Private Attributes

double angwidth
 
double dx
 
double dz
 
int iaxis
 
std::string idName
 
std::string idNameSpace
 
std::vector< std::string > names
 
double offset
 
double radius
 

Detailed Description

Definition at line 10 of file DDHCalXtalAlgo.h.

Constructor & Destructor Documentation

DDHCalXtalAlgo::DDHCalXtalAlgo ( )

Definition at line 18 of file DDHCalXtalAlgo.cc.

18  {
19 #ifdef EDM_ML_DEBUG
20  edm::LogVerbatim("HCalGeom") << "DDHCalXtalAlgo info: Creating an instance";
21 #endif
22 }
DDHCalXtalAlgo::~DDHCalXtalAlgo ( )
override

Definition at line 24 of file DDHCalXtalAlgo.cc.

24 {}

Member Function Documentation

void DDHCalXtalAlgo::execute ( DDCompactView cpv)
override

Definition at line 59 of file DDHCalXtalAlgo.cc.

References funct::abs(), angle(), geant_units::operators::convertRadToDeg(), DDrot(), PVValHelper::dx, PVValHelper::dz, mps_fire::i, trivialCutFlow_cff::idName, createfilelist::int, names, PFRecoTauDiscriminationByIsolation_cfi::offset, class-composition::parent, DDCompactView::position(), TCMET_cfi::radius, idealTransformation::rotation, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, and theta().

59  {
60 
61  double theta[3], phi[3], pos[3];
62  phi[0] = 0;
63  phi[1] = 90._deg;
64  theta[1-iaxis] = 90._deg;
65  pos[1-iaxis] = 0;
66  int number = (int)(names.size());
67  for (int i=0; i<number; i++) {
68  double angle = 0.5*angwidth*(2*i+1-number);
69  theta[iaxis] = 90._deg + angle;
70  if (angle>0) {
71  theta[2] = angle;
72  phi[2] = iaxis*90._deg;
73  } else {
74  theta[2] =-angle;
75  phi[2] = (2-3*iaxis)*90._deg;
76  }
77  pos[iaxis] = angle*(dz+radius);
78  pos[2] = dx*std::abs(sin(angle)) + offset;
79 
81  std::string rotstr = names[i];
82  DDTranslation tran(pos[0], pos[1], pos[2]);
83  DDName parentName = parent().name();
84 
85  static const double tol = 0.01_deg; // 0.01 degree
86  if (std::abs(angle) > tol) {
87 #ifdef EDM_ML_DEBUG
88  edm::LogVerbatim("HCalGeom") << "DDHCalXtalAlgo: Creating a rotation "
89  << rotstr << "\t"
90  << convertRadToDeg(theta[0]) << ","
91  << convertRadToDeg(phi[0]) << ","
92  << convertRadToDeg(theta[1]) << ","
93  << convertRadToDeg(phi[1]) << ","
94  << convertRadToDeg(theta[2]) << ","
95  << convertRadToDeg(phi[2]);
96 #endif
97  rotation = DDrot(DDName(rotstr, idNameSpace), theta[0], phi[0], theta[1],
98  phi[1], theta[2], phi[2]);
99  }
100  cpv.position(DDName(idName, idNameSpace), parentName, i+1, tran, rotation);
101 #ifdef EDM_ML_DEBUG
102  edm::LogVerbatim("HCalGeom") << "DDHCalXtalAlgo: "
103  << DDName(idName,idNameSpace) << " number "
104  << i+1 << " positioned in " << parentName
105  << " at " << tran << " with " << rotation;
106 #endif
107  }
108 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
constexpr NumType convertRadToDeg(NumType radians)
Definition: GeantUnits.h:98
std::vector< std::string > names
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:68
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DDRotation DDrot(const DDName &name, std::unique_ptr< DDRotationMatrix > rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:80
std::string idName
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::string idNameSpace
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
void DDHCalXtalAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 26 of file DDHCalXtalAlgo.cc.

References geant_units::operators::convertRadToDeg(), PVValHelper::dx, PVValHelper::dz, mps_fire::i, trivialCutFlow_cff::idName, createfilelist::int, names, DDCurrentNamespace::ns(), PFRecoTauDiscriminationByIsolation_cfi::offset, class-composition::parent, and TCMET_cfi::radius.

30  {
31 
32  radius = nArgs["Radius"];
33  offset = nArgs["Offset"];
34  dx = nArgs["Dx"];
35  dz = nArgs["Dz"];
36  angwidth = nArgs["AngWidth"];
37  iaxis = int (nArgs["Axis"]);
38  names = vsArgs["Names"];
39 
40 #ifdef EDM_ML_DEBUG
41  edm::LogVerbatim("HCalGeom") << "DDHCalXtalAlgo::Parameters for positioning:"
42  << " Axis " << iaxis << "\tRadius " << radius
43  << "\tOffset " << offset << "\tDx " << dx
44  << "\tDz " << dz << "\tAngWidth "
45  << convertRadToDeg(angwidth) << "\tNumbers "
46  << names.size();
47  for (unsigned int i = 0; i < names.size(); i++)
48  edm::LogVerbatim("HCalGeom") << "\tnames[" << i << "] = " << names[i];
49 #endif
51  idName = sArgs["ChildName"];
52 #ifdef EDM_ML_DEBUG
53  edm::LogVerbatim("HCalGeom") << "DDHCalXtalAlgo: Parent " << parent().name()
54  << "\tChild " << idName << " NameSpace "
55  << idNameSpace;
56 #endif
57 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: GeantUnits.h:98
static std::string & ns()
std::vector< std::string > names
std::string idName
std::string idNameSpace

Member Data Documentation

double DDHCalXtalAlgo::angwidth
private

Definition at line 30 of file DDHCalXtalAlgo.h.

double DDHCalXtalAlgo::dx
private

Definition at line 28 of file DDHCalXtalAlgo.h.

double DDHCalXtalAlgo::dz
private
int DDHCalXtalAlgo::iaxis
private

Definition at line 31 of file DDHCalXtalAlgo.h.

std::string DDHCalXtalAlgo::idName
private

Definition at line 35 of file DDHCalXtalAlgo.h.

std::string DDHCalXtalAlgo::idNameSpace
private

Definition at line 34 of file DDHCalXtalAlgo.h.

std::vector<std::string> DDHCalXtalAlgo::names
private

Definition at line 32 of file DDHCalXtalAlgo.h.

double DDHCalXtalAlgo::offset
private

Definition at line 27 of file DDHCalXtalAlgo.h.

double DDHCalXtalAlgo::radius
private

Definition at line 26 of file DDHCalXtalAlgo.h.