Skip to content

Commit

Permalink
Add more useful documentation to python config
Browse files Browse the repository at this point in the history
  • Loading branch information
bryngemark committed Feb 23, 2024
1 parent cdebd83 commit 81aa27d
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions Recon/python/beamElectronLocator.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
"""Example configuration object for a processor"""
"""Configuration for beam electron locator
Attributes:
-------------
input_collection : string
Name of the input collection, should be one that holds sim hits
input_pass_name : string
Pass name of the input collection
output_collection : string
Name of the output collection, holding the condensed list of beam electron locations
granularity_X_mm : float
The expected actual resolution or the bar width in mm of the TS in the X direction
granularity_Y_mm : float
The expected actual resolution or the bar width in mm of the TS in the Y direction
min_granularity_mm : float
The maximum distance between SimHits that are grouped together as one beam electron
verbose : boolean
If set to true, more information is spit out to either Info or Debug log level
# We need the ldmx configuration package to construct the processor objects
"""

from LDMX.Framework import ldmxcfg

class BeamElectronLocator(ldmxcfg.Producer) :
"""The name is purely conventional to match the C++ class name for clarity
The line
super().__init__( name , "recon::BeamElectronLocator" , "Recon" )
Calls the constructor for ldmxcfg.Producer, which is how we have handles
on this processor. You need to give the actual C++ class name with
namespace(s) as the second entry, and the name of the module the C++ class
is in as the third entry.
Any other lines define parameters that are accessible in the C++
configure method. For example, the line
self.my_parameter = 20
defines a integer parameter for this class which can be accessed
in the configure method with
int my_parameter = parameters.getParameter<int>("my_parameter");
Examples
--------
Creating the configuration object gives the parameters set
in __init__.
beamEleFinder = BeamElectronLocator( 'beamEleFinder')
from LDMX.Recon.beamElectronLocator import BeamElectronLocator
beamEleFinder= BeamELectronLocator('beamEleFinder')
You can also change the parameters after creating this object.
beamELeFinder.my_parameter = 50
You can change the parameters after creating this object.
beamEleFinder.my_parameter = 50
Then you put your processor into the sequence of the process.
p.sequence.append( beamEleFinder )
Expand All @@ -39,11 +41,11 @@ class BeamElectronLocator(ldmxcfg.Producer) :
def __init__(self, name ):
super().__init__( name , "recon::BeamElectronLocator" , 'Recon' )

self.input_collection = "TruthBeamElectronsTarget"
self.input_collection = "truthBeamElectronsTarget"
self.input_pass_name = ""
self.output_collection = "BeamElectronTruthInfo"
self.granularity_X_mm = 0.9
self.granularity_Y_mm = 0.9
self.granularity_X_mm = 20./8.
self.granularity_Y_mm = 80./48.
self.min_granularity_mm = 0.1
self.verbose = False

0 comments on commit 81aa27d

Please sign in to comment.