![]() |
FairShip
|
This folder contains the necessary processors to create DIS events from input muons, and the generator to replay the created daughters with Geant4.
For this generator, -i/--firstEvent (or NewMuDISGenerator::Init's startEvent) is a zero-based muon entry in the supplied MuonDIS tree or chain. In filtered files this indexes the retained muons, not their original entry numbers. All retained DIS interactions of that muon and subsequent muons are available, in material order. -n limits the number of input muon entries (-n -1: all remaining; -n 0: none), including muons with no DIS interactions. If no -n or –nEvents option is given, it will default to 100 DIS interactions, as 100 input muons could represent a very large number of DIS interactions to process. All DIS interactions of the selected muons are simulated. In C++, call SetNevents(nMuons) before Init to select this limit; GetNevents() returns the resulting number of DIS interactions for the FairRoot event loop. A start equal to the number of muon entries gives zero events; negative starts and starts beyond the end are rejected.
Replay uses each material's stored muon_nDISevt_<VOL> count and mudis_nDISdaughters_<VOL> daughter ranges. Filtering updates both, so replay does not need the original number of generated DIS interactions. After all materials in one muon entry are exhausted, replay advances to the next muon. Inconsistent vector lengths, negative counts, missing muon tracks and daughter totals that disagree with the stored particles reject initialization. Replay also validates each loaded muon before adding any tracks and returns kFALSE on inconsistent input.
The weight of the MCTracks associated with the daughters, MCTrack.fW, is the wDIS, i.e. input muon weight (also in MCTrack[0].fW) times density times length, divided by number of DIS events generated per input muon (also saved in a separate branch). To find the correct cross section for having a realistic physics weight, one should use the muon momentum used per DIS interaction, saved as well in a separate branch.
The main simulation macro selects this generator via --NewMuDIS (--MuDIS there still selects the legacy generator):
The simulation macro calls RegisterOutputBranches(sink.GetOutTree()) after run.Init() and before replay. Other drivers can use the same method; the generator must outlive the output tree. Each simulated cbmsim event contains:
| Branch | Type | Meaning |
|---|---|---|
| muDIS_material | TString | Material label of the replayed interaction; replaces DISMaterial, so analysis need not translate an enum from another software version. |
| muDIS_muEntry | Int_t | Zero-based input muon entry across the input chain, including the start offset. For filtered input this refers to the filtered tree. |
| muDIS_disIndex | Int_t | Zero-based DIS index within that muon's current material in the input tree (fnmuDis before advancement). |
| muDIS_xsec | Double_t | Always -1 until the input cross sections are reliable. |
| muDIS_pPythia | Double_t | Beam momentum from muon_pPythia_<material>, in GeV/c. |
| muDIS_nGenerated | std::vector<Int_t> | Actual counts before filtering from muon_nDISGenerated_<material>, in MatTypeStr order: MS, UBT, SBTsens, SBTfr, SSTsens, SSTfr, HE, AIR, HeBalloon, REST. -1 means not crossed; 0 means crossed but no interactions generated. |
GetMaterial() still exposes the enum value after a successful ReadEvent().
The simulation macro calls python/MuDISGenerator_postProcessing.py after simulation. It appends the original muon's UBT, SBT, SST and TD points to each event's corresponding detector branches, retaining only points with GetZ() < DISvz. Points at the DIS vertex or downstream are excluded. Copied points refer to MCTrack[0] (the incoming muon) and the new event ID; simulated points and file metadata are preserved. The helper matches the generator's input order, material counts and starting muon entry, including filtered inputs and runs ending partway through a muon. For every output event it checks that muDIS_muEntry, muDIS_material and muDIS_disIndex match the interaction it is about to use, and stops with an error, leaving the output unchanged, if they differ. It must run before any output event skimming or reordering.
Path discovery uses the MC start and the first recorded muon hit in UBT, SBT, each of Tr1–Tr4, and TD. Available hits are ordered in z. A non-forward (pz <= 0) selected measurement rejects the muon.
prepareEvents.py loads the shield map from the geometry's shieldName and muShield.Entrance[0]. Explicit maps can be supplied with --muon-shield-field-map and --muon-shield-field-z. C++ callers configure MuDISProcessor::SetMuonShieldField(map, geometry) (or the same method on MuGeoProcessor) and retain ownership of both objects. A missing map is an error for a muon without UBT in a geometry containing shield magnets, since the field cannot be inferred from material shapes. Muons starting upstream of --z_min (default 2500 cm) are only counted in the end-of-run summary; their paths are built as described above.
Only magnet volumes inside MuonShieldArea contribute to MS. Magnetic trajectories are navigated as chords refined to a 0.0001 cm interpolation deviation tolerance; geometry navigation and DIS vertex sampling use the same chords. POCAs between measurements set switching z planes; each line remains anchored to its own position, momentum and time. Times before a reference measurement are extrapolated backwards. DIS vertices are sampled uniformly in path length. MS sampling uses at most the last 20 cm of accumulated material z, excluding gaps, converted to actual trajectory length.
Transverse gaps at the switching planes are excluded from the path length. The diagnostic summary counts the routes prepared during initialization: UBT backward extrapolation, an MC start in field, and an MC start in a field-free region (which can subsequently enter field). These are mutually exclusive counts per initialized muon, before material navigation; failed magnetic transport remains in the rejected-muon count. Starts at or beyond the maximum z are counted separately as skipped. All counts reset for each processing run. At the end of processing, LOG(info) reports rejected muons, the number of switches and muons with a transverse gap above the configured threshold, and the largest gap. Set the threshold with --poca-jump-threshold <cm> in prepareEvents.py, or MuDISProcessor::SetPocaJumpThreshold(cm) in C++. The default is 1 cm, and a gap equal to the threshold is not counted.
The end-of-run summary also reports sums of MCTrack[0].fW (via GetWeight()) for the muon counters, including geometry routes, rejections, and muons with large POCA jumps. Each muon contributes its weight once to each applicable count, independent of the number of generated DIS events. Charge counts use the existing momentum cut; the no-hit count is diagnostic and does not reject the muon. The weighted skipped-path count includes muons with invalid or empty paths. Unreadable entries, missing tracks and non-muon entries in the general skipped-event count have no corresponding muon weight and are not included in that weighted count.
Each output muon has muon_path_length, the sum of the path intervals used for DIS vertex sampling, excluding REST, and muon_path_length_<MatType> branches for MS, UBT, SBTsens, SBTfr, SSTsens, SSTfr, HE, AIR, HeBalloon, and REST. These lengths are in cm and exclude transverse POCA jumps. The MS length uses only the last 20 cm in accumulated z (or the full MS path if shorter), converted to trajectory length, matching the vertex sampling and DIS weight interval. The full REST length is saved separately in muon_path_length_REST.
The end-of-run Muon path totals lines accumulate these same lengths, once per output muon, independently of the number of DIS interactions. Each category (including REST) reports sum(L) and sum(fW*L) in cm, plus the count and sum(fW) of crossing muons (positive path length). The overall line excludes REST from the lengths and counts all output muons, including those with zero total DIS path length. Totals reset each run and are printed with 17 significant digits for combining jobs.
Sum the printed quantities across jobs before dividing: use sum(L) divided by the crossing count for a conditional mean, or sum(fW*L) / sum(fW) for its MC-weighted counterpart. For means over all output muons, including zero lengths, use the overall line's count or weight sum as the denominator. A weighted mean is undefined when its weight sum is zero. These are DIS material categories, not individual geometry material names; the MS total uses the restricted sampling interval, not the full shield trajectory.
HeBalloon groups the helium balloon liner walls and both lids. In the veto geometry these are the skin of the HeBalloon volume around decay_medium; the helium gas remains in HE. The liner has its own DIS branches and filter histograms. REST remains the last category and is excluded from DIS generation.
prepareEvents.py --seed INTEGER seeds both Pythia6 and ROOT. Seeds wrap into [1, 899999999]; without this option a nanosecond-resolution time seed is used. The effective seed is logged. --check-all-volumes enables the optional inclusive geometry scan (also available as MuDISProcessor::CheckAllVolumes()).
The filter preserves both generation metadata values for every material, even when none of that material's DIS events survive.