CMS 3D CMS Logo

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

Public Member Functions

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

Private Attributes

string childName
 
string idNameSpace
 
int incrcn
 
size_t numcopies
 
vector< double > phi
 
double radius
 
size_t startcn
 
double tilt
 
vector< double > zpos
 

Detailed Description

Definition at line 20 of file DDTrackerPhiAlgo.cc.

Constructor & Destructor Documentation

◆ DDTrackerPhiAlgo()

DDTrackerPhiAlgo::DDTrackerPhiAlgo ( )

Definition at line 48 of file DDTrackerPhiAlgo.cc.

References LogDebug.

48  : startcn(1), incrcn(1) {
49  LogDebug("TrackerGeom") << "DDTrackerPhiAlgo info: Creating an instance";
50 }
#define LogDebug(id)

◆ ~DDTrackerPhiAlgo()

DDTrackerPhiAlgo::~DDTrackerPhiAlgo ( )
override

Definition at line 52 of file DDTrackerPhiAlgo.cc.

52 {}

Member Function Documentation

◆ execute()

void DDTrackerPhiAlgo::execute ( DDCompactView cpv)
override

Definition at line 101 of file DDTrackerPhiAlgo.cc.

References submitPVValidationJobs::child, childName, funct::cos(), DDrot(), DDSplit(), first, mps_fire::i, idNameSpace, incrcn, LogDebug, numcopies, class-composition::parent, phi, DDCompactView::position(), radius, idealTransformation::rotation, edm::second(), funct::sin(), startcn, theta(), tilt, cond::impl::to_string(), and zpos.

101  {
102  DDName mother = parent().name();
104  double theta = 90. * CLHEP::deg;
105  size_t i = 0;
106  int ci = startcn;
107  for (; i < numcopies; ++i) {
108  double phix = phi[i] + tilt;
109  double phiy = phix + 90. * CLHEP::deg;
110  double phideg = phi[i] / CLHEP::deg;
111 
112  string rotstr = DDSplit(childName).first + to_string(phideg);
114  if (!rotation) {
115  LogDebug("TrackerGeom") << "DDTrackerPhiAlgo test: Creating a new "
116  << "rotation: " << rotstr << "\t"
117  << "90., " << phix / CLHEP::deg << ", 90.," << phiy / CLHEP::deg << ", 0, 0";
118  rotation = DDrot(DDName(rotstr, idNameSpace), theta, phix, theta, phiy, 0., 0.);
119  }
120 
121  double xpos = radius * cos(phi[i]);
122  double ypos = radius * sin(phi[i]);
123  DDTranslation tran(xpos, ypos, zpos[i]);
124 
125  cpv.position(child, mother, ci, tran, rotation);
126  LogDebug("TrackerGeom") << "DDTrackerPhiAlgo test: " << child << " number " << ci << " positioned in " << mother
127  << " at " << tran << " with " << rotation;
128  ci = ci + incrcn;
129  }
130 }
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
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:71
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
U second(std::pair< T, U > const &p)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
vector< double > phi
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
vector< double > zpos
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
#define LogDebug(id)

◆ initialize()

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

Definition at line 54 of file DDTrackerPhiAlgo.cc.

References childName, mps_fire::i, idNameSpace, incrcn, createfilelist::int, LogDebug, DDCurrentNamespace::ns(), numcopies, class-composition::parent, phi, radius, startcn, tilt, and zpos.

58  {
59  if (nArgs.find("StartCopyNo") != nArgs.end()) {
60  startcn = size_t(nArgs["StartCopyNo"]);
61  } else {
62  startcn = 1;
63  }
64  if (nArgs.find("IncrCopyNo") != nArgs.end()) {
65  incrcn = int(nArgs["IncrCopyNo"]);
66  } else {
67  incrcn = 1;
68  }
69 
70  radius = nArgs["Radius"];
71  tilt = nArgs["Tilt"];
72  phi = vArgs["Phi"];
73  zpos = vArgs["ZPos"];
74 
75  if (nArgs.find("NumCopies") != nArgs.end()) {
76  numcopies = size_t(nArgs["NumCopies"]);
77  if (numcopies != phi.size()) {
78  edm::LogError("TrackerGeom") << "DDTrackerPhiAlgo error: Parameter "
79  << "NumCopies does not agree with the size "
80  << "of the Phi vector. It was adjusted to "
81  << "be the size of the Phi vector and may "
82  << "lead to crashes or errors.";
83  }
84  } else {
85  numcopies = phi.size();
86  }
87 
88  LogDebug("TrackerGeom") << "DDTrackerPhiAlgo debug: Parameters for position"
89  << "ing:: "
90  << " Radius " << radius << " Tilt " << tilt / CLHEP::deg << " Copies " << phi.size() << " at";
91  for (int i = 0; i < (int)(phi.size()); i++)
92  LogDebug("TrackerGeom") << "\t[" << i << "] phi = " << phi[i] / CLHEP::deg << " z = " << zpos[i];
93 
95  childName = sArgs["ChildName"];
96  DDName parentName = parent().name();
97  LogDebug("TrackerGeom") << "DDTrackerPhiAlgo debug: Parent " << parentName << "\tChild " << childName << " NameSpace "
98  << idNameSpace;
99 }
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
static std::string & ns()
Log< level::Error, false > LogError
vector< double > phi
vector< double > zpos
#define LogDebug(id)

Member Data Documentation

◆ childName

string DDTrackerPhiAlgo::childName
private

Definition at line 41 of file DDTrackerPhiAlgo.cc.

Referenced by execute(), and initialize().

◆ idNameSpace

string DDTrackerPhiAlgo::idNameSpace
private

Definition at line 40 of file DDTrackerPhiAlgo.cc.

Referenced by execute(), and initialize().

◆ incrcn

int DDTrackerPhiAlgo::incrcn
private

Definition at line 44 of file DDTrackerPhiAlgo.cc.

Referenced by execute(), and initialize().

◆ numcopies

size_t DDTrackerPhiAlgo::numcopies
private

Definition at line 45 of file DDTrackerPhiAlgo.cc.

Referenced by execute(), and initialize().

◆ phi

vector<double> DDTrackerPhiAlgo::phi
private

◆ radius

double DDTrackerPhiAlgo::radius
private

Definition at line 35 of file DDTrackerPhiAlgo.cc.

Referenced by execute(), and initialize().

◆ startcn

size_t DDTrackerPhiAlgo::startcn
private

Definition at line 43 of file DDTrackerPhiAlgo.cc.

Referenced by execute(), and initialize().

◆ tilt

double DDTrackerPhiAlgo::tilt
private

Definition at line 36 of file DDTrackerPhiAlgo.cc.

Referenced by execute(), and initialize().

◆ zpos

vector<double> DDTrackerPhiAlgo::zpos
private

Definition at line 38 of file DDTrackerPhiAlgo.cc.

Referenced by execute(), and initialize().