CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DDTrackerRingAlgo Class Reference
Inheritance diagram for DDTrackerRingAlgo:

Public Member Functions

 DDTrackerRingAlgo ()
 
void execute (DDCompactView &cpv) override
 
void initialize (const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
 
 ~DDTrackerRingAlgo () override
 

Private Attributes

vector< double > center
 
string childName
 
double delta
 
string idNameSpace
 
int incrCopyNo
 
bool isFlipped
 
bool isZPlus
 
int n
 
double radius
 
double rangeAngle
 
double startAngle
 
int startCopyNo
 
double tiltAngle
 

Detailed Description

Definition at line 54 of file DDTrackerRingAlgo.cc.

Constructor & Destructor Documentation

◆ DDTrackerRingAlgo()

DDTrackerRingAlgo::DDTrackerRingAlgo ( )

Definition at line 85 of file DDTrackerRingAlgo.cc.

References LogDebug.

85 { LogDebug("TrackerGeom") << "DDTrackerRingAlgo info: Creating an instance"; }
#define LogDebug(id)

◆ ~DDTrackerRingAlgo()

DDTrackerRingAlgo::~DDTrackerRingAlgo ( )
override

Definition at line 87 of file DDTrackerRingAlgo.cc.

87 {}

Member Function Documentation

◆ execute()

void DDTrackerRingAlgo::execute ( DDCompactView cpv)
override

Definition at line 128 of file DDTrackerRingAlgo.cc.

References submitPVValidationJobs::child, filterCSVwithJSON::copy, funct::cos(), DDrot(), DDSplit(), dumpMFGeometry_cfg::delta, dqmdumpme::first, mps_fire::i, LogDebug, DDRotation::matrix(), dqmiodumpmetadata::n, class-composition::parent, DDCompactView::position(), CosmicsPD_Skims::radius, edm::second(), funct::sin(), theta(), and cond::impl::to_string().

128  {
129  DDRotation flipRot, tiltRot, phiRot, globalRot; // Identity
130  DDRotationMatrix flipMatrix, tiltMatrix, phiRotMatrix, globalRotMatrix; // Identity matrix
131  string rotstr = "RTrackerRingAlgo";
132 
133  // flipMatrix calculus
134  if (isFlipped) {
135  string flipRotstr = rotstr + "Flip";
136  flipRot = DDRotation(DDName(flipRotstr, idNameSpace));
137  if (!flipRot) {
138  LogDebug("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " << flipRotstr << "\t90., 180., "
139  << "90., 90., "
140  << "180., 0.";
141  flipRot = DDrot(DDName(flipRotstr, idNameSpace),
142  90. * CLHEP::deg,
143  180. * CLHEP::deg,
144  90. * CLHEP::deg,
145  90. * CLHEP::deg,
146  180. * CLHEP::deg,
147  0.);
148  }
149  flipMatrix = flipRot.matrix();
150  }
151  // tiltMatrix calculus
152  if (isZPlus) {
153  string tiltRotstr = rotstr + "Tilt" + to_string(tiltAngle / CLHEP::deg) + "ZPlus";
154  tiltRot = DDRotation(DDName(tiltRotstr, idNameSpace));
155  if (!tiltRot) {
156  LogDebug("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " << tiltRotstr << "\t90., 90., "
157  << tiltAngle / CLHEP::deg << ", 180., " << 90. - tiltAngle / CLHEP::deg << ", 0.";
158  tiltRot = DDrot(DDName(tiltRotstr, idNameSpace),
159  90. * CLHEP::deg,
160  90. * CLHEP::deg,
161  tiltAngle,
162  180. * CLHEP::deg,
163  90. * CLHEP::deg - tiltAngle,
164  0.);
165  }
166  tiltMatrix = tiltRot.matrix();
167  if (isFlipped) {
168  tiltMatrix *= flipMatrix;
169  }
170  } else {
171  string tiltRotstr = rotstr + "Tilt" + to_string(tiltAngle / CLHEP::deg) + "ZMinus";
172  tiltRot = DDRotation(DDName(tiltRotstr, idNameSpace));
173  if (!tiltRot) {
174  LogDebug("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " << tiltRotstr << "\t90., 90., "
175  << tiltAngle / CLHEP::deg << ", 0., " << 90. + tiltAngle / CLHEP::deg << ", 0.";
176  tiltRot = DDrot(DDName(tiltRotstr, idNameSpace),
177  90. * CLHEP::deg,
178  90. * CLHEP::deg,
179  tiltAngle,
180  0.,
181  90. * CLHEP::deg + tiltAngle,
182  0.);
183  }
184  tiltMatrix = tiltRot.matrix();
185  if (isFlipped) {
186  tiltMatrix *= flipMatrix;
187  }
188  }
189 
190  // Loops for all phi values
191  DDName mother = parent().name();
193  double theta = 90. * CLHEP::deg;
194  int copy = startCopyNo;
195  double phi = startAngle;
196 
197  for (int i = 0; i < n; i++) {
198  // phiRotMatrix calculus
199  double phix = phi;
200  double phiy = phix + 90. * CLHEP::deg;
201  double phideg = phix / CLHEP::deg;
202  if (phideg != 0) {
203  string phiRotstr = rotstr + "Phi" + to_string(phideg * 10.);
204  phiRot = DDRotation(DDName(phiRotstr, idNameSpace));
205  if (!phiRot) {
206  LogDebug("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new rotation: " << phiRotstr << "\t90., "
207  << phix / CLHEP::deg << ", 90.," << phiy / CLHEP::deg << ", 0., 0.";
208  phiRot = DDrot(DDName(phiRotstr, idNameSpace), theta, phix, theta, phiy, 0., 0.);
209  }
210  phiRotMatrix = phiRot.matrix();
211  }
212 
213  // globalRot def
214  string globalRotstr = rotstr + "Phi" + to_string(phideg * 10.) + "Tilt" + to_string(tiltAngle / CLHEP::deg);
215  if (isZPlus) {
216  globalRotstr += "ZPlus";
217  if (isFlipped) {
218  globalRotstr += "Flip";
219  }
220  } else {
221  globalRotstr += "ZMinus";
222  if (isFlipped) {
223  globalRotstr += "Flip";
224  }
225  }
226  globalRot = DDRotation(DDName(globalRotstr, idNameSpace));
227  if (!globalRot) {
228  LogDebug("TrackerGeom") << "DDTrackerRingAlgo test: Creating a new "
229  << "rotation: " << globalRotstr;
230  globalRotMatrix = phiRotMatrix * tiltMatrix;
231  globalRot = DDrot(DDName(globalRotstr, idNameSpace), make_unique<DDRotationMatrix>(globalRotMatrix));
232  }
233 
234  // translation def
235  double xpos = radius * cos(phi) + center[0];
236  double ypos = radius * sin(phi) + center[1];
237  double zpos = center[2];
238  DDTranslation tran(xpos, ypos, zpos);
239 
240  // Positions child with respect to parent
241  cpv.position(child, mother, copy, tran, globalRot);
242  LogDebug("TrackerGeom") << "DDTrackerRingAlgo test " << child << " number " << copy << " positioned in " << mother
243  << " at " << tran << " with " << globalRot;
244 
245  copy += incrCopyNo;
246  phi += delta;
247  }
248 }
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
vector< double > center
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
std::string to_string(const V &value)
Definition: OMSAccess.h:77
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
U second(std::pair< T, U > const &p)
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
DDRotation DDrot(const DDName &name, std::unique_ptr< DDRotationMatrix > rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:67
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
Geom::Theta< T > theta() const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDRotationMatrix & matrix()
Definition: DDTransform.h:85
#define LogDebug(id)

◆ initialize()

void DDTrackerRingAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 89 of file DDTrackerRingAlgo.cc.

References electrons_cff::bool, dumpMFGeometry_cfg::delta, createfilelist::int, LogDebug, dqmiodumpmetadata::n, DDCurrentNamespace::ns(), class-composition::parent, and CosmicsPD_Skims::radius.

93  {
94  n = int(nArgs["N"]);
95  startCopyNo = int(nArgs["StartCopyNo"]);
96  incrCopyNo = int(nArgs["IncrCopyNo"]);
97  rangeAngle = nArgs["RangeAngle"];
98  startAngle = nArgs["StartAngle"];
99  radius = nArgs["Radius"];
100  center = vArgs["Center"];
101  isZPlus = bool(nArgs["IsZPlus"]);
102  tiltAngle = nArgs["TiltAngle"];
103  isFlipped = bool(nArgs["IsFlipped"]);
104 
105  if (fabs(rangeAngle - 360.0 * CLHEP::deg) < 0.001 * CLHEP::deg) {
106  delta = rangeAngle / double(n);
107  } else {
108  if (n > 1) {
109  delta = rangeAngle / double(n - 1);
110  } else {
111  delta = 0.;
112  }
113  }
114 
115  LogDebug("TrackerGeom") << "DDTrackerRingAlgo debug: Parameters for position"
116  << "ing:: n " << n << " Start, Range, Delta " << startAngle / CLHEP::deg << " "
117  << rangeAngle / CLHEP::deg << " " << delta / CLHEP::deg << " Radius " << radius << " Centre "
118  << center[0] << ", " << center[1] << ", " << center[2];
119 
121  childName = sArgs["ChildName"];
122 
123  DDName parentName = parent().name();
124  LogDebug("TrackerGeom") << "DDTrackerRingAlgo debug: Parent " << parentName << "\tChild " << childName
125  << " NameSpace " << idNameSpace;
126 }
vector< double > center
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
static std::string & ns()
#define LogDebug(id)

Member Data Documentation

◆ center

vector<double> DDTrackerRingAlgo::center
private

Definition at line 75 of file DDTrackerRingAlgo.cc.

◆ childName

string DDTrackerRingAlgo::childName
private

Definition at line 82 of file DDTrackerRingAlgo.cc.

◆ delta

double DDTrackerRingAlgo::delta
private

Definition at line 79 of file DDTrackerRingAlgo.cc.

◆ idNameSpace

string DDTrackerRingAlgo::idNameSpace
private

Definition at line 81 of file DDTrackerRingAlgo.cc.

◆ incrCopyNo

int DDTrackerRingAlgo::incrCopyNo
private

Definition at line 71 of file DDTrackerRingAlgo.cc.

◆ isFlipped

bool DDTrackerRingAlgo::isFlipped
private

Definition at line 78 of file DDTrackerRingAlgo.cc.

◆ isZPlus

bool DDTrackerRingAlgo::isZPlus
private

Definition at line 76 of file DDTrackerRingAlgo.cc.

◆ n

int DDTrackerRingAlgo::n
private

Definition at line 69 of file DDTrackerRingAlgo.cc.

◆ radius

double DDTrackerRingAlgo::radius
private

Definition at line 74 of file DDTrackerRingAlgo.cc.

◆ rangeAngle

double DDTrackerRingAlgo::rangeAngle
private

Definition at line 72 of file DDTrackerRingAlgo.cc.

◆ startAngle

double DDTrackerRingAlgo::startAngle
private

Definition at line 73 of file DDTrackerRingAlgo.cc.

◆ startCopyNo

int DDTrackerRingAlgo::startCopyNo
private

Definition at line 70 of file DDTrackerRingAlgo.cc.

◆ tiltAngle

double DDTrackerRingAlgo::tiltAngle
private

Definition at line 77 of file DDTrackerRingAlgo.cc.