Warning, file /DD4hep/examples/DDCMS/src/plugins/DDTECCoolAlgo.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 "DD4hep/Printout.h"
0021 #include "DDCMS/DDCMSPlugins.h"
0022
0023
0024 #include <sstream>
0025
0026 using namespace std;
0027 using namespace dd4hep;
0028 using namespace dd4hep::cms;
0029
0030 static long algorithm(Detector& ,
0031 ParsingContext& ctxt,
0032 xml_h e,
0033 SensitiveDetector& )
0034 {
0035 Namespace ns(ctxt,e,true);
0036 AlgoArguments args(ctxt, e);
0037 int startCopyNo = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1;
0038 double rPosition = args.value<double>("RPosition");
0039 vector<double> phiPosition = args.value<vector<double> >("PhiPosition");
0040 vector<string> coolInsert = args.value<vector<string> >("CoolInsert");
0041 Volume mother = ns.volume(args.parentName());
0042
0043 LogDebug("TECGeom") << "debug: Parent " << mother.name()
0044 <<" NameSpace " << ns.name << " at radial Position " << rPosition;
0045 if (phiPosition.size() == coolInsert.size()) {
0046 for (int i=0; i<(int)(phiPosition.size()); i++) {
0047 LogDebug("TECGeom") << "debug: Insert[" << i << "]: "
0048 << coolInsert.at(i) << " at Phi "
0049 << phiPosition.at(i)/CLHEP::deg;
0050 }
0051 }
0052 else {
0053 LogDebug("TECGeom") << "ERROR: Number of inserts does not match the numer of PhiPositions!";
0054 }
0055
0056 int copyNo = startCopyNo;
0057
0058 for (int i = 0; i < (int)(coolInsert.size()); i++) {
0059 Volume child = ns.volume(ns.real_name(coolInsert.at(i)));
0060
0061 double xpos = rPosition*cos(phiPosition.at(i));
0062 double ypos = -rPosition*sin(phiPosition.at(i));
0063
0064 Position tran(xpos, ypos, 0.0);
0065 mother.placeVolume(child, copyNo, tran);
0066 LogDebug("TECGeom") << "test " << child.name() << "["
0067 << copyNo << "] positioned in " << mother.name()
0068 << " at " << tran
0069 << " phi " << phiPosition.at(i)/CLHEP::deg << " r "
0070 << rPosition;
0071 copyNo++;
0072 }
0073 LogDebug("TECGeom") << "Finished....";
0074 return 1;
0075 }
0076
0077
0078 DECLARE_DDCMS_DETELEMENT(DDCMS_track_DDTECCoolAlgo,algorithm)
0079