15 #include "CLHEP/Units/GlobalPhysicalConstants.h" 16 #include "CLHEP/Units/GlobalSystemOfUnits.h" 95 startCopyNo =
int(nArgs[
"StartCopyNo"]);
96 incrCopyNo =
int(nArgs[
"IncrCopyNo"]);
97 rangeAngle = nArgs[
"RangeAngle"];
98 startAngle = nArgs[
"StartAngle"];
100 center = vArgs[
"Center"];
101 isZPlus =
bool(nArgs[
"IsZPlus"]);
102 tiltAngle = nArgs[
"TiltAngle"];
103 isFlipped =
bool(nArgs[
"IsFlipped"]);
105 if (fabs(rangeAngle - 360.0 * CLHEP::deg) < 0.001 * CLHEP::deg) {
106 delta = rangeAngle / double(
n);
109 delta = rangeAngle / double(
n - 1);
115 LogDebug(
"TrackerGeom") <<
"DDTrackerRingAlgo debug: Parameters for position" 116 <<
"ing:: n " <<
n <<
" Start, Range, Delta " << startAngle / CLHEP::deg <<
" " 117 << rangeAngle / CLHEP::deg <<
" " <<
delta / CLHEP::deg <<
" Radius " <<
radius <<
" Centre " 118 << center[0] <<
", " << center[1] <<
", " << center[2];
121 childName = sArgs[
"ChildName"];
124 LogDebug(
"TrackerGeom") <<
"DDTrackerRingAlgo debug: Parent " << parentName <<
"\tChild " << childName
125 <<
" NameSpace " << idNameSpace;
129 DDRotation flipRot, tiltRot, phiRot, globalRot;
131 string rotstr =
"RTrackerRingAlgo";
135 string flipRotstr = rotstr +
"Flip";
138 LogDebug(
"TrackerGeom") <<
"DDTrackerRingAlgo test: Creating a new rotation: " << flipRotstr <<
"\t90., 180., " 149 flipMatrix = flipRot.
matrix();
153 string tiltRotstr = rotstr +
"Tilt" +
to_string(tiltAngle / CLHEP::deg) +
"ZPlus";
156 LogDebug(
"TrackerGeom") <<
"DDTrackerRingAlgo test: Creating a new rotation: " << tiltRotstr <<
"\t90., 90., " 157 << tiltAngle / CLHEP::deg <<
", 180., " << 90. - tiltAngle / CLHEP::deg <<
", 0.";
163 90. * CLHEP::deg - tiltAngle,
166 tiltMatrix = tiltRot.
matrix();
168 tiltMatrix *= flipMatrix;
171 string tiltRotstr = rotstr +
"Tilt" +
to_string(tiltAngle / CLHEP::deg) +
"ZMinus";
174 LogDebug(
"TrackerGeom") <<
"DDTrackerRingAlgo test: Creating a new rotation: " << tiltRotstr <<
"\t90., 90., " 175 << tiltAngle / CLHEP::deg <<
", 0., " << 90. + tiltAngle / CLHEP::deg <<
", 0.";
181 90. * CLHEP::deg + tiltAngle,
184 tiltMatrix = tiltRot.
matrix();
186 tiltMatrix *= flipMatrix;
193 double theta = 90. * CLHEP::deg;
194 int copy = startCopyNo;
195 double phi = startAngle;
197 for (
int i = 0;
i <
n;
i++) {
200 double phiy = phix + 90. * CLHEP::deg;
201 double phideg = phix / CLHEP::deg;
203 string phiRotstr = rotstr +
"Phi" +
to_string(phideg * 10.);
206 LogDebug(
"TrackerGeom") <<
"DDTrackerRingAlgo test: Creating a new rotation: " << phiRotstr <<
"\t90., " 207 << phix / CLHEP::deg <<
", 90.," << phiy / CLHEP::deg <<
", 0., 0.";
210 phiRotMatrix = phiRot.
matrix();
214 string globalRotstr = rotstr +
"Phi" +
to_string(phideg * 10.) +
"Tilt" +
to_string(tiltAngle / CLHEP::deg);
216 globalRotstr +=
"ZPlus";
218 globalRotstr +=
"Flip";
221 globalRotstr +=
"ZMinus";
223 globalRotstr +=
"Flip";
228 LogDebug(
"TrackerGeom") <<
"DDTrackerRingAlgo test: Creating a new " 229 <<
"rotation: " << globalRotstr;
230 globalRotMatrix = phiRotMatrix * tiltMatrix;
231 globalRot =
DDrot(
DDName(globalRotstr, idNameSpace), make_unique<DDRotationMatrix>(globalRotMatrix));
235 double xpos =
radius *
cos(phi) + center[0];
236 double ypos =
radius *
sin(phi) + center[1];
237 double zpos = center[2];
242 LogDebug(
"TrackerGeom") <<
"DDTrackerRingAlgo test " <<
child <<
" number " <<
copy <<
" positioned in " << mother
243 <<
" at " << tran <<
" with " << globalRot;
static AlgebraicMatrix initialize()
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
Sin< T >::type sin(const T &t)
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
DDName is used to identify DDD entities uniquely.
std::string to_string(const V &value)
static std::string & ns()
Compact representation of the geometrical detector hierarchy.
Represents a uniquely identifyable rotation matrix.
U second(std::pair< T, U > const &p)
void execute(DDCompactView &cpv) override
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
Cos< T >::type cos(const T &t)
~DDTrackerRingAlgo() override
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
Geom::Theta< T > theta() const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
DDRotationMatrix & matrix()