ATLAS Offline Software
AODCollHandleBase.h
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 // Header file for class AODCollHandleBase //
9 // //
10 // Description: Base class for collection handles //
11 // //
12 // //
14 
15 #ifndef VP1AODSYSTEMS_AODCOLLHANDLEBASE_H
16 #define VP1AODSYSTEMS_AODCOLLHANDLEBASE_H
17 
18 //Local
20 
21 //VP1
22 #include "VP1Base/VP1Interval.h"
23 #include "VP1Base/VP1QtUtils.h"
25 
26 //xAOD
27 //#include "xAODBase/IParticle.h" // for xAOD::Type::ObjectType
28 #include "xAODBase/ObjectType.h" // for xAOD::Type::ObjectType
29 
30 // Qt
31 #include <QColor>
32 #include <QList>
33 
34 //Misc
35 #include <iostream>
36 #include <fstream>
37 
38 class AODSysCommonData;
39 class AODHandleBase;
40 class SoSeparator;
41 class SoMaterial;
43 //class TrackSysCommonData;
44 
45 //namespace Trk {
46 // class Track;
47 // class Segment;
48 // class IExtrapolator;
49 //}
50 
51 
57 {
58 
59  Q_OBJECT
60 
61 public:
62 
63  //Each derived class should implement a "static QStringList
64  //availableCollections();" method, which the collection widget will
65  //use to determine the available collections.
66 
68 // AODCollHandleBase(AODSysCommonData *, const QString& name);
69 
70  virtual void init(VP1MaterialButtonBase* matBut=0) =0;//reimplementations must start with a call to VP1StdCollection::init.
71  virtual ~AODCollHandleBase();
72 
73  //Called just after creation. Should set current cut values and
74  //connections with controller to monitor future changes. Reimplement
75  //the ..Specific method to setup subsystem specific settings.
77 protected:
80 public:
81 
83  // For loading the data and resetting after each event: //
85 
86  //For use by the handles:
87  QString name() const;
88  const AODSysCommonData * common() const { return m_commonData; }
90  const VP1ExtraSepLayerHelper * sepHelper() const { return m_sephelper; }//For attaching/detaching.
91  VP1ExtraSepLayerHelper * sepHelper() { return m_sephelper; }//For attaching/detaching.
92  void setSepHelper(VP1ExtraSepLayerHelper * sh) { m_sephelper=sh; }//For attaching/detaching.
93 
94  virtual QByteArray persistifiableState() const;
95  virtual void setState(const QByteArray&);
96  virtual void dumpToJSON( std::ofstream& ) const {};
98 
99 protected:
100 
101 // //Must be called from derived classes when filling in new object handles.
102  virtual void hintNumberOfHandlesInEvent(unsigned)=0;
103  virtual void addHandle(AODHandleBase*)=0;
104 
105  //For iterating over object handles:
106  virtual void handleIterationBegin()=0;
107  virtual AODHandleBase* getNextHandle()=0; //Returns 0 when done.
108  virtual QList<AODHandleBase*> getHandlesList() const =0;
109 
110  //Override if special cuts. Remember to call base class implementation also for common cuts.
111  virtual bool cut(AODHandleBase*) = 0 ;//Return true if should be shown (based on various cuts), false otherwise.
112 
113  //Utility (fixme: put in utility class elsewhere).
114  template <class T> void cleanupPtrContainer(T&) const;//Delete pointers and calls .clear()
115  // template <class T> void cleanupNodeContainer(T&) const;//unref's pointers and calls .clear()
116 
117  void recheckCutStatus(AODHandleBase*);//Call in derived classes for handles that might be effected by a change in cuts.
118 
119  //Convenience methods which can be called from derived classes or
120  //the trackcollwidget (but specialised procedures might be more
121  //optimal)
122 public:
128 
129  int nShownHandles() { return m_nshownhandles; }
130 
131  //For use only by AODHandleBase::setVisible(..):
134 //
135 // virtual bool mayHaveAssociatedObjects() const { return false; }
136 
137 // enum COLOURBY { COLOUR_PERCOLLECTION, COLOUR_RANDOM, COLOUR_BYPID, COLOUR_MOMENTUM, COLOUR_CHARGE, COLOUR_DISTANCE, COLOUR_VERTEX };
138  // static QString toString(const COLOURBY&);
139  //
140  // COLOURBY colourBy() const { return m_colourby; }
141 
142 // virtual COLOURBY defaultColourBy () const { return COLOUR_PERCOLLECTION; }
143 // virtual bool allowColourByPID() const { return false; }
144 // virtual bool allowColourByMomentum() const { return false; }
145 // virtual bool allowColourByCharge() const { return false; }
146 // virtual bool allowColourByVertex() const { return false; }
147 //
148 protected:
149 
150  qint32 provideCollTypeID() const;
151  virtual QString provideSection() const;
152  virtual QString provideSectionToolTip() const;
153  virtual QString provideText() const { return name(); };//FIXME
154  virtual void assignDefaultMaterial(SoMaterial*) const;
155  virtual QColor defaultColor() const = 0;//Will be used in assignDefaultMaterial
156  virtual QString matButtonToolTip() const { return "Edit cuts/properties/material for "+text(); }
157  QList<QWidget*> provideExtraWidgetsForGuiRow() const;
158  QByteArray extraWidgetsState() const;
159  void setExtraWidgetsState(const QByteArray&);
160 
161 private Q_SLOTS:
163  void collVisibilityChanged(bool);
164  virtual void resetCachedValuesCuts() = 0; // must be implemented in inherited classes, according to the relevant physics cuts and the related user input form
165 
166 public Q_SLOTS:
167 // void rerandomiseRandomTrackColours();
168 
169  // setters
170 // void setCutAllowedPt(const VP1Interval&);
171 // void setCutAllowedEta(const VP1Interval&);
172 // void setCutAllowedPhi(const QList<VP1Interval>&);
173 
174  //getters
175 // VP1Interval getCutAllowedPt() {return m_cut_allowedPtSq; };
176 // VP1Interval getCutAllowedEta() {return m_cut_allowedEta; };
177 // QList<VP1Interval> getCutAllowedPhi() {return m_cut_allowedPhi; };
178 // bool getPtAllowall() {return m_cut_pt_allowall; };
179 // bool getEtaAllowall() {return m_cut_eta_allowall; };
180 // bool getPhiAllowall() {return m_cut_phi_allowall; };
181 
182 
183 private:
184 
185  class Imp;
187 
192 
193 // VP1Interval m_cut_allowedPtSq;//We store the allowed interval for pt squared - to avoid sqrt's.
194 // VP1Interval m_cut_allowedEta;
195 // QList<VP1Interval> m_cut_allowedPhi;
196 // bool m_cut_pt_allowall;
197 // bool m_cut_eta_allowall;
198 // bool m_cut_phi_allowall;
199 // bool m_cut_etaptphi_allwillfail;
200  void fillObjectBrowser();
202 };
203 
204 #endif
205 
206 
207 
208 
AODCollHandleBase::setExtraWidgetsState
void setExtraWidgetsState(const QByteArray &)
Definition: AODCollHandleBase.cxx:519
AODCollHandleBase::assignDefaultMaterial
virtual void assignDefaultMaterial(SoMaterial *) const
Definition: AODCollHandleBase.cxx:495
AODCollHandleBase::common
AODSysCommonData * common()
Definition: AODCollHandleBase.h:89
AODHandleBase
Definition: AODHandleBase.h:43
AODCollHandleBase
Base class for all AOD object collections This class primarily handles setting up the interface,...
Definition: AODCollHandleBase.h:57
AODCollHandleBase::nShownHandles
int nShownHandles()
Definition: AODCollHandleBase.h:129
ObjectType
ObjectType
Definition: BaseObject.h:11
AODSysCommonData
Definition: AODSysCommonData.h:42
AODCollHandleBase::addHandle
virtual void addHandle(AODHandleBase *)=0
AODSystemController.h
VP1QtUtils.h
AODCollHandleBase::hintNumberOfHandlesInEvent
virtual void hintNumberOfHandlesInEvent(unsigned)=0
AODCollHandleBase::dumpToJSON
virtual void dumpToJSON(std::ofstream &) const
Definition: AODCollHandleBase.h:96
AODCollHandleBase::Imp
Definition: AODCollHandleBase.cxx:52
AODCollHandleBase::colourByComboBoxItemChanged
void colourByComboBoxItemChanged()
Definition: AODCollHandleBase.cxx:536
AODCollHandleBase::common
const AODSysCommonData * common() const
Definition: AODCollHandleBase.h:88
AODCollHandleBase::incrementNShownHandles
void incrementNShownHandles()
Definition: AODCollHandleBase.h:132
AODCollHandleBase::provideText
virtual QString provideText() const
Definition: AODCollHandleBase.h:153
AODCollHandleBase::AODCollHandleBase
AODCollHandleBase(AODSysCommonData *, const QString &name, xAOD::Type::ObjectType)
Definition: AODCollHandleBase.cxx:66
AODCollHandleBase::getHandlesList
virtual QList< AODHandleBase * > getHandlesList() const =0
ObjectType.h
VP1ExtraSepLayerHelper
Definition: VP1ExtraSepLayerHelper.h:22
FullCPAlgorithmsTest_eljob.sh
sh
Definition: FullCPAlgorithmsTest_eljob.py:114
AODCollHandleBase::handleIterationBegin
virtual void handleIterationBegin()=0
AODCollHandleBase::setState
virtual void setState(const QByteArray &)
Provide specific implementation.
Definition: AODCollHandleBase.cxx:551
AODCollHandleBase::m_commonData
AODSysCommonData * m_commonData
Definition: AODCollHandleBase.h:190
AODCollHandleBase::m_sephelper
VP1ExtraSepLayerHelper * m_sephelper
Definition: AODCollHandleBase.h:191
RCU::Shell
Definition: ShellExec.cxx:28
AODCollHandleBase::provideSection
virtual QString provideSection() const
Definition: AODCollHandleBase.cxx:380
AODSystemController
Definition: AODSystemController.h:43
AODCollHandleBase::updateMaterialOfAllHandles
void updateMaterialOfAllHandles()
Definition: AODCollHandleBase.cxx:240
AODCollHandleBase::recheckCutStatusOfAllNotVisibleHandles
void recheckCutStatusOfAllNotVisibleHandles()
Definition: AODCollHandleBase.cxx:177
AODCollHandleBase::extraWidgetsState
QByteArray extraWidgetsState() const
Definition: AODCollHandleBase.cxx:510
AODCollHandleBase::recheckCutStatusOfAllHandles
void recheckCutStatusOfAllHandles()
Definition: AODCollHandleBase.cxx:203
VP1StdCollection::text
QString text() const
Definition: VP1StdCollection.cxx:132
AODCollHandleBase::cleanupPtrContainer
void cleanupPtrContainer(T &) const
AODCollHandleBase::decrementNShownHandles
void decrementNShownHandles()
Definition: AODCollHandleBase.h:133
VP1Interval.h
AODCollHandleBase::provideExtraWidgetsForGuiRow
QList< QWidget * > provideExtraWidgetsForGuiRow() const
Definition: AODCollHandleBase.cxx:503
AODCollHandleBase::defaultColor
virtual QColor defaultColor() const =0
AODCollHandleBase::updateObjectBrowserVisibilityCounts
void updateObjectBrowserVisibilityCounts()
Definition: AODCollHandleBase.cxx:419
AODCollHandleBase::setupSettingsFromController
void setupSettingsFromController(const AODSystemController *)
Definition: AODCollHandleBase.cxx:112
AODCollHandleBase::getNextHandle
virtual AODHandleBase * getNextHandle()=0
AODCollHandleBase::xAODType
xAOD::Type::ObjectType xAODType() const
Dummy implementation does nothing.
Definition: AODCollHandleBase.h:97
AODCollHandleBase::sepHelper
VP1ExtraSepLayerHelper * sepHelper()
Definition: AODCollHandleBase.h:91
AODCollHandleBase::matButtonToolTip
virtual QString matButtonToolTip() const
Definition: AODCollHandleBase.h:156
VP1MaterialButtonBase
Definition: VP1MaterialButton.h:25
AODCollHandleBase::sepHelper
const VP1ExtraSepLayerHelper * sepHelper() const
Definition: AODCollHandleBase.h:90
AODCollHandleBase::m_nshownhandles
int m_nshownhandles
Definition: AODCollHandleBase.h:188
AODCollHandleBase::collVisibilityChanged
void collVisibilityChanged(bool)
Definition: AODCollHandleBase.cxx:393
AODCollHandleBase::setSepHelper
void setSepHelper(VP1ExtraSepLayerHelper *sh)
Definition: AODCollHandleBase.h:92
AODCollHandleBase::persistifiableState
virtual QByteArray persistifiableState() const
Provide specific implementation.
Definition: AODCollHandleBase.cxx:571
AODCollHandleBase::init
virtual void init(VP1MaterialButtonBase *matBut=0)=0
AODCollHandleBase::~AODCollHandleBase
virtual ~AODCollHandleBase()
Definition: AODCollHandleBase.cxx:93
AODCollHandleBase::m_type
xAOD::Type::ObjectType m_type
Definition: AODCollHandleBase.h:189
AODCollHandleBase::update3DObjectsOfAllHandles
void update3DObjectsOfAllHandles()
Definition: AODCollHandleBase.cxx:223
VP1StdCollection
Definition: VP1StdCollection.h:31
AODCollHandleBase::m_dbase
Imp * m_dbase
Definition: AODCollHandleBase.h:185
AODCollHandleBase::recheckCutStatus
void recheckCutStatus(AODHandleBase *)
Definition: AODCollHandleBase.cxx:137
AODCollHandleBase::setupSettingsFromControllerSpecific
virtual void setupSettingsFromControllerSpecific(const AODSystemController *)
For extensions specific to this collection.
Definition: AODCollHandleBase.h:79
VP1StdCollection.h
AODCollHandleBase::fillObjectBrowser
void fillObjectBrowser()
Definition: AODCollHandleBase.cxx:431
AODCollHandleBase::recheckCutStatusOfAllVisibleHandles
void recheckCutStatusOfAllVisibleHandles()
Definition: AODCollHandleBase.cxx:144
AODCollHandleBase::provideCollTypeID
qint32 provideCollTypeID() const
Definition: AODCollHandleBase.cxx:375
AODCollHandleBase::provideSectionToolTip
virtual QString provideSectionToolTip() const
Definition: AODCollHandleBase.cxx:388
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
AODCollHandleBase::name
QString name() const
Definition: AODCollHandleBase.cxx:130
AODCollHandleBase::cut
virtual bool cut(AODHandleBase *)=0
AODCollHandleBase::resetCachedValuesCuts
virtual void resetCachedValuesCuts()=0