@@ -4,19 +4,86 @@ ldmx-sw is organized into "modules" that contain related code, the `Framework` m
44is of particular importance since it defines the core processing interfaces and handles
55reading/writing data from/to the ROOT files.
66
7- ## Where is the ` main ` ?
8- Many developers, especially those who are more familiar with C++, will want to know
9- where the ` fire ` executable is defined.
10- ` fire ` is defined within ` Framework/app/fire.cxx ` and this file reveals the overall
11- flow of the program.
7+ The overall flow of a successful execution of ` fire ` goees through two stages.
128
1391 . Configure - run the provided Python script and then extract the run configuration
1410 from the Python objects that were created when the script was run.
15112 . Run - execute the configured run. The ` framework::Process ` class is the main object
1612 that handles the execution.
1713
18- ## How does Python get run?
14+ ~~~ admonish question collapsible=true title="Where is the main?"
15+ Many developers, especially those who are more familiar with C++, will want to know
16+ where the `fire` executable is defined.
17+ `fire` is defined within `Framework/app/fire.cxx` and this file reveals the overall
18+ flow of the program.
19+ ~~~
20+
21+ ~~~ admonish question collapsible=true title="How does Python get run?"
1922We launch Python from within our C++ program by
2023[embedding Python](https://docs.python.org/3/extending/embedding.html).
2124In the configuration area of `Framework`, you'll see may of these calls to Python's
2225C interface (like `Py_InitializeEx()` for example).
26+ ~~~
27+
28+ ~~~ admonish question collapsible=true title="Why use Python for configuration?"
29+ It's easier than maintaining our own language for configuration.
30+
31+ The sheer number of configuration parameters makes it necessary to organize
32+ them based on which parts of the software they correspond to.
33+ This then necessitates some kind of configuration language in order
34+ to instruct the software of the values for the multitude of parameters.
35+
36+ Geant4 has a similar issue and chose to develop their own configuration
37+ language -- search "Geant4 macro commands" online to see what it looks like.
38+ Besides being a huge technical debt in order to maintain such a language,
39+ we also then lose all of the helpful benefits of running Python.
40+ Users can use Python libraries (like `sys`, `os`, and `argparse`) to
41+ allow for their configuration to be "smarter" and inspect command line
42+ arguments as well as environment variables.
43+ We [can implement checks on the configuration in Python](https://github.com/LDMX-Software/ldmx-sw/issues/1303)
44+ in order to catch any configuration issues as early as possible.
45+ ~~~
46+
47+ We require ldmx-sw to do a lot of different tasks and the Framework is present
48+ to make sure those different tasks can be developed on top of a known structure.
49+ The following pieces of Framework helps introduce the vocabulary as well as explain how they are used.
50+
51+ Each of these classes in C++ has a "mirror" Python class that is used to configure it.
52+ While the Python configuration class is not strictly necessary for the configuration system
53+ to function as intended, it is very helpful to keep parameters organized and have the
54+ configuration understandable.
55+
56+ ~~~ admonish example
57+ A C++ producer that is declared like
58+ ```cpp
59+ class MyProducer : public framework::Producer {
60+ ```
61+ would have a mirror python configuration class defined like
62+ ```python
63+ class MyProducer(ldmxcfg.Producer):
64+ ```
65+ This mirroring helps point out that all the configuration parameters
66+ within the Python `MyProducer` are meant to be used by the C++ `MyProducer`.
67+ ~~~
68+
69+ #### Processor
70+ A processor is the main object that developers of ldmx-sw interact with.
71+ They are used to create the objects within an event ("Producer") and analyze
72+ those objects ("Analyzer").
73+ A processor is given access to the event where it can access the event objects
74+ from an input file or produced by earlier producers.
75+ They can also be used to fill histograms which are stored into the output
76+ histogram file and provided "storage hints" that can be used to decide if
77+ a specific event should be written into the output event file.
78+
79+ #### Conditions
80+ A "condition" is an object that is the same for many events in sequence (like a table of
81+ electrical gains or the "geometry" of the detector).
82+ Conditions are provided by "Conditions Object Providers" that can be written by ldmx-sw
83+ developers.
84+ These providers only construct the conditions themselves when the condition is requested
85+ by a processor. They take information from the current event to see how to configure
86+ the condition that is being constructed and how long the constructed condition is valid
87+ for ("interval of validity" or IOV).
88+ The Framework then can come back to the provider to construct a new condition if the
89+ condition that was previously provided is not valid anymore.
0 commit comments