CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
DDTECCoolAlgo.cc File Reference
#include "DD4hep/DetFactoryHelper.h"
#include "DD4hep/Printout.h"
#include "DataFormats/Math/interface/CMSUnits.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <sstream>

Go to the source code of this file.

Functions

static long algorithm (Detector &, cms::DDParsingContext &ctxt, xml_h e)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_track_DDTECCoolAlgo)
 

Function Documentation

static long algorithm ( Detector &  ,
cms::DDParsingContext ctxt,
xml_h  e 
)
static

Definition at line 14 of file DDTECCoolAlgo.cc.

References writedatasetfile::args, angle_units::operators::convertRadToDeg(), funct::cos(), cms::DDAlgoArguments::find(), mps_fire::i, cms::DDNamespace::name(), cms::DDAlgoArguments::parentName(), PixelTestBeamValidation_cfi::Position, cms::DDNamespace::realName(), funct::sin(), cms::DDAlgoArguments::value(), and cms::DDNamespace::volume().

14  {
15  cms::DDNamespace ns(ctxt, e, true);
16  DDAlgoArguments args(ctxt, e);
17  int startCopyNo = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1;
18  double rPosition = args.value<double>("RPosition");
19  vector<double> phiPosition = args.value<vector<double> >("PhiPosition");
20  vector<string> coolInsert = args.value<vector<string> >("CoolInsert");
21  Volume mother = ns.volume(args.parentName());
22 
23  edm::LogVerbatim("TECGeom") << "DDTECCoolAlgo debug: Parent " << mother.name() << " NameSpace " << ns.name()
24  << " at radial Position " << rPosition;
25  if (phiPosition.size() == coolInsert.size()) {
26  for (int i = 0; i < (int)(phiPosition.size()); i++) {
27  edm::LogVerbatim("TECGeom") << "DDTECCoolAlgo debug: Insert[" << i << "]: " << coolInsert.at(i) << " at Phi "
28  << convertRadToDeg(phiPosition.at(i));
29  }
30  } else {
31  edm::LogVerbatim("TECGeom") << "DDTECCoolAlgo ERROR: Number of inserts does not match the numer of PhiPositions!";
32  }
33 
34  int copyNo = startCopyNo;
35  // loop over the inserts to be placed
36  for (int i = 0; i < (int)(coolInsert.size()); i++) {
37  Volume child = ns.volume(ns.realName(coolInsert.at(i)));
38  // get positions
39  double xpos = rPosition * cos(phiPosition.at(i));
40  double ypos = -rPosition * sin(phiPosition.at(i));
41  // place inserts
42  Position tran(xpos, ypos, 0.0);
43  mother.placeVolume(child, copyNo, tran);
44  edm::LogVerbatim("TECGeom") << "DDTECCoolAlgo test " << child.name() << "[" << copyNo << "] positioned in "
45  << mother.name() << " at " << tran << " phi " << convertRadToDeg(phiPosition.at(i))
46  << " r " << rPosition;
47  copyNo++;
48  }
49  edm::LogVerbatim("TECGeom") << "DDTECCoolAlgo Finished....";
50  return 1;
51 }
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
dd4hep::Volume Volume
DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_track_DDTECCoolAlgo   
)

Definition at line 54 of file DDTECCoolAlgo.cc.