CMS 3D CMS Logo

DDTrackerLinear.cc
Go to the documentation of this file.
1 // File: DDTrackerLinear.cc
3 // Description: Position n copies at given intervals along an axis
5 
12 #include "CLHEP/Units/GlobalPhysicalConstants.h"
13 #include "CLHEP/Units/GlobalSystemOfUnits.h"
14 
15 #include <string>
16 #include <vector>
17 
18 using namespace std;
19 
20 class DDTrackerLinear : public DDAlgorithm {
21 public:
22  //Constructor and Destructor
24  ~DDTrackerLinear() override;
25 
26  void initialize(const DDNumericArguments& nArgs,
27  const DDVectorArguments& vArgs,
28  const DDMapArguments& mArgs,
29  const DDStringArguments& sArgs,
30  const DDStringVectorArguments& vsArgs) override;
31 
32  void execute(DDCompactView& cpv) override;
33 
34 private:
35  string idNameSpace; //Namespace of this and ALL sub-parts
36  string childName; //Child name
37  int number; //Number of positioning
38  int startcn; //Start copy no index
39  int incrcn; //Increment of copy no.
40  double theta; //Direction of translation
41  double phi; // ......
42  double offset; //Offset along (theta,phi) direction
43  double delta; //Increment ................
44  vector<double> centre; //Centre
45  string rotMat; //Rotation matrix
46 };
47 
48 DDTrackerLinear::DDTrackerLinear() : startcn(1), incrcn(1) {
49  LogDebug("TrackerGeom") << "DDTrackerLinear info: Creating an instance";
50 }
51 
53 
55  const DDVectorArguments& vArgs,
56  const DDMapArguments&,
57  const DDStringArguments& sArgs,
58  const DDStringVectorArguments&) {
59  number = int(nArgs["Number"]);
60  theta = nArgs["Theta"];
61  phi = nArgs["Phi"];
62  offset = nArgs["Offset"];
63  delta = nArgs["Delta"];
64  centre = vArgs["Center"];
65  rotMat = sArgs["Rotation"];
66  if (nArgs.find("StartCopyNo") != nArgs.end()) {
67  startcn = size_t(nArgs["StartCopyNo"]);
68  } else {
69  startcn = 1;
70  }
71  if (nArgs.find("IncrCopyNo") != nArgs.end()) {
72  incrcn = int(nArgs["IncrCopyNo"]);
73  } else {
74  incrcn = 1;
75  }
76 
78  childName = sArgs["ChildName"];
79  DDName parentName = parent().name();
80  LogDebug("TrackerGeom") << "DDTrackerLinear debug: Parent " << parentName << "\tChild " << childName << " NameSpace "
81  << idNameSpace << "\tNumber " << number << "\tAxis (theta/phi) " << theta / CLHEP::deg << ", "
82  << phi / CLHEP::deg << "\t(Offset/Delta) " << offset << ", " << delta << "\tCentre "
83  << centre[0] << ", " << centre[1] << ", " << centre[2] << "\tRotation " << rotMat;
84 }
85 
87  DDName mother = parent().name();
89  DDTranslation direction(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta));
91  string rotstr = DDSplit(rotMat).first;
93  if (rotstr != "NULL") {
94  string rotns = DDSplit(rotMat).second;
95  rot = DDRotation(DDName(rotstr, rotns));
96  }
97  int ci = startcn;
98  for (int i = 0; i < number; i++) {
99  DDTranslation tran = base + (offset + double(i) * delta) * direction;
100  cpv.position(child, mother, ci, tran, rot);
101  LogDebug("TrackerGeom") << "DDTrackerLinear test: " << child << " number " << ci << " positioned in " << mother
102  << " at " << tran << " with " << rot;
103  ++ci;
104  }
105 }
106 
107 DEFINE_EDM_PLUGIN(DDAlgorithmFactory, DDTrackerLinear, "track:DDTrackerLinear");
DDTrackerLinear::~DDTrackerLinear
~DDTrackerLinear() override
Definition: DDTrackerLinear.cc:52
DDCurrentNamespace.h
mps_fire.i
i
Definition: mps_fire.py:428
DDTrackerLinear::offset
double offset
Definition: DDTrackerLinear.cc:42
MessageLogger.h
DDTrackerLinear::execute
void execute(DDCompactView &cpv) override
Definition: DDTrackerLinear.cc:86
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
DDTrackerLinear::centre
vector< double > centre
Definition: DDTrackerLinear.cc:44
DDTrackerLinear::delta
double delta
Definition: DDTrackerLinear.cc:43
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDTrackerLinear::initialize
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
Definition: DDTrackerLinear.cc:54
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
DDTrackerLinear::startcn
int startcn
Definition: DDTrackerLinear.cc:38
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
DDTrackerLinear::number
int number
Definition: DDTrackerLinear.cc:37
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edmplugin::PluginFactory
Definition: PluginFactory.h:34
DDTypes.h
createfilelist.int
int
Definition: createfilelist.py:10
DDTrackerLinear
Definition: DDTrackerLinear.cc:20
DDTrackerLinear::incrcn
int incrcn
Definition: DDTrackerLinear.cc:39
DDTrackerLinear::rotMat
string rotMat
Definition: DDTrackerLinear.cc:45
ReadMapType< double >
DDAlgorithm.h
std
Definition: JetResolutionObject.h:76
submitPVValidationJobs.child
child
Definition: submitPVValidationJobs.py:119
DDCurrentNamespace::ns
static std::string & ns()
Definition: DDCurrentNamespace.cc:3
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
DDTrackerLinear::DDTrackerLinear
DDTrackerLinear()
Definition: DDTrackerLinear.cc:48
DDRotation
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
initialize
static AlgebraicMatrix initialize()
Definition: BeamSpotTransientTrackingRecHit.cc:24
DDTrackerLinear::idNameSpace
string idNameSpace
Definition: DDTrackerLinear.cc:35
child
Definition: simpleInheritance.h:11
newFWLiteAna.base
base
Definition: newFWLiteAna.py:92
DDAlgorithmFactory.h
DDTrackerLinear::theta
double theta
Definition: DDTrackerLinear.cc:40
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
DDTrackerLinear::phi
double phi
Definition: DDTrackerLinear.cc:41
DDTrackerLinear::childName
string childName
Definition: DDTrackerLinear.cc:36