ATLAS Offline Software
Loading...
Searching...
No Matches
PhiSectionWidget::Imp Class Reference
Collaboration diagram for PhiSectionWidget::Imp:

Public Member Functions

void approximateSectorStatusFromRanges (const 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);
316 }
318 popup_setNPhiSubMenu->addSeparator();
319 popup_setCustomNPhi = popup_setNPhiSubMenu->addAction("&Custom...");
320 }
321}
static Double_t a
QList< QAction * > popuplist_setNPhi

◆ approximateSectorStatusFromRanges()

void PhiSectionWidget::Imp::approximateSectorStatusFromRanges ( const 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}
#define M_PI

◆ 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("
671 +theclass->enabledRangesToString()+")");
672 }
673 emit theclass->enabledPhiRangesChanged(r);
674}
PhiSectionWidget * theclass
QList< VP1Interval > cachedRanges
QList< VP1Interval > enabledPhiRangesNoCache(const QVector< bool > &secstatus, bool &allOn, bool &allOff) const
QVector< bool > sectorstatus
static bool debug()
Definition VP1Msg.h:32
static bool verbose()
Definition VP1Msg.h:31
int r
Definition globals.cxx:22

◆ 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}
static void wrap(QList< VP1Interval > &)
l
Printing final latex table to .tex output file.
@ open
Definition BinningType.h:40
status
Definition merge.py:16

◆ 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{
260 std::map<QGraphicsEllipseItem*,int>::iterator it, itE = item2sector.end();
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}
std::map< QGraphicsEllipseItem *, int > item2sector

◆ 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: