ATLAS Offline Software
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 
10 #include "VP1Base/IVP13DSystem.h"
11 #include <QColor>
12 
17 
18 //____________________________________________________________________
20 {
22 }
23 
24 //____________________________________________________________________
26 public:
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 //____________________________________________________________________
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.
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::MMPrepData*>(prd));
69  return new PRDHandle_MM(this,static_cast<const Muon::MMPrepData*>(prd));
70 }
71 
72 //____________________________________________________________________
74 {
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());
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);
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 // }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
PRDCollHandle_MM
Definition: PRDCollHandle_MM.h:11
PRDHandle_MM
Definition: PRDHandle_MM.h:12
Muon::MuonPrepDataContainer
Template for Muon PRD containers (which are basically collections of MuonPrepDataCollections).
Definition: MuonPrepDataContainer.h:42
PRDCollHandle_MM::~PRDCollHandle_MM
virtual ~PRDCollHandle_MM()
Definition: PRDCollHandle_MM.cxx:54
Muon::MMPrepData
Class to represent MM measurements.
Definition: MMPrepData.h:22
PRDCollHandle_MM::Imp::excludeMaskedHits
bool excludeMaskedHits
Definition: PRDCollHandle_MM.cxx:31
PRDCollHandle_MM::Imp::updateProjectionFlag
void updateProjectionFlag()
PRDCollHandle_MM.h
VP1HelperClassBase::messageVerbose
void messageVerbose(const QString &) const
Definition: VP1HelperClassBase.cxx:78
PRDCollHandle_MM::m_d
Imp * m_d
Definition: PRDCollHandle_MM.h:55
PRDSystemController
Definition: PRDSystemController.h:34
fillPileUpNoiseLumi.connect
string connect
Definition: fillPileUpNoiseLumi.py:70
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
PRDCollHandle_MM::setMinNHitsPerStation
void setMinNHitsPerStation(unsigned)
Definition: PRDCollHandle_MM.cxx:156
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
skel.it
it
Definition: skel.GENtoEVGEN.py:423
PRDCollHandleBase::common
PRDSysCommonData * common() const
Definition: PRDCollHandleBase.h:49
PRDCollHandle_MM::Imp::minHitsPerStation
unsigned minHitsPerStation
Definition: PRDCollHandle_MM.cxx:29
PRDHandle_MM::parentMuonChamberPV
GeoPVConstLink parentMuonChamberPV() const
Definition: PRDHandle_MM.h:32
MM
@ MM
Definition: RegSelEnums.h:38
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
PRDCollHandle_MM::Imp::projectionsEnabled
bool projectionsEnabled
Definition: PRDCollHandle_MM.cxx:34
MMPrepDataContainer.h
PRDCollHandleBase::recheckCutStatusOfAllHandles
void recheckCutStatusOfAllHandles()
Definition: PRDCollHandleBase.cxx:566
PRDCollHandle_MM::availableCollections
static QStringList availableCollections(IVP1System *)
Definition: PRDCollHandle_MM.cxx:19
PRDSysCommonData
Definition: PRDSysCommonData.h:35
PRDCollHandle_MM::Imp::onlyShowActive
bool onlyShowActive
Definition: PRDCollHandle_MM.cxx:32
VP1String::str
static QString str(const QString &s)
Definition: VP1String.h:49
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
TruthTest.itE
itE
Definition: TruthTest.py:25
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
VP1SGContentsHelper::getKeys
QStringList getKeys() const
Definition: VP1SGContentsHelper.h:55
PRDCollHandleBase
Definition: PRDCollHandleBase.h:25
PRDCollHandle_MM::defaultColor
virtual QColor defaultColor() const override
Definition: PRDCollHandle_MM.cxx:60
PRDCollHandle_MM::Imp::allowedADCValues
VP1Interval allowedADCValues
Definition: PRDCollHandle_MM.cxx:30
PRDHandle_MM::mm
const Muon::MMPrepData * mm() const
Definition: PRDHandle_MM.h:24
IVP1System
Definition: IVP1System.h:36
Muon::MMPrepData::detectorElement
virtual const MuonGM::MMReadoutElement * detectorElement() const override final
Returns the detector element corresponding to this PRD.
Definition: MMPrepData.h:206
PRDCollHandle_MM::Imp::theclass
PRDCollHandle_MM * theclass
Definition: PRDCollHandle_MM.cxx:27
MuonGM::MuonReadoutElement::parentMuonStation
const MuonStation * parentMuonStation() const
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonReadoutElement.cxx:135
IVP13DSystem.h
PRDCollHandle_MM::Imp::status
QString status
Definition: PRDCollHandle_MM.cxx:33
MMPrepData.h
PRDCollHandle_MM::Imp::appropriateprojection
int appropriateprojection
Definition: PRDCollHandle_MM.cxx:35
PRDCollHandleBase::recheckCutStatusOfAllNotVisibleHandles
void recheckCutStatusOfAllNotVisibleHandles()
Definition: PRDCollHandleBase.cxx:603
PRDDetType
Definition: PRDDetTypes.h:10
PRDCollHandle_MM::PRDCollHandle_MM
PRDCollHandle_MM(PRDSysCommonData *, const QString &key)
Definition: PRDCollHandle_MM.cxx:40
Trk::PrepRawData
Definition: PrepRawData.h:62
PRDCollHandle_MM::setLimitToActiveChambers
void setLimitToActiveChambers(bool)
Definition: PRDCollHandle_MM.cxx:269
PRDHandle_MM.h
PRDCollHandle_MM::addPRD
virtual PRDHandleBase * addPRD(const Trk::PrepRawData *) override
Definition: PRDCollHandle_MM.cxx:66
PRDCollHandle_MM::Imp::mm2stationcounter
std::map< const MuonGM::MuonStation *, unsigned > mm2stationcounter
Definition: PRDCollHandle_MM.cxx:28
PRDSystemController.h
PRDSystemController::mdtMinNHitsPerStation
unsigned mdtMinNHitsPerStation() const
Definition: PRDSystemController.cxx:434
PRDCollHandle_MM::setupSettingsFromControllerSpecific
virtual void setupSettingsFromControllerSpecific(PRDSystemController *) override
Definition: PRDCollHandle_MM.cxx:126
VP1SGContentsHelper
Definition: VP1SGContentsHelper.h:26
VP1Interval
Definition: VP1Interval.h:23
PRDCollHandle_MM::muonChambersTouchedByTracksChanged
void muonChambersTouchedByTracksChanged(void)
Inform this handle that it might need to recheck cuts.
Definition: PRDCollHandle_MM.cxx:283
PRDCollHandleBase::recheckCutStatusOfAllVisibleHandles
void recheckCutStatusOfAllVisibleHandles()
Definition: PRDCollHandleBase.cxx:585
calibdata.cd
cd
Definition: calibdata.py:51
PRDCollHandle_MM::eraseEventDataSpecific
virtual void eraseEventDataSpecific() override
Definition: PRDCollHandle_MM.cxx:87
PRDCollHandle_MM::cut
virtual bool cut(PRDHandleBase *) override
Definition: PRDCollHandle_MM.cxx:93
VP1JobConfigInfo.h
PRDHandleBase
Definition: PRDHandleBase.h:35
TouchedMuonChamberHelper.h
VP1JobConfigInfo::hasMuonGeometry
static bool hasMuonGeometry()
Definition: VP1JobConfigInfo.cxx:134
PRDCollHandleBase::getPrdHandles
std::vector< PRDHandleBase * > & getPrdHandles()
Definition: PRDCollHandleBase.cxx:507
PRDSystemController::limitToActiveChambers
bool limitToActiveChambers() const
Definition: PRDSystemController.cxx:463
VP1SGContentsHelper.h
PRDCollHandle_MM::postLoadInitialisation
virtual void postLoadInitialisation() override
Definition: PRDCollHandle_MM.cxx:73
PRDCollHandle_MM::Imp
Definition: PRDCollHandle_MM.cxx:25
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37