ATLAS Offline Software
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 
10 #include "VP1Base/IVP13DSystem.h"
11 #include <QColor>
12 
17 
18 //____________________________________________________________________
20 {
22 }
23 
24 //____________________________________________________________________
26 public:
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;
36  void updateProjectionFlag();
37 };
38 
39 //____________________________________________________________________
42  m_highLightMasked(false), m_highLightADCBelow(-1), m_projection(PRDCollHandle_MDT::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.
47  m_d->excludeMaskedHits = true;
48  m_d->onlyShowActive = true;
49  m_d->projectionsEnabled = false;
50  m_d->appropriateprojection = 0;//none
51 }
52 
53 //____________________________________________________________________
55 {
56  delete m_d;
57 }
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 {
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
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) {
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)));
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 //____________________________________________________________________
172 {
173  if (m_d->allowedADCValues==newinterval)
174  return;
176  m_d->allowedADCValues = newinterval;
177  if (newinterval.contains(old)) {
179  } else {
180  if (old.contains(newinterval))
181  recheckCutStatusOfAllVisibleHandles();//cut tightened
182  else
184  }
185 }
186 
187 //____________________________________________________________________
189 {
190  if (m_d->excludeMaskedHits==b)
191  return;
192  bool cut_relaxed = !b;
194  if (cut_relaxed)
196  else
198 }
199 
200 //____________________________________________________________________
201 void 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.
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);
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.
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;
258 }
259 
260 //____________________________________________________________________
263  return;
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);
277  if (cut_relaxed)
279  else
281 }
282 
284 {
285  messageVerbose("PRDCollHandle_MDT::muonChambersTouchedByTracksChanged");
287 }
288 
289 
290 //____________________________________________________________________
293  if (projectionsEnabled) {
294  if (appropriateprojection==1)
295  projflag = PRDCollHandle_MDT::TOTUBES;
296  else if (appropriateprojection==2)
298  }
299 
300  if (theclass->m_projection!=projflag) {
301  theclass->m_projection = projflag;
305  for (;it!=itE;++it)
306  (*it)->update3DObjects();
308  }
309 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
NONE
@ NONE
Definition: sTGCenumeration.h:13
PRDHandle_MDT::driftCircleStatus
QString driftCircleStatus() const
Definition: PRDHandle_MDT.cxx:107
PRDCollHandle_MDT::availableCollections
static QStringList availableCollections(IVP1System *)
Definition: PRDCollHandle_MDT.cxx:19
Muon::MuonPrepDataContainer
Template for Muon PRD containers (which are basically collections of MuonPrepDataCollections).
Definition: MuonPrepDataContainer.h:42
PRDCollHandle_MDT::m_highLightMasked
bool m_highLightMasked
Definition: PRDCollHandle_MDT.h:60
PRDCollHandle_MDT::cut
virtual bool cut(PRDHandleBase *) override
Definition: PRDCollHandle_MDT.cxx:93
PRDCollHandle_MDT::setStatus
void setStatus(const QString &)
Definition: PRDCollHandle_MDT.cxx:201
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
PRDHandle_MDT::driftCircle
const Muon::MdtPrepData * driftCircle() const
Definition: PRDHandle_MDT.h:25
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
VP1HelperClassBase::messageVerbose
void messageVerbose(const QString &) const
Definition: VP1HelperClassBase.cxx:78
PRDHandle_MDT::parentMuonChamberPV
GeoPVConstLink parentMuonChamberPV() const
Definition: PRDHandle_MDT.h:33
PRDCollHandle_MDT::Imp::updateProjectionFlag
void updateProjectionFlag()
Definition: PRDCollHandle_MDT.cxx:291
PRDSystemController
Definition: PRDSystemController.h:34
fillPileUpNoiseLumi.connect
string connect
Definition: fillPileUpNoiseLumi.py:70
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
skel.it
it
Definition: skel.GENtoEVGEN.py:396
PRDCollHandleBase::common
PRDSysCommonData * common() const
Definition: PRDCollHandleBase.h:49
PRDCollHandle_MDT::postLoadInitialisation
virtual void postLoadInitialisation() override
Definition: PRDCollHandle_MDT.cxx:73
PRDCollHandle_MDT::setAllowedADCValues
void setAllowedADCValues(const VP1Interval &)
Definition: PRDCollHandle_MDT.cxx:171
PRDCollHandle_MDT::setExcludeMaskedHits
void setExcludeMaskedHits(bool)
Definition: PRDCollHandle_MDT.cxx:188
PRDCollHandle_MDT::setMinNHitsPerStation
void setMinNHitsPerStation(unsigned)
Definition: PRDCollHandle_MDT.cxx:156
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
VP1StdCollection::largeChangesBegin
virtual void largeChangesBegin()
Definition: VP1StdCollection.cxx:228
PRDCollHandle_MDT.h
MdtPrepData.h
PRDHandle_MDT::ADC
int ADC() const
Definition: PRDHandle_MDT.h:49
PRDCollHandleBase::recheckCutStatusOfAllHandles
void recheckCutStatusOfAllHandles()
Definition: PRDCollHandleBase.cxx:566
PRDSysCommonData
Definition: PRDSysCommonData.h:35
PRDCollHandle_MDT::m_projection
PROJECTION m_projection
Definition: PRDCollHandle_MDT.h:62
VP1String::str
static QString str(const QString &s)
Definition: VP1String.h:49
PRDCollHandle_MDT::setEnableProjections
void setEnableProjections(bool)
Definition: PRDCollHandle_MDT.cxx:252
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
PRDCollHandle_MDT::TOTUBES
@ TOTUBES
Definition: PRDCollHandle_MDT.h:24
TruthTest.itE
itE
Definition: TruthTest.py:25
PRDCollHandle_MDT::Imp::theclass
PRDCollHandle_MDT * theclass
Definition: PRDCollHandle_MDT.cxx:27
PRDCollHandle_MDT::m_d
Imp * m_d
Definition: PRDCollHandle_MDT.h:55
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
VP1SGContentsHelper::getKeys
QStringList getKeys() const
Definition: VP1SGContentsHelper.h:55
PRDSystemController::mdtAllowedADCValues
VP1Interval mdtAllowedADCValues() const
Definition: PRDSystemController.cxx:440
PRDCollHandle_MDT::setHighLightByUpperADCBound
void setHighLightByUpperADCBound(int)
Definition: PRDCollHandle_MDT.cxx:228
MdtPrepDataContainer.h
PRDCollHandleBase
Definition: PRDCollHandleBase.h:25
PRDCollHandle_MDT::Imp::allowedADCValues
VP1Interval allowedADCValues
Definition: PRDCollHandle_MDT.cxx:30
PRDCollHandle_MDT::setLimitToActiveChambers
void setLimitToActiveChambers(bool)
Definition: PRDCollHandle_MDT.cxx:269
IVP1System
Definition: IVP1System.h:36
PRDCollHandle_MDT::m_highLightADCBelow
int m_highLightADCBelow
Definition: PRDCollHandle_MDT.h:61
PRDCollHandle_MDT::Imp::excludeMaskedHits
bool excludeMaskedHits
Definition: PRDCollHandle_MDT.cxx:31
lumiFormat.i
int i
Definition: lumiFormat.py:85
PRDCollHandle_MDT::eraseEventDataSpecific
virtual void eraseEventDataSpecific() override
Definition: PRDCollHandle_MDT.cxx:87
PRDCollHandle_MDT::PRDCollHandle_MDT
PRDCollHandle_MDT(PRDSysCommonData *, const QString &key)
Definition: PRDCollHandle_MDT.cxx:40
MuonGM::MuonReadoutElement::parentMuonStation
const MuonStation * parentMuonStation() const
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonReadoutElement.cxx:135
IVP13DSystem.h
PRDHandle_MDT
Definition: PRDHandle_MDT.h:12
PRDCollHandle_MDT::Imp::projectionsEnabled
bool projectionsEnabled
Definition: PRDCollHandle_MDT.cxx:34
PRDSystemController::highLightMDTHitsByUpperADCBound
int highLightMDTHitsByUpperADCBound()
Definition: PRDSystemController.cxx:533
PRDSystemController::mdtExcludeMaskedHits
bool mdtExcludeMaskedHits() const
Definition: PRDSystemController.cxx:451
PRDCollHandle_MDT
Definition: PRDCollHandle_MDT.h:11
PRDCollHandleBase::recheckCutStatusOfAllNotVisibleHandles
void recheckCutStatusOfAllNotVisibleHandles()
Definition: PRDCollHandleBase.cxx:603
PRDDetType
Definition: PRDDetTypes.h:10
PRDCollHandle_MDT::Imp::appropriateprojection
int appropriateprojection
Definition: PRDCollHandle_MDT.cxx:35
Trk::PrepRawData
Definition: PrepRawData.h:62
PRDSystemController::highLightMDTHitsByMask
bool highLightMDTHitsByMask()
Definition: PRDSystemController.cxx:525
PRDSystemController::mdt_cutMdtDriftCircleStatus
QString mdt_cutMdtDriftCircleStatus() const
Definition: PRDSystemController.cxx:457
PRDSystemController::projectMDTHits
bool projectMDTHits() const
Definition: PRDSystemController.cxx:557
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
VP1Interval::contains
bool contains(const double &x) const
PRDCollHandle_MDT::addPRD
virtual PRDHandleBase * addPRD(const Trk::PrepRawData *) override
Definition: PRDCollHandle_MDT.cxx:66
PRDSystemController.h
PRDSystemController::mdtMinNHitsPerStation
unsigned mdtMinNHitsPerStation() const
Definition: PRDSystemController.cxx:434
Muon::MdtPrepData
Class to represent measurements from the Monitored Drift Tubes.
Definition: MdtPrepData.h:33
PRDCollHandle_MDT::Imp::mdt2stationcounter
std::map< const MuonGM::MuonStation *, unsigned > mdt2stationcounter
Definition: PRDCollHandle_MDT.cxx:28
VP1SGContentsHelper
Definition: VP1SGContentsHelper.h:26
PRDHandle_MDT.h
VP1StdCollection::largeChangesEnd
virtual void largeChangesEnd()
Definition: VP1StdCollection.cxx:239
PRDCollHandle_MDT::defaultColor
virtual QColor defaultColor() const override
Definition: PRDCollHandle_MDT.cxx:60
PRDCollHandle_MDT::Imp
Definition: PRDCollHandle_MDT.cxx:25
VP1Interval
Definition: VP1Interval.h:23
PRDCollHandle_MDT::Imp::status
QString status
Definition: PRDCollHandle_MDT.cxx:33
CSV_InDetExporter.old
old
Definition: CSV_InDetExporter.py:145
ReadFloatFromCool.adc
adc
Definition: ReadFloatFromCool.py:48
PRDCollHandle_MDT::PROJECTION
PROJECTION
Definition: PRDCollHandle_MDT.h:24
PRDSysCommonData::system
IVP13DSystem * system() const
Definition: PRDSysCommonData.h:78
PRDCollHandleBase::recheckCutStatusOfAllVisibleHandles
void recheckCutStatusOfAllVisibleHandles()
Definition: PRDCollHandleBase.cxx:585
PRDCollHandle_MDT::Imp::onlyShowActive
bool onlyShowActive
Definition: PRDCollHandle_MDT.cxx:32
PRDCollHandle_MDT::muonChambersTouchedByTracksChanged
void muonChambersTouchedByTracksChanged(void)
Inform this handle that it might need to recheck cuts.
Definition: PRDCollHandle_MDT.cxx:283
VP1Interval::isAllR
bool isAllR() const
PRDCollHandle_MDT::setHighLightByMask
void setHighLightByMask(bool)
Definition: PRDCollHandle_MDT.cxx:211
calibdata.cd
cd
Definition: calibdata.py:51
PRDCollHandle_MDT::setupSettingsFromControllerSpecific
virtual void setupSettingsFromControllerSpecific(PRDSystemController *) override
Definition: PRDCollHandle_MDT.cxx:126
VP1JobConfigInfo.h
PRDHandleBase
Definition: PRDHandleBase.h:35
PRDCollHandle_MDT::TOCHAMBERS
@ TOCHAMBERS
Definition: PRDCollHandle_MDT.h:24
TouchedMuonChamberHelper.h
PRDCollHandle_MDT::setAppropriateProjection
void setAppropriateProjection(int)
Definition: PRDCollHandle_MDT.cxx:261
PRDCollHandle_MDT::~PRDCollHandle_MDT
virtual ~PRDCollHandle_MDT()
Definition: PRDCollHandle_MDT.cxx:54
VP1JobConfigInfo::hasMuonGeometry
static bool hasMuonGeometry()
Definition: VP1JobConfigInfo.cxx:134
PRDCollHandleBase::getPrdHandles
std::vector< PRDHandleBase * > & getPrdHandles()
Definition: PRDCollHandleBase.cxx:507
PRDCollHandle_MDT::NONE
@ NONE
Definition: PRDCollHandle_MDT.h:24
PRDSystemController::limitToActiveChambers
bool limitToActiveChambers() const
Definition: PRDSystemController.cxx:463
Muon::MdtPrepData::detectorElement
virtual const MuonGM::MdtReadoutElement * detectorElement() const override
Returns the detector element corresponding to this PRD.
Definition: MdtPrepData.h:141
IVP13DSystem::deselectAll
virtual void deselectAll(SoCooperativeSelection *exception_sel=0)
Definition: IVP13DSystem.cxx:331
MDT
@ MDT
Definition: RegSelEnums.h:31
PRDCollHandle_MDT::Imp::minHitsPerStation
unsigned minHitsPerStation
Definition: PRDCollHandle_MDT.cxx:29
common
Definition: common.py:1
VP1SGContentsHelper.h
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37