CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
DDTrackerIrregularRingAlgo Class Reference
Inheritance diagram for DDTrackerIrregularRingAlgo:

Public Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 54 of file DDTrackerIrregularRingAlgo.cc.

Constructor & Destructor Documentation

DDTrackerIrregularRingAlgo::DDTrackerIrregularRingAlgo ( )

Definition at line 87 of file DDTrackerIrregularRingAlgo.cc.

References LogDebug.

87  {
88  LogDebug("TrackerGeom") << "DDTrackerIrregularRingAlgo info: Creating an instance";
89 }
#define LogDebug(id)
DDTrackerIrregularRingAlgo::~DDTrackerIrregularRingAlgo ( )
overridedefault

Member Function Documentation

void DDTrackerIrregularRingAlgo::execute ( DDCompactView cpv)
override

Definition at line 125 of file DDTrackerIrregularRingAlgo.cc.

References submitPVValidationJobs::child, angle_units::operators::convertDegToRad(), angle_units::operators::convertRadToDeg(), filterCSVwithJSON::copy, funct::cos(), DDrot(), DDSplit(), first, mps_fire::i, LogDebug, DDRotation::matrix(), dqmiodumpmetadata::n, SpecificationBuilder_cfi::parent(), DDCompactView::position(), CosmicsPD_Skims::radius, edm::second(), funct::sin(), theta(), and cond::impl::to_string().

