CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DDHCalXtalAlgo Class Reference
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 24 of file DDHCalXtalAlgo.cc.

Constructor & Destructor Documentation

◆ DDHCalXtalAlgo()

DDHCalXtalAlgo::DDHCalXtalAlgo ( )

Definition at line 51 of file DDHCalXtalAlgo.cc.

51  {
52 #ifdef EDM_ML_DEBUG
53  edm::LogVerbatim("HCalGeom") << "DDHCalXtalAlgo info: Creating an instance";
54 #endif
55 }

◆ ~DDHCalXtalAlgo()

DDHCalXtalAlgo::~DDHCalXtalAlgo ( )
override

Definition at line 57 of file DDHCalXtalAlgo.cc.

57 {}

Member Function Documentation

◆ execute()

void DDHCalXtalAlgo::execute ( DDCompactView cpv)
override

Definition at line 88 of file DDHCalXtalAlgo.cc.

88  {
89  double theta[3], phi[3], pos[3];
90  phi[0] = 0;
91  phi[1] = 90._deg;
92  theta[1 - iaxis] = 90._deg;
93  pos[1 - iaxis] = 0;
94  int number = (int)(names.size());
95  for (int i = 0; i < number; i++) {
96  double angle = 0.5 * angwidth * (2 * i + 1 - number);
97  theta[iaxis] = 90._deg + angle;
98  if (angle > 0) {
99  theta[2] = angle;
100  phi[2] = iaxis * 90._deg;
101  } else {
102  theta[2] = -angle;
103  phi[2] = (2 - 3 * iaxis) * 90._deg;
104  }
105  pos[iaxis] = angle * (dz + radius);
106  pos[2] = dx * std::abs(sin(angle)) + offset;
107 
109  std::string rotstr = names[i];
110  DDTranslation tran(pos[0], pos[1], pos[2]);
111  DDName parentName = parent().name();
112 
113  static const double tol = 0.01_deg; // 0.01 degree
114  if (std::abs(angle) > tol) {
115 #ifdef EDM_ML_DEBUG
116  edm::LogVerbatim("HCalGeom") << "DDHCalXtalAlgo: Creating a rotation " << rotstr << "\t"
117  << convertRadToDeg(theta[0]) << "," << convertRadToDeg(phi[0]) << ","
118  << convertRadToDeg(theta[1]) << "," << convertRadToDeg(phi[1]) << ","
119  << convertRadToDeg(theta[2]) << "," << convertRadToDeg(phi[2]);
120 #endif
121  rotation = DDrot(DDName(rotstr, idNameSpace), theta[0], phi[0], theta[1], phi[1], theta[2], phi[2]);
122  }
123  cpv.position(DDName(idName, idNameSpace), parentName, i + 1, tran, rotation);
124 #ifdef EDM_ML_DEBUG
125  edm::LogVerbatim("HCalGeom") << "DDHCalXtalAlgo: " << DDName(idName, idNameSpace) << " number " << i + 1
126  << " positioned in " << parentName << " at " << tran << " with " << rotation;
127 #endif
128  }
129 }

References funct::abs(), angle(), angle_units::operators::convertRadToDeg(), DDrot(), PVValHelper::dx, PVValHelper::dz, mps_fire::i, versionedElectronIDProducer_cfi::idName, createfilelist::int, names, contentValuesFiles::number, hltrates_dqm_sourceclient-live_cfg::offset, class-composition::parent, DDCompactView::position(), CosmicsPD_Skims::radius, idealTransformation::rotation, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, and theta().

◆ initialize()

void DDHCalXtalAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 59 of file DDHCalXtalAlgo.cc.

