ATLAS Offline Software
PhiSectionWidget.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef PHISECTIONWIDGET_H
6 #define PHISECTIONWIDGET_H
7 
9 // //
10 // Header file for class PhiSectionWidget //
11 // //
12 // Author: Thomas Kittelmann <Thomas.Kittelmann@cern.ch> //
13 // //
14 // Initial VP1 version: September 2007 //
15 // Major update: January 2009 //
16 // //
18 
20 #include "VP1Base/VP1Interval.h"
21 #include "VP1Base/VP1Msg.h"
22 
23 #include <QGraphicsView>
24 #include <QByteArray>
25 
26 class PhiSectionWidget : public QGraphicsView, public VP1HelperClassBase {
27 
28 
29  Q_OBJECT
30 
31 public:
32 
33  PhiSectionWidget(QWidget * parent,IVP1System * sys = 0);
34  virtual ~PhiSectionWidget();
35 
36  int numberOfSectors() const;
37  void setNumberOfSectors(int,bool forceAllEnabled = false);//(default is 12)
38 
39  bool allSectorsOn() const;
40  bool allSectorsOff() const;
41 
42  //Return disjoint intervals of allowed phi values. If all sectors
43  //are off, an empty list is returned. If all are on, a single
44  //interval of 0..2*M_PI is returned:
45  QList<VP1Interval> enabledPhiRanges() const;
46 
47  QString enabledRangesToString() const;
48 
49  //This further imposes a condition of phi in [phi_min,phi_max]:
50  QList<VP1Interval> enabledPhiRanges( double phi_min, double phi_max ) const;
51 
52  QByteArray state() const;
53  void setState(QByteArray);
54 
55  void launchContextMenu(QPoint);
56  void setSectorStatus(int,bool);
57 
58  //Convenience methods for dealing with "sectors" outside the widget:
59  bool virtualSectorEnabled(int iSector, int nSectors) const;
60  QVector<bool> virtualSectorsEnabled(int nSectors) const;
61  static int phiToVirtualSectorIndex(double phi,int nSectors);
62  void setAllowedNumberOfSectors(QList<int> allowedNSectors, bool allowCustom = false);//If current number is not
63  //among the allowed values,
64  //the lowest of the allowed
65  //sectors will be chosen
66  //(unless allowCustom=true).
67  //Call ignored if invalid list.
68 
69 signals:
70  void enabledPhiRangesChanged(const QList<VP1Interval>&);
71 
72 protected:
73  void mousePressEvent(QMouseEvent *);
74  void resizeEvent(QResizeEvent *);
75  void mouseMoveEvent(QMouseEvent *event);
76  void dropEvent(QDropEvent *event);
77  void dragEnterEvent(QDragEnterEvent *event);
78  void dragLeaveEvent(QDragLeaveEvent * event);
79  void dragMoveEvent(QDragMoveEvent * event);
80 private:
81 
82  class Imp;
83  Imp * m_d;
84 
85 };
86 
87 #endif
PhiSectionWidget::phiToVirtualSectorIndex
static int phiToVirtualSectorIndex(double phi, int nSectors)
Definition: PhiSectionWidget.cxx:716
PhiSectionWidget::allSectorsOn
bool allSectorsOn() const
Definition: PhiSectionWidget.cxx:483
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
PhiSectionWidget::numberOfSectors
int numberOfSectors() const
Definition: PhiSectionWidget.cxx:252
PhiSectionWidget::~PhiSectionWidget
virtual ~PhiSectionWidget()
Definition: PhiSectionWidget.cxx:142
PhiSectionWidget::Imp
Definition: PhiSectionWidget.cxx:39
VP1Msg.h
PhiSectionWidget::allSectorsOff
bool allSectorsOff() const
Definition: PhiSectionWidget.cxx:492
PhiSectionWidget::enabledRangesToString
QString enabledRangesToString() const
Definition: PhiSectionWidget.cxx:639
PhiSectionWidget::mousePressEvent
void mousePressEvent(QMouseEvent *)
Definition: PhiSectionWidget.cxx:397
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
PhiSectionWidget::launchContextMenu
void launchContextMenu(QPoint)
Definition: PhiSectionWidget.cxx:324
PhiSectionWidget::PhiSectionWidget
PhiSectionWidget(QWidget *parent, IVP1System *sys=0)
Definition: PhiSectionWidget.cxx:95
PhiSectionWidget::resizeEvent
void resizeEvent(QResizeEvent *)
Definition: PhiSectionWidget.cxx:476
PhiSectionWidget::setSectorStatus
void setSectorStatus(int, bool)
Definition: PhiSectionWidget.cxx:273
IVP1System
Definition: IVP1System.h:36
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
PhiSectionWidget::setAllowedNumberOfSectors
void setAllowedNumberOfSectors(QList< int > allowedNSectors, bool allowCustom=false)
Definition: PhiSectionWidget.cxx:831
PhiSectionWidget::setNumberOfSectors
void setNumberOfSectors(int, bool forceAllEnabled=false)
Definition: PhiSectionWidget.cxx:153
PhiSectionWidget::state
QByteArray state() const
Definition: PhiSectionWidget.cxx:728
test_pyathena.parent
parent
Definition: test_pyathena.py:15
PhiSectionWidget::enabledPhiRangesChanged
void enabledPhiRangesChanged(const QList< VP1Interval > &)
VP1Interval.h
python.L1.Config.LegacyTopoMergerMap.signals
signals
Definition: LegacyTopoMergerMap.py:13
PhiSectionWidget
Definition: PhiSectionWidget.h:26
VP1HelperClassBase
Definition: VP1HelperClassBase.h:28
PhiSectionWidget::dragMoveEvent
void dragMoveEvent(QDragMoveEvent *event)
Definition: PhiSectionWidget.cxx:818
PhiSectionWidget::setState
void setState(QByteArray)
Definition: PhiSectionWidget.cxx:747
VP1HelperClassBase.h
PhiSectionWidget::virtualSectorsEnabled
QVector< bool > virtualSectorsEnabled(int nSectors) const
Definition: PhiSectionWidget.cxx:704
PhiSectionWidget::virtualSectorEnabled
bool virtualSectorEnabled(int iSector, int nSectors) const
Definition: PhiSectionWidget.cxx:677
PhiSectionWidget::dropEvent
void dropEvent(QDropEvent *event)
Definition: PhiSectionWidget.cxx:468
PhiSectionWidget::dragEnterEvent
void dragEnterEvent(QDragEnterEvent *event)
Definition: PhiSectionWidget.cxx:461
PhiSectionWidget::enabledPhiRanges
QList< VP1Interval > enabledPhiRanges() const
Definition: PhiSectionWidget.cxx:560
PhiSectionWidget::m_d
Imp * m_d
Definition: PhiSectionWidget.h:82
PhiSectionWidget::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event)
Definition: PhiSectionWidget.cxx:431
PhiSectionWidget::dragLeaveEvent
void dragLeaveEvent(QDragLeaveEvent *event)
Definition: PhiSectionWidget.cxx:825