ATLAS Offline Software
Loading...
Searching...
No Matches
AODCollHandleBase.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 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
39class AODHandleBase;
40class SoSeparator;
41class 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
61public:
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.
77protected:
80public:
81
83 // For loading the data and resetting after each event: //
85
86 //For use by the handles:
87 const 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
99protected:
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)
122public:
128
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//
148protected:
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
161private 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
166public 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
183private:
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
xAOD::Type::ObjectType xAODType() const
Dummy implementation does nothing.
AODCollHandleBase(AODSysCommonData *, const QString &name, xAOD::Type::ObjectType)
void recheckCutStatus(AODHandleBase *)
const AODSysCommonData * common() const
virtual QString matButtonToolTip() const
virtual void setState(const QByteArray &)
Provide specific implementation.
virtual QString provideText() const
qint32 provideCollTypeID() const
void cleanupPtrContainer(T &) const
void recheckCutStatusOfAllNotVisibleHandles()
virtual void assignDefaultMaterial(SoMaterial *) const
void setSepHelper(VP1ExtraSepLayerHelper *sh)
virtual void init(VP1MaterialButtonBase *matBut=0)=0
virtual void handleIterationBegin()=0
void recheckCutStatusOfAllVisibleHandles()
void setExtraWidgetsState(const QByteArray &)
xAOD::Type::ObjectType m_type
virtual void dumpToJSON(std::ofstream &) const
virtual QString provideSection() const
virtual void addHandle(AODHandleBase *)=0
QByteArray extraWidgetsState() const
AODSysCommonData * common()
virtual void setupSettingsFromControllerSpecific(const AODSystemController *)
For extensions specific to this collection.
virtual QByteArray persistifiableState() const
Provide specific implementation.
VP1ExtraSepLayerHelper * sepHelper()
virtual AODHandleBase * getNextHandle()=0
void setupSettingsFromController(const AODSystemController *)
virtual QString provideSectionToolTip() const
virtual void resetCachedValuesCuts()=0
virtual QList< AODHandleBase * > getHandlesList() const =0
AODSysCommonData * m_commonData
virtual QColor defaultColor() const =0
virtual void hintNumberOfHandlesInEvent(unsigned)=0
const VP1ExtraSepLayerHelper * sepHelper() const
void updateObjectBrowserVisibilityCounts()
QList< QWidget * > provideExtraWidgetsForGuiRow() const
const QString & name() const
virtual bool cut(AODHandleBase *)=0
VP1ExtraSepLayerHelper * m_sephelper
QString text() const
VP1StdCollection(IVP1System *, const QString &helperClassName)
ObjectType
Type of objects that have a representation in the xAOD EDM.
Definition ObjectType.h:32