Belle II Software development
ECLDumpGeometry Class Reference
Inheritance diagram for ECLDumpGeometry:

Public Member Functions

 __init__ (self)
 
 event (self)
 

Public Attributes

 root = ROOT
 ROOT module, kept so that event() does not have to import it again.
 
 n_crystals = ROOT.Belle2.ECLElementNumbers.c_NCrystals
 number of ECL crystals; cellID runs from 1 to this value
 
bool first_event = True
 print the geometry in the first event only
 

Detailed Description

Print the location and direction of the axis of every ECL crystal, once.

The numbers come from ECL::ECLGeometryPar, i.e. from the
ECLCrystalsShapeAndPosition payload valid for the experiment and run being
processed, so the geometry has to be built by the Gearbox and Geometry modules
first.

The table is printed in the first event, because the crystal positions are
read from a conditions payload and are therefore only known once the run is
started.

Definition at line 16 of file ecl_utils.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self)
Constructor: load the ECL library and look up the number of crystals.

Definition at line 29 of file ecl_utils.py.

29 def __init__(self):
30 """Constructor: load the ECL library and look up the number of crystals."""
31 super().__init__()
32 self.set_name("ECLDumpGeometry")
33
34 import ROOT
35 ROOT.gSystem.Load("libecl.so")
36 ROOT.gInterpreter.Declare("#include <ecl/dataobjects/ECLElementNumbers.h>")
37
38
39 self.root = ROOT
40
41 self.n_crystals = ROOT.Belle2.ECLElementNumbers.c_NCrystals
42
43 self.first_event = True
44

Member Function Documentation

◆ event()

event ( self)
Print the table of crystal positions in the first event.

Definition at line 45 of file ecl_utils.py.

45 def event(self):
46 """Print the table of crystal positions in the first event."""
47 if not self.first_event:
48 return
49 self.first_event = False
50
51 geometry = self.root.Belle2.ECL.ECLGeometryPar.Instance()
52 print("\nLocation and direction of the axis of each ECL crystal")
53 print("cellID x [cm] y [cm] z [cm] axisTheta axisPhi [rad]")
54 for cell_id in range(1, self.n_crystals + 1):
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}")
59 print("\n")
static ECLGeometryPar * Instance()
Static method to get a reference to the ECLGeometryPar instance.

Member Data Documentation

◆ first_event

bool first_event = True

print the geometry in the first event only

Definition at line 43 of file ecl_utils.py.

◆ n_crystals

n_crystals = ROOT.Belle2.ECLElementNumbers.c_NCrystals

number of ECL crystals; cellID runs from 1 to this value

Definition at line 41 of file ecl_utils.py.

◆ root

root = ROOT

ROOT module, kept so that event() does not have to import it again.

Definition at line 39 of file ecl_utils.py.


The documentation for this class was generated from the following file: