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}
43
44
46{
47 if (firstEvent) {
48 firstEvent = false;
49
50 //..ECL geometry
52 std::printf("\nLocation and direction of the axis of each ECL crystal\n");
53 std::printf("cellID x y z axisTheta axisPhi \n");
54 for (int cellID = 1; cellID <= ECLElementNumbers::c_NCrystals; cellID++) {
55 ROOT::Math::XYZVector pos = eclGeometry->GetCrystalPos(cellID - 1);
56 ROOT::Math::XYZVector dir = eclGeometry->GetCrystalVec(cellID - 1);
57 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());
58 }
59 std::printf("\n\n");
60 }
61}
62
63
virtual void initialize() override
Register input and output data.
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.
Base class for Modules.
Definition: Module.h:72
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
@ 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:650
const int c_NCrystals
Number of crystals.
Abstract base class for different kinds of events.
STL namespace.