![]() |
Classes | |
class | evt::ComponentGroup< Component > |
Common class for groups of components of the Event hierarchy. More... | |
class | evt::Event |
class | evt::Header |
Global event header. More... | |
Modules | |
Shower | |
Surface Event | |
Fluorescence Event | |
User Data | |
In the example above, a copy of a utl::TraceI object is returned from the event, so making the assignment t[300]=60
does not alter the evt::Event contents. In contrast, consider this code:
In this case, the return-by-reference in the first line provides a handle into the utl::TraceI object, allowing us to alter the trace in the evt::Event. In short, if you are attempting to change the values stored within data structures in the event, you must use return-by-reference semantics.Most Event functions also provide an option to return a const reference. For example, the sevt::PMT interface contains a function const utl::TraceI& GetFADCTrace(..arguments..)
. This provides access to the FADC information (by reference), but disallows changing it. Using reference semantics is more efficient than returning an object since no copying is required, and should therefore be used in cases where you only want to read pre-existing data.Iterators over evt::Event components are also provided in both const and non-const versions. If you need to change the value of an object being iterated over, you must use the non-const form. If you are just reading information, the const form is safer.
We'll refer to this as the Get/Make/Has protocol. As a specific example of an optional component, consider the Monte Carlo truth belonging to an sevt::PMT.
This Get/Make/Has protocol is used by physics modules to check for the presence or absence of components, determine if the required processing has been done at various stages of computation, and create components when appropriate.Enumerated components are Event components which exist in multiple instances, such as components representing Stations, Telescopes, PMTs, pixels and so forth. The Get/Make/Has protocol described above is used with enumerated components by specifying a component index as an argument to the Get/Make/Has method:
Existing enumerated components can also be accessed by iterators. For example:
Use of iterators is the preferred method for accessing existing enumerated components. The reason is that use of the iterators helps to avoid failures due to inadvertent requests for non-existing components.Finally, MultiTrace components are used to hold collections of traces each of which is labeled by the source generating the trace. For instance, in a Monte Carlo simulation of the SD, one can store separate FADC traces for the electron, muon and photon components of a total trace. Such components can be accessed by explicitly specifying an enumeration representing the trace source, or by using iterators to step through all available sources: