CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DDHGCalWaferAlgo Class Reference
Inheritance diagram for DDHGCalWaferAlgo:

Public Member Functions

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

Private Attributes

std::vector< double > angles
 
double cellSize
 
int cellType
 
std::vector< std::string > childNames
 
std::vector< int > detectorType
 
std::string idName
 
std::string idNameSpace
 
DDName parentName
 
std::vector< int > positionX
 
std::vector< int > positionY
 
std::string rotns
 

Detailed Description

Definition at line 25 of file DDHGCalWaferAlgo.cc.

Constructor & Destructor Documentation

DDHGCalWaferAlgo::DDHGCalWaferAlgo ( )

Definition at line 52 of file DDHGCalWaferAlgo.cc.

52  {
53 #ifdef EDM_ML_DEBUG
54  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferAlgo: Creating an instance";
55 #endif
56 }
DDHGCalWaferAlgo::~DDHGCalWaferAlgo ( )
override

Definition at line 58 of file DDHGCalWaferAlgo.cc.

58 {}

Member Function Documentation

void DDHGCalWaferAlgo::execute ( DDCompactView cpv)
override

Definition at line 88 of file DDHGCalWaferAlgo.cc.

References particleFlowDisplacedVertex_cfi::angles, angle_units::operators::convertDegToRad(), filterCSVwithJSON::copy, DDrot(), DEFINE_EDM_PLUGIN, PVValHelper::dx, PVValHelper::dy, formatAsDegrees(), dqmdumpme::k, Skims_PA_cff::name, DDCompactView::position(), idealTransformation::rotation, AlCaHLTBitMon_QueryRunRegistry::string, and funct::tan().

88  {
89 #ifdef EDM_ML_DEBUG
90  edm::LogVerbatim("HGCalGeom") << "==>> Constructing DDHGCalWaferAlgo...";
91 #endif
92  double dx = 0.5 * cellSize;
93  double dy = 0.5 * dx * tan(30._deg);
94 
95  for (unsigned int k = 0; k < positionX.size(); ++k) {
98  std::string rotstr("NULL");
99  if (angles[k] != 0) {
100  double phi = convertDegToRad(angles[k]);
101  rotstr = "R" + formatAsDegrees(phi);
102  rotation = DDRotation(DDName(rotstr, rotns));
103  if (!rotation) {
104 #ifdef EDM_ML_DEBUG
105  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferAlgo: Creating new rotation " << DDName(rotstr, rotns) << "\t90, "
106  << angles[k] << ", 90, " << (angles[k] + 90) << ", 0, 0";
107 #endif
108  rotation = DDrot(DDName(rotstr, rotns), 90._deg, phi, 90._deg, (90._deg + phi), 0, 0);
109  }
110  }
111  double xpos = dx * positionX[k];
112  double ypos = dy * positionY[k];
113  DDTranslation tran(xpos, ypos, 0);
114  int copy = cellType * 1000 + k;
115  cpv.position(DDName(name, idNameSpace), parentName, copy, tran, rotation);
116 #ifdef EDM_ML_DEBUG
117  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferAlgo: " << DDName(name, idNameSpace) << " number " << copy
118  << " positioned in " << parentName << " at " << tran << " with " << rotation;
119 #endif
120  }
121 }
constexpr long double convertDegToRad(NumType degrees)
Definition: angle_units.h:27
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
std::string idNameSpace
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::vector< int > positionX
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 formatAsDegrees(double radianVal)
Definition: DDTypes.cc:68
std::vector< int > detectorType
std::vector< std::string > childNames
std::vector< int > positionY
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::vector< double > angles
ROOT::Math::Rotation3D DDRotation
void DDHGCalWaferAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 60 of file DDHGCalWaferAlgo.cc.

References particleFlowDisplacedVertex_cfi::angles, dbl_to_int(), createfilelist::int, dqmdumpme::k, DDCurrentNamespace::ns(), and class-composition::parent.

64  {
65  cellSize = nArgs["CellSize"];
66  cellType = (int)(nArgs["CellType"]);
67  childNames = vsArgs["ChildNames"];
68  positionX = dbl_to_int(vArgs["PositionX"]);
69  positionY = dbl_to_int(vArgs["PositionY"]);
70  angles = vArgs["Angles"];
71  detectorType = dbl_to_int(vArgs["DetectorType"]);
72 #ifdef EDM_ML_DEBUG
73  edm::LogVerbatim("HGCalGeom") << childNames.size() << " children: " << childNames[0] << "; " << childNames[1]
74  << " positioned " << positionX.size() << " times with cell size " << cellSize;
75  for (unsigned int k = 0; k < positionX.size(); ++k)
76  edm::LogVerbatim("HGCalGeom") << "[" << k << "] x " << positionX[k] << " y " << positionY[k] << " angle "
77  << angles[k] << " detector " << detectorType[k];
78 #endif
79  rotns = sArgs["RotNameSpace"];
81  parentName = parent().name();
82 #ifdef EDM_ML_DEBUG
83  edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferAlgo debug: Parent " << parentName << " NameSpace " << idNameSpace
84  << " for Rotation " << rotns;
85 #endif
86 }
static std::string & ns()
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
std::string idNameSpace
std::vector< int > positionX
std::vector< int > detectorType
std::vector< std::string > childNames
std::vector< int > positionY
std::vector< double > angles

Member Data Documentation

std::vector<double> DDHGCalWaferAlgo::angles
private

Definition at line 44 of file DDHGCalWaferAlgo.cc.

double DDHGCalWaferAlgo::cellSize
private

Definition at line 39 of file DDHGCalWaferAlgo.cc.

int DDHGCalWaferAlgo::cellType
private

Definition at line 40 of file DDHGCalWaferAlgo.cc.

std::vector<std::string> DDHGCalWaferAlgo::childNames
private

Definition at line 41 of file DDHGCalWaferAlgo.cc.

std::vector<int> DDHGCalWaferAlgo::detectorType
private

Definition at line 45 of file DDHGCalWaferAlgo.cc.

std::string DDHGCalWaferAlgo::idName
private

Definition at line 46 of file DDHGCalWaferAlgo.cc.

std::string DDHGCalWaferAlgo::idNameSpace
private

Definition at line 48 of file DDHGCalWaferAlgo.cc.

DDName DDHGCalWaferAlgo::parentName
private

Definition at line 49 of file DDHGCalWaferAlgo.cc.

std::vector<int> DDHGCalWaferAlgo::positionX
private

Definition at line 42 of file DDHGCalWaferAlgo.cc.

std::vector<int> DDHGCalWaferAlgo::positionY
private

Definition at line 43 of file DDHGCalWaferAlgo.cc.

std::string DDHGCalWaferAlgo::rotns
private

Definition at line 47 of file DDHGCalWaferAlgo.cc.