125  {
126  DDRotation flipRot, tiltRot, phiOwnAxisRot, phiRot, globalRot; // Identity
127  DDRotationMatrix flipMatrix, tiltMatrix, phiOwnAxisRotMatrix, phiRotMatrix, globalRotMatrix; // Identity matrix
128  string rotstr = "RTrackerRingAlgo";
129 
130  // flipMatrix calculus
131  if (isFlipped) {
132  string flipRotstr = rotstr + "Flip";
133  flipRot = DDRotation(DDName(flipRotstr, idNameSpace));
134  if (!flipRot) {
135  LogDebug("TrackerGeom") << "DDTrackerIrregularRingAlgo test: Creating a new rotation: " << flipRotstr
136  << "\t90., 180., "
137  << "90., 90., "
138  << "180., 0.";
139  flipRot = DDrot(DDName(flipRotstr, idNameSpace), 90._deg, 180._deg, 90._deg, 90._deg, 180._deg, 0.);
140  }
141  flipMatrix = flipRot.matrix();
142  }
143  // tiltMatrix calculus
144  if (isZPlus) {
145  string tiltRotstr = rotstr + "Tilt" + to_string(convertRadToDeg(tiltAngle)) + "ZPlus";
146  tiltRot = DDRotation(DDName(tiltRotstr, idNameSpace));
147  if (!tiltRot) {
148  LogDebug("TrackerGeom") << "DDTrackerIrregularRingAlgo test: Creating a new rotation: " << tiltRotstr
149  << "\t90., 90., " << convertRadToDeg(tiltAngle) << ", 180., "
150  << 90. - convertRadToDeg(tiltAngle) << ", 0.";
151  tiltRot = DDrot(DDName(tiltRotstr, idNameSpace), 90._deg, 90._deg, tiltAngle, 180._deg, 90._deg - tiltAngle, 0.);
152  }
153  tiltMatrix = tiltRot.matrix();
154  if (isFlipped) {
155  tiltMatrix *= flipMatrix;
156  }
157  } else {
158  string tiltRotstr = rotstr + "Tilt" + to_string(convertRadToDeg(tiltAngle)) + "ZMinus";
159  tiltRot = DDRotation(DDName(tiltRotstr, idNameSpace));
160  if (!tiltRot) {
161  LogDebug("TrackerGeom") << "DDTrackerIrregularRingAlgo test: Creating a new rotation: " << tiltRotstr
162  << "\t90., 90., " << convertRadToDeg(tiltAngle) << ", 0., "
163  << 90. + convertRadToDeg(tiltAngle) << ", 0.";
164  tiltRot = DDrot(DDName(tiltRotstr, idNameSpace), 90._deg, 90._deg, tiltAngle, 0., 90._deg + tiltAngle, 0.);
165  }
166  tiltMatrix = tiltRot.matrix();
167  if (isFlipped) {
168  tiltMatrix *= flipMatrix;
169  }
170  }
171 
172  // Loops for all phi values
173  DDName mother = parent().name();
175  double theta = 90._deg;
176  int copy = startCopyNo;
177  //double phi = startAngle;
178 
179  for (int i = 0; i < n; i++) {
180  // phiRotMatrix calculus
181  //double phix = phi;
182  //double phix_ownaxis = 0._deg;
183  double phix = convertDegToRad(phiAngles.at(i));
184  double phix_ownaxis = convertDegToRad(yawAngles.at(i));
185  radius = radiusValues.at(i);
186  double phiy = phix + 90._deg;
187  double phiy_ownaxis = phix_ownaxis + 90._deg;
188  double phideg = convertRadToDeg(phix);
189  double phideg_ownaxis = convertRadToDeg(phix_ownaxis);
190  if (phideg_ownaxis != 0) {
191  string phiOwnAxisRotstr = rotstr + "PhiOwnAxis" + to_string(phideg_ownaxis * 10.);
192  phiOwnAxisRot = DDRotation(DDName(phiOwnAxisRotstr, idNameSpace));
193  if (!phiOwnAxisRot) {
194  LogDebug("TrackerGeom") << "DDTrackerIrregularRingAlgo test: Creating a new rotation: " << phiOwnAxisRotstr
195  << "\t90., " << convertRadToDeg(phix_ownaxis) << ", 90.,"
196  << convertRadToDeg(phiy_ownaxis) << ", 0., 0.";
197  phiOwnAxisRot = DDrot(DDName(phiOwnAxisRotstr, idNameSpace), theta, phix_ownaxis, theta, phiy_ownaxis, 0., 0.);
198  }
199  phiOwnAxisRotMatrix = phiOwnAxisRot.matrix();
200  }
201  if (phideg != 0) {
202  string phiRotstr = rotstr + "Phi" + to_string(phideg * 10.);
203  phiRot = DDRotation(DDName(phiRotstr, idNameSpace));
204  if (!phiRot) {
205  LogDebug("TrackerGeom") << "DDTrackerIrregularRingAlgo test: Creating a new rotation: " << phiRotstr
206  << "\t90., " << convertRadToDeg(phix) << ", 90.," << convertRadToDeg(phiy)
207  << ", 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(convertRadToDeg(tiltAngle));
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") << "DDTrackerIrregularRingAlgo test: Creating a new "
229  << "rotation: " << globalRotstr;
230  globalRotMatrix = phiOwnAxisRotMatrix * phiRotMatrix * tiltMatrix;
231  globalRot = DDrot(DDName(globalRotstr, idNameSpace), make_unique<DDRotationMatrix>(globalRotMatrix));
232  }
233 
234  // translation def
235  double xpos = radius * cos(phix) + center[0];
236  double ypos = radius * sin(phix) + 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") << "DDTrackerIrregularRingAlgo test " << child << " number " << copy << " positioned in "
243  << mother << " at " << tran << " with " << globalRot;
244 
245  copy += incrCopyNo;
246  }
247 }
constexpr double convertDegToRad(NumType degrees)
Definition: angle_units.h:27
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
std::string to_string(const V &value)
Definition: OMSAccess.h:71
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
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDRotationMatrix & matrix()
Definition: DDTransform.h:85
#define LogDebug(id)
void DDTrackerIrregularRingAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 93 of file DDTrackerIrregularRingAlgo.cc.

References angle_units::operators::convertRadToDeg(), LogDebug, dqmiodumpmetadata::n, DDCurrentNamespace::ns(), SpecificationBuilder_cfi::parent(), and CosmicsPD_Skims::radius.

97  {
98  n = int(nArgs["N"]);
99  startCopyNo = int(nArgs["StartCopyNo"]);
100  incrCopyNo = int(nArgs["IncrCopyNo"]);
101  rangeAngle = nArgs["RangeAngle"];
102  startAngle = nArgs["StartAngle"];
103  radius = nArgs["Radius"];
104  center = vArgs["Center"];
105  yawAngles = vArgs["yawAngleValues"];
106  phiAngles = vArgs["phiAngleValues"];
107  radiusValues = vArgs["radiusValues"];
108  isZPlus = bool(nArgs["IsZPlus"]);
109  tiltAngle = nArgs["TiltAngle"];
110  isFlipped = bool(nArgs["IsFlipped"]);
111 
112  LogDebug("TrackerGeom") << "DDTrackerIrregularRingAlgo debug: Parameters for position"
113  << "ing:: n " << n << " Start, Range " << convertRadToDeg(startAngle) << " "
114  << convertRadToDeg(rangeAngle) << " Radius " << radius << " Centre " << center[0] << ", "
115  << center[1] << ", " << center[2];
116 
118  childName = sArgs["ChildName"];
119 
120  DDName parentName = parent().name();
121  LogDebug("TrackerGeom") << "DDTrackerIrregularRingAlgo debug: Parent " << parentName << "\tChild " << childName
122  << " NameSpace " << idNameSpace;
123 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
static std::string & ns()
#define LogDebug(id)

Member Data Documentation

vector<double> DDTrackerIrregularRingAlgo::center
private

Definition at line 75 of file DDTrackerIrregularRingAlgo.cc.

string DDTrackerIrregularRingAlgo::childName
private

Definition at line 84 of file DDTrackerIrregularRingAlgo.cc.

string DDTrackerIrregularRingAlgo::idNameSpace
private

Definition at line 83 of file DDTrackerIrregularRingAlgo.cc.

int DDTrackerIrregularRingAlgo::incrCopyNo
private

Definition at line 71 of file DDTrackerIrregularRingAlgo.cc.

bool DDTrackerIrregularRingAlgo::isFlipped
private

Definition at line 81 of file DDTrackerIrregularRingAlgo.cc.

bool DDTrackerIrregularRingAlgo::isZPlus
private

Definition at line 79 of file DDTrackerIrregularRingAlgo.cc.

int DDTrackerIrregularRingAlgo::n
private

Definition at line 69 of file DDTrackerIrregularRingAlgo.cc.

vector<double> DDTrackerIrregularRingAlgo::phiAngles
private

Definition at line 76 of file DDTrackerIrregularRingAlgo.cc.

double DDTrackerIrregularRingAlgo::radius
private

Definition at line 74 of file DDTrackerIrregularRingAlgo.cc.

vector<double> DDTrackerIrregularRingAlgo::radiusValues
private

Definition at line 77 of file DDTrackerIrregularRingAlgo.cc.

double DDTrackerIrregularRingAlgo::rangeAngle
private

Definition at line 72 of file DDTrackerIrregularRingAlgo.cc.

double DDTrackerIrregularRingAlgo::startAngle
private

Definition at line 73 of file DDTrackerIrregularRingAlgo.cc.

int DDTrackerIrregularRingAlgo::startCopyNo
private

Definition at line 70 of file DDTrackerIrregularRingAlgo.cc.

double DDTrackerIrregularRingAlgo::tiltAngle
private

Definition at line 80 of file DDTrackerIrregularRingAlgo.cc.

vector<double> DDTrackerIrregularRingAlgo::yawAngles
private

Definition at line 78 of file DDTrackerIrregularRingAlgo.cc.