How DigiSim works
The DigiSim package works by using a chain of "modifiers", which will
successive transformations to the input simulated hits. The
hits are then simply appended to the LCEvent, and get automatically
written to the output LCIO file. Fig.1 shows the DigiSim class
diagram, which is helpful to understand how DigiSim works. Note
that the ellipses represent the Marlin/C++ and the LCSim/Java
frameworks. Right below the frameworks are the framework-specific
liaison classes DigiSimProcessor and DigiSimDriver, whose interfaces
are imposed by the frameworks. All other classes have basically
the same interfaces and have the same functionality in the Java and C++
Figure 1: Class diagram for the
digitization simulation package DigiSim. Please note the
inheritance relationships represented by the solid arrows and the
containment (usage) relationships represented by the solid (dashed)
line and open arrows.
AbstractCalHitModifier, RandomNoise and FunctionModifier are abstract
classes, defining the
interfaces to be followed by their subclasses.
The frameworks, namely Marlin in C++ or LCSim in Java, take care of all
the I/O, and call specific DigiSim hooks for initialization, event
finalization. The hooks are actually defined by each framework,
hence DigiSimProcessor (DigiSimDriver) is the
only DigiSim class which knows about the Marlin (LCSim) framework, and
so abides by the interface
imposed for all Marlin Processors
These classes instantiate one digitizer per subdetector to be digitized.
The Digitizer class is responsible for managing the whole digitization
processing for its subdetector. During its initialization, all
the requested modifiers
instantiated and configured, according to the DigiSim configuration
file, or steering file.
The processing which takes place during the event loop is better
understood by analysing Fig.2. The modifiers will act on
transient copies of the
calorimeter hits (class TempCalHit),
which is used as
both input and output to the modifiers' event processing method.
The abstract class CalHitModifier
defines the interface to be inherited by the modifiers.
Figure 2 - Diagram illustrating the
event processing loop. (Click on the figure for better resolution)
At the event loop, events are
passed to the Digitizer,
which extracts the simulated hits (SimCalorimeterHits)
from an LCCollection (SimHitsLCCollection).
Simulated hits are converted into the transient hits (class TempCalHits) and passed through
a chain of modifiers. Each modifier modifies the input TempCalHits by applying their
own transformation. After all the modifiers have been processed,
the final TempCalHit
objects are finally converted into RawCalorimeterHits (including
some double to integer conversions), which are then stored into
a new LCCollection
(RawHitsLCCollection) and appended to the event. The
framework provides default processors/drivers
which take care of writing the modified events into the output file. In the Marlin/C++ version of
DigiSim, the framework also provides processors which can convert from
RawCalorimeterHits to CalorimeterHits>
and from RawCalorimeterHits to SimCalorimeterHits. Information on these conversions is in the "Configuring DigiSim and its
modifiers" section of this website.