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 }
Log< level::Info, true > LogVerbatim

◆ ~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.

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().

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 }
Log< level::Info, true > LogVerbatim
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
std::vector< std::string > names
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
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:67
std::string idName
std::string idNameSpace
Geom::Theta< T > theta() const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11

◆ 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.

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.

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 }
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
static std::string & ns()
std::vector< std::string > names
std::string idName
std::string idNameSpace

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.