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