CMS 3D CMS Logo

DDBHMAngular.cc
Go to the documentation of this file.
1 // File: DDBHMAngular.cc
3 // Description: Position inside the mother according to phi
5 
6 #include <algorithm>
7 #include <cmath>
8 #include <map>
9 #include <string>
10 #include <vector>
11 
22 
23 using namespace geant_units::operators;
24 
25 //#define EDM_ML_DEBUG
26 
27 class DDBHMAngular : public DDAlgorithm {
28 public:
29  //Constructor and Destructor
30  DDBHMAngular();
31 
32  void initialize(const DDNumericArguments& nArgs,
33  const DDVectorArguments& vArgs,
34  const DDMapArguments& mArgs,
35  const DDStringArguments& sArgs,
36  const DDStringVectorArguments& vsArgs) override;
37 
38  void execute(DDCompactView& cpv) override;
39 
40 private:
41  int units; //Number of copies
42  double rr; //Radial position of the detectors
43  double dphi; //the distance in phi between the detectors
44 
45  std::string rotMat; //Name of the rotation matrix
46  std::string childName; //Children name
47 };
48 
49 DDBHMAngular::DDBHMAngular() { edm::LogVerbatim("ForwardGeom") << "DDBHMAngular test: Creating an instance"; }
50 
52  const DDVectorArguments&,
53  const DDMapArguments&,
54  const DDStringArguments& sArgs,
55  const DDStringVectorArguments&) {
56  units = int(nArgs["number"]);
57  rr = nArgs["radius"];
58  dphi = nArgs["deltaPhi"];
59 #ifdef EDM_ML_DEBUG
60  edm::LogVerbatim("ForwardGeom") << "DDBHMAngular debug: Parameters for positioning-- " << units
61  << " copies at radius " << convertMmToCm(rr) << " cm with delta(phi) "
62  << convertRadToDeg(dphi);
63 #endif
64  rotMat = sArgs["Rotation"];
65  childName = sArgs["ChildName"];
66 #ifdef EDM_ML_DEBUG
67  edm::LogVerbatim("ForwardGeom") << "DDBHMAngular debug: Parent " << parent().name() << "\tChild " << childName
68  << "\tRotation matrix " << rotMat;
69 #endif
70 }
71 
73  DDName child(DDSplit(childName).first, DDSplit(childName).second);
74  DDName parentName = parent().name();
75  std::string rotstr = DDSplit(rotMat).first;
77  if (rotstr != "NULL") {
78  std::string rotns = DDSplit(rotMat).second;
79  rot = DDRotation(DDName(rotstr, rotns));
80  }
81 
82  static const double fac1 = 0.5;
83  static const double fac2 = 1.5;
84  static const double fac3 = 14.5;
85  static const double fac4 = 15.5;
86  for (int jj = 0; jj < units; jj++) {
87  double driverX(0), driverY(0), driverZ(0);
88  if (jj < 16) {
89  driverX = rr * cos((jj + fac1) * dphi);
90  driverY = sqrt(rr * rr - driverX * driverX);
91  } else if (jj == 16) {
92  driverX = rr * cos(fac4 * dphi);
93  driverY = -sqrt(rr * rr - driverX * driverX);
94  } else if (jj == 17) {
95  driverX = rr * cos(fac3 * dphi);
96  driverY = -sqrt(rr * rr - driverX * driverX);
97  } else if (jj == 18) {
98  driverX = rr * cos(fac1 * dphi);
99  driverY = -sqrt(rr * rr - driverX * driverX);
100  } else if (jj == 19) {
101  driverX = rr * cos(fac2 * dphi);
102  driverY = -sqrt(rr * rr - driverX * driverX);
103  }
104  DDTranslation tran(driverX, driverY, driverZ);
105 
106  cpv.position(child, parentName, jj + 1, tran, rot);
107 #ifdef EDM_ML_DEBUG
108  edm::LogVerbatim("ForwardGeom") << "DDBHMAngular test: " << child << " number " << jj + 1 << " positioned in "
109  << parentName << " at " << tran << " with " << rot;
110 #endif
111  }
112 }
113 
114 DEFINE_EDM_PLUGIN(DDAlgorithmFactory, DDBHMAngular, "bhmalgo:DDBHMAngular");
PluginFactory.h
DDCurrentNamespace.h
MessageLogger.h
DDBHMAngular::initialize
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
Definition: DDBHMAngular.cc:51
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
findQualityFiles.rr
string rr
Definition: findQualityFiles.py:185
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
DDSplit.h
DDBHMAngular::rotMat
std::string rotMat
Definition: DDBHMAngular.cc:45
isotrackTrainRegressor.fac2
def fac2(jeta)
Definition: isotrackTrainRegressor.py:113
DDBHMAngular::units
int units
Definition: DDBHMAngular.cc:41
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
DDBHMAngular
Definition: DDBHMAngular.cc:27
geant_units::operators
Definition: GeantUnits.h:18
dqmdumpme.first
first
Definition: dqmdumpme.py:55
units
TString units(TString variable, Char_t axis)
DDBHMAngular::rr
double rr
Definition: DDBHMAngular.cc:42
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDBHMAngular::execute
void execute(DDCompactView &cpv) override
Definition: DDBHMAngular.cc:72
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GeantUnits.h
edmplugin::PluginFactory
Definition: PluginFactory.h:34
DDTypes.h
createfilelist.int
int
Definition: createfilelist.py:10
DDutils.h
edm::LogVerbatim
Definition: MessageLogger.h:297
DDLogicalPart.h
ReadMapType< double >
DDAlgorithm.h
DDBHMAngular::childName
std::string childName
Definition: DDBHMAngular.cc:46
DDBHMAngular::dphi
double dphi
Definition: DDBHMAngular.cc:43
findQualityFiles.jj
string jj
Definition: findQualityFiles.py:188
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
DDRotation
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:62
DDBHMAngular::DDBHMAngular
DDBHMAngular()
Definition: DDBHMAngular.cc:49
class-composition.child
child
Definition: class-composition.py:91
initialize
static AlgebraicMatrix initialize()
Definition: BeamSpotTransientTrackingRecHit.cc:24
child
Definition: simpleInheritance.h:11
DDAlgorithmFactory.h
class-composition.parent
parent
Definition: class-composition.py:88
DDSplit
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
Definition: DDSplit.cc:3
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:66
isotrackTrainRegressor.fac1
def fac1(jeta)
Definition: isotrackTrainRegressor.py:107
DDRotation
ROOT::Math::Rotation3D DDRotation
Definition: DDEcalEndcapAlgo.cc:18