Warning, file /DD4hep/examples/DDCMS/src/plugins/DDTrackerLinear.cpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include "DD4hep/DetFactoryHelper.h"
0020 #include "DDCMS/DDCMSPlugins.h"
0021
0022 using namespace std;
0023 using namespace dd4hep;
0024 using namespace dd4hep::cms;
0025
0026 static long algorithm(Detector& ,
0027 ParsingContext& ctxt,
0028 xml_h e,
0029 SensitiveDetector& )
0030 {
0031 Namespace ns(ctxt, e, true);
0032 AlgoArguments args(ctxt, e);
0033 int startcn = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1;
0034 int incrcn = args.find("IncrCopyNo") ? args.value<int>("IncrCopyNo") : 1;
0035 int number = args.value<int>("Number");
0036 double theta = args.value<double>("Theta");
0037 double phi = args.value<double>("Phi");
0038 double offset = args.value<double>("Offset");
0039 double delta = args.value<double>("Delta");
0040 vector<double> centre = args.value<vector<double> >("Center");
0041 string rotMat = args.value<string>("Rotation");
0042 Volume mother = ns.volume(args.parentName());
0043 Volume child = ns.volume(args.value<string>("ChildName"));
0044
0045 LogDebug("TrackerGeom") << "+++ Executing Algorithm. rParent:" << mother.name();
0046 LogDebug("TrackerGeom") << "debug: Parent " << mother.name()
0047 << "\tChild " << child.name() << " NameSpace "
0048 << ns.name << "\tNumber " << number
0049 << "\tAxis (theta/phi) " << theta/dd4hep::deg << ", "
0050 << phi/dd4hep::deg << "\t(Offset/Delta) " << offset
0051 << ", " << delta << "\tCentre " << centre[0] << ", "
0052 << centre[1] << ", " << centre[2] << "\tRotation "
0053 << rotMat;
0054
0055 Position direction(sin(theta)*cos(phi),sin(theta)*sin(phi),cos(theta));
0056 Position base(centre[0],centre[1],centre[2]);
0057 RotationZYX rot;
0058 if ( !rotMat.empty() ) {
0059 rot = ns.rotation(rotMat);
0060 }
0061 for (int i=0, ci=startcn; i<number; i++, ci += incrcn) {
0062 Position tran = base + (offset + double(i)*delta)*direction;
0063
0064 rotMat.empty()
0065 ? mother.placeVolume(child,ci,Transform3D(rot,tran))
0066 : mother.placeVolume(child,ci,tran);
0067 LogDebug("TrackerGeom") << child.name() << " number "
0068 << ci << " positioned in " << mother.name() << " at "
0069 << tran << " with " << rot;
0070 }
0071 return 1;
0072 }
0073
0074
0075 DECLARE_DDCMS_DETELEMENT(DDCMS_track_DDTrackerLinear,algorithm)
0076