Skip to content

Commit 4048528

Browse files
Merge pull request #233 from sophiemiddleton/Mu2eDisplay
Large scale refinements to code base
2 parents f7fafc9 + f72876b commit 4048528

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3994
-2274
lines changed

CustomGUIv2/controller/MyNewMain.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ sap.ui.define(['rootui5/eve7/controller/Main.controller',
108108
},
109109

110110
showEventInfo : function() {
111-
let tinfo = "Event : " + this.fw2gui.eventid + " Sub Run :" + this.fw2gui.subrunid + " Run :" + this.fw2gui.runid;
111+
let tinfo = " Run :" + this.fw2gui.runid + " Sub Run :" + this.fw2gui.subrunid + "Event : " + this.fw2gui.eventid;
112112
document.title = tinfo;
113113
//this.byId("runInput").setValue(this.fw2gui.runid);
114114
//this.byId("eventInput").setValue(this.fw2gui.eventid);

CustomGUIv2/view/MyMain.view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<Input id="dateInput" width="100px" />
6464
</OverflowToolbar>
6565
<OverflowToolbar id="otb3">
66-
<Label text="test:">
66+
<Label text="AutoPlay (plcaeholder):">
6767
<layoutData>
6868
<OverflowToolbarLayoutData priority="Disappear" shrinkable="true" minWidth="40px" />
6969
</layoutData>

README.md

Lines changed: 8 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,12 @@ This repo contains the current EventDisplay source code, example fcls, tutorials
44

55
The EventDisplay is based on REve which is an updated version of the well-known and widely used TEve ROOT based Event Visualization Software. REve uses modernized infrastcutrue and allows Web Access for remote use.
66

7-
For more information about REve and the implementation for Mu2e see: https://mu2ewiki.fnal.gov/wiki/Eve7EventDisplay#Examples_of_the_Eve-7_Mu2e_Display.
8-
9-
# Useage
10-
11-
## Sequential on known file
12-
To use the display to scroll through events sequentially utilize either the ```nominal_example``` for nominal Mu2e geometry or ```extracted_example``` for the extracted geometry and run as you would any other .fcl:
13-
14-
```
15-
mu2e -c <chosen_geom.fcl> <filename.art>
16-
```
17-
18-
The current available options for the .fcl are located in the ```examples``` directory. There are four main examples:
19-
20-
* nominal_MDC2020.fcl: with the original CRV geometry, to be used the MDC2020 samples
21-
* nominal_MDC2025.fcl: with the MDC2025 CRV geometry assuming the common GDML
22-
* extracted_MDC2020.fcl: for those still using MDC2020 extracted samples, to be retired
23-
* extracted_MDC2025.fcl: for those doing extracted studies with MDC2025 samples
24-
* nominal_Run1A.fcl: Run1A CRV geometry MDC2025
25-
* nominal_Run2.fcl: full CRV geometry, MDC2025
26-
27-
These .fcl can be edited as you wish (adding or removing certain features), they should provide good starting points for any study.
28-
29-
## Go to an given event
30-
31-
There are a number of ways to go from your analysis to a visualized event. Utilities are provided in both rooutils [cite] and pyutils [https://github.com/Mu2e/pyutils/blob/main/pyutils/pydisplay.py]. There is also a custom script in this repo ```config/EventDisplay.sh``` the usage is as follows:
32-
33-
```
34-
./EventDisplay.sh --run 1201 --subrun 34 --event 15028 --dataset mcs.mu2e.ensembleMDS2cMix1BBTriggered.MDC2020ba_best_v1_3.art
35-
```
36-
37-
if you know the name of the dataset.
38-
39-
If you are working with an ntuple, you may not know all the commands to figure out its parent mcs. In this case run:
40-
41-
```
42-
./EventDisplay.sh --run 1201 --subrun 476 --event 1 --dataset nts.mu2e.ensembleMDS2cMix1BBTriggered.MDC2020ba_best_v1_3_v06_06_00.001201_00000476.root
43-
```
44-
45-
where the run, subrun and event numbers are identified from your analysis to be an event of interest in that root file.
46-
47-
48-
49-
# Tutorial
50-
51-
We are in the process of updating our Analysis Tools Tutorial material. In the meantime, please see: https://mu2ewiki.fnal.gov/wiki/EventDisplayTutorial
52-
53-
# Development
54-
55-
This code is still under development by the Mu2e Analysis Tools Group. The development team current consists of Sophie Middleton, Andy Edmonds and Namitha Chithiraseemadam. Please contact us to contribute.
7+
## Documentation
8+
9+
* [Getting Started](./documentation/GettingStarted.md)
10+
* [Examples](./documentation/examples.md).
11+
* [Fcl Options](./documentation/FclOptions.md).
12+
* [GUI Options](./documentation/GUIOptions.md).
13+
* [EventNavigation](./documentation/EventNavigation.md).
14+
* [Data Product Visualizaton](./documentation/DataProductVisualization.md).
5615

config/drawutils.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
int TRKtrans = 98;
44
int CALtrans = 100;
55
int CRYtrans = 90;
6-
int CRVtrans = 98;
6+
int Crvtrans = 98;
77
int BLtrans = 90;//BL = beamline elements
88

99
int maxlevel = 8; //8=calocrystals, moved to 10 for PA
@@ -15,10 +15,10 @@ int GeomLineWidth = 1;
1515
int TRKColor = 432; //kCyan = 432
1616
int CALColor = 432; //kCyan = 432
1717
int BLColor = 432; //kCyan = 432
18-
int CRVColor = 432; //kCyan = 432
18+
int CrvColor = 432; //kCyan = 432
1919

20-
int CRVBarColor = 632;
20+
int CrvBarColor = 632;
2121
int RecoTrackColor = 600; //kGreen
22-
int CRVHitColor = 600; //kBlue
22+
int CrvHitColor = 600; //kBlue
2323
int TrkHitColor = 632; //kBlue
2424
int TrkNoHitColor = 600; //kBlue

config/start_RemoteDisplay.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash
2+
3+
# Initialize variables
4+
PORT_NUM=""
5+
MACHINE_ID=""
6+
USERNAME=""
7+
8+
# --- Function to open browser based on OS ---
9+
open_browser() {
10+
local url=$1
11+
case "$(uname -s)" in
12+
Darwin)
13+
# macOS
14+
echo "Detected macOS. Opening Google Chrome..."
15+
open -a "Google Chrome" "$url"
16+
;;
17+
Linux)
18+
# Linux variants
19+
echo "Detected Linux. Attempting to open browser..."
20+
# Try specific commands for Chrome/Chromium, fall back to xdg-open
21+
if command -v google-chrome >/dev/null; then
22+
google-chrome "$url"
23+
elif command -v chromium-browser >/dev/null; then
24+
chromium-browser "$url"
25+
else
26+
xdg-open "$url"
27+
fi
28+
;;
29+
CYGWIN*|MINGW*|MSYS*)
30+
# Windows (Git Bash/Cygwin)
31+
echo "Detected Windows. Opening browser..."
32+
cmd.exe /c start "$url"
33+
;;
34+
*)
35+
echo "Unsupported OS. Please open the URL manually: $url"
36+
;;
37+
esac
38+
}
39+
40+
# --- Parse command-line arguments ---
41+
while [[ "$#" -gt 0 ]]; do
42+
case "$1" in
43+
--port)
44+
PORT_NUM="$2"
45+
shift; shift
46+
;;
47+
--machine)
48+
MACHINE_ID="$2"
49+
shift; shift
50+
;;
51+
--user)
52+
USERNAME="$2"
53+
shift; shift
54+
;;
55+
*)
56+
echo "Unknown parameter passed: $1"
57+
echo "Usage: $0 --port <number> --machine <id> --user <name>"
58+
exit 1
59+
;;
60+
esac
61+
done
62+
63+
# --- Validation ---
64+
if [ -z "$PORT_NUM" ] || [ -z "$MACHINE_ID" ] || [ -z "$USERNAME" ]; then
65+
echo "Error: Missing required arguments."
66+
echo "Usage: $0 --port <number> --machine <id> --user <name>"
67+
echo "Example: $0 --port 1234 --machine 05 --user sophie"
68+
exit 1
69+
fi
70+
71+
# --- Execution ---
72+
HOSTNAME="mu2egpvm${MACHINE_ID}.fnal.gov"
73+
URL="http://localhost:${PORT_NUM}/win1/"
74+
75+
open_browser "$URL"
76+
77+
echo "Establishing SSH tunnel for ${USERNAME}@${HOSTNAME} on port ${PORT_NUM}"
78+
ssh -KXY -L "${PORT_NUM}:localhost:${PORT_NUM}" "${USERNAME}@${HOSTNAME}"
79+
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Data Product Visualization in Mu2e Event Display
2+
3+
This document outlines the purpose and key features of the core C++ functions used in the Mu2e event display to visualize **Monte Carlo (MC)** and **Reconstructed (Reco)** data products. These functions convert abstract data objects into graphical elements using the **ROOT REve** framework, enabling detailed event inspection.
4+
5+
---
6+
7+
## MC Data Visualization
8+
9+
The following function displays simulated particle trajectories.
10+
11+
### $\text{MCInterface::AddMCTrajectoryCollection}$
12+
13+
This function processes collections of $\text{MCTrajectory}$ objects and renders them as colored lines in the detector scene.
14+
15+
| Feature | Description |
16+
| :--- | :--- |
17+
| **Input** | $\text{MCTrajectoryCollection}$ |
18+
| **Visualization** | **$\text{REveLine}$** for each trajectory. |
19+
| **Color Coding** | Line color is assigned based on the **particle's PDG ID** (e.g., electron is red, muon is black). |
20+
| **Filtering** | Draws only particles whose PDG ID is included in the user-defined $\text{particleIds}$ list. |
21+
| **Title Info** | Includes **Particle Name**, **SimParticle ID**, **Parent ID**, **Kinetic Energy**, and **Creation/Stopping Codes** for traceability. |
22+
23+
### $\text{MCInterface::AddSurfaceStepCollection}$
24+
25+
This function visualizes points where a $\text{SimParticle}$ crosses a defined detector or virtual surface.
26+
27+
| Feature | Description |
28+
| :--- | :--- |
29+
| **Input** | $\text{SurfaceStepCollection}$ |
30+
| **Visualization** | **$\text{REvePointSet}$** marker at the step's $\text{midPosition}$. |
31+
| **Color Coding** | Fixed to **kBlack** (in the current implementation) to distinguish them clearly from track lines. |
32+
| **Filtering** | Draws only steps made by particles whose PDG ID is in the user-defined $\text{particleIds}$ list. |
33+
| **Title Info** | Includes the **Surface ID name**, step **Position**, **Time**, **Momentum**, and **Energy Deposit** ($\text{edep}$). |
34+
35+
---
36+
37+
## Reconstructed (Reco) Data Visualization
38+
39+
These functions visualize the output of track fitting and hit clustering algorithms.
40+
41+
### $\text{DataInterface::FillKinKalTrajectory}$
42+
43+
This is the main orchestration function for visualizing reconstructed tracks ($\text{KalSeed}$) and their associated products.
44+
45+
| Feature | Description |
46+
| :--- | :--- |
47+
| **Input** | $\text{KalSeedPtrCollection}$ |
48+
| **Action** | Identifies the successful fit type ($\text{LoopHelix}$, $\text{CentralHelix}$, $\text{KinematicLine}$) and calls specialized functions to draw the trajectory and products. |
49+
| **Output** | Adds a **$\text{REveCompound}$** (**trackproducts**) to the scene, grouping all elements related to a single track. |
50+
| **Trajectory** | Uses $\text{AddKinKalTrajectory}$ to draw the path based on the chosen fit type. |
51+
| **Products** | Calls $\text{AddTrkStrawHit}$ (for hits) and $\text{AddKalIntersection}$ (for material/surface crossings). |
52+
53+
### $\text{DataInterface::AddKinKalTrajectory}$
54+
55+
Renders the smooth, mathematical path of a **$\text{KinKal}$ track fit**.
56+
57+
| Feature | Description |
58+
| :--- | :--- |
59+
| **Input** | $\text{KinKal}$ Trajectory ($\text{LoopHelix}$, $\text{CentralHelix}$, or $\text{KinematicLine}$) |
60+
| **Visualization** | **$\text{REveLine}$** generated by sampling the trajectory's equation across its time range at discrete steps ($\text{0.1}$ time units). |
61+
| **Title Info** | Includes **Particle Name**, **Momentum**, **Fit Parameters** ($\text{lam}$, $\text{rad}$, $\text{omega}$, $\text{d0}$, $\text{z0}$), and **Fit Consistency**. |
62+
63+
### $\text{DataInterface::AddTrkStrawHit}$
64+
65+
Visualizes the individual $\text{Tracker}$ hits that contributed to a track fit.
66+
67+
| Feature | Description |
68+
| :--- | :--- |
69+
| **Input** | $\text{TrkStrawHitSeed}$s from a $\text{KalSeed}$ |
70+
| **Visualization** | A **$\text{REveCompound}$** containing a **$\text{REvePointSet}$** (the hit position) and a **$\text{REveLine}$** (the $2\sigma$ error bar perpendicular to the track/wire). |
71+
| **Color Coding** | Uses **$\text{TrkHitColor}$** but switches to a **$\text{TrkNoHitColor}$** if the full drift constraint was *not* used in the fit. |
72+
73+
### $\text{DataInterface::AddKalIntersection}$
74+
75+
Marks where the track crosses significant surfaces within the detector geometry.
76+
77+
| Feature | Description |
78+
| :--- | :--- |
79+
| **Input** | $\text{KalIntersection}$ objects from a $\text{KalSeed}$ |
80+
| **Visualization** | **$\text{REvePointSet}$** marker. |
81+
| **Color Coding** | **kViolet** for intersections with material (where $\text{dMom} > 0.0$) and **kYellow** for intersections with virtual surfaces. |
82+
| **Title Info** | **Position**, **Time**, **Momentum/dMomentum**, and the name of the **Surface** intersected. |
83+
84+
### $\text{DataInterface::AddTrkHits}$
85+
86+
Visually links reconstructed tracks to the original hit collections.
87+
88+
| Feature | Description |
89+
| :--- | :--- |
90+
| **Input** | $\text{ComboHitCollection}$ and $\text{KalSeedPtrCollection}$ |
91+
| **Visualization** | **$\text{REvePointSet}$** at the position of each $\text{ComboHit}$. |
92+
| **Functionality** | **Filters** the $\text{ComboHits}$ by comparing their $\text{StrawId}$ against a set of $\text{StrawId}$s used in all $\text{KalSeeds}$. This highlights *only* the hits used for tracking. |
93+
| **Efficiency** | Uses a **$\text{std::set}$** to efficiently check $\text{StrawId}$ membership, preventing slow triple-nested loop searches. |
94+
95+
### $\text{DataInterface::AddTimeClusters}$
96+
97+
Visually displays clusters of hits used to determine the initial time ($\text{t0}$) for track seeds.
98+
99+
| Feature | Description |
100+
| :--- | :--- |
101+
| **Input** | $\text{TimeClusterCollection}$ |
102+
| **Visualization** | **$\text{REvePointSet}$** marker at the cluster's central position. |
103+
| **Title Info** | Cluster $\text{t0}$ and error. |
104+
105+
### $\text{DataInterface::AddCosmicTrackFit}$
106+
107+
Draws the simple straight-line fit for cosmic ray data.
108+
109+
| Feature | Description |
110+
| :--- | :--- |
111+
| **Input** | $\text{CosmicTrackSeedCollection}$ |
112+
| **Visualization** | **$\text{REveLine}$** segment. |
113+
| **Functionality** | Draws a line segment between the calculated track positions corresponding to the **first and last Y-coordinates** of the hits used in the fit. |

