CMS 3D CMS Logo

DDVecCMSDetector.cc
Go to the documentation of this file.
7 #include "base/Transformation3D.h"
8 #include "navigation/NavigationState.h"
9 #include "navigation/SimpleNavigator.h"
10 #include "volumes/LogicalVolume.h"
11 #include "volumes/Box.h"
12 
13 #include <memory>
14 #include <string>
15 
16 using namespace vecgeom;
17 
19 public:
20  explicit DDVecCMSDetector(const edm::ParameterSet& p);
21 
22  void beginJob() override {}
23  void analyze( edm::Event const& iEvent, edm::EventSetup const& ) override;
24  void endJob() override;
25 };
26 
28 {}
29 
30 void
32 {
33  UnplacedBox world_params = UnplacedBox(4., 4., 4.);
34  UnplacedBox largebox_params = UnplacedBox(1.5, 1.5, 1.5);
35  UnplacedBox smallbox_params = UnplacedBox(0.5, 0.5, 0.5);
36 
37  LogicalVolume worldl(&world_params);
38  LogicalVolume largebox("Large box", &largebox_params);
39  LogicalVolume smallbox("Small box", &smallbox_params);
40 
41  Transformation3D origin = Transformation3D();
42  Transformation3D placement1 = Transformation3D(2, 2, 2);
43  Transformation3D placement2 = Transformation3D(-2, 2, 2);
44  Transformation3D placement3 = Transformation3D(2, -2, 2);
45  Transformation3D placement4 = Transformation3D(2, 2, -2);
46  Transformation3D placement5 = Transformation3D(-2, -2, 2);
47  Transformation3D placement6 = Transformation3D(-2, 2, -2);
48  Transformation3D placement7 = Transformation3D(2, -2, -2);
49  Transformation3D placement8 = Transformation3D(-2, -2, -2);
50 
51  largebox.PlaceDaughter(&smallbox, &origin);
52  worldl.PlaceDaughter(&largebox, &placement1);
53  worldl.PlaceDaughter(&largebox, &placement2);
54  worldl.PlaceDaughter(&largebox, &placement3);
55  worldl.PlaceDaughter(&largebox, &placement4);
56  worldl.PlaceDaughter("Hello the world!", &largebox, &placement5);
57  worldl.PlaceDaughter(&largebox, &placement6);
58  worldl.PlaceDaughter(&largebox, &placement7);
59  worldl.PlaceDaughter(&largebox, &placement8);
60 
61  VPlacedVolume *world_placed = worldl.Place();
62  GeoManager::Instance().SetWorld(world_placed);
63  GeoManager::Instance().CloseGeometry();
64 
65  std::cerr << "Printing world content:\n";
66  world_placed->PrintContent();
67 
68  SimpleNavigator nav;
69  Vector3D<Precision> point(2, 2, 2);
70  NavigationState *path = NavigationState::MakeInstance(4);
71  nav.LocatePoint(world_placed, point, *path, true);
72  path->Print();
73 
74  GeoManager::Instance().FindLogicalVolume("Large box");
75  GeoManager::Instance().FindPlacedVolume("Large box");
76 
77  NavigationState::ReleaseInstance(path);
78 }
79 
80 void
82 {}
83 
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:230
DDVecCMSDetector(const edm::ParameterSet &p)
void beginJob() override
void endJob() override
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
virtual example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5