ATLAS Offline Software
PRDCollHandle_SpacePoints.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 // //
8 // Implementation of class PRDCollHandle_SpacePoints //
9 // //
10 // Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11 // Initial version: September 2008 //
12 // //
14 
18 #include "VP1Base/IVP1System.h"
23 #include <QColor>
24 
25 //____________________________________________________________________
27 {
29  return QStringList();
31  QStringList unsafekeys;
33  for (QString key : keys) {
34  if (key.contains("sct",Qt::CaseInsensitive))
35  unsafekeys << key;
36  }
37  }
39  for (QString key : keys) {
40  if (key.contains("pixel",Qt::CaseInsensitive))
41  unsafekeys << key;
42  }
43  }
44  for (QString unsafekey : unsafekeys)
45  keys.removeAll(unsafekey);
46  return keys;
47 }
48 
49 //____________________________________________________________________
51 public:
52  PRDCommonFlags::InDetPartsFlags indetpartsflags;
53 };
54 
55 
56 //____________________________________________________________________
58  : PRDCollHandleBase(PRDDetType::SpacePoints,common,key), m_d(new Imp)
59 {
61 }
62 
63 //____________________________________________________________________
65 {
66  delete m_d;
67 }
68 
69 //____________________________________________________________________
71 {
72  if (text().contains("pixel",Qt::CaseInsensitive))
73  return QColor::fromRgbF(1.0, 0.666667, 0.5 );//beige
74  else
75  return QColor::fromRgbF(1.0, 1.0, 0.5 );//light yellow
76 }
77 
78 //____________________________________________________________________
80 {
82  // Retrieve element container from event store:
83  const SpacePointContainer* container;
84  if(!VP1SGAccessHelper(systemBase()).retrieve(container,text()))
85  return false;
86 
87  int isp(0);
88  SpacePointContainer::const_iterator itElement, itElementE(container->end());
89  for (itElement=container->begin();itElement!=itElementE;++itElement) {
90  SpacePointContainer::base_value_type::const_iterator it, itE((*itElement)->end());
91  for (it=(*itElement)->begin();it!=itE;++it) {
92  const Trk::SpacePoint * sp = *it;
93  ++isp;
94  if (!sp) {
95  message("WARNING - ignoring null spacepoint pointer.");
96  continue;
97  }
98  if (!sp->clusterList().first) {
99  message("WARNING - ignoring spacepoint with null first cluster.");
100  continue;
101  }
102  PRDHandleBase * handle = new PRDHandle_SpacePoint(this,sp);
103  if (handle) {
104  addHandle(handle);
105  //We just register the first of the (possibly) two prds here (fixme: check that it works):
106  common()->registerPRD2Handle(handle->getPRD(),handle);
107  } else {
108  message("WARNING - ignoring null handle pointer.");
109  }
110  if (!(isp%100))
111  systemBase()->updateGUI();
112  }
113  }
114  return true;
115 }
116 
117 //____________________________________________________________________
119 {
120  PRDHandle_SpacePoint * handle = static_cast<PRDHandle_SpacePoint*>(handlebase);
121  assert(handle);
122 
124  if (handle->isBarrel()) {
126  return false;
127  } else {
129  return false;
130  }
131  }
132  return true;
133 }
134 
135 //____________________________________________________________________
137 {
138 }
139 
140 //____________________________________________________________________
142 {
143 }
144 
145 //____________________________________________________________________
147 {
148  connect(controller,SIGNAL(inDetPartsFlagsChanged(PRDCommonFlags::InDetPartsFlags)),
149  this,SLOT(setPartsFlags(PRDCommonFlags::InDetPartsFlags)));
150  setPartsFlags(controller->inDetPartsFlags());
151 }
152 
153 //____________________________________________________________________
154 void PRDCollHandle_SpacePoints::setPartsFlags(PRDCommonFlags::InDetPartsFlags flags)
155 {
156  //NB: The code is this method is very similar in PRDCollHandle_Pixel::setPartsFlags, PRDCollHandle_SCT::setPartsFlags,
157  //PRDCollHandle_TRT::setPartsFlags and and PRDCollHandle_SpacePoints::setPartsFlags
158  //Fixme: base decision to recheck on visibility also!
159 
160  if (m_d->indetpartsflags==flags)
161  return;
162 
167  bool barrelChanged = (barrelPosChanged || barrelNegChanged);
168  bool endcapChanged = (endcapPosChanged || endcapNegChanged);
170 
173  for (;it!=itE;++it) {
174  PRDHandle_SpacePoint* handle = static_cast<PRDHandle_SpacePoint*>(*it);
175  if (handle->isBarrel()) {
176  if (barrelChanged&&(handle->isPositiveZ()?barrelPosChanged:barrelNegChanged))
177  recheckCutStatus(handle);
178  } else {
179  if (endcapChanged&&(handle->isPositiveZ()?endcapPosChanged:endcapNegChanged))
180  recheckCutStatus(handle);
181  }
182  }
183  largeChangesEnd();
184 }
Trk::SpacePoint::clusterList
const std::pair< const PrepRawData *, const PrepRawData * > & clusterList() const
return the pair of cluster pointers by reference
Definition: Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h:127
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Trk::SpacePoint
Definition: Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h:35
PRDCollHandle_SpacePoints::Imp
Definition: PRDCollHandle_SpacePoints.cxx:50
PRDHandle_SpacePoint.h
PRDCollHandle_SpacePoints::PRDCollHandle_SpacePoints
PRDCollHandle_SpacePoints(PRDSysCommonData *, const QString &key)
Definition: PRDCollHandle_SpacePoints.cxx:57
PRDHandle_SpacePoint::isPositiveZ
bool isPositiveZ() const
Definition: PRDHandle_SpacePoint.h:53
AthenaPoolTestRead.flags
flags
Definition: AthenaPoolTestRead.py:8
PRDCollHandleBase::recheckCutStatus
void recheckCutStatus(PRDHandleBase *)
Definition: PRDCollHandleBase.cxx:519
PRDCollHandle_SpacePoints::defaultColor
virtual QColor defaultColor() const override
Definition: PRDCollHandle_SpacePoints.cxx:70
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
PRDCollHandleBase::addHandle
void addHandle(PRDHandleBase *)
Definition: PRDCollHandleBase.cxx:500
VP1StdCollection::largeChangesBegin
virtual void largeChangesBegin()
Definition: VP1StdCollection.cxx:228
PRDSysCommonData
Definition: PRDSysCommonData.h:35
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
TruthTest.itE
itE
Definition: TruthTest.py:25
SpacePointContainer.h
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
VP1SGContentsHelper::getKeys
QStringList getKeys() const
Definition: VP1SGContentsHelper.h:55
PRDCollHandleBase
Definition: PRDCollHandleBase.h:25
PRDHandle_SpacePoint::isBarrel
bool isBarrel() const
Definition: PRDHandle_SpacePoint.h:51
IVP1System
Definition: IVP1System.h:36
PRDSysCommonData::registerPRD2Handle
void registerPRD2Handle(const Trk::PrepRawData *prd, PRDHandleBase *handle)
Definition: PRDSysCommonData.cxx:97
PRDCollHandle_SpacePoints::load
virtual bool load() override
Definition: PRDCollHandle_SpacePoints.cxx:79
contains
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition: hcg.cxx:111
PRDCollHandle_SpacePoints::cut
virtual bool cut(PRDHandleBase *) override
Definition: PRDCollHandle_SpacePoints.cxx:118
VP1JobConfigInfo::hasSCTGeometry
static bool hasSCTGeometry()
Definition: VP1JobConfigInfo.cxx:128
PRDCommonFlags::All
@ All
Definition: PRDCommonFlags.h:30
IdentifiableContainerMT::end
const_iterator end() const
return const_iterator for end of container
Definition: IdentifiableContainerMT.h:242
VP1StdCollection::text
QString text() const
Definition: VP1StdCollection.cxx:132
IdentifiableContainerMT::const_iterator
Definition: IdentifiableContainerMT.h:82
IdentifiableContainerMT::begin
const_iterator begin() const
return const_iterator for first entry
Definition: IdentifiableContainerMT.h:236
PRDCollHandle_SpacePoints::m_d
Imp * m_d
Definition: PRDCollHandle_SpacePoints.h:51
PRDDetType
Definition: PRDDetTypes.h:10
PRDCollHandle_SpacePoints.h
PRDCollHandle_SpacePoints::availableCollections
static QStringList availableCollections(IVP1System *)
Definition: PRDCollHandle_SpacePoints.cxx:26
PRDCollHandle_SpacePoints::eraseEventDataSpecific
virtual void eraseEventDataSpecific() override
Definition: PRDCollHandle_SpacePoints.cxx:136
PRDHandleBase::getPRD
virtual const Trk::PrepRawData * getPRD() const =0
VP1HelperClassBase::systemBase
IVP1System * systemBase() const
Definition: VP1HelperClassBase.h:50
PRDSystemController.h
PRDCollHandle_SpacePoints::postLoadInitialisation
virtual void postLoadInitialisation() override
Definition: PRDCollHandle_SpacePoints.cxx:141
VP1SGContentsHelper
Definition: VP1SGContentsHelper.h:26
VP1StdCollection::largeChangesEnd
virtual void largeChangesEnd()
Definition: VP1StdCollection.cxx:239
PRDCollHandle_SpacePoints::~PRDCollHandle_SpacePoints
virtual ~PRDCollHandle_SpacePoints()
Definition: PRDCollHandle_SpacePoints.cxx:64
PRDCommonFlags::BarrelPositive
@ BarrelPositive
Definition: PRDCommonFlags.h:24
PRDCollHandle_SpacePoints::setPartsFlags
void setPartsFlags(PRDCommonFlags::InDetPartsFlags)
Definition: PRDCollHandle_SpacePoints.cxx:154
PRDCommonFlags::BarrelNegative
@ BarrelNegative
Definition: PRDCommonFlags.h:25
PRDCommonFlags::EndCapPositive
@ EndCapPositive
Definition: PRDCommonFlags.h:26
IVP1System::updateGUI
void updateGUI()
Definition: IVP1System.cxx:262
PRDSystemController::inDetPartsFlags
PRDCommonFlags::InDetPartsFlags inDetPartsFlags() const
Definition: PRDSystemController.cxx:378
PRDCollHandle_SpacePoints::Imp::indetpartsflags
PRDCommonFlags::InDetPartsFlags indetpartsflags
Definition: PRDCollHandle_SpacePoints.cxx:52
VP1HelperClassBase::message
void message(const QString &) const
Definition: VP1HelperClassBase.cxx:49
VP1JobConfigInfo.h
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
SpacePointContainer
Definition: Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePointContainer.h:29
PRDHandleBase
Definition: PRDHandleBase.h:35
VP1SGAccessHelper
Definition: VP1SGAccessHelper.h:25
PRDCommonFlags::EndCapNegative
@ EndCapNegative
Definition: PRDCommonFlags.h:27
VP1JobConfigInfo::hasPixelGeometry
static bool hasPixelGeometry()
Definition: VP1JobConfigInfo.cxx:127
PRDCollHandleBase::getPrdHandles
std::vector< PRDHandleBase * > & getPrdHandles()
Definition: PRDCollHandleBase.cxx:507
VP1SGAccessHelper.h
IVP1System.h
PRDHandle_SpacePoint
Definition: PRDHandle_SpacePoint.h:33
common
Definition: common.py:1
PRDCollHandle_SpacePoints::setupSettingsFromControllerSpecific
virtual void setupSettingsFromControllerSpecific(PRDSystemController *) override
Definition: PRDCollHandle_SpacePoints.cxx:146
VP1SGContentsHelper.h
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37