ATLAS Offline Software
Loading...
Searching...
No Matches
PRDCollHandle_MDT.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
11#include <QColor>
12
17
18//____________________________________________________________________
23
24//____________________________________________________________________
26public:
28 std::map<const MuonGM::MuonStation*,unsigned> mdt2stationcounter;
29 unsigned minHitsPerStation = 0U;
31 bool excludeMaskedHits = false;
32 bool onlyShowActive = false;
33 QString status;
34 bool projectionsEnabled = false;
37};
38
39//____________________________________________________________________
41 : PRDCollHandleBase(PRDDetType::MDT,cd,key), m_d(new Imp),
43{
44 m_d->theclass = this;
45 m_d->minHitsPerStation = 0;//If the intention is no cut, then put to 0 instead of 1.
46 m_d->allowedADCValues = VP1Interval();
47 m_d->excludeMaskedHits = true;
48 m_d->onlyShowActive = true;
49 m_d->projectionsEnabled = false;
50 m_d->appropriateprojection = 0;//none
51}
52
53//____________________________________________________________________
58
59//____________________________________________________________________
61{
62 return QColor::fromRgbF( 1.0, 0.666667, 0.0);//orange
63}
64
65//____________________________________________________________________
67{
68 assert(dynamic_cast<const Muon::MdtPrepData*>(prd));
69 return new PRDHandle_MDT(this,static_cast<const Muon::MdtPrepData*>(prd));
70}
71
72//____________________________________________________________________
74{
75 std::vector<PRDHandleBase*>::iterator it(getPrdHandles().begin()),itE(getPrdHandles().end());
76 std::map<const MuonGM::MuonStation*,unsigned>::iterator itStation;
77 for (;it!=itE;++it) {
78 itStation = m_d->mdt2stationcounter.find(static_cast<PRDHandle_MDT*>(*it)->driftCircle()->detectorElement()->parentMuonStation());
79 if (itStation!=m_d->mdt2stationcounter.end())
80 ++(itStation->second);
81 else
82 m_d->mdt2stationcounter[static_cast<PRDHandle_MDT*>(*it)->driftCircle()->detectorElement()->parentMuonStation()]=1;
83 }
84}
85
86//____________________________________________________________________
88{
89 m_d->mdt2stationcounter.clear();
90}
91
92//____________________________________________________________________
94{
95
96 PRDHandle_MDT * handle = static_cast<PRDHandle_MDT*>(handlebase);
97 assert(handle);
98
99 if (m_d->excludeMaskedHits) {
100 // messageVerbose(QString("Handle status = ")+handle->driftCircleStatus()+QString(", GUI: ")+common()->controller()->mdt_cutMdtDriftCircleStatus() );
101 if(!(handle->driftCircleStatus()==common()->controller()->mdt_cutMdtDriftCircleStatus()))
102 return false;
103 }
104
105 if (!m_d->allowedADCValues.isAllR()) {
106 if (!m_d->allowedADCValues.contains(handle->ADC()))
107 return false;
108 }
109
110 if (m_d->minHitsPerStation) {
111 assert(m_d->mdt2stationcounter.find(handle->driftCircle()->detectorElement()->parentMuonStation())!=m_d->mdt2stationcounter.end());
112 if (m_d->mdt2stationcounter[handle->driftCircle()->detectorElement()->parentMuonStation()]<m_d->minHitsPerStation)
113 return false;
114 }
115
116 // messageVerbose("PRDCollHandle_MDT::cut: ");
117 if (m_d->onlyShowActive) {
118 if (!common()->touchedMuonChamberHelper()->isTouchedByTrack(handle->parentMuonChamberPV()))
119 return false;
120 }
121
122 return true;
123}
124
125//____________________________________________________________________
127{
128 connect(controller,SIGNAL(mdtMinNHitsPerStationChanged(unsigned)),this,SLOT(setMinNHitsPerStation(unsigned)));
130
131 connect(controller,SIGNAL(highLightMDTHitsByMaskChanged(bool)),this,SLOT(setHighLightByMask(bool)));
133
134 connect(controller,SIGNAL(highLightMDTHitsByUpperADCBoundChanged(int)),this,SLOT(setHighLightByUpperADCBound(int)));
136
137 connect(controller,SIGNAL(mdtAllowedADCValuesChanged(VP1Interval)),this,SLOT(setAllowedADCValues(VP1Interval)));
139
140 connect(controller,SIGNAL(mdtExcludeMaskedHitsChanged(bool)),this,SLOT(setExcludeMaskedHits(bool)));
142
143 connect(controller,SIGNAL(mdt_cutMdtDriftCircleStatusChanged(QString)),this,SLOT(setStatus(QString)));
145
146 connect(controller,SIGNAL(projectMDTHitsChanged(bool)),this,SLOT(setEnableProjections(bool)));
148
149 connect(controller,SIGNAL(limitToActiveChambersChanged(bool)),this,SLOT(setLimitToActiveChambers(bool)));
151
152 connect(common()->touchedMuonChamberHelper(),SIGNAL(muonChambersTouchedByTracksChanged(void)),this,SLOT(muonChambersTouchedByTracksChanged(void)));
153}
154
155//____________________________________________________________________
157{
158 if (minnhits==1)
159 minnhits = 0;//Since 0 and 1 gives same result, we map all 1's to 0's to avoid unnecessary cut rechecks.
160 if (m_d->minHitsPerStation==minnhits)
161 return;
162 bool cut_relaxed = minnhits < m_d->minHitsPerStation;
163 m_d->minHitsPerStation=minnhits;
164 if (cut_relaxed)
166 else
168}
169
170//____________________________________________________________________
172{
173 if (m_d->allowedADCValues==newinterval)
174 return;
175 VP1Interval old(m_d->allowedADCValues);
176 m_d->allowedADCValues = newinterval;
177 if (newinterval.contains(old)) {
179 } else {
180 if (old.contains(newinterval))
182 else
184 }
185}
186
187//____________________________________________________________________
189{
190 if (m_d->excludeMaskedHits==b)
191 return;
192 bool cut_relaxed = !b;
193 m_d->excludeMaskedHits=b;
194 if (cut_relaxed)
196 else
198}
199
200//____________________________________________________________________
201void PRDCollHandle_MDT::setStatus(const QString& b)
202{
203 // messageVerbose(QString("SetStatus: ")+b);
204 if (m_d->status==b)
205 return;
206 m_d->status=b;
208}
209
210//____________________________________________________________________
212{
213 if (m_highLightMasked==b)
214 return;
216
217 //Fixme: check PRDCollHandle::hasCustomHighlighting() before proceeding to loop here?.
218
219 //call updateMaterial on all handles which are masked.
220 std::vector<PRDHandleBase*>::iterator it(getPrdHandles().begin()),itE(getPrdHandles().end());
221 for (;it!=itE;++it) {
222 if (static_cast<PRDHandle_MDT*>(*it)-> masked())
223 (*it)->updateMaterial();
224 }
225}
226
227//____________________________________________________________________
229{
230 if (bound<-1)
231 bound = -1;//Since all negative gives same result, we map all those to -1 to avoid unnecessary rechecks.
232 if (m_highLightADCBelow==bound)
233 return;
234
235 int low=std::min(m_highLightADCBelow,bound);
236 int high=std::max(m_highLightADCBelow,bound);
238
239 //Fixme: check PRDCollHandle::hasCustomHighlighting() before proceeding to loop here?.
240
241 //call updateMaterial on all handles which are between the former and present values of the bound.
242 std::vector<PRDHandleBase*>::iterator it(getPrdHandles().begin()),itE(getPrdHandles().end());
243 int adc;
244 for (;it!=itE;++it) {
245 adc = static_cast<PRDHandle_MDT*>(*it)->ADC();
246 if (adc>=low&&adc<=high)
247 (*it)->updateMaterial();
248 }
249}
250
251//____________________________________________________________________
253{
254 if (m_d->projectionsEnabled==b)
255 return;
256 m_d->projectionsEnabled=b;
257 m_d->updateProjectionFlag();
258}
259
260//____________________________________________________________________
262 if (m_d->appropriateprojection==i)
263 return;
264 m_d->appropriateprojection=i;
265 m_d->updateProjectionFlag();
266}
267
268//____________________________________________________________________
270{
271 messageVerbose("PRDCollHandle_MDT::setLimitToActiveChambers => "+str(l)+" current="+str(m_d->onlyShowActive));
272
273 if (m_d->onlyShowActive==l)
274 return;
275 bool cut_relaxed=(m_d->onlyShowActive);
276 m_d->onlyShowActive=l;
277 if (cut_relaxed)
279 else
281}
282
284{
285 messageVerbose("PRDCollHandle_MDT::muonChambersTouchedByTracksChanged");
287}
288
289
290//____________________________________________________________________
293 if (projectionsEnabled) {
296 else if (appropriateprojection==2)
298 }
299
300 if (theclass->m_projection!=projflag) {
301 theclass->m_projection = projflag;
302 theclass->common()->system()->deselectAll();
303 theclass->largeChangesBegin();
304 std::vector<PRDHandleBase*>::iterator it(theclass->getPrdHandles().begin()),itE(theclass->getPrdHandles().end());
305 for (;it!=itE;++it)
306 (*it)->update3DObjects();
307 theclass->largeChangesEnd();
308 }
309}
@ MDT
Definition RegSelEnums.h:31
Class to represent measurements from the Monitored Drift Tubes.
Definition MdtPrepData.h:33
virtual const MuonGM::MdtReadoutElement * detectorElement() const override
Returns the detector element corresponding to this PRD.
void recheckCutStatusOfAllNotVisibleHandles()
PRDCollHandleBase(PRDDetType::Type, PRDSysCommonData *, const QString &key)
std::vector< PRDHandleBase * > & getPrdHandles()
PRDSysCommonData * common() const
void recheckCutStatusOfAllVisibleHandles()
PRDCollHandle_MDT * theclass
std::map< const MuonGM::MuonStation *, unsigned > mdt2stationcounter
void setMinNHitsPerStation(unsigned)
virtual void postLoadInitialisation() override
virtual PRDHandleBase * addPRD(const Trk::PrepRawData *) override
PRDCollHandle_MDT(PRDSysCommonData *, const QString &key)
void setHighLightByUpperADCBound(int)
virtual QColor defaultColor() const override
virtual bool cut(PRDHandleBase *) override
virtual void setupSettingsFromControllerSpecific(PRDSystemController *) override
void muonChambersTouchedByTracksChanged(void)
Inform this handle that it might need to recheck cuts.
void setLimitToActiveChambers(bool)
virtual void eraseEventDataSpecific() override
void setAllowedADCValues(const VP1Interval &)
static QStringList availableCollections(IVP1System *)
void setStatus(const QString &)
const Muon::MdtPrepData * driftCircle() const
int ADC() const
GeoPVConstLink parentMuonChamberPV() const
QString driftCircleStatus() const
unsigned mdtMinNHitsPerStation() const
VP1Interval mdtAllowedADCValues() const
QString mdt_cutMdtDriftCircleStatus() const
void messageVerbose(const QString &) const
bool contains(const double &x) const
static bool hasMuonGeometry()
QStringList getKeys() const
MuonPrepDataContainerT< MdtPrepData > MdtPrepDataContainer