ATLAS Offline Software
Loading...
Searching...
No Matches
TrackCollHandle_TrkSegment.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7// //
8// Implementation of class TrackCollHandle_TrkSegment //
9// //
10// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11// Initial version: February 2008 //
12// //
14
18#include "VP1Base/IVP1System.h"
19#include "VP1Base/VP1QtUtils.h"
23#include "TrkSegment/Segment.h"
25
26//____________________________________________________________________
31
32
34 = VP1QtUtils::environmentVariableIsOn("VP1_ALWAYS_SHOW_ALL_TRACK_COLLECTIONS");
35
36//____________________________________________________________________
38{
39 //There must be at least one of the trackers available for this to make sense.
42 sys->messageDebug("TrackCollHandle_TrkSegment::availableCollections: Neither"
43 " Pixel, SCT, TRT or Muon geometry available. Won't"
44 " look in event store for Trk::Track collections");
45 return {};
46 }
47
48 QStringList keysInSG = VP1SGContentsHelper(sys).getKeys<Trk::SegmentCollection>();
49 if (keysInSG.isEmpty()||Imp::alwaysShowAllTrackColls)
50 return keysInSG;
51
52 QRegExp needsMuonsPattern("Converted.*|.*MBoy.*|.*Moore.*|.*Mu.*|.*Staco.*");
53 QRegExp needsAllIDPattern(".*Id.*|.*ID.*|.*InDet.*|.*Inner.*");
54 QRegExp needsTRTPattern(".*Trt.*|.*TRT.*|.*trt.*");
55
56 const bool jobcfgAllID
60
61 QStringList outkeys;
62
63 for (const QString& key : keysInSG) {
64 if (!VP1JobConfigInfo::hasMuonGeometry() && needsMuonsPattern.exactMatch(key)) {
65 sys->messageDebug("TrackCollHandle_TrkSegment::availableCollections: Ignoring key '"
66 +key+"' since muon geometry is not present in job.");
67 continue;
68 }
69 if (!VP1JobConfigInfo::hasTRTGeometry() && needsTRTPattern.exactMatch(key)) {
70 sys->messageDebug("TrackCollHandle_TrkSegment::availableCollections: Ignoring key '"
71 +key+"' since TRT geometry is not present in job.");
72 continue;
73 }
74 if (!jobcfgAllID && needsAllIDPattern.exactMatch(key)) {
75 sys->messageDebug("TrackCollHandle_TrkSegment::availableCollections: Ignoring key '"
76 +key+"' since pixel, sct and trt geometry are not all present in job.");
77 continue;
78 }
79 outkeys<<key;
80 }
81 return outkeys;
82
83}
84
85//____________________________________________________________________
91
92//____________________________________________________________________
97
98//____________________________________________________________________
103
104//____________________________________________________________________
106{
107 //Get collection:
108 const Trk::SegmentCollection *segmentColl(nullptr);
109 if (!VP1SGAccessHelper(systemBase()).retrieve(segmentColl, name())) {
110 common()->systemBase()->message("Error: Could not retrieve segment collection with key="+name());
111 return false;
112 }
113
114 //Make appropriate trk::segment handles:
115 hintNumberOfTracksInEvent(segmentColl->size());
116 int i(0);
117 Trk::SegmentCollection::const_iterator segItr, segItrEnd = segmentColl->end();
118 for ( segItr = segmentColl->begin() ; segItr != segItrEnd; ++segItr) {
119 if (*segItr)
120 addTrackHandle(new TrackHandle_TrkSegment(this,*segItr));
121 else
122 common()->systemBase()->messageDebug("WARNING: Ignoring null Trk::Segment pointer.");
123
124 if (!(i++%100))
126 }
127
128 return true;
129}
130
131//____________________________________________________________________
133{
134 if (!TrackCollHandleBase::cut(handle))
135 return false;
136
137 //fixme: more?
138 return true;
139}
140
141//____________________________________________________________________
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
void messageDebug(const QString &) const
void updateGUI()
void message(const QString &) const
TrackSysCommonData * common() const
void hintNumberOfTracksInEvent(unsigned)
const QString & name() const
virtual bool cut(TrackHandleBase *)
void addTrackHandle(TrackHandleBase *)
TrackCollHandleBase(TrackSysCommonData *, const QString &name, TrackType::Type)
void visibleStateUpdated(TrackHandle_TrkSegment *)
TrackCollHandle_TrkSegment(TrackSysCommonData *, const QString &name)
void setupSettingsFromControllerSpecific(TrackSystemController *)
static QStringList availableCollections(IVP1System *)
SoMaterial * currentMaterial() const
bool visible() const
const Trk::Segment * trkSegmentPointer() const
VisibleObjectToMaterialHelper< Trk::Segment > * visTrkSegmentsToMaterialHelper() const
IVP1System * systemBase() const
static bool hasTRTGeometry()
static bool hasPixelGeometry()
static bool hasSCTGeometry()
static bool hasMuonGeometry()
static bool environmentVariableIsOn(const QString &name)
QStringList getKeys() const
void setState(const objectT *, SoMaterial *mat)
DataVector< Trk::Segment > SegmentCollection