ATLAS Offline Software
Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
VP1Prioritiser::Imp::SystemInfo Class Reference
Collaboration diagram for VP1Prioritiser::Imp::SystemInfo:

Public Types

enum  VisibilityState { NOTVISIBLE, VISIBLE, SOONVISIBLE }
 

Public Member Functions

 SystemInfo (IVP1System *, Imp *, IVP1ChannelWidget *, const VisibilityState &)
 
 ~SystemInfo ()
 
void setVisibilityState (const VisibilityState &)
 
void addTimeMeasurement (const double &)
 
double refreshtime () const
 

Public Attributes

IVP1Systemsystem
 

Private Member Functions

void calcPriority ()
 
void removeFromPriMap ()
 

Private Attributes

double m_timing
 
double m_priority
 
const bool m_accumulator
 
VisibilityState m_vs
 
Impm_d
 
QQueue< double > m_timemeasurements
 

Detailed Description

Definition at line 33 of file VP1Prioritiser.cxx.

Member Enumeration Documentation

◆ VisibilityState

Enumerator
NOTVISIBLE 
VISIBLE 
SOONVISIBLE 

Definition at line 35 of file VP1Prioritiser.cxx.

Constructor & Destructor Documentation

◆ SystemInfo()

VP1Prioritiser::Imp::SystemInfo::SystemInfo ( IVP1System s,
Imp d,
IVP1ChannelWidget cw,
const VisibilityState vs 
)
inline

Definition at line 78 of file VP1Prioritiser.cxx.

79  : system(s), m_priority(117117.117),
81 {
82  //If another system with the same name exists already, we use that
83  //timing as a reasonable guess. Otherwise we use the average of the
84  //other channels. Failing that we use a default of 500ms.:
85  double tmp(0);
86  bool found(false);
89  if ( it.key()->name() == s->name() ) {
90  m_timing=it.value()->refreshtime();
91  found=true;
92  break;
93  }
94  tmp += m_timing=it.value()->refreshtime();
95  }
96  if (!found&&!m_d->sys2info.empty())
97  m_timing = tmp/m_d->sys2info.count();
98  else
99  m_timing=500;
100 
101  calcPriority();
102 }

◆ ~SystemInfo()

VP1Prioritiser::Imp::SystemInfo::~SystemInfo ( )
inline

Definition at line 105 of file VP1Prioritiser.cxx.

106 {
108 }

Member Function Documentation

◆ addTimeMeasurement()

void VP1Prioritiser::Imp::SystemInfo::addTimeMeasurement ( const double &  t)
inline

Definition at line 122 of file VP1Prioritiser.cxx.

123 {
124  //Keep the seven latest measurements, and use a truncated mean as
125  //final estimate.
126 
127  m_timemeasurements.enqueue(t);
128  if (m_timemeasurements.count()==8)
129  m_timemeasurements.dequeue();
130 
131  QList<double> tmplist = m_timemeasurements;
132  std::sort(tmplist.begin(), tmplist.end());
133 
134  switch(tmplist.count()) {
135  case 1: m_timing = tmplist.at(0); break;
136  case 2: m_timing = 0.5*(tmplist.at(0)+tmplist.at(1)); break;
137  case 3: m_timing = tmplist.at(1); break;
138  case 4: m_timing = 0.5*(tmplist.at(1)+tmplist.at(2)); break;
139  case 5: m_timing = (tmplist.at(1)+tmplist.at(2)+tmplist.at(3))/3.0; break;
140  case 6: m_timing = 0.5*(tmplist.at(2)+tmplist.at(3)); break;
141  case 7: m_timing = (tmplist.at(2)+tmplist.at(3)+tmplist.at(4))/3.0; break;
142  default: assert(0&&"Should never happen"); break;
143  }
144 
145  calcPriority();
146 }

◆ calcPriority()

void VP1Prioritiser::Imp::SystemInfo::calcPriority ( )
inlineprivate

Definition at line 149 of file VP1Prioritiser.cxx.

150 {
151  //1) Remove from m_d->priority2sys map
152 
153  if (m_priority!=117117.117)
155 
156  //2) Calculate new priority
157 
158  //Priority is based on how long the systems take to refresh (the
159  //fastest gets refreshed first). In order to ensure that visible,
160  //soonvisible, and accumulators gets priority they get a bonus of
161  //30s, XXXms, and 100ms respectively (where XXX depends on the scenario):
162 
163  m_priority = m_timing + (m_vs==VISIBLE?-30000.0:(m_vs==SOONVISIBLE?-m_d->soonvisbonus:0.0)) + (m_accumulator?-100.0:0.0);
164 
165  //3) Add to m_d->priority2sys map
166 
167  std::pair<double,IVP1System*> a(m_priority,system);
168  m_d->priority2sys.insert(a);
169 }

◆ refreshtime()

double VP1Prioritiser::Imp::SystemInfo::refreshtime ( ) const
inline

Definition at line 41 of file VP1Prioritiser.cxx.

41 { return m_timing; }

◆ removeFromPriMap()

