ATLAS Offline Software
Loading...
Searching...
No Matches
PRDCollHandle_MM.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> mm2stationcounter;
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::MM,cd,key), m_d(new Imp) //,
42 // m_highLightMasked(false), m_highLightADCBelow(-1), m_projection(PRDCollHandle_MM::NONE)
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::MMPrepData*>(prd));
69 return new PRDHandle_MM(this,static_cast<const Muon::MMPrepData*>(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->mm2stationcounter.find(static_cast<PRDHandle_MM*>(*it)->mm()->detectorElement()->parentMuonStation());
79 if (itStation!=m_d->mm2stationcounter.end())
80 ++(itStation->second);
81 else
82 m_d->mm2stationcounter[static_cast<PRDHandle_MM*>(*it)->mm()->detectorElement()->parentMuonStation()]=1;
83 }
84}
85
86//____________________________________________________________________
88{
89 m_d->mm2stationcounter.clear();
90}
91
92//____________________________________________________________________
94{
95
96 PRDHandle_MM * handle = static_cast<PRDHandle_MM*>(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->mm2stationcounter.find(handle->mm()->detectorElement()->parentMuonStation())!=m_d->mm2stationcounter.end());
112 if (m_d->mm2stationcounter[handle->mm()->detectorElement()->parentMuonStation()]<m_d->minHitsPerStation)
113 return false;
114 }
115
116 // messageVerbose("PRDCollHandle_MM::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)));
132 // setHighLightByMask(controller->highLightMDTHitsByMask());
133
134 // connect(controller,SIGNAL(highLightMDTHitsByUpperADCBoundChanged(int)),this,SLOT(setHighLightByUpperADCBound(int)));
135 // setHighLightByUpperADCBound(controller->highLightMDTHitsByUpperADCBound());
136 //
137 // connect(controller,SIGNAL(mdtAllowedADCValuesChanged(VP1Interval)),this,SLOT(setAllowedADCValues(VP1Interval)));
138 // setAllowedADCValues(controller->mdtAllowedADCValues());
139
140 // connect(controller,SIGNAL(mdtExcludeMaskedHitsChanged(bool)),this,SLOT(setExcludeMaskedHits(bool)));
141 // setExcludeMaskedHits(controller->mdtExcludeMaskedHits());
142
143 // connect(controller,SIGNAL(mdt_cutMdtDriftCircleStatusChanged(QString)),this,SLOT(setStatus(QString)));
144 // setStatus(controller->mdt_cutMdtDriftCircleStatus());
145
146 // connect(controller,SIGNAL(projectMDTHitsChanged(bool)),this,SLOT(setEnableProjections(bool)));
147 // setEnableProjections(controller->projectMDTHits());
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// //____________________________________________________________________
171// void PRDCollHandle_MM::setAllowedADCValues(VP1Interval newinterval)
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)) {
178// recheckCutStatusOfAllNotVisibleHandles();//cut relaxed
179// } else {
180// if (old.contains(newinterval))
181// recheckCutStatusOfAllVisibleHandles();//cut tightened
182// else
183// recheckCutStatusOfAllHandles();
184// }
185// }
186
187// //____________________________________________________________________
188// void PRDCollHandle_MM::setExcludeMaskedHits(bool b)
189// {
190// if (m_d->excludeMaskedHits==b)
191// return;
192// bool cut_relaxed = !b;
193// m_d->excludeMaskedHits=b;
194// if (cut_relaxed)
195// recheckCutStatusOfAllNotVisibleHandles();
196// else
197// recheckCutStatusOfAllVisibleHandles();
198// }
199
200// //____________________________________________________________________
201// void PRDCollHandle_MM::setStatus(QString b)
202// {
203// // messageVerbose(QString("SetStatus: ")+b);
204// if (m_d->status==b)
205// return;
206// m_d->status=b;
207// recheckCutStatusOfAllHandles();
208// }
209
210// //____________________________________________________________________
211// void PRDCollHandle_MM::setHighLightByMask(bool b)
212// {
213// if (m_highLightMasked==b)
214// return;
215// m_highLightMasked=b;
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_MM*>(*it)-> masked())
223// (*it)->updateMaterial();
224// }
225// }
226
227// //____________________________________________________________________
228// void PRDCollHandle_MM::setHighLightByUpperADCBound(int bound)
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);
237// 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_MM*>(*it)->ADC();
246// if (adc>=low&&adc<=high)
247// (*it)->updateMaterial();
248// }
249// }
250
251// //____________________________________________________________________
252// void PRDCollHandle_MM::setEnableProjections( bool b )
253// {
254// if (m_d->projectionsEnabled==b)
255// return;
256// m_d->projectionsEnabled=b;
257// m_d->updateProjectionFlag();
258// }
259//
260// //____________________________________________________________________
261// void PRDCollHandle_MM::setAppropriateProjection( int i ) {
262// if (m_d->appropriateprojection==i)
263// return;
264// m_d->appropriateprojection=i;
265// m_d->updateProjectionFlag();
266// }
267
268//____________________________________________________________________
270{
271 messageVerbose("PRDCollHandle_MM::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_MM::muonChambersTouchedByTracksChanged");
287}
288
289
290// //____________________________________________________________________
291// void PRDCollHandle_MM::Imp::updateProjectionFlag() {
292// PROJECTION projflag(PRDCollHandle_MM::NONE);
293// if (projectionsEnabled) {
294// if (appropriateprojection==1)
295// projflag = PRDCollHandle_MM::TOTUBES;
296// else if (appropriateprojection==2)
297// projflag = PRDCollHandle_MM::TOCHAMBERS;
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// }
@ MM
Definition RegSelEnums.h:38
Class to represent MM measurements.
Definition MMPrepData.h:22
virtual const MuonGM::MMReadoutElement * detectorElement() const override final
Returns the detector element corresponding to this PRD.
Definition MMPrepData.h:206
void recheckCutStatusOfAllNotVisibleHandles()
PRDCollHandleBase(PRDDetType::Type, PRDSysCommonData *, const QString &key)
std::vector< PRDHandleBase * > & getPrdHandles()
PRDSysCommonData * common() const
void recheckCutStatusOfAllVisibleHandles()
std::map< const MuonGM::MuonStation *, unsigned > mm2stationcounter
PRDCollHandle_MM * theclass
virtual void postLoadInitialisation() override
static QStringList availableCollections(IVP1System *)
virtual PRDHandleBase * addPRD(const Trk::PrepRawData *) override
virtual bool cut(PRDHandleBase *) override
virtual QColor defaultColor() const override
virtual void setupSettingsFromControllerSpecific(PRDSystemController *) override
void muonChambersTouchedByTracksChanged(void)
Inform this handle that it might need to recheck cuts.
void setLimitToActiveChambers(bool)
PRDCollHandle_MM(PRDSysCommonData *, const QString &key)
virtual void eraseEventDataSpecific() override
void setMinNHitsPerStation(unsigned)
GeoPVConstLink parentMuonChamberPV() const
const Muon::MMPrepData * mm() const
unsigned mdtMinNHitsPerStation() const
void messageVerbose(const QString &) const
static bool hasMuonGeometry()
QStringList getKeys() const
MuonPrepDataContainerT< MMPrepData > MMPrepDataContainer