Belle II Software development
ECLDumpGeometryModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9/* Own header. */
10#include <ecl/modules/eclDumpGeometry/ECLDumpGeometryModule.h>
11
12/* ECL headers. */
13#include <ecl/dataobjects/ECLElementNumbers.h>
14#include <ecl/geometry/ECLGeometryPar.h>
15
16/* ROOT headers. */
17#include <Math/Vector3D.h>
18
19using namespace Belle2;
20using namespace std;
21
22
23//-----------------------------------------------------------------
24// Register the Module
25//-----------------------------------------------------------------
26REG_MODULE(ECLDumpGeometry);
27
28//-----------------------------------------------------------------
29// Implementation
30//-----------------------------------------------------------------
31
33{
34 // Set module properties
35 setDescription("Print out location of every crystal");
37}
38
39
41{
42 if (firstEvent) {
43 firstEvent = false;
44
45 //..ECL geometry
47 std::printf("\nLocation and direction of the axis of each ECL crystal\n");
48 std::printf("cellID x y z axisTheta axisPhi \n");
49 for (int cellID = 1; cellID <= ECLElementNumbers::c_NCrystals; cellID++) {
50 ROOT::Math::XYZVector pos = eclGeometry->GetCrystalPos(cellID - 1);
51 ROOT::Math::XYZVector dir = eclGeometry->GetCrystalVec(cellID - 1);
52 std::printf("%6d %9.4f %9.4f %9.4f %9.6f %9.6f\n", cellID, pos.X(), pos.Y(), pos.Z(), dir.Theta(), dir.Phi());
53 }
54 std::printf("\n\n");
55 }
56}
57
58
virtual void event() override
Event.
bool firstEvent
print out geometry in the first event
ECLDumpGeometryModule()
Constructor: Sets the description, the properties and the parameters of the module.
The Class for ECL Geometry Parameters.
static ECLGeometryPar * Instance()
Static method to get a reference to the ECLGeometryPar instance.
ROOT::Math::XYZVector GetCrystalPos(int cid)
The Position of crystal.
ROOT::Math::XYZVector GetCrystalVec(int cid)
The direction of crystal.
void setDescription(const std::string &description)
Sets the description of the module.
Definition Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition Module.cc:208
Module()
Constructor.
Definition Module.cc:30
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition Module.h:80
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition Module.h:649
const int c_NCrystals
Number of crystals.
Abstract base class for different kinds of events.
STL namespace.