ATLAS Offline Software
Loading...
Searching...
No Matches
PRDCollHandle_TRT.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
9#include <QColor>
10
13
17
18//____________________________________________________________________
20{
21 return VP1JobConfigInfo::hasTRTGeometry() ? VP1SGContentsHelper(sys).getKeys<InDet::TRT_DriftCircleContainer>() : QStringList();
22}
23
24//____________________________________________________________________
26public:
27 //Keep specific lists of handles here... i.e. those with a HT for instance
28 // std::vector<PRDHandle_TRT*> prdhandles;
30
31 //We only load these on demand!
33 const TRT_ID * idhelper = nullptr;
34
35 PRDCommonFlags::InDetPartsFlags indetpartsflags;
36 double minToT = 0.0;
37 double maxToT = 0.0;
38 int minLE = 0;
39 int maxLE = 0;
40 bool needToTCheck = false;
41 bool needLECheck = false;
42 bool requireHT = false;
43};
44
45//____________________________________________________________________
48{
49 m_d->trtdetmgr = 0;
50 m_d->idhelper = 0;
51 m_d->attempted_detmgrload = false;
53 m_d->minToT = -0.5*3.125;
54 m_d->maxToT = 24.5*3.125;
55 m_d->minLE = 0;
56 m_d->maxLE = 23;
57 m_d->needToTCheck = false;
58 m_d->needLECheck = false;
59 m_d->requireHT = false;
60}
61
62//____________________________________________________________________
67
68//____________________________________________________________________
70{
71 return QColor::fromRgbF(1.0, 1.0, 1.0);//white
72
73}
74
75//____________________________________________________________________
77{
78 assert(dynamic_cast<const InDet::TRT_DriftCircle*>(prd));
79 return new PRDHandle_TRT(this,static_cast<const InDet::TRT_DriftCircle*>(prd));
80}
81
82//____________________________________________________________________
84{
85 PRDHandle_TRT * handle = static_cast<PRDHandle_TRT*>(handlebase);
86 assert(handle);
87
88 if (m_d->needToTCheck) {
89 const double ToT = handle->driftCircle()->timeOverThreshold();
90 if (ToT<m_d->minToT)
91 return false;
92 if (ToT>m_d->maxToT)
93 return false;
94 }
95
96 if (m_d->needLECheck) {
97 const int LE = handle->driftCircle()->driftTimeBin();//returns 0..24. 24 means no LT bits.
98 if (LE>=0&&LE<24) {
99 if (LE<m_d->minLE)
100 return false;
101 if (LE>m_d->maxLE)
102 return false;
103 }
104 }
105
106
107 if (m_d->indetpartsflags!=PRDCommonFlags::All) {
108 if (handle->isBarrel()) {
109 if (!(handle->isPositiveZ()?(m_d->indetpartsflags&PRDCommonFlags::BarrelPositive):(m_d->indetpartsflags&PRDCommonFlags::BarrelNegative)))
110 return false;
111 } else {
112 if (!(handle->isPositiveZ()?(m_d->indetpartsflags&PRDCommonFlags::EndCapPositive):(m_d->indetpartsflags&PRDCommonFlags::EndCapNegative)))
113 return false;
114 }
115 }
116
117 if (m_d->requireHT&&!handle->highLevel())
118 return false;
119
120 return true;
121}
122
123//____________________________________________________________________
124void PRDCollHandle_TRT::setPartsFlags(PRDCommonFlags::InDetPartsFlags flags ) {
125 //NB: The code is this method is very similar in PRDCollHandle_Pixel::setPartsFlags, PRDCollHandle_SCT::setPartsFlags,
126 //PRDCollHandle_TRT::setPartsFlags and and PRDCollHandle_SpacePoints::setPartsFlags
127 //Fixme: base decision to recheck on visibility also!
128
129 if (m_d->indetpartsflags==flags)
130 return;
131
132 bool barrelPosChanged = (m_d->indetpartsflags&PRDCommonFlags::BarrelPositive)!=(flags&PRDCommonFlags::BarrelPositive);
133 bool barrelNegChanged = (m_d->indetpartsflags&PRDCommonFlags::BarrelNegative)!=(flags&PRDCommonFlags::BarrelNegative);
134 bool endcapPosChanged = (m_d->indetpartsflags&PRDCommonFlags::EndCapPositive)!=(flags&PRDCommonFlags::EndCapPositive);
135 bool endcapNegChanged = (m_d->indetpartsflags&PRDCommonFlags::EndCapNegative)!=(flags&PRDCommonFlags::EndCapNegative);
136 bool barrelChanged = (barrelPosChanged || barrelNegChanged);
137 bool endcapChanged = (endcapPosChanged || endcapNegChanged);
138 m_d->indetpartsflags=flags;
139
141 std::vector<PRDHandleBase*>::iterator it(getPrdHandles().begin()),itE(getPrdHandles().end());
142 for (;it!=itE;++it) {
143 PRDHandle_TRT* handle = static_cast<PRDHandle_TRT*>(*it);
144 if (handle->isBarrel()) {
145 if (barrelChanged&&(handle->isPositiveZ()?barrelPosChanged:barrelNegChanged))
146 recheckCutStatus(handle);
147 } else {
148 if (endcapChanged&&(handle->isPositiveZ()?endcapPosChanged:endcapNegChanged))
149 recheckCutStatus(handle);
150 }
151 }
153}
154
155//____________________________________________________________________
157{
158 double newminToT = (nbins-0.5)*3.125;
159 if (m_d->minToT==newminToT)
160 return;
161 bool cut_relaxed = (newminToT<m_d->minToT);
162 m_d->minToT=newminToT;
163 m_d->needToTCheck = (m_d->minToT>0.0||m_d->maxToT<24*3.125);
164 if (cut_relaxed)
166 else
168}
169
170//____________________________________________________________________
172{
173 double newmaxToT = (nbins+0.5)*3.125;
174 if (m_d->maxToT==newmaxToT)
175 return;
176 bool cut_relaxed = (newmaxToT>m_d->maxToT);
177 m_d->maxToT=newmaxToT;
178 m_d->needToTCheck = (m_d->minToT>0.0||m_d->maxToT<24*3.125);
179 if (cut_relaxed)
181 else
183}
184
185//____________________________________________________________________
187{
188 int newminLE = i-1;
189 if (m_d->minLE==newminLE)
190 return;
191 bool cut_relaxed = (newminLE<m_d->minLE);
192 m_d->minLE=newminLE;
193 m_d->needLECheck = (m_d->minLE>0||m_d->maxLE<23);
194 if (cut_relaxed)
196 else
198}
199
200//____________________________________________________________________
202{
203 int newmaxLE = i-1;
204 if (m_d->maxLE==newmaxLE)
205 return;
206 bool cut_relaxed = (newmaxLE>m_d->maxLE);
207 m_d->maxLE=newmaxLE;
208 m_d->needLECheck = (m_d->minLE>0||m_d->maxLE<23);
209 if (cut_relaxed)
211 else
213}
214
215//____________________________________________________________________
217{
218 if (m_d->requireHT==reqHT)
219 return;
220 m_d->requireHT=reqHT;
221 if (m_d->requireHT)
223 else
225 //NB: Since we assume the large majority are without HT, we do not
226 // base decision to recheck on presence of HT.
227}
228
229//____________________________________________________________________
231{
232 connect(controller,SIGNAL(projectTRTHitsChanged(bool)),this,SLOT(setProject(bool)));
233 setProject(controller->projectTRTHits());//Fixme: Do in pixel/sct as well!
234
235 connect(controller,SIGNAL(highLightTRTHitsByHighThresholdChanged(bool)),this,SLOT(setHighLightHighThresholds(bool)));
237
238 connect(controller,SIGNAL(inDetPartsFlagsChanged(PRDCommonFlags::InDetPartsFlags)),this,SLOT(setPartsFlags(PRDCommonFlags::InDetPartsFlags)));
239 setPartsFlags(controller->inDetPartsFlags());
240
241 connect(controller,SIGNAL(trtMinToTChanged(unsigned)),this,SLOT(setMinToT(unsigned)));
242 setMinToT(controller->trtMinToT());
243
244 connect(controller,SIGNAL(trtMaxToTChanged(unsigned)),this,SLOT(setMaxToT(unsigned)));
245 setMaxToT(controller->trtMaxToT());
246
247 connect(controller,SIGNAL(trtMinLEChanged(unsigned)),this,SLOT(setMinLE(unsigned)));
248 setMinLE(controller->trtMinLE());
249
250 connect(controller,SIGNAL(trtMaxLEChanged(unsigned)),this,SLOT(setMaxLE(unsigned)));
251 setMaxLE(controller->trtMaxLE());
252
253 connect(controller,SIGNAL(trtRequireHTChanged(bool)),this,SLOT(setRequireHT(bool)));
254 setRequireHT(controller->trtRequireHT());
255}
256
257//____________________________________________________________________
259{
260 if (m_highlightHT==hl)
261 return;
262 m_highlightHT=hl;
263
264 //Fixme: check PRDCollHandle::hasCustomHighlighting() before proceeding to loop here?.
265
266 //call updateMaterial on all handles which have a high threshold.
268 std::vector<PRDHandleBase*>::iterator it(getPrdHandles().begin()),itE(getPrdHandles().end());
269 for (;it!=itE;++it) {
270 if (static_cast<PRDHandle_TRT*>(*it)->highLevel())
271 (*it)->updateMaterial();
272 }
274
275}
276
277//____________________________________________________________________
278void PRDCollHandle_TRT::setAppropriateProjection( InDetProjFlags::InDetProjPartsFlags f )
279{
280 //Fixme: use message:
281 messageVerbose("setAppropriateProjection called.");
283 return;
284 messageVerbose("setAppropriateProjection => update needed.");
285
286 InDetProjFlags::InDetProjPartsFlags changedparts = ( m_appropriateProjections ^ f );
288
289 bool updateposbarrel = ( changedparts & InDetProjFlags::Barrel_AllPos );
290 bool updatenegbarrel = ( changedparts & InDetProjFlags::Barrel_AllNeg );
291 bool updateposendcap = ( changedparts & InDetProjFlags::EndCap_AllPos );
292 bool updatenegendcap = ( changedparts & InDetProjFlags::EndCap_AllNeg );
293 bool updatebarrel = updateposbarrel || updatenegbarrel;
294 bool updateendcap = updateposendcap || updatenegendcap;
295
296 messageVerbose("setAppropriateProjection updating (brlA,brlC,ecA,ecC) = ("+str(updateposbarrel)+","+str(updatenegbarrel)
297 +","+str(updateposendcap)+","+str(updatenegendcap)+")");
298
299 if (!updatebarrel&&!updateendcap) {
300 message("setAppropriateProjection WARNING: Unexpected flag value.");
301 return;
302 }
303
304 common()->system()->deselectAll();
306 std::vector<PRDHandleBase*>::iterator it(getPrdHandles().begin()),itE(getPrdHandles().end());
307 for (;it!=itE;++it) {
308 PRDHandle_TRT* handle = static_cast<PRDHandle_TRT*>(*it);
309 if (handle->isBarrel()) {
310 if (updatebarrel) {
311 if (handle->isPositiveZ()) {
312 if (updateposbarrel)
313 handle->update3DObjects();
314 } else {
315 if (updatenegbarrel)
316 handle->update3DObjects();
317 }
318 }
319 } else {
320 if (updateendcap) {
321 if (handle->isPositiveZ()) {
322 if (updateposendcap)
323 handle->update3DObjects();
324 } else {
325 if (updatenegendcap)
326 handle->update3DObjects();
327 }
328 }
329 }
330 }
332
333}
334
335//____________________________________________________________________
337{
338 //Fixme: use message:
339 messageVerbose("setProject called with project = "+str(b));
340
341 if (m_project==b) {
342 messageVerbose("setProject ==> No change.");
343 return;
344 }
345 m_project=b;
346 messageVerbose("setProject ==> Setting changed.");
347
348 common()->system()->deselectAll();
350 std::vector<PRDHandleBase*>::iterator it(getPrdHandles().begin()),itE(getPrdHandles().end());
351 for (;it!=itE;++it)
352 static_cast<PRDHandle_TRT*>(*it)->update3DObjects();
354
355}
virtual void deselectAll(SoCooperativeSelection *exception_sel=0)
The Detector Manager for all TRT Detector elements, it acts as the interface to the detector elements...
int driftTimeBin() const
returns the leading edge bin defined as in TRT_LoLumRawData to be the first 0-1 transition
double timeOverThreshold() const
returns Time over threshold in ns
void recheckCutStatusOfAllNotVisibleHandles()
PRDCollHandleBase(PRDDetType::Type, PRDSysCommonData *, const QString &key)
std::vector< PRDHandleBase * > & getPrdHandles()
PRDSysCommonData * common() const
void recheckCutStatus(PRDHandleBase *)
void recheckCutStatusOfAllVisibleHandles()
PRDCommonFlags::InDetPartsFlags indetpartsflags
const InDetDD::TRT_DetectorManager * trtdetmgr
InDetProjFlags::InDetProjPartsFlags m_appropriateProjections
virtual QColor defaultColor() const override
PRDCollHandle_TRT(PRDSysCommonData *, const QString &key)
void setHighLightHighThresholds(bool)
virtual PRDHandleBase * addPRD(const Trk::PrepRawData *) override
virtual bool cut(PRDHandleBase *) override
static QStringList availableCollections(IVP1System *)
void setAppropriateProjection(InDetProjFlags::InDetProjPartsFlags)
virtual void setupSettingsFromControllerSpecific(PRDSystemController *) override
void setPartsFlags(PRDCommonFlags::InDetPartsFlags)
bool isPositiveZ() const
bool isBarrel() const
bool highLevel() const
const InDet::TRT_DriftCircle * driftCircle() const
IVP13DSystem * system() const
PRDCommonFlags::InDetPartsFlags inDetPartsFlags() const
This is an Identifier helper class for the TRT subdetector.
Definition TRT_ID.h:82
void messageVerbose(const QString &) const
void message(const QString &) const
static bool hasTRTGeometry()
QStringList getKeys() const
virtual void largeChangesEnd()
virtual void largeChangesBegin()
Definition HitInfo.h:33