14 #include "CLHEP/Units/GlobalPhysicalConstants.h" 15 #include "CLHEP/Units/GlobalSystemOfUnits.h" 19 LogDebug(
"TrackerGeom") <<
"DDCutTubsFromPoints info: Creating an instance";
30 r_min = nArgs[
"rMin"];
31 r_max = nArgs[
"rMax"];
32 z_pos = nArgs[
"zPos"];
35 auto phis_name =
DDName(sArgs[
"Phi"]);
36 auto z_ls_name =
DDName(sArgs[
"z_l"]);
37 auto z_ts_name =
DDName(sArgs[
"z_t"]);
45 for (
unsigned i = 0;
i < phis.
size();
i++) {
55 LogDebug(
"TrackerGeom") <<
"DDCutTubsFromPoints debug: Parent " << parentName
56 <<
"\tSolid " << solidOutput <<
" NameSpace " 58 <<
"\tnumber of sections " <<
sections.size();
83 std::vector<DDSolid> segments;
84 std::vector<double> offsets;
88 if (s1.
phi !=
s2.phi) {
98 if (
s2.z_l < min_z) min_z =
s2.z_l;
99 if (
s2.z_t > max_z) max_z =
s2.z_t;
101 double P1_z_l = s1.
z_l;
102 double P1_z_t = s1.
z_t;
103 double P2_z_l =
s2.z_l;
104 double P2_z_t =
s2.z_t;
106 double P1_x_t =
cos(phi1) *
r;
107 double P1_x_l =
cos(phi1) *
r;
108 double P1_y_t =
sin(phi1) *
r;
109 double P1_y_l =
sin(phi1) *
r;
111 double P2_x_t =
cos(phi2) *
r;
112 double P2_x_l =
cos(phi2) *
r;
113 double P2_y_t =
sin(phi2) *
r;
114 double P2_y_l =
sin(phi2) *
r;
118 double P3_z_l = (P1_z_l + P2_z_l) / 2;
119 double P3_z_t = (P1_z_t + P2_z_t) / 2;
124 double dz = (P3_z_t - P3_z_l) / 2;
125 double offset = (P3_z_t + P3_z_l) / 2;
129 double D1_z_l = P1_z_l - P3_z_l;
130 double D2_z_l = P2_z_l - P3_z_l;
133 double n_x_l = (P1_y_l * D2_z_l) - (D1_z_l * P2_y_l);
134 double n_y_l = (D1_z_l * P2_x_l) - (P1_x_l * D2_z_l);
135 double n_z_l = (P1_x_l * P2_y_l) - (P1_y_l * P2_x_l);
145 double D1_z_t = P1_z_t - P3_z_t;
146 double D2_z_t = P2_z_t - P3_z_t;
148 double n_x_t = (P1_y_t * D2_z_t) - (D1_z_t * P2_y_t);
149 double n_y_t = (D1_z_t * P2_x_t) - (P1_x_t * D2_z_t);
150 double n_z_t = (P1_x_t * P2_y_t) - (P1_y_t * P2_x_t);
158 double dphi = phi2 - phi1;
162 n_x_t, n_y_t, n_z_t);
163 segments.emplace_back(seg);
164 offsets.emplace_back(offset);
169 assert(segments.size() >= 2);
173 double shift = offsets[0];
175 for (
unsigned i = 1;
i < segments.size()-1;
i++) {
189 double offset = - shift + (min_z + (max_z-min_z)/2);
DDMaterial is used to define and access material information.
std::vector< Section > sections
Sin< T >::type sin(const T &t)
~DDCutTubsFromPoints() override
size_t size() const
the size of the array of values
const std::string & ns() const
Returns the namespace.
DDName is used to identify DDD entities uniquely.
static std::string & ns()
type of data representation of DDCompactView
A DDSolid represents the shape of a part.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Represents a uniquely identifyable rotation matrix.
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
static DDSolid cuttubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi, double lx, double ly, double lz, double tx, double ty, double tz)
Cos< T >::type cos(const T &t)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> ...
static double square(double x)
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
static unsigned int const shift
static DDSolid unionSolid(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
const std::string & name() const
Returns the name.
void execute(DDCompactView &cpv) override