ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
PhiSectionWidget::Imp Class Reference
Collaboration diagram for PhiSectionWidget::Imp:

Public Member Functions

void approximateSectorStatusFromRanges (QList< VP1Interval > oldEnabledRanges, QVector< bool > &target)
 
void updateColors ()
 
void ensureMenuInit ()
 
void addMenuEntriesForSetNPhi ()
 
QList< VP1IntervalenabledPhiRangesNoCache (const QVector< bool > &secstatus, bool &allOn, bool &allOff) const
 
void checkForChanges ()
 

Static Public Member Functions

static void wrap (QList< VP1Interval > &)
 

Public Attributes

PhiSectionWidgettheclass
 
QVector< bool > sectorstatus
 
std::map< QGraphicsEllipseItem *, int > item2sector
 
QPoint dragStartPosition
 
QPen pen_on
 
QPen pen_off
 
QBrush brush_on
 
QBrush brush_off
 
bool cacheValid
 
QList< VP1IntervalcachedRanges
 
bool cachedAllOn
 
bool cachedAllOff
 
bool allowCustomNSectors
 
QList< int > allowedNSectors
 
QMenu * popup_menu
 
QAction * popup_enableAllAction
 
QAction * popup_disableAllAction
 
QAction * popup_invertAction
 
QAction * popup_copyAction
 
QAction * popup_pasteAction
 
QMenu * popup_setNPhiSubMenu
 
QList< QAction * > popuplist_setNPhi
 
QAction * popup_setCustomNPhi
 

Detailed Description

Definition at line 39 of file PhiSectionWidget.cxx.

Member Function Documentation

◆ addMenuEntriesForSetNPhi()

void PhiSectionWidget::Imp::addMenuEntriesForSetNPhi ( )

Definition at line 302 of file PhiSectionWidget.cxx.

303 {
304  if (!popup_menu)
305  return;
306  if (!popuplist_setNPhi.isEmpty()) {
307  for(QAction * setNPhiAct : popuplist_setNPhi)
308  delete setNPhiAct;
309  }
310  popuplist_setNPhi.clear();
311 
312  for(int nSectors : allowedNSectors) {
313  QAction * a = popup_setNPhiSubMenu->addAction(QString::number(nSectors));
314  a->setData(nSectors);
315  popuplist_setNPhi << a;
316  }
317  if (allowCustomNSectors) {
318  popup_setNPhiSubMenu->addSeparator();
319  popup_setCustomNPhi = popup_setNPhiSubMenu->addAction("&Custom...");
320  }
321 }

◆ approximateSectorStatusFromRanges()

void PhiSectionWidget::Imp::approximateSectorStatusFromRanges ( QList< VP1Interval oldEnabledRanges,
QVector< bool > &  target 
)

Definition at line 791 of file PhiSectionWidget.cxx.

793 {
794  if (oldEnabledRanges.isEmpty()) {
795  target.fill(false);
796  return;
797  }
798  if (oldEnabledRanges.count()==1&&oldEnabledRanges.first().length()>=2*M_PI*(1.0-1.0e-10)) {
799  target.fill(true);
800  return;
801  }
802  const unsigned n = target.size();
803  target.fill(false);
804  const double dphi = (2*M_PI)/n;
805  const double epsilon(dphi*1.0e-9);
806  for (unsigned i = 0; i < n; ++i) {
807  VP1Interval phirange(dphi*i+epsilon,dphi*(i+1)-epsilon);
808  for(const VP1Interval& oldrange : oldEnabledRanges) {
809  if (phirange.hasOverlap(oldrange,2*M_PI)) {
810  target[i]=true;
811  break;
812  }
813  }
814  }
815 }

◆ checkForChanges()

void PhiSectionWidget::Imp::checkForChanges ( )

Definition at line 650 of file PhiSectionWidget.cxx.