void VP1Prioritiser::Imp::SystemInfo::removeFromPriMap ( )
inlineprivate

Definition at line 172 of file VP1Prioritiser.cxx.

173 {
174  //Fixme: Cache itp and it (in class Imp even?)!
175  std::pair<Pri2SysMap::iterator, Pri2SysMap::iterator> itp(m_d->priority2sys.equal_range(m_priority));
176  Pri2SysMap::iterator it = itp.first;
177  for (;it!=itp.second;++it) {
178  if (it->second==system) {
179  m_d->priority2sys.erase(it);
180  break;
181  }
182  }
183  assert(it != itp.second);
184 }

◆ setVisibilityState()

void VP1Prioritiser::Imp::SystemInfo::setVisibilityState ( const VisibilityState vs)
inline

Definition at line 111 of file VP1Prioritiser.cxx.

112 {
113  //Fixme: When do we get tabmanager setVisible signals? At startup? When channels are added?
114  //Fixme: Do not emit these during file loading!!
115  if (m_vs==vs)
116  return;
117  m_vs = vs;
118  calcPriority();
119 }

Member Data Documentation

◆ m_accumulator

const bool VP1Prioritiser::Imp::SystemInfo::m_accumulator
private

Definition at line 45 of file VP1Prioritiser.cxx.

◆ m_d

Imp* VP1Prioritiser::Imp::SystemInfo::m_d
private

Definition at line 48 of file VP1Prioritiser.cxx.

◆ m_priority

double VP1Prioritiser::Imp::SystemInfo::m_priority
private

Definition at line 44 of file VP1Prioritiser.cxx.

◆ m_timemeasurements

QQueue<double> VP1Prioritiser::Imp::SystemInfo::m_timemeasurements
private

Definition at line 50 of file VP1Prioritiser.cxx.

◆ m_timing

double VP1Prioritiser::Imp::SystemInfo::m_timing
private

Definition at line 43 of file VP1Prioritiser.cxx.

◆ m_vs

VisibilityState VP1Prioritiser::Imp::SystemInfo::m_vs
private

Definition at line 46 of file VP1Prioritiser.cxx.

◆ system

IVP1System* VP1Prioritiser::Imp::SystemInfo::system

Definition at line 38 of file VP1Prioritiser.cxx.


The documentation for this class was generated from the following file:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TruthTest.itp
itp
Definition: TruthTest.py:46
VP1Prioritiser::Imp::SystemInfo::m_d
Imp * m_d
Definition: VP1Prioritiser.cxx:48
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
beamspotman.tmplist
tmplist
Definition: beamspotman.py:381
hist_file_dump.d
d
Definition: hist_file_dump.py:137
skel.it
it
Definition: skel.GENtoEVGEN.py:396
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
TruthTest.itE
itE
Definition: TruthTest.py:25
VP1Prioritiser::Imp::SystemInfo::m_timemeasurements
QQueue< double > m_timemeasurements
Definition: VP1Prioritiser.cxx:50
IVP1ChannelWidget::isAccumulator
virtual bool isAccumulator() const
Definition: IVP1ChannelWidget.cxx:83
VP1Prioritiser::Imp::SystemInfo::system
IVP1System * system
Definition: VP1Prioritiser.cxx:38
VP1Prioritiser::Imp::priority2sys
Pri2SysMap priority2sys
Definition: VP1Prioritiser.cxx:56
VP1Prioritiser::Imp::SystemInfo::removeFromPriMap
void removeFromPriMap()
Definition: VP1Prioritiser.cxx:172
VP1Prioritiser::Imp::SystemInfo::NOTVISIBLE
@ NOTVISIBLE
Definition: VP1Prioritiser.cxx:35
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
VP1Prioritiser::Imp::SystemInfo::VISIBLE
@ VISIBLE
Definition: VP1Prioritiser.cxx:35
VP1Prioritiser::Imp::soonvisbonus
double soonvisbonus
Definition: VP1Prioritiser.cxx:59
VP1Prioritiser::Imp::SystemInfo::m_accumulator
const bool m_accumulator
Definition: VP1Prioritiser.cxx:45
VP1Prioritiser::Imp::sys2info
QHash< IVP1System *, SystemInfo * > sys2info
Definition: VP1Prioritiser.cxx:61
a
TList * a
Definition: liststreamerinfos.cxx:10
VP1Prioritiser::Imp::SystemInfo::calcPriority
void calcPriority()
Definition: VP1Prioritiser.cxx:149
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
VP1Prioritiser::Imp::SystemInfo::SOONVISIBLE
@ SOONVISIBLE
Definition: VP1Prioritiser.cxx:35
VP1Prioritiser::Imp::SystemInfo::m_vs
VisibilityState m_vs
Definition: VP1Prioritiser.cxx:46
VP1Prioritiser::Imp::SystemInfo::m_priority
double m_priority
Definition: VP1Prioritiser.cxx:44
VP1Prioritiser::Imp::SystemInfo::m_timing
double m_timing
Definition: VP1Prioritiser.cxx:43