ATLAS Offline Software
Loading...
Searching...
No Matches
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
9
10#include <iostream>
11using std::cout;
12using std::endl;
13
14using namespace LArSamples;
15
16
17HistoryIterator::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
39 const History* history = m_interface->cellHistory(m_pos);
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}
HistoryIterator * operator++()
unsigned int pos() const
const Interface * m_interface
HistoryIterator(const Interface &interface, unsigned int pos=0, double eMin=-1, double adcMaxMin=-1)
Constructor.
const History * history() const