CMS 3D CMS Logo

Functions
build.h File Reference
#include <string>
#include <DetectorDescription/Core/interface/DDCompactView.h>

Go to the source code of this file.

Functions

void output (std::string filename)
 
void regressionTest_first (ClhepEvaluator &)
 
void regressionTest_forth ()
 
void regressionTest_second ()
 
void regressionTest_setup (ClhepEvaluator &)
 
void regressionTest_third ()
 
void testParser ()
 
void testrot ()
 

Function Documentation

◆ output()

void output ( std::string  filename)

◆ regressionTest_first()

void regressionTest_first ( ClhepEvaluator )

load the new cpv

Definition at line 111 of file build.cc.

References DDSolidFactory::box(), gather_cfg::cout, DDrot(), ClhepEvaluator::eval(), eostools::move(), DDCompactView::position(), eostools::rm(), AlCaHLTBitMon_QueryRunRegistry::string, FrontierCondition_GT_autoExpress_cfi::t0, RandomServiceHelper::t1, RandomServiceHelper::t2, RandomServiceHelper::t3, unit(), and gpuVertexFinder::ws.

111  {
113  DDCompactView cpv;
114  cout << "main::initialize DDL parser" << endl;
115  DDLParser myP(cpv);
116 
117  cout << "main::about to set configuration" << endl;
118 
119  string ns("first");
120  DDSolid support = DDSolidFactory::box(DDName("support", ns),
121  eval.eval(ns, "[setup:corner]/4."),
122  eval.eval(ns, "[setup:corner]/8."),
123  eval.eval(ns, "[setup:corner]/4."));
124  DDSolid sensor = DDSolidFactory::box(DDName("sensor", ns),
125  eval.eval(ns, "[setup:corner]/16."),
126  eval.eval(ns, "[setup:corner]/16."),
127  eval.eval(ns, "[setup:corner]/16."));
128 
129  DDLogicalPart supportLP(DDName("support", ns), // name
130  DDName("Oxygen", "elements"), // material
131  DDName("support", ns)); // solid
132 
133  DDLogicalPart sensorLP(DDName("sensor", ns), DDName("Nitrogen", "elements"), DDName("sensor", ns));
134 
135  DDLogicalPart part(DDName("group", ns), DDName("Air", "setup"), DDName("group", "setup"));
136 
137  DDRotation r30(DDName("R30", "setup"));
138  DDRotation r60(DDName("R60", "setup"));
139  DDRotation r90(DDName("R90", "setup"));
140  DDRotation unit(DDName("Unit", "setup"));
143  eval.eval(ns, "[setup:corner]/8."), eval.eval(ns, "[setup:corner]/16."), eval.eval(ns, "[setup:corner]/8."));
145  eval.eval(ns, "[setup:corner]*1.25*cos(0.)"), eval.eval(ns, "[setup:corner]*1.25*sin(0.)"), eval.eval(ns, "0."));
146  DDTranslation t3(eval.eval(ns, "[setup:corner]*1.25*cos(30.*deg)"),
147  eval.eval(ns, "[setup:corner]*1.25*sin(30.*deg)"),
148  eval.eval(ns, "0."));
149  DDTranslation t4(eval.eval(ns, "[setup:corner]*1.25*cos(60.*deg)"),
150  eval.eval(ns, "[setup:corner]*1.25*sin(60.*deg)"),
151  eval.eval(ns, "0."));
152  DDTranslation t5(eval.eval(ns, "[setup:corner]*1.25*cos(90.*deg)"),
153  eval.eval(ns, "[setup:corner]*1.25*sin(90.*deg)"),
154  eval.eval(ns, "0."));
155 
156  cpv.position(sensorLP, supportLP, std::string("1"), t1, unit);
157  cpv.position(supportLP, part, std::string("1"), t2, unit);
158  cpv.position(supportLP, part, std::string("2"), t3, r30);
159  cpv.position(supportLP, part, std::string("3"), t4, r60);
160  cpv.position(supportLP, part, std::string("4"), t5, r90);
161 
162  std::unique_ptr<DDRotationMatrix> rm =
163  std::make_unique<DDRotationMatrix>(ROOT::Math::AxisAngle(DD3Vector(1., 1., 1.), 20._deg));
164  DDRotation rw = DDrot(DDName("group", ns), std::move(rm));
165  DDLogicalPart ws(DDName("world", "setup"));
166  cpv.position(part, ws, std::string("1"), t0, rw);
167 }
def rm(path, rec=False)
Definition: eostools.py:363
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
auto &__restrict__ ws
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
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
static DDSolid box(const DDName &name, double xHalf, double yHalf, double zHalf)
Creates a box with side length 2*xHalf, 2*yHalf, 2*zHalf.
Definition: DDSolid.cc:547
Basic3DVector unit() const
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:63
part
Definition: HCALResponse.h:20
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
def move(src, dest)
Definition: eostools.py:511

◆ regressionTest_forth()

void regressionTest_forth ( )

◆ regressionTest_second()

void regressionTest_second ( )

◆ regressionTest_setup()

void regressionTest_setup ( ClhepEvaluator )

Definition at line 40 of file build.cc.

References DDMaterial::addMaterial(), DDSolidFactory::box(), gather_cfg::cout, DDrot(), ClhepEvaluator::eval(), DDI::Singleton< I >::instance(), eostools::move(), ClhepEvaluator::set(), and DDSolidFactory::shapeless().