documentation/EventNavigation.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
## 🗺️ Event Navigation
2+
3+
During analysis, there are several methods available to navigate to a specific event within the Event Display.
4+
5+
---
6+
7+
### 1. Default Sequential Mode
8+
9+
The **default navigation mode** is sequential.
10+
11+
* By default, the setting `seqMode` is set to `true`.
12+
* The display begins at the **first event**.
13+
* Users can navigate to the next event in the sequence using the **GUI's navigation controls**.
14+
15+
---
16+
17+
### 2. Autoplay
18+
19+
The **Autoplay** option overrides the standard GUI navigation.
20+
21+
* When the "**autoplay**" checkbox is selected, the display will **stream all events sequentially** until it reaches the end of the file.
22+
23+
---
24+
25+
### 3. Go to an Event: GUI
26+
27+
The Event Display GUI includes **text entry boxes** that allow a user to jump directly to an event by specifying its **run** and **event number**.
28+
29+
* **Steps to Use (Currently a Placeholder):**
30+
1. Ensure the display is loaded in `seqMode`.
31+
2. Navigate to the **second event** using the `NextEvent()` function.
32+
3. Enter the desired run and event number into the text boxes.
33+
4. Select the **`Go()`** button, followed immediately by **`NextEvent()`**.
34+
35+
> **Note:** This is **not the recommended method** for navigation and is considered a placeholder feature.
36+
37+
---
38+
39+
### 4. Go to an Event: Scripts (Recommended Method)
40+
41+
The most robust way to navigate to a specific event is by using the custom script located in this repository: `config/EventDisplay.sh`.
42+
43+
#### A. Navigating with the Dataset Name
44+
45+
If you know the name of the **dataset** containing the event, use the following syntax:
46+
47+
```
48+
./EventDisplay.sh --run 1201 --subrun 34 --event 15028 --dataset mcs.mu2e.ensembleMDS2cMix1BBTriggered.MDC2020ba_best_v1_3.art```
49+
```
50+
51+
If you are working with an ntuple, you may not know all the commands to figure out its parent mcs. In this case run:
52+
53+
```
54+
./EventDisplay.sh --run 1201 --subrun 476 --event 1 --dataset nts.mu2e.ensembleMDS2cMix1BBTriggered.MDC2020ba_best_v1_3_v06_06_00.001201_00000476.root
55+
```
56+
57+
where the run, subrun and event numbers are identified from your analysis to be an event of interest in that root file.

0 commit comments

Comments
 (0)