Warning, file /DD4hep/examples/DDCMS/src/plugins/DDTrackerXYZPosAlgo.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 startCopyNo = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1;
0034 int incrCopyNo = args.find("IncrCopyNo") ? args.value<int>("IncrCopyNo") : 1;
0035 Volume mother = ns.volume(args.parentName());
0036 Volume child = ns.volume(args.value<string>("ChildName"));
0037 vector<double> xvec = args.value<vector<double> >("XPositions");
0038 vector<double> yvec = args.value<vector<double> >("YPositions");
0039 vector<double> zvec = args.value<vector<double> >("ZPositions");
0040 vector<string> rotMat = args.value<vector<string> >("Rotations");
0041
0042 LogDebug("TrackerGeom") << "debug: Parent " << mother.name()
0043 << "\tChild " << child.name() << " NameSpace "
0044 << ns.name << "\tCopyNo (Start/Increment) "
0045 << startCopyNo << ", " << incrCopyNo << "\tNumber "
0046 << xvec.size() << ", " << yvec.size() << ", " << zvec.size();
0047 for (int i = 0; i < (int)(zvec.size()); i++) {
0048 LogDebug("TrackerGeom") << "\t[" << i << "]\tX = " << xvec[i]
0049 << "\t[" << i << "]\tY = " << yvec[i]
0050 << "\t[" << i << "]\tZ = " << zvec[i]
0051 << ", Rot.Matrix = " << rotMat[i];
0052 }
0053
0054 for (int i=0, copy = startCopyNo; i<(int)(zvec.size()); i++, copy += incrCopyNo) {
0055 Position tran(xvec[i], yvec[i], zvec[i]);
0056 Rotation3D rot;
0057 rotMat[i] != "NULL"
0058 ? mother.placeVolume(child,copy,Transform3D(ns.rotation(rotMat[i]),tran))
0059 : mother.placeVolume(child,tran);
0060 LogDebug("TrackerGeom") << "test: " << child.name()
0061 <<" number " << copy << " positioned in "
0062 << mother.name() << " at " << tran << " with " << rot;
0063 }
0064 return 1;
0065 }
0066
0067
0068 DECLARE_DDCMS_DETELEMENT(DDCMS_track_DDTrackerXYZPosAlgo,algorithm)