CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDTECCoolAlgo.cc
Go to the documentation of this file.
1 // File: DDTECCoolAlgo.cc
3 // Description: Placing cooling pieces in the petal material of a TEC petal
4 // * in each call all objects are placed at the same radial position.
5 // * Inserts are placed into the parent object
6 // * for all i: CoolInsert[i] goes to PhiPosition[i]
8 
9 #include <cmath>
10 #include <algorithm>
11 
17 #include "CLHEP/Units/GlobalPhysicalConstants.h"
18 #include "CLHEP/Units/GlobalSystemOfUnits.h"
19 
20 
21 DDTECCoolAlgo::DDTECCoolAlgo(): phiPosition(0),coolInsert(0) {
22  LogDebug("TECGeom") << "DDTECCoolAlgo info: Creating an instance";
23 }
24 
26 
28  const DDVectorArguments & vArgs,
29  const DDMapArguments & ,
30  const DDStringArguments & sArgs,
31  const DDStringVectorArguments & vsArgs) {
32 
34  startCopyNo = int(nArgs["StartCopyNo"]);
35 
36  DDName parentName = parent().name();
37  rPosition = nArgs["RPosition"];
38  LogDebug("TECGeom") << "DDTECCoolAlgo debug: Parent " << parentName
39  <<" NameSpace " << idNameSpace << " at radial Position "
40  << rPosition ;
41  phiPosition = vArgs["PhiPosition"];
42  coolInsert = vsArgs["CoolInsert"];
43  if (phiPosition.size() == coolInsert.size()) {
44  for (int i=0; i<(int)(phiPosition.size()); i++)
45  LogDebug("TECGeom") << "DDTECCoolAlgo debug: Insert[" << i << "]: "
46  << coolInsert.at(i) << " at Phi "
47  << phiPosition.at(i)/CLHEP::deg;
48  } else {
49  LogDebug("TECGeom") << "ERROR: Number of inserts does not match the numer of PhiPositions!";
50  }
51  LogDebug("TECGeom") << " Done creating instance of DDTECCoolAlgo ";
52 }
53 
55  LogDebug("TECGeom") << "==>> Constructing DDTECCoolAlgo...";
56  int copyNo = startCopyNo;
57  // loop over the inserts to be placed
58  for (int i = 0; i < (int)(coolInsert.size()); i++) {
59  // get objects
61  DDSplit(coolInsert.at(i)).second);
62  DDName mother = parent().name();
63  // get positions
64  double xpos = rPosition*cos(phiPosition.at(i));
65  double ypos = -rPosition*sin(phiPosition.at(i));
66  // place inserts
67  DDTranslation tran(xpos, ypos, 0.0);
69  cpv.position(child, mother, copyNo, tran, rotation);
70  LogDebug("TECGeom") << "DDTECCoolAlgo test " << child << "["
71  << copyNo << "] positioned in " << mother
72  << " at " << tran << " with " << rotation
73  << " phi " << phiPosition.at(i)/CLHEP::deg << " r "
74  << rPosition;
75  copyNo++;
76  }
77  LogDebug("TECGeom") << "<<== End of DDTECCoolAlgo construction ...";
78 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
list parent
Definition: dbtoconf.py:74
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
static std::string & ns()
void execute(DDCompactView &cpv)
type of data representation of DDCompactView
Definition: DDCompactView.h:77
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
U second(std::pair< T, U > const &p)
std::vector< std::string > coolInsert
Definition: DDTECCoolAlgo.h:29
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
bool first
Definition: L1TdeRCT.cc:94
std::string idNameSpace
Definition: DDTECCoolAlgo.h:25
virtual ~DDTECCoolAlgo()
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
double rPosition
Definition: DDTECCoolAlgo.h:27
std::vector< double > phiPosition
Definition: DDTECCoolAlgo.h:28
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4