651 {
652  if(VP1Msg::debug()){
653  theclass->messageDebug("checkForChanges()");
654  }
655 
656  //Ensure caches are updated, and emit signal in case of any change:
657  cacheValid = true;
658 
660  if (cachedRanges == r) {
661  return;
662  }
663  updateColors();
664  cachedRanges = r;
665 
666  if(VP1Msg::verbose()){
667  QString s;
668  for(int i=0;i<r.count();++i)
669  s+= r.at(i).toString()+(i==r.count()-1?"":", ");
670  theclass->messageVerbose("Emitting enabledPhiRangesChanged("
672  }
674 }

◆ enabledPhiRangesNoCache()

QList< VP1Interval > PhiSectionWidget::Imp::enabledPhiRangesNoCache ( const QVector< bool > &  secstatus,
bool &  allOn,
bool &  allOff 
) const

Definition at line 510 of file PhiSectionWidget.cxx.

511 {
512  if(VP1Msg::verbose()){
513  theclass->messageVerbose("enabledPhiRangesNoCache()");
514  }
515  QList<VP1Interval> l;
516  allOn = true;
517  allOff = true;
518 
519  const unsigned int n = secstatus.count();
520 
521  const double dphi = (2*M_PI)/n;
522  if(VP1Msg::debug()){
523  qDebug() << "n: " << n << " - dphi:" << dphi;
524  }
525 
526  bool open(false);
527  double tmp(-999);
528 
529  for (unsigned i = 0; i < n; ++i) {
530  const bool status = secstatus[i];
531  if (status) {
532  allOff = false;
533  }
534  else {
535  allOn = false;
536  }
537  if (status!=open) {
538  if (!open) {
539  tmp = i*dphi;
540  open = true;
541  } else {
542  l << VP1Interval(tmp,i*dphi);
543  open = false;
544  }
545  }
546  }
547  if (open)
548  l << VP1Interval(tmp,(2*M_PI));
549  wrap(l);
550 
551  if(VP1Msg::debug()){
552  theclass->messageDebug("exiting enabledPhiRangesNoCache()...");
553  }
554 
555  return l;
556 }

◆ ensureMenuInit()

void PhiSectionWidget::Imp::ensureMenuInit ( )

Definition at line 285 of file PhiSectionWidget.cxx.

286 {
287  if (popup_menu)
288  return;
289  popup_menu = new QMenu(theclass);
290  popup_copyAction = popup_menu->addAction("&Copy");
291  popup_pasteAction = popup_menu->addAction("&Paste");
292  popup_menu->addSeparator();
293  popup_enableAllAction = popup_menu->addAction("&Enable all sectors");
294  popup_disableAllAction = popup_menu->addAction("&Disable all sectors");
295  popup_invertAction = popup_menu->addAction("&Invert");
296  popup_menu->addSeparator();
297  popup_setNPhiSubMenu = popup_menu->addMenu("&Set number of phi sectors");
299 }

◆ updateColors()

void PhiSectionWidget::Imp::updateColors ( )

Definition at line 258 of file PhiSectionWidget.cxx.

259 {
261  for (it = item2sector.begin();it!=itE;++it) {
262  if (sectorstatus[it->second]) {
263  it->first->setPen(pen_on);
264  it->first->setBrush(brush_on);
265  } else {
266  it->first->setPen(pen_off);
267  it->first->setBrush(brush_off);
268  }
269  }
270 }

◆ wrap()

void PhiSectionWidget::Imp::wrap ( QList< VP1Interval > &  l)
static

Definition at line 500 of file PhiSectionWidget.cxx.

501 {
502  if (l.count()<2||l.front().lower()!=0.0||l.back().upper()!=(2*M_PI))
503  return;
504  l.front().setLower(l.back().lower()-(2*M_PI));
505  l.removeLast();
506 }

Member Data Documentation

◆ allowCustomNSectors

bool PhiSectionWidget::Imp::allowCustomNSectors

Definition at line 70 of file PhiSectionWidget.cxx.

◆ allowedNSectors

QList<int> PhiSectionWidget::Imp::allowedNSectors

Definition at line 71 of file PhiSectionWidget.cxx.

◆ brush_off

QBrush PhiSectionWidget::Imp::brush_off

Definition at line 55 of file PhiSectionWidget.cxx.

◆ brush_on

QBrush PhiSectionWidget::Imp::brush_on

Definition at line 54 of file PhiSectionWidget.cxx.

◆ cachedAllOff

bool PhiSectionWidget::Imp::cachedAllOff

Definition at line 64 of file PhiSectionWidget.cxx.

◆ cachedAllOn

bool PhiSectionWidget::Imp::cachedAllOn

Definition at line 63 of file PhiSectionWidget.cxx.

◆ cachedRanges

QList<VP1Interval> PhiSectionWidget::Imp::cachedRanges

Definition at line 62 of file PhiSectionWidget.cxx.

◆ cacheValid

bool PhiSectionWidget::Imp::cacheValid

Definition at line 61 of file PhiSectionWidget.cxx.

◆ dragStartPosition

QPoint PhiSectionWidget::Imp::dragStartPosition

Definition at line 49 of file PhiSectionWidget.cxx.

◆ item2sector

std::map<QGraphicsEllipseItem*,int> PhiSectionWidget::Imp::item2sector

Definition at line 45 of file PhiSectionWidget.cxx.

◆ pen_off

QPen PhiSectionWidget::Imp::pen_off

Definition at line 53 of file PhiSectionWidget.cxx.

◆ pen_on

QPen PhiSectionWidget::Imp::pen_on

Definition at line 52 of file PhiSectionWidget.cxx.

◆ popup_copyAction

QAction* PhiSectionWidget::Imp::popup_copyAction

Definition at line 78 of file PhiSectionWidget.cxx.

◆ popup_disableAllAction

QAction* PhiSectionWidget::Imp::popup_disableAllAction

Definition at line 76 of file PhiSectionWidget.cxx.

◆ popup_enableAllAction

QAction* PhiSectionWidget::Imp::popup_enableAllAction

Definition at line 75 of file PhiSectionWidget.cxx.

◆ popup_invertAction

QAction* PhiSectionWidget::Imp::popup_invertAction

Definition at line 77 of file PhiSectionWidget.cxx.

◆ popup_menu

QMenu* PhiSectionWidget::Imp::popup_menu

Definition at line 74 of file PhiSectionWidget.cxx.

◆ popup_pasteAction

QAction* PhiSectionWidget::Imp::popup_pasteAction

Definition at line 79 of file PhiSectionWidget.cxx.

◆ popup_setCustomNPhi

QAction* PhiSectionWidget::Imp::popup_setCustomNPhi

Definition at line 82 of file PhiSectionWidget.cxx.

◆ popup_setNPhiSubMenu

QMenu* PhiSectionWidget::Imp::popup_setNPhiSubMenu

Definition at line 80 of file PhiSectionWidget.cxx.

◆ popuplist_setNPhi

QList<QAction*> PhiSectionWidget::Imp::popuplist_setNPhi

Definition at line 81 of file PhiSectionWidget.cxx.

◆ sectorstatus

QVector<bool> PhiSectionWidget::Imp::sectorstatus

Definition at line 44 of file PhiSectionWidget.cxx.

◆ theclass

PhiSectionWidget* PhiSectionWidget::Imp::theclass

Definition at line 41 of file PhiSectionWidget.cxx.


The documentation for this class was generated from the following file:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
PhiSectionWidget::Imp::wrap
static void wrap(QList< VP1Interval > &)
Definition: PhiSectionWidget.cxx:500
beamspotman.r
def r
Definition: beamspotman.py:676
PhiSectionWidget::Imp::popuplist_setNPhi
QList< QAction * > popuplist_setNPhi
Definition: PhiSectionWidget.cxx:81
PhiSectionWidget::Imp::popup_invertAction
QAction * popup_invertAction
Definition: PhiSectionWidget.cxx:77
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
PhiSectionWidget::Imp::popup_setNPhiSubMenu
QMenu * popup_setNPhiSubMenu
Definition: PhiSectionWidget.cxx:80
GlobalVariables.phirange
phirange
Definition: GlobalVariables.py:64
VP1HelperClassBase::messageVerbose
void messageVerbose(const QString &) const
Definition: VP1HelperClassBase.cxx:78
PhiSectionWidget::Imp::popup_copyAction
QAction * popup_copyAction
Definition: PhiSectionWidget.cxx:78
PhiSectionWidget::Imp::sectorstatus
QVector< bool > sectorstatus
Definition: PhiSectionWidget.cxx:44
PhiSectionWidget::enabledRangesToString
QString enabledRangesToString() const
Definition: PhiSectionWidget.cxx:639
skel.it
it
Definition: skel.GENtoEVGEN.py:423
PhiSectionWidget::Imp::allowCustomNSectors
bool allowCustomNSectors
Definition: PhiSectionWidget.cxx:70
M_PI
#define M_PI
Definition: ActiveFraction.h:11
PhiSectionWidget::Imp::updateColors
void updateColors()
Definition: PhiSectionWidget.cxx:258
VP1Msg::debug
static bool debug()
Definition: VP1Msg.h:32
PhiSectionWidget::Imp::cachedAllOn
bool cachedAllOn
Definition: PhiSectionWidget.cxx:63
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
VP1HelperClassBase::messageDebug
void messageDebug(const QString &) const
Definition: VP1HelperClassBase.cxx:65
TruthTest.itE
itE
Definition: TruthTest.py:25
PhiSectionWidget::Imp::pen_on
QPen pen_on
Definition: PhiSectionWidget.cxx:52
PhiSectionWidget::Imp::theclass
PhiSectionWidget * theclass
Definition: PhiSectionWidget.cxx:41
PhiSectionWidget::Imp::popup_setCustomNPhi
QAction * popup_setCustomNPhi
Definition: PhiSectionWidget.cxx:82
lumiFormat.i
int i
Definition: lumiFormat.py:92
beamspotman.n
n
Definition: beamspotman.py:731
PhiSectionWidget::Imp::pen_off
QPen pen_off
Definition: PhiSectionWidget.cxx:53
PhiSectionWidget::enabledPhiRangesChanged
void enabledPhiRangesChanged(const QList< VP1Interval > &)
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
PhiSectionWidget::Imp::brush_on
QBrush brush_on
Definition: PhiSectionWidget.cxx:54
PhiSectionWidget::Imp::cacheValid
bool cacheValid
Definition: PhiSectionWidget.cxx:61
PhiSectionWidget::Imp::cachedRanges
QList< VP1Interval > cachedRanges
Definition: PhiSectionWidget.cxx:62
PhiSectionWidget::Imp::popup_menu
QMenu * popup_menu
Definition: PhiSectionWidget.cxx:74
PhiSectionWidget::Imp::popup_pasteAction
QAction * popup_pasteAction
Definition: PhiSectionWidget.cxx:79
python.selection.number
number
Definition: selection.py:20
Trk::open
@ open
Definition: BinningType.h:40
VP1Interval
Definition: VP1Interval.h:23
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
a
TList * a
Definition: liststreamerinfos.cxx:10
PhiSectionWidget::Imp::popup_enableAllAction
QAction * popup_enableAllAction
Definition: PhiSectionWidget.cxx:75
PhiSectionWidget::Imp::allowedNSectors
QList< int > allowedNSectors
Definition: PhiSectionWidget.cxx:71
PhiSectionWidget::Imp::brush_off
QBrush brush_off
Definition: PhiSectionWidget.cxx:55
PhiSectionWidget::Imp::addMenuEntriesForSetNPhi
void addMenuEntriesForSetNPhi()
Definition: PhiSectionWidget.cxx:302
PhiSectionWidget::Imp::cachedAllOff
bool cachedAllOff
Definition: PhiSectionWidget.cxx:64
VP1Msg::verbose
static bool verbose()
Definition: VP1Msg.h:31
merge.status
status
Definition: merge.py:17
COOLRates.target
target
Definition: COOLRates.py:1106
PhiSectionWidget::Imp::item2sector
std::map< QGraphicsEllipseItem *, int > item2sector
Definition: PhiSectionWidget.cxx:45
PhiSectionWidget::Imp::enabledPhiRangesNoCache
QList< VP1Interval > enabledPhiRangesNoCache(const QVector< bool > &secstatus, bool &allOn, bool &allOff) const
Definition: PhiSectionWidget.cxx:510
PhiSectionWidget::Imp::popup_disableAllAction
QAction * popup_disableAllAction
Definition: PhiSectionWidget.cxx:76