ATLAS Offline Software
HistoryIterator.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 #include "LArSamplesMon/Data.h"
9 
10 #include <iostream>
11 using std::cout;
12 using std::endl;
13 
14 using namespace LArSamples;
15 
16 
17 HistoryIterator::HistoryIterator(const Interface& interface, unsigned int pos,
18  double eMin, double adcMaxMin)
19  : m_interface(&interface), m_pos(pos),
20  m_eMin(eMin), m_adcMaxMin(adcMaxMin)
21 {
22  if (!isValid()) next();
23 }
24 
25 
27 {
28  return m_interface->cellHistory(m_pos);
29 }
30 
31 
33 {
34  if (m_pos >= Definitions::nChannels) return false;
35  unsigned int size = m_interface->historySize(m_pos);
36  if (size == 0) return false;
37  if (m_eMin < 0 && m_adcMaxMin < 0) return true;
38 
40  bool found = false;
41  for (unsigned int i = 0; i < history->nData(); i++) {
42  if (history->data(i)->energy() > m_eMin && history->data(i)->adcMax() > m_adcMaxMin) {
43  found = true;
44  break;
45  }
46  }
47  return found;
48 }
49 
50 
52 {
53  m_pos++;
54 
55  for (; m_pos < m_interface->end(); m_pos++)
56  if (isValid()) break;
57 
58  return history();
59 }
60 
61 
63 {
64  next();
65  return this;
66 }
LArSamples::HistoryIterator::m_eMin
double m_eMin
Definition: HistoryIterator.h:45
LArSamples::HistoryIterator::isValid
bool isValid() const
Definition: HistoryIterator.cxx:32
HistoryIterator.h
LArSamples::Data::adcMax
double adcMax() const
Definition: Data.h:129
LArSamples::History
Definition: History.h:40
LArSamples::Interface::cellHistory
const History * cellHistory(unsigned int i) const
Definition: Interface.cxx:114
LArSamples
Definition: AbsShape.h:24
LArSamples::HistoryIterator::HistoryIterator
HistoryIterator(const Interface &interface, unsigned int pos=0, double eMin=-1, double adcMaxMin=-1)
Constructor
Definition: HistoryIterator.cxx:17
LArSamples::HistoryIterator::history
const History * history() const
Definition: HistoryIterator.cxx:26
LArSamples::Interface::end
unsigned int end() const
Definition: Interface.h:60
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
LArSamples::History::data
const Data * data(unsigned int i) const
Definition: History.cxx:88
LArSamples::Definitions::nChannels
static const unsigned int nChannels
Definition: Definitions.h:14
lumiFormat.i
int i
Definition: lumiFormat.py:92
LArSamples::HistoryIterator
storage of the time histories of all the cells
Definition: HistoryIterator.h:20
LArSamples::History::nData
unsigned int nData() const
Definition: History.h:56
LArSamples::HistoryIterator::m_adcMaxMin
double m_adcMaxMin
Definition: HistoryIterator.h:45
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
LArSamples::Interface
Definition: Interface.h:36
Data.h
LArSamples::Interface::historySize
unsigned int historySize(unsigned int i) const
Definition: Interface.h:57
LArSamples::HistoryIterator::m_interface
const Interface * m_interface
Definition: HistoryIterator.h:42
History.h
LArSamples::HistoryIterator::operator++
HistoryIterator * operator++()
Definition: HistoryIterator.cxx:62
Interface.h
LArSamples::Data::energy
double energy() const
Definition: Data.h:113
LArSamples::HistoryIterator::next
const History * next()
Definition: HistoryIterator.cxx:51
LArSamples::HistoryIterator::m_pos
unsigned int m_pos
Definition: HistoryIterator.h:43