CMS 3D CMS Logo

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

Definition at line 24 of file DDHGCalWaferAlgo.cc.

24 {}

Member Function Documentation

void DDHGCalWaferAlgo::execute ( DDCompactView cpv)
override

Definition at line 57 of file DDHGCalWaferAlgo.cc.

References angles, cellSize, cellType, childNames, popcon2dropbox::copy(), gather_cfg::cout, DDrot(), detectorType, PVValHelper::dx, PVValHelper::dy, idNameSpace, gen::k, dataset::name, parentName, DDCompactView::position(), positionX, positionY, idealTransformation::rotation, rotns, AlCaHLTBitMon_QueryRunRegistry::string, and funct::tan().

57  {
58 
59 #ifdef EDM_ML_DEBUG
60  edm::LogInfo("HGCalGeom") << "==>> Constructing DDHGCalWaferAlgo...";
61 #endif
62  double dx = 0.5*cellSize;
63  double dy = 0.5*dx*tan(30.0*CLHEP::deg);
64 
65  for (unsigned int k=0; k<positionX.size(); ++k) {
68  std::string rotstr("NULL");
69  if (angles[k] != 0) {
70  if (angles[k] >=0 && angles[k] < 100) rotstr = "R0";
71  else rotstr = "R";
72  rotstr = rotstr + std::to_string(angles[k]);
73  rotation = DDRotation(DDName(rotstr, rotns));
74  if (!rotation) {
75 #ifdef EDM_ML_DEBUG
76  std::cout << "DDHGCalWaferAlgo: Creating new rotation "
77  << DDName(rotstr, rotns) << "\t90, " << angles[k] << ", 90, "
78  << (angles[k]+90) << ", 0, 0" << std::endl;
79 #endif
80  rotation = DDrot(DDName(rotstr, rotns), 90*CLHEP::deg,
81  angles[k]*CLHEP::deg, 90*CLHEP::deg,
82  (90+angles[k])*CLHEP::deg, 0*CLHEP::deg,0*CLHEP::deg);
83  }
84  }
85  double xpos = dx*positionX[k];
86  double ypos = dy*positionY[k];
87  DDTranslation tran(xpos, ypos, 0);
88  int copy = cellType*1000+k;
89  cpv.position(DDName(name,idNameSpace), parentName, copy, tran, rotation);
90 #ifdef EDM_ML_DEBUG
91  std::cout << "DDHGCalWaferAlgo: " << DDName(name,idNameSpace) << " number "
92  << copy << " positioned in " << parentName << " at " << tran
93  << " with " << rotation << std::endl;
94 #endif
95  }
96 }
def copy(args, dbName)
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:68
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:80
std::vector< int > detectorType
int k[5][pyjets_maxn]
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
void DDHGCalWaferAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 26 of file DDHGCalWaferAlgo.cc.

References angles, cellSize, cellType, childNames, gather_cfg::cout, dbl_to_int(), detectorType, idNameSpace, createfilelist::int, gen::k, DDCurrentNamespace::ns(), class-composition::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  std::cout << childNames.size() << " children: " << childNames[0] << "; "
41  << childNames[1] << " positioned " << positionX.size()
42  << " times with cell size " << cellSize << std::endl;
43  for (unsigned int k=0; k<positionX.size(); ++k)
44  std::cout << "[" << k << "] x " << positionX[k] << " y " << positionY[k]
45  << " angle " << angles[k] << " detector " << detectorType[k]
46  << std::endl;
47 #endif
48  rotns = sArgs["RotNameSpace"];
50  parentName = parent().name();
51 #ifdef EDM_ML_DEBUG
52  std::cout << "DDHGCalWaferAlgo debug: Parent " << parentName << " NameSpace "
53  << idNameSpace << " for Rotation " << rotns << std::endl;
54 #endif
55 }
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
int k[5][pyjets_maxn]
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().