10Python utilities for the ECL.
17 """Print the location and direction of the axis of every ECL crystal, once.
19 The numbers come from ECL::ECLGeometryPar, i.e. from the
20 ECLCrystalsShapeAndPosition payload valid for the experiment and run being
21 processed, so the geometry has to be built by the Gearbox and Geometry modules
24 The table is printed in the first event, because the crystal positions are
25 read from a conditions payload and are therefore only known once the run is
30 """Constructor: load the ECL library and look up the number of crystals."""
32 self.set_name(
"ECLDumpGeometry")
35 ROOT.gSystem.Load(
"libecl.so")
36 ROOT.gInterpreter.Declare(
"#include <ecl/dataobjects/ECLElementNumbers.h>")
41 self.
n_crystals = ROOT.Belle2.ECLElementNumbers.c_NCrystals
46 """Print the table of crystal positions in the first event."""
52 print(
"\nLocation and direction of the axis of each ECL crystal")
53 print(
"cellID x [cm] y [cm] z [cm] axisTheta axisPhi [rad]")
55 position = geometry.GetCrystalPos(cell_id - 1)
56 direction = geometry.GetCrystalVec(cell_id - 1)
57 print(f
"{cell_id:6d} {position.X():9.4f} {position.Y():9.4f} {position.Z():9.4f} "
58 f
"{direction.Theta():9.6f} {direction.Phi():9.6f}")
static ECLGeometryPar * Instance()
Static method to get a reference to the ECLGeometryPar instance.
bool first_event
print the geometry in the first event only
n_crystals
number of ECL crystals; cellID runs from 1 to this value
root
ROOT module, kept so that event() does not have to import it again.