40  {
41  string ns = "setup"; // current namespace faking the filename 'setup.xml'
42 
43  // length of a side of world cube
44  eval.set(ns, "length", "20.*m");
45 
46  // center of a corner in the cube
47  eval.set(ns, "corner", "[length]/4.");
48 
49  // world-solid
50  DDName worldName("world", ns);
51  DDName airName("Air", ns);
52  DDName nitrogenName("Nitrogen", "elements");
53  DDName oxygenName("Oxygen", "elements");
54 
56  worldName, eval.eval(ns, "[length]/2."), eval.eval(ns, "[length]/2."), eval.eval(ns, "[length]/2."));
57 
58  DDLogicalPart(worldName, // name
59  airName, // material
60  worldName // solid
61  );
62 
63  DDMaterial air(airName, eval.eval(ns, "1.214*mg/cm3")); // mixture for Air
64  air.addMaterial(DDMaterial(nitrogenName), eval.eval(ns, "0.75"));
65  air.addMaterial(DDMaterial(oxygenName), eval.eval(ns, "0.25"));
66 
67  cout << air << endl;
68 
69  DDMaterial(nitrogenName, // name
70  eval.eval(ns, "7"), // Z
71  eval.eval(ns, "14.007*g/mole"), // A
72  eval.eval(ns, "0.808*g/cm3")); // density
73 
74  DDMaterial(oxygenName, // name
75  eval.eval(ns, "8"), // Z
76  eval.eval(ns, "15.999*g/mole"), // A
77  eval.eval(ns, "1.43*g/cm3")); // density
78 
79  cout << air << endl;
80 
81  // Some rotations in the x-y plane (Unit, 30,60,90 degs)
82  std::unique_ptr<DDRotationMatrix> r0 = std::make_unique<DDRotationMatrix>();
83  std::unique_ptr<DDRotationMatrix> r30 = std::make_unique<DDRotationMatrix>(ROOT::Math::RotationZ(30._deg));
84  std::unique_ptr<DDRotationMatrix> r60 = std::make_unique<DDRotationMatrix>(ROOT::Math::RotationZ(60._deg));
85  std::unique_ptr<DDRotationMatrix> r90 = std::make_unique<DDRotationMatrix>(ROOT::Math::RotationZ(90._deg));
86 
87  DDrot(DDName("Unit", ns), std::move(r0));
88  DDrot(DDName("R30", ns), std::move(r30));
89  DDrot(DDName("R60", ns), std::move(r60));
90  DDrot(DDName("R90", ns), std::move(r90));
91 
92  DDSolid collectorSolid = DDSolidFactory::shapeless(DDName("group", ns));
93 
94  DDRootDef::instance().set(worldName);
95 }
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
int addMaterial(const DDMaterial &m, double fm)
adds a material to the mixture proportional to its fraction-mass fm.
Definition: DDMaterial.cc:63
static value_type & instance()
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
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
static DDSolid box(const DDName &name, double xHalf, double yHalf, double zHalf)
Creates a box with side length 2*xHalf, 2*yHalf, 2*zHalf.
Definition: DDSolid.cc:547
static DDSolid shapeless(const DDName &name)
Definition: DDSolid.cc:702
def move(src, dest)
Definition: eostools.py:511

◆ regressionTest_third()

void regressionTest_third ( )

◆ testParser()

void testParser ( )

Definition at line 210 of file build.cc.

References gather_cfg::cout, MillePedeFileConverter_cfg::e, DDLParser::parse(), and FIPConfiguration::readConfig().

210  {
211  try {
212  cout << "main:: initialize" << endl;
213  DDCompactView cpv;
214  cout << "main::initialize DDL parser" << endl;
215  DDLParser myP(cpv);
216 
217  cout << "main::about to set configuration" << endl;
218 
219  FIPConfiguration cf(cpv);
220  cf.readConfig("DetectorDescription/RegressionTest/test/configuration.xml");
221 
222  cout << "main::about to start parsing" << endl;
223 
224  myP.parse(cf);
225 
226  cout << "main::completed Parser" << endl;
227 
228  cout << endl << endl << "main::Start checking!" << endl << endl;
229 
230  } catch (cms::Exception& e) {
231  cout << "main::PROBLEM:" << endl << " " << e << endl;
232  }
233 }
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:63
FIPConfiguration reads in the configuration file for the DDParser.

◆ testrot()

void testrot ( )

Definition at line 251 of file build.cc.

References gather_cfg::cout, printRot(), and eostools::rm().

251  {
252  {
253  ROOT::Math::AxisAngle aa(DD3Vector(1., 1., 1.), 20._deg);
254  DDRotationMatrix rm(aa);
255  cout << "DD3Vector was " << DD3Vector(1., 1., 1.) << " and the rotation was 20*deg around that axis." << endl;
256  printRot(rm);
257  }
258  {
259  DDRotationMatrix rm(1, 0, 0, 0, -1, 0, 0, 0, 1);
260  cout << "(1,0,0, 0,-1,0, 0,0,1)" << endl;
261  printRot(rm);
262  }
263 }
def rm(path, rec=False)
Definition: eostools.py:363
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
void printRot(const DDRotationMatrix &rot)
Definition: build.cc:235
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.