CMS 3D CMS Logo

Functions
DDTrackerXYZPosAlgo.cc File Reference
#include "DD4hep/DetFactoryHelper.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

Go to the source code of this file.

Functions

static long algorithm (Detector &, cms::DDParsingContext &ctxt, xml_h e)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_track_DDTrackerXYZPosAlgo)
 

Function Documentation

◆ algorithm()

static long algorithm ( Detector &  ,
cms::DDParsingContext ctxt,
xml_h  e 
)
static

Definition at line 9 of file DDTrackerXYZPosAlgo.cc.

9  {
10  cms::DDNamespace ns(ctxt, e, true);
11  DDAlgoArguments args(ctxt, e);
12  int startCopyNo = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1;
13  int incrCopyNo = args.find("IncrCopyNo") ? args.value<int>("IncrCopyNo") : 1;
14  Volume mother = ns.volume(args.parentName());
15  Volume child = ns.volume(args.value<string>("ChildName"));
16  vector<double> xvec = args.value<vector<double> >("XPositions"); // X positions
17  vector<double> yvec = args.value<vector<double> >("YPositions"); // Y positions
18  vector<double> zvec = args.value<vector<double> >("ZPositions"); // Z positions
19  vector<string> rotMat = args.value<vector<string> >("Rotations"); // Names of rotation matrices
20 
21  LogDebug("TrackerGeom") << "debug: Parent " << mother.name() << "\tChild " << child.name() << " NameSpace "
22  << ns.name() << "\tCopyNo (Start/Increment) " << startCopyNo << ", " << incrCopyNo
23  << "\tNumber " << xvec.size() << ", " << yvec.size() << ", " << zvec.size();
24  for (int i = 0; i < (int)(zvec.size()); i++) {
25  LogDebug("TrackerGeom") << "\t[" << i << "]\tX = " << xvec[i] << "\t[" << i << "]\tY = " << yvec[i] << "\t[" << i
26  << "]\tZ = " << zvec[i] << ", Rot.Matrix = " << rotMat[i];
27  }
28 
29  for (int i = 0, copy = startCopyNo; i < (int)(zvec.size()); i++, copy += incrCopyNo) {
30  Position tran(xvec[i], yvec[i], zvec[i]);
31  Rotation3D rot;
32  /* PlacedVolume pv = */ rotMat[i] != "NULL"
33  ? mother.placeVolume(child, copy, Transform3D(ns.rotation(rotMat[i]), tran))
34  : mother.placeVolume(child, tran);
35  LogDebug("TrackerGeom") << "test: " << child.name() << " number " << copy << " positioned in " << mother.name()
36  << " at " << tran << " with " << rot;
37  }
38  return 1;
39 }

References writedatasetfile::args, filterCSVwithJSON::copy, MillePedeFileConverter_cfg::e, mps_fire::i, createfilelist::int, LogDebug, cms::DDNamespace::name(), PixelTestBeamValidation_cfi::Position, makeMuonMisalignmentScenario::rot, cms::DDNamespace::rotation(), and cms::DDNamespace::volume().

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_track_DDTrackerXYZPosAlgo   
)

Definition at line 42 of file DDTrackerXYZPosAlgo.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
mps_fire.i
i
Definition: mps_fire.py:428
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
cms::DDNamespace
Definition: DDNamespace.h:16
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:75
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:47
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
createfilelist.int
int
Definition: createfilelist.py:10
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
child
Definition: simpleInheritance.h:11
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37