63  {
64  radius = nArgs["Radius"];
65  offset = nArgs["Offset"];
66  dx = nArgs["Dx"];
67  dz = nArgs["Dz"];
68  angwidth = nArgs["AngWidth"];
69  iaxis = int(nArgs["Axis"]);
70  names = vsArgs["Names"];
71 
72 #ifdef EDM_ML_DEBUG
73  edm::LogVerbatim("HCalGeom") << "DDHCalXtalAlgo::Parameters for positioning:"
74  << " Axis " << iaxis << "\tRadius " << radius << "\tOffset " << offset << "\tDx " << dx
75  << "\tDz " << dz << "\tAngWidth " << convertRadToDeg(angwidth) << "\tNumbers "
76  << names.size();
77  for (unsigned int i = 0; i < names.size(); i++)
78  edm::LogVerbatim("HCalGeom") << "\tnames[" << i << "] = " << names[i];
79 #endif
81  idName = sArgs["ChildName"];
82 #ifdef EDM_ML_DEBUG
83  edm::LogVerbatim("HCalGeom") << "DDHCalXtalAlgo: Parent " << parent().name() << "\tChild " << idName << " NameSpace "
84  << idNameSpace;
85 #endif
86 }

References angle_units::operators::convertRadToDeg(), PVValHelper::dx, PVValHelper::dz, mps_fire::i, versionedElectronIDProducer_cfi::idName, createfilelist::int, names, DDCurrentNamespace::ns(), hltrates_dqm_sourceclient-live_cfg::offset, class-composition::parent, and CosmicsPD_Skims::radius.

Member Data Documentation

◆ angwidth

double DDHCalXtalAlgo::angwidth
private

Definition at line 43 of file DDHCalXtalAlgo.cc.

◆ dx

double DDHCalXtalAlgo::dx
private

Definition at line 41 of file DDHCalXtalAlgo.cc.

◆ dz

double DDHCalXtalAlgo::dz
private

◆ iaxis

int DDHCalXtalAlgo::iaxis
private

Definition at line 44 of file DDHCalXtalAlgo.cc.

◆ idName

std::string DDHCalXtalAlgo::idName
private

Definition at line 48 of file DDHCalXtalAlgo.cc.

◆ idNameSpace

std::string DDHCalXtalAlgo::idNameSpace
private

Definition at line 47 of file DDHCalXtalAlgo.cc.

◆ names

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

Definition at line 45 of file DDHCalXtalAlgo.cc.

◆ offset

double DDHCalXtalAlgo::offset
private

Definition at line 40 of file DDHCalXtalAlgo.cc.

◆ radius

double DDHCalXtalAlgo::radius
private

Definition at line 39 of file DDHCalXtalAlgo.cc.

mps_fire.i
i
Definition: mps_fire.py:428
DDrot
DDRotation DDrot(const DDName &name, std::unique_ptr< DDRotationMatrix > rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:67
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
pos
Definition: PixelAliasList.h:18
DDHCalXtalAlgo::iaxis
int iaxis
Definition: DDHCalXtalAlgo.cc:44
DDHCalXtalAlgo::radius
double radius
Definition: DDHCalXtalAlgo.cc:39
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DDHCalXtalAlgo::offset
double offset
Definition: DDHCalXtalAlgo.cc:40
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDHCalXtalAlgo::names
std::vector< std::string > names
Definition: DDHCalXtalAlgo.cc:45
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
DDHCalXtalAlgo::idNameSpace
std::string idNameSpace
Definition: DDHCalXtalAlgo.cc:47
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
createfilelist.int
int
Definition: createfilelist.py:10
DDHCalXtalAlgo::angwidth
double angwidth
Definition: DDHCalXtalAlgo.cc:43
DDHCalXtalAlgo::dx
double dx
Definition: DDHCalXtalAlgo.cc:41
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDAxes::phi
DDHCalXtalAlgo::dz
double dz
Definition: DDHCalXtalAlgo.cc:42
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
DDCurrentNamespace::ns
static std::string & ns()
Definition: DDCurrentNamespace.cc:3
angle
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
DDRotation
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DDHCalXtalAlgo::idName
std::string idName
Definition: DDHCalXtalAlgo.cc:48
edm::Log
Definition: MessageLogger.h:70
class-composition.parent
parent
Definition: class-composition.py:98
DDCompactView::position
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
Definition: DDCompactView.cc:76