CMS 3D CMS Logo

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 
16 #include "CLHEP/Units/GlobalPhysicalConstants.h"
17 #include "CLHEP/Units/GlobalSystemOfUnits.h"
18 
19 #include <cmath>
20 #include <algorithm>
21 #include <map>
22 #include <string>
23 #include <vector>
24 
25 using namespace std;
26 
27 class DDTECCoolAlgo : public DDAlgorithm {
28 public:
29  //Constructor and Destructor
30  DDTECCoolAlgo();
31  ~DDTECCoolAlgo() override;
32 
33  void initialize(const DDNumericArguments& nArgs,
34  const DDVectorArguments& vArgs,
35  const DDMapArguments& mArgs,
36  const DDStringArguments& sArgs,
37  const DDStringVectorArguments& vsArgs) override;
38 
39  void execute(DDCompactView& cpv) override;
40 
41 private:
42  string idNameSpace; //Namespace of this and ALL parts
43  int startCopyNo; //Start copy number
44  double rPosition; // Position of the Inserts in R
45  vector<double> phiPosition; // Position of the Inserts in Phi
46  vector<string> coolInsert; //Name of cooling pieces
47 };
48 
49 DDTECCoolAlgo::DDTECCoolAlgo() : phiPosition(0), coolInsert(0) {
50  LogDebug("TECGeom") << "DDTECCoolAlgo info: Creating an instance";
51 }
52 
54 
56  const DDVectorArguments& vArgs,
57  const DDMapArguments&,
58  const DDStringArguments& sArgs,
59  const DDStringVectorArguments& vsArgs) {
61  startCopyNo = int(nArgs["StartCopyNo"]);
62 
63  DDName parentName = parent().name();
64  rPosition = nArgs["RPosition"];
65  LogDebug("TECGeom") << "DDTECCoolAlgo debug: Parent " << parentName << " NameSpace " << idNameSpace
66  << " at radial Position " << rPosition;
67  phiPosition = vArgs["PhiPosition"];
68  coolInsert = vsArgs["CoolInsert"];
69  if (phiPosition.size() == coolInsert.size()) {
70  for (int i = 0; i < (int)(phiPosition.size()); i++)
71  LogDebug("TECGeom") << "DDTECCoolAlgo debug: Insert[" << i << "]: " << coolInsert.at(i) << " at Phi "
72  << phiPosition.at(i) / CLHEP::deg;
73  } else {
74  LogDebug("TECGeom") << "ERROR: Number of inserts does not match the numer of PhiPositions!";
75  }
76  LogDebug("TECGeom") << " Done creating instance of DDTECCoolAlgo ";
77 }
78 
80  LogDebug("TECGeom") << "==>> Constructing DDTECCoolAlgo...";
81  int copyNo = startCopyNo;
82  // loop over the inserts to be placed
83  for (int i = 0; i < (int)(coolInsert.size()); i++) {
84  // get objects
86  DDName mother = parent().name();
87  // get positions
88  double xpos = rPosition * cos(phiPosition.at(i));
89  double ypos = -rPosition * sin(phiPosition.at(i));
90  // place inserts
91  DDTranslation tran(xpos, ypos, 0.0);
93  cpv.position(child, mother, copyNo, tran, rotation);
94  LogDebug("TECGeom") << "DDTECCoolAlgo test " << child << "[" << copyNo << "] positioned in " << mother << " at "
95  << tran << " with " << rotation << " phi " << phiPosition.at(i) / CLHEP::deg << " r "
96  << rPosition;
97  copyNo++;
98  }
99  LogDebug("TECGeom") << "<<== End of DDTECCoolAlgo construction ...";
100 }
101 
102 DEFINE_EDM_PLUGIN(DDAlgorithmFactory, DDTECCoolAlgo, "track:DDTECCoolAlgo");
DDCurrentNamespace.h
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
DDTECCoolAlgo::idNameSpace
string idNameSpace
Definition: DDTECCoolAlgo.cc:42
DDTECCoolAlgo::rPosition
double rPosition
Definition: DDTECCoolAlgo.cc:44
DDTECCoolAlgo::coolInsert
vector< string > coolInsert
Definition: DDTECCoolAlgo.cc:46
DDSplit.h
DDTECCoolAlgo::startCopyNo
int startCopyNo
Definition: DDTECCoolAlgo.cc:43
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
DDTECCoolAlgo::initialize
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
Definition: DDTECCoolAlgo.cc:55
dqmdumpme.first
first
Definition: dqmdumpme.py:55
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DDTECCoolAlgo::~DDTECCoolAlgo
~DDTECCoolAlgo() override
Definition: DDTECCoolAlgo.cc:53
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
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
DDTECCoolAlgo::execute
void execute(DDCompactView &cpv) override
Definition: DDTECCoolAlgo.cc:79
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
edmplugin::PluginFactory
Definition: PluginFactory.h:34
DDTypes.h
DDTECCoolAlgo::phiPosition
vector< double > phiPosition
Definition: DDTECCoolAlgo.cc:45
createfilelist.int
int
Definition: createfilelist.py:10
DDutils.h
ReadMapType< double >
DDAlgorithm.h
std
Definition: JetResolutionObject.h:76
DDTECCoolAlgo::DDTECCoolAlgo
DDTECCoolAlgo()
Definition: DDTECCoolAlgo.cc:49
DDCurrentNamespace::ns
static std::string & ns()
Definition: DDCurrentNamespace.cc:3
DDTECCoolAlgo
Definition: DDTECCoolAlgo.cc:27
DDRotation
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
initialize
static AlgebraicMatrix initialize()
Definition: BeamSpotTransientTrackingRecHit.cc:24
child
Definition: simpleInheritance.h:11
DDAlgorithmFactory.h
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