CMS 3D CMS Logo

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

#include <DDHGCalWaferAlgo.h>

Inheritance diagram for DDHGCalWaferAlgo:

Public Member Functions

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

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 10 of file DDHGCalWaferAlgo.h.

Constructor & Destructor Documentation

DDHGCalWaferAlgo::DDHGCalWaferAlgo ( )

Definition at line 18 of file DDHGCalWaferAlgo.cc.

18  {
19 #ifdef EDM_ML_DEBUG
20  edm::LogInfo("HGCalGeom") << "DDHGCalWaferAlgo test: Creating an instance";
21 #endif
22 }
DDHGCalWaferAlgo::~DDHGCalWaferAlgo ( )
virtual

Definition at line 24 of file DDHGCalWaferAlgo.cc.

24 {}

Member Function Documentation

void DDHGCalWaferAlgo::execute ( DDCompactView cpv)

Definition at line 59 of file DDHGCalWaferAlgo.cc.

References angles, cellSize, cellType, childNames, filterCSVwithJSON::copy, DDrot(), detectorType, idNameSpace, relval_2017::k, mergeVDriftHistosByStation::name, parentName, DDCompactView::position(), positionX, positionY, idealTransformation::rotation, rotns, AlCaHLTBitMon_QueryRunRegistry::string, and funct::tan().

59  {
60 
61 #ifdef EDM_ML_DEBUG
62  edm::LogInfo("HGCalGeom") << "==>> Constructing DDHGCalWaferAlgo...";
63 #endif
64  double dx = 0.5*cellSize;
65  double dy = 0.5*dx*tan(30.0*CLHEP::deg);
66 
67  for (unsigned int k=0; k<positionX.size(); ++k) {
70  std::string rotstr("NULL");
71  if (angles[k] != 0) {
72  if (angles[k] >=0 && angles[k] < 100) rotstr = "R0";
73  else rotstr = "R";
74  rotstr = rotstr + std::to_string(angles[k]);
75  rotation = DDRotation(DDName(rotstr, rotns));
76  if (!rotation) {
77 #ifdef EDM_ML_DEBUG
78  edm::LogInfo("HGCalGeom") << "DDHGCalWaferAlgo: Creating new rotation "
79  << DDName(rotstr, rotns) << "\t90, "
80  << angles[k] << ", 90, " << (angles[k]+90)
81  << ", 0, 0";
82 #endif
83  rotation = DDrot(DDName(rotstr, rotns), 90*CLHEP::deg,
84  angles[k]*CLHEP::deg, 90*CLHEP::deg,
85  (90+angles[k])*CLHEP::deg, 0*CLHEP::deg, 0*CLHEP::deg);
86  }
87  }
88  double xpos = dx*positionX[k];
89  double ypos = dy*positionY[k];
90  DDTranslation tran(xpos, ypos, 0);
91  int copy = cellType*1000+k;
92  cpv.position(DDName(name,idNameSpace), parentName, copy, tran, rotation);
93 #ifdef EDM_ML_DEBUG
94  edm::LogInfo("HGCalGeom") << "DDHGCalWaferAlgo: "
95  << DDName(name,idNameSpace) << " number " << copy
96  << " positioned in " << parentName << " at "
97  << tran << " with " << rotation;
98 #endif
99  }
100 }
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:16
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
std::string idNameSpace
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::vector< int > positionX
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:90
std::vector< int > detectorType
std::vector< std::string > childNames
std::vector< int > positionY
std::vector< double > angles
void DDHGCalWaferAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)

Definition at line 26 of file DDHGCalWaferAlgo.cc.

References angles, cellSize, cellType, childNames, dbl_to_int(), detectorType, idNameSpace, relval_2017::k, DDCurrentNamespace::ns(), SpecificationBuilder_cfi::parent(), parentName, positionX, positionY, and rotns.

30  {
31 
32  cellSize = nArgs["CellSize"];
33  cellType = (int)(nArgs["CellType"]);
34  childNames = vsArgs["ChildNames"];
35  positionX = dbl_to_int(vArgs["PositionX"]);
36  positionY = dbl_to_int(vArgs["PositionY"]);
37  angles = vArgs["Angles"];
38  detectorType= dbl_to_int(vArgs["DetectorType"]);
39 #ifdef EDM_ML_DEBUG
40  edm::LogInfo("HGCalGeom") << childNames.size() << " children: "
41  << childNames[0] << "; " << childNames[1]
42  << " positioned " << positionX.size()
43  << " times with cell size " << cellSize;
44  for (unsigned int k=0; k<positionX.size(); ++k)
45  edm::LogInfo("HGCalGeom") << "[" << k << "] x " << positionX[k] << " y "
46  << positionY[k] << " angle " << angles[k]
47  << " detector " << detectorType[k];
48 #endif
49  rotns = sArgs["RotNameSpace"];
51  parentName = parent().name();
52 #ifdef EDM_ML_DEBUG
53  edm::LogInfo("HGCalGeom") << "DDHGCalWaferAlgo debug: Parent "
54  << parentName << " NameSpace " << idNameSpace
55  << " for Rotation " << rotns;
56 #endif
57 }
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 31 of file DDHGCalWaferAlgo.h.

Referenced by execute(), and initialize().

double DDHGCalWaferAlgo::cellSize
private

Definition at line 26 of file DDHGCalWaferAlgo.h.

Referenced by execute(), and initialize().

int DDHGCalWaferAlgo::cellType
private

Definition at line 27 of file DDHGCalWaferAlgo.h.

Referenced by execute(), and initialize().

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

Definition at line 28 of file DDHGCalWaferAlgo.h.

Referenced by execute(), and initialize().

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

Definition at line 32 of file DDHGCalWaferAlgo.h.

Referenced by execute(), and initialize().

std::string DDHGCalWaferAlgo::idName
private

Definition at line 33 of file DDHGCalWaferAlgo.h.

std::string DDHGCalWaferAlgo::idNameSpace
private

Definition at line 35 of file DDHGCalWaferAlgo.h.

Referenced by execute(), and initialize().

DDName DDHGCalWaferAlgo::parentName
private

Definition at line 36 of file DDHGCalWaferAlgo.h.

Referenced by execute(), and initialize().

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

Definition at line 29 of file DDHGCalWaferAlgo.h.

Referenced by execute(), and initialize().

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

Definition at line 30 of file DDHGCalWaferAlgo.h.

Referenced by execute(), and initialize().

std::string DDHGCalWaferAlgo::rotns
private

Definition at line 34 of file DDHGCalWaferAlgo.h.

Referenced by execute(), and initialize().