 |
Belle II Software
release-05-02-19
|
1 #include <display/modules/display/DisplayModule.h>
3 #include <framework/dataobjects/DisplayData.h>
4 #include <display/DisplayUI.h>
5 #include <display/EVEVisualization.h>
6 #include <display/EveGeometry.h>
7 #include <mdst/dataobjects/Track.h>
8 #include <mdst/dataobjects/TrackFitResult.h>
9 #include <simulation/dataobjects/MCParticleTrajectory.h>
11 #include <framework/datastore/StoreArray.h>
12 #include <framework/datastore/StoreObjPtr.h>
13 #include <framework/gearbox/Gearbox.h>
14 #include <framework/core/Path.h>
16 #include <tracking/dataobjects/RecoTrack.h>
17 #include <tracking/dataobjects/RecoHitInformation.h>
18 #include <genfit/GFRaveVertex.h>
20 #include <TApplication.h>
21 #include <TEveManager.h>
29 setDescription(
"Interactive visualisation of Monte Carlo, intermediate and reconstructed objects, plus geometry. See https://confluence.desy.de/display/BI/Software+/EventDisplay for detailed documentation.");
31 addParam(
"options", m_options,
32 "Drawing options for RecoTracks, a combination of DHMP. See EVEVisualization::setOptions or the display.py example for an explanation.",
34 addParam(
"showMCInfo", m_showMCInfo,
"Show Monte Carlo information (MCParticles, SimHits)",
true);
35 addParam(
"assignHitsToPrimaries", m_assignToPrimaries,
36 "If true, hits created by secondary particles (after scattering, decay-in-flight, ...) will be assigned to the original primary particle.",
38 addParam(
"showAllPrimaries", m_showAllPrimaries,
39 "If true, all primary MCParticles will be shown, regardless of wether hits are produced.",
true);
40 addParam(
"hideSecondaries", m_hideSecondaries,
"If true, secondary MCParticles (and hits created by them) will not be shown.",
42 addParam(
"showCharged", m_showCharged,
43 "If true, all charged MCParticles will be shown, including secondaries (implies disabled assignHitsToPrimaries). May be slow.",
45 addParam(
"showNeutrals", m_showNeutrals,
46 "If true, all neutral MCParticles will be shown, including secondaries (implies disabled assignHitsToPrimaries). May be slow.",
48 addParam(
"showTrackLevelObjects", m_showTrackLevelObjects,
49 "If true, fitted Tracks, GFRave Vertices and ECLCluster objects will be shown in the display.",
true);
50 addParam(
"showRecoTracks", m_showRecoTracks,
51 "If true, track candidates (RecoTracks) and reconstructed hits will be shown in the display.",
false);
52 addParam(
"showCDCHits", m_showCDCHits,
53 "If true, CDCHit objects will be shown as drift cylinders (shortened, z position set to zero).",
false);
54 addParam(
"showTriggerObjects", m_showTriggerObjects,
55 "If true, CDCHit objects will be assigned to trigger segments and trigger tracks will be shown.",
false);
56 addParam(
"showBKLM2dHits", m_showBKLM2dHits,
57 "If true, BKLM2dHit objects will be shown in the display",
true);
58 addParam(
"showEKLM2dHits", m_showEKLM2dHits,
59 "If true, EKLMHit2d objects will be shown in the display",
true);
60 addParam(
"showARICHHits", m_showARICHHits,
61 "If true, ARICHHit objects will be shown.",
false);
62 addParam(
"automatic", m_automatic,
63 "Non-interactively save visualisations for each event. Note that this still requires an X server, but you can use the 'Xvfb' dummy server by running basf2 using 'xvfb-run -s \"-screen 0 640x480x24\" basf2 ...' to run headless.",
65 addParam(
"fullGeometry", m_fullGeometry,
66 "Show full geometry instead of simplified shapes. Further details can be enabled by changing the VisLevel option for Eve -> Scenes -> Geometry Scene -> Top_1.",
68 addParam(
"hideObjects", m_hideObjects,
69 "Objects which are to be hidden (can be manually re-enabled in tree view). Names correspond to the object names in the 'Event'. (Note that this won't work for objects somewhere deep in the tree, only for those immediately below 'Event'.)", {});
70 addParam(
"customGeometryExtractPath", m_customGeometryExtractPath,
"Path to custom file with geometry extract.", std::string(
""));
71 addParam(
"hideVolumes", m_hideVolumes,
72 "List of volumes to be hidden (can be re-enabled in Eve panel / Geometry scene. The volume and all its daughters will be hidden.", {});
73 addParam(
"deleteVolumes", m_deleteVolumes,
74 "List of volumes to be deleted. The volume and all its daughters will be deleted completely. Uses Regular Expressions (RE)! If the expression starts with '#', only daughters are removed (# is removed for RE)", {});
78 if ((!gApplication) || (gApplication->TestBit(TApplication::kDefaultApplication))) {
79 new TApplication(
"ROOT_application", 0, 0);
120 m_display->
addParameter(
"Assign hits to primary particles", getParam<bool>(
"assignHitsToPrimaries"), 1);
127 m_display->
addParameter(
"Show tracks, vertices, gammas", getParam<bool>(
"showTrackLevelObjects"), 0);
131 if (detectorName !=
"Belle2Detector") {
132 B2INFO(
"Non-standard detector '" << detectorName <<
"' used, switching to full geometry.");
158 B2WARNING(
"Display window closed, continuing with next module. (hit Ctrl+C to exit)");
167 B2WARNING(
"assignHitsToPrimaries and showCharged/showNeutrals can not be used together!");
197 for (std::string colName : recoTrackArrays) {
199 for (
const RecoTrack& recoTrack : recoTracks) {
200 if (colName !=
"RecoTracksMpl") {
222 for (
int i = 0 ; i < testbeamROIs.
getEntries(); i++)
228 for (
auto& hit : cdchits)
234 for (
const auto& i : arrayList) {
236 for (
auto& hit : tshits)
242 for (std::string colName : trgTrackArrays) {
252 for (
auto& hit : bklmhits)
258 for (
auto& hit : eklmhits)
264 for (
auto& hit : arichhits)
271 for (
const Track& track : tracks)
275 const int nVertices = vertices.getEntries();
276 for (
int i = 0; i < nVertices; i++) {
295 for (
const KLMCluster& cluster : klmclusters) {
void hideObjects(const std::vector< std::string > &names)
hide objects with the given names.
bool getReturnValue() const
Return value for current event, only makes sense if allowFlaggingEvents(true) was called.
void setHideVolumes(const std::vector< std::string > &volumes)
List of volumes to be hidden (can be re-enabled in Eve panel / Geometry scene.
bool m_hideSecondaries
If true, secondary MCParticles (and hits created by them) will not be shown.
void addUnassignedRecoHits(const StoreArray< T > &hits)
After adding recohits for tracks/candidates, this function adds the remaining hits in a global collec...
@ c_Simplified
a simplified Belle II geometry.
void terminate() override
Terminate gEve to avoid problems with root's cleanup.
bool startDisplay()
Start interactive display for current event.
std::vector< std::string > m_deleteVolumes
List of volumes to be deleted.
EVEVisualization * m_visualizer
Pointer to visualizer.
void allowFlaggingEvents(const std::string &description="")
Show control for flagging events (to set module return value).
void addECLCluster(const ECLCluster *cluster)
Add a reconstructed cluster in the ECL.
static Gearbox & getInstance()
Return reference to the Gearbox instance.
Control TEve browser user interface.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
bool m_showRecoTracks
Whether to show RecoTracks.
bool m_showCharged
If true, all charged primary and secondary MCParticles will be shown, regardless of wether hits are p...
void clearEvent()
remove all event data in current event.
bool hasCondition() const
Returns true if at least one condition was set for the module.
void showUserData(const DisplayData &displayData)
Add user-defined data (labels, points, etc.)
void addCDCTriggerSegmentHit(const std::string &collectionName, const CDCTriggerSegmentHit *hit)
show outline of track segments.
bool m_assignToPrimaries
If true, hits created by secondary particles (e.g.
void makeTracks()
Create visual representation of all tracks.
Track created by the CDC trigger.
bool m_showTrackLevelObjects
If true, fitted RecoTracks, GFRave Vertices and ECLGamma objects will be shown in the display.
DisplayUI * m_display
pointer to actual display
@ c_nPhotons
CR is split into n photons (N1)
static std::vector< std::string > getArrayList(DataStore::EDurability durability=DataStore::c_Event)
Return list of array names with matching type.
std::vector< std::string > m_hideVolumes
List of volumes to be hidden (can be re-enabled in Eve panel / Geometry scene.
void addGeometry(EType visMode)
Add TGeo geometry to Eve (only needs to be done once.)
bool m_showCDCHits
If true, CDCHit objects will be shown as drift cylinders (shortened, z position set to zero).
void event() override
Show various reconstructed or simulated objects in the event viewer until the next event is requested...
void addTOPDigits(const StoreArray< TOPDigit > &digits)
Add TOPDigits (shown aggregated per module).
void setVisualisationMode(EType visMode)
switch to given visualisation mode.
void initialize() override
Sets up geometry if needed.
void addBKLMHit2d(const BKLMHit2d *bklm2dhit)
Add a reconstructed 2d hit in the BKLM.
bool m_showAllPrimaries
If true, all primary MCParticles will be shown, regardless of wether hits are produced.
bool m_showEKLM2dHits
If true, EKLMHit2d objects will be shown in the display.
void addTrackCandidate(const std::string &collectionName, const RecoTrack &recoTrack)
Add a RecoTrack, to evaluate track finding.
void setDeleteVolumes(const std::vector< std::string > &volumes)
List of volumes to be removed.
bool m_showARICHHits
If true, ARICHHit objects will be shown as squares, corresponding to channel pixels.
This is the Reconstruction Event-Data Model Track.
void setCustomExtractPath(const std::string &extractPath)
Set custom path to the geometry extract (to change originally hard-coded value)
Produces visualisation for MCParticles, simhits, genfit::Tracks, geometry and other things.
void addROI(const ROIid *roi)
Add a Region Of Interest, computed by the PXDDataReduction module.
void addCDCTriggerTrack(const std::string &collectionName, const CDCTriggerTrack &track)
Add a CDCTriggerTrack.
void addTrackCandidateImproved(const std::string &collectionName, const RecoTrack &recoTrack)
Add a RecoTrack, but use stored genfit track representation to make visualisation objects.
Abstract base class for different kinds of events.
Type-safe access to single objects in the data store.
virtual std::string getString(const std::string &path="") const noexcept(false) override
Get the parameter path as a string.
void addEKLMHit2d(const EKLMHit2d *bklm2dhit)
Add a reconstructed 2d hit in the EKLM.
void addCDCHit(const CDCHit *hit, bool showTriggerHits=false)
show CDCHits directly.
void addKLMCluster(const KLMCluster *cluster)
Add a reconstructed cluster in the KLM.
bool m_fullGeometry
Show full geometry instead of simplified shapes.
MCTrack * addMCParticle(const MCParticle *particle)
Return MCTrack for given particle, add it if it doesn't exist yet.
void addARICHHit(const ARICHHit *hit)
Add recontructed hit in ARICH.
void addParameter(const std::string &label, ModuleParam< bool > ¶m, int level)
Generate UI elements so the given module parameter can be changed at run time.
const ModuleCondition * getCondition() const
Return a pointer to the first condition (or nullptr, if none was set)
void setAssignToPrimaries(bool on)
If true, hits created by secondary particles (e.g.
void addVertex(const genfit::GFRaveVertex *vertex)
Add a vertex point and its covariance matrix.
void setReturnValue(int value)
Sets the return value for this module as integer.
bool cumulativeIsOn() const
If true, DisplayModule shouldn't clear previous data (i.e.
@ c_Full
Full geometry converted from Geant4 (use this for non-standard Belle II setups!).
void showUserData(const DisplayData &displayData)
Add user-defined data (histograms, etc.).
void setOptions(const std::string &opts)
Set the display options.
bool m_showBKLM2dHits
If true, BKLMHit objects will be shown in the display.
std::string m_customGeometryExtractPath
Path to custom file with geometry extract.
void setHideSecondaries(bool on)
If true, secondary MCParticles (and hits created by them) will not be shown.
The event display module.
void addTrack(const Belle2::Track *belle2Track)
Add this genfit::Track to event data.
bool m_showTriggerObjects
If true, CDCHit objects will be assigned to trigger segments and trigger tracks will be shown.
std::string m_options
List of drawing options, see EVEVisualization::setOptions()
Class that bundles various TrackFitResults.
A Class to store the Monte Carlo particle information.
void clearEvent()
clear event data.
bool m_automatic
Non-interactively save visualizations for each event.
bool m_showMCInfo
Show Monte Carlo information (MCParticles, SimHits).
bool m_showNeutrals
If true, all neutral primary and secondary MCParticles will be shown, regardless of wether hits are p...
std::vector< std::string > m_hideObjects
objects which are to be hidden (can be manually re-enabled in tree view).
void addSimHits(const StoreArray< T > &hits)
Add all entries in the given 'hits' array (and the corresponding MCParticles) to the event scene.
int getEntries() const
Get the number of objects in the array.
@ c_PrimaryParticle
bit 0: Particle is primary particle.
std::string getPathString() const override
return the module name.