Warning, file /DD4hep/examples/DDCMS/src/plugins/DDTrackerPhiAltAlgo.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 Volume mother = ns.volume(args.parentName());
0034 Volume child = ns.volume(args.childName());
0035 double tilt = args.value<double>("Tilt");
0036 double startAngle = args.value<double>("StartAngle");
0037 double rangeAngle = args.value<double>("RangeAngle");
0038 double radiusIn = args.value<double>("RadiusIn");
0039 double radiusOut = args.value<double>("RadiusOut");
0040 double zpos = args.value<double>("ZPosition");
0041 int number = args.value<int>("Number");
0042 int startCopyNo = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1;
0043 int incrCopyNo = args.find("IncrCopyNo") ? args.value<int>("IncrCopyNo") : 1;
0044
0045 LogDebug("TrackerGeom") << "Parent " << mother.name() << "\tChild " << child.name() << " NameSpace " << ns.name;
0046 LogDebug("TrackerGeom") << "Parameters for positioning-- Tilt " << tilt
0047 << "\tStartAngle " << startAngle/CLHEP::deg
0048 << "\tRangeAngle " << rangeAngle/CLHEP::deg
0049 << "\tRin " << radiusIn << "\tRout " << radiusOut
0050 << "\t ZPos " << zpos << "\tCopy Numbers " << number
0051 << " Start/Increment " << startCopyNo << ", "
0052 << incrCopyNo;
0053
0054 if (number > 0) {
0055 double theta = 90.*CLHEP::deg;
0056 double dphi;
0057 if (number == 1 || fabs(rangeAngle-360.0*CLHEP::deg)<0.001*CLHEP::deg)
0058 dphi = rangeAngle/number;
0059 else
0060 dphi = rangeAngle/(number-1);
0061 int copyNo = startCopyNo;
0062
0063 for (int i=0; i<number; i++) {
0064 double phi = startAngle + i*dphi;
0065 double phix = phi - tilt + 90.*CLHEP::deg;
0066 double phiy = phix + 90.*CLHEP::deg;
0067 double phideg = phix/CLHEP::deg;
0068
0069 Rotation3D rotation;
0070 if (phideg != 0) {
0071 rotation = make_rotation3D(theta, phix, theta, phiy, 0., 0.);
0072 }
0073
0074 double xpos, ypos;
0075 if (i%2 == 0) {
0076 xpos = radiusIn*cos(phi);
0077 ypos = radiusIn*sin(phi);
0078 } else {
0079 xpos = radiusOut*cos(phi);
0080 ypos = radiusOut*sin(phi);
0081 }
0082 Position tran(xpos, ypos, zpos);
0083 mother.placeVolume(child,copyNo,Transform3D(rotation,tran));
0084 LogDebug("TrackerGeom") << "" << child.name()
0085 << " number " << copyNo << " positioned in "
0086 << mother.name() << " at " << tran << " with "
0087 << rotation;
0088 copyNo += incrCopyNo;
0089 }
0090 }
0091 return 1;
0092 }
0093
0094
0095 DECLARE_DDCMS_DETELEMENT(DDCMS_track_DDTrackerPhiAltAlgo,algorithm)
0096