CMS 3D CMS Logo

DDTrackerXYZPosAlgo.cc
Go to the documentation of this file.
1 // File: DDTrackerXYZPosAlgo.cc
3 // Description: Position n copies at given x-values, y-values and z-values
5 
12 
13 #include <string>
14 #include <vector>
15 
16 using namespace std;
17 
18 class DDTrackerXYZPosAlgo : public DDAlgorithm {
19 public:
20  //Constructor and Destructor
22  ~DDTrackerXYZPosAlgo() override;
23 
24  void initialize(const DDNumericArguments& nArgs,
25  const DDVectorArguments& vArgs,
26  const DDMapArguments& mArgs,
27  const DDStringArguments& sArgs,
28  const DDStringVectorArguments& vsArgs) override;
29 
30  void execute(DDCompactView& cpv) override;
31 
32 private:
33  vector<double> xvec; //X positions
34  vector<double> yvec; //Y positions
35  vector<double> zvec; //Z positions
36  vector<string> rotMat; //Names of rotation matrices
37 
38  string idNameSpace; //Namespace of this and ALL sub-parts
39  string childName; //Child name
40  int startCopyNo; //Start Copy number
41  int incrCopyNo; //Increment in Copy number
42 };
43 
45  LogDebug("TrackerGeom") << "DDTrackerXYZPosAlgo info: Creating an instance";
46 }
47 
49 
51  const DDVectorArguments& vArgs,
52  const DDMapArguments&,
53  const DDStringArguments& sArgs,
54  const DDStringVectorArguments& vsArgs) {
55  startCopyNo = int(nArgs["StartCopyNo"]);
56  incrCopyNo = int(nArgs["IncrCopyNo"]);
57  xvec = vArgs["XPositions"];
58  yvec = vArgs["YPositions"];
59  zvec = vArgs["ZPositions"];
60  rotMat = vsArgs["Rotations"];
61 
62  idNameSpace = DDCurrentNamespace::ns();
63  childName = sArgs["ChildName"];
64  DDName parentName = parent().name();
65  LogDebug("TrackerGeom") << "DDTrackerXYZPosAlgo debug: Parent " << parentName << "\tChild " << childName
66  << " NameSpace " << idNameSpace << "\tCopyNo (Start/Increment) " << startCopyNo << ", "
67  << incrCopyNo << "\tNumber " << xvec.size() << ", " << yvec.size() << ", " << zvec.size();
68  for (int i = 0; i < (int)(zvec.size()); i++) {
69  LogDebug("TrackerGeom") << "\t[" << i << "]\tX = " << xvec[i] << "\t[" << i << "]\tY = " << yvec[i] << "\t[" << i
70  << "]\tZ = " << zvec[i] << ", Rot.Matrix = " << rotMat[i];
71  }
72 }
73 
75  int copy = startCopyNo;
76  DDName mother = parent().name();
77  DDName child(DDSplit(childName).first, DDSplit(childName).second);
78 
79  for (int i = 0; i < (int)(zvec.size()); i++) {
80  DDTranslation tran(xvec[i], yvec[i], zvec[i]);
81  string rotstr = DDSplit(rotMat[i]).first;
83  if (rotstr != "NULL") {
84  string rotns = DDSplit(rotMat[i]).second;
85  rot = DDRotation(DDName(rotstr, rotns));
86  }
87  cpv.position(child, mother, copy, tran, rot);
88  LogDebug("TrackerGeom") << "DDTrackerXYZPosAlgo test: " << child << " number " << copy << " positioned in "
89  << mother << " at " << tran << " with " << rot;
90  copy += incrCopyNo;
91  }
92 }
93 
94 DEFINE_EDM_PLUGIN(DDAlgorithmFactory, DDTrackerXYZPosAlgo, "track:DDTrackerXYZPosAlgo");
DDCurrentNamespace.h
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
DDTrackerXYZPosAlgo::yvec
vector< double > yvec
Definition: DDTrackerXYZPosAlgo.cc:34
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
DDSplit.h
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
DDTrackerXYZPosAlgo::startCopyNo
int startCopyNo
Definition: DDTrackerXYZPosAlgo.cc:40
DDTrackerXYZPosAlgo::DDTrackerXYZPosAlgo
DDTrackerXYZPosAlgo()
Definition: DDTrackerXYZPosAlgo.cc:44
DDTrackerXYZPosAlgo::idNameSpace
string idNameSpace
Definition: DDTrackerXYZPosAlgo.cc:38
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
DDTrackerXYZPosAlgo::xvec
vector< double > xvec
Definition: DDTrackerXYZPosAlgo.cc:33
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edmplugin::PluginFactory
Definition: PluginFactory.h:34
DDTypes.h
DDTrackerXYZPosAlgo::initialize
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
Definition: DDTrackerXYZPosAlgo.cc:50
createfilelist.int
int
Definition: createfilelist.py:10
DDTrackerXYZPosAlgo::zvec
vector< double > zvec
Definition: DDTrackerXYZPosAlgo.cc:35
DDTrackerXYZPosAlgo
Definition: DDTrackerXYZPosAlgo.cc:18
DDTrackerXYZPosAlgo::incrCopyNo
int incrCopyNo
Definition: DDTrackerXYZPosAlgo.cc:41
ReadMapType< double >
DDAlgorithm.h
std
Definition: JetResolutionObject.h:76
submitPVValidationJobs.child
child
Definition: submitPVValidationJobs.py:119
DDTrackerXYZPosAlgo::rotMat
vector< string > rotMat
Definition: DDTrackerXYZPosAlgo.cc:36
DDCurrentNamespace::ns
static std::string & ns()
Definition: DDCurrentNamespace.cc:3
DDTrackerXYZPosAlgo::execute
void execute(DDCompactView &cpv) override
Definition: DDTrackerXYZPosAlgo.cc:74
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
DDTrackerXYZPosAlgo::~DDTrackerXYZPosAlgo
~DDTrackerXYZPosAlgo() override
Definition: DDTrackerXYZPosAlgo.cc:48
DDRotation
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
DDTrackerXYZPosAlgo::childName
string childName
Definition: DDTrackerXYZPosAlgo.cc:39
initialize
static AlgebraicMatrix initialize()
Definition: BeamSpotTransientTrackingRecHit.cc:24
child
Definition: simpleInheritance.h:11
DDAlgorithmFactory.h
class-composition.parent
parent
Definition: class-composition.py:88
DDSplit
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
Definition: DDSplit.cc:3
DDCompactView::position
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
Definition: DDCompactView.cc:76
DDRotation
ROOT::Math::Rotation3D DDRotation
Definition: DDEcalEndcapAlgo.cc:16