ATLAS Offline Software
TBBPCRaw.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TBEVENT_TBBPCRAW_H
6 #define TBEVENT_TBBPCRAW_H
7 
20 #include "TBEvent/TBBeamDetector.h"
21 
22 #include "TBEvent/TBTDCRawCont.h"
23 #include "TBEvent/TBADCRawCont.h"
24 
25 #include "AthLinks/ElementLink.h"
26 
27 #include <string>
28 #include <vector>
29 
30 
31 
32 class TBBPCRaw : public TBBeamDetector
33 {
34  public:
35 
37  typedef std::vector< ElementLink<TBTDCRawCont> > tdc_store_type;
38  typedef tdc_store_type::const_iterator tdc_store_iterator;
39 
41  typedef std::vector< ElementLink<TBADCRawCont> > adc_store_type;
42  typedef adc_store_type::const_iterator adc_store_iterator;
43 
44  enum SignalSource { tdcLeft = 0,
45  tdcRight = 1,
46  tdcUp = 2,
47  tdcDown = 3,
50  unknown = 6 };
51 
53  // Constructors and Destructor //
55 
56  TBBPCRaw();
57 
59 
60  TBBPCRaw(const std::string& thisBPCName) : TBBeamDetector(thisBPCName)
61  {}
62 
63  TBBPCRaw(const std::string& thisBPCName,
64  const TBTDCRawCont* theTDCCont,
65  const std::vector<const TBTDCRaw*>& theTDCs,
66  const TBADCRawCont* theADCCont,
67  const std::vector<const TBADCRaw*>& theADCs);
68 
69  ~TBBPCRaw();
70 
72  // Data Access //
74  void setSignals(const TBTDCRawCont* theTDCCont,
75  const std::vector<const TBTDCRaw*>& theTDCs,
76  const TBADCRawCont* theADCCont,
77  const std::vector<const TBADCRaw*>& theADCs);
78 
81  tdc_signal_type getTDCUp() const;
83  tdc_signal_type getTDCSignal(SignalSource theSource) const;
84 
87  adc_signal_type getADCSignal(SignalSource theSource) const;
88 
89  // access overflow
90  virtual bool isOverflow() const;
91  virtual bool isOverflow(SignalSource theSource) const;
92 
93  // iterator on time measurements
96  SignalSource getSignalSource(tdc_store_iterator& theTDCIterator) const;
97 
98  // iterator on amplitude mesaurement
100  adc_store_iterator adc_end() const;
101  SignalSource getSignalSource(adc_store_iterator& theADCIterator) const;
102 
103  private:
104 
106  // Private Data //
108 
111 
113  // Private Functions //
115 
116 /* template<typename T> */
117 /* size_t findIndex(const T& theStore,T::const_iterator& theIterator) */
118 /* { */
119 /* T::const_iterator firstInStore = theStore.begin(); */
120 /* T::const_iterator lastInStore = theStore.end(); */
121 /* size_t theIndex = 0; */
122 /* while ( firstInStore != theIterator && firstInStore != lastInStore ) */
123 /* { */
124 /* theIndex++; */
125 /* firstInStore++; */
126 /* } */
127 /* if ( firstInStore == lastInStore ) theIndex = size_t(-1); */
128 /* return theIndex; */
129 /* } */
130 
131 
132  size_t findIndex( const tdc_store_type& theStore,tdc_store_iterator& theIterator) const
133  {
134  tdc_store_type::const_iterator firstInStore = theStore.begin();
135  tdc_store_type::const_iterator lastInStore = theStore.end();
136  size_t theIndex = 0;
137  while ( firstInStore != theIterator && firstInStore != lastInStore )
138  {
139  ++theIndex;
140  ++firstInStore;
141  }
142  if ( firstInStore == lastInStore ) theIndex = size_t(-1);
143  return theIndex;
144  }
145  size_t findIndex(const adc_store_type& theStore,adc_store_type::const_iterator& theIterator) const
146  {
147  adc_store_type::const_iterator firstInStore = theStore.begin();
148  adc_store_type::const_iterator lastInStore = theStore.end();
149  size_t theIndex = 0;
150  while ( firstInStore != theIterator && firstInStore != lastInStore )
151  {
152  ++theIndex;
153  ++firstInStore;
154  }
155  if ( firstInStore == lastInStore ) theIndex = size_t(-1);
156  return theIndex;
157  }
158 
159 };
160 
162 // Inline Functions //
164 
165 // global overflow
166 inline bool TBBPCRaw::isOverflow() const
167 {
168  return m_overflow;
169 }
170 
171 // specific signals
173 {
174  return this->getTDCSignal(TBBPCRaw::tdcLeft);
175 }
176 
178 {
179  return this->getTDCSignal(TBBPCRaw::tdcRight);
180 }
181 
183 {
184  return this->getTDCSignal(TBBPCRaw::tdcUp);
185 }
186 
188 {
189  return this->getTDCSignal(TBBPCRaw::tdcDown);
190 }
191 
193 {
195 }
196 
198 {
199  return this->getADCSignal(TBBPCRaw::adcVertical);
200 }
201 
202 // iterators
204 {
205  return m_tdcSignals.begin();
206 }
208 {
209  return m_tdcSignals.end();
210 }
212 {
213  return m_adcSignals.begin();
214 }
216 {
217  return m_adcSignals.end();
218 }
219 #endif
TBBPCRaw::TBBPCRaw
TBBPCRaw(const std::string &thisBPCName)
standard constructor
Definition: TBBPCRaw.h:60
TBBPCRaw::tdc_begin
tdc_store_iterator tdc_begin() const
Definition: TBBPCRaw.h:203
TBBeamDetector.h
TBBPCRaw
raw data class for BPC measurement
Definition: TBBPCRaw.h:33
TBBPCRaw::getTDCSignal
tdc_signal_type getTDCSignal(SignalSource theSource) const
Definition: TBBPCRaw.cxx:100
TBBPCRaw::getTDCRight
tdc_signal_type getTDCRight() const
Definition: TBBPCRaw.h:177
TBBPCRaw::TBBPCRaw
TBBPCRaw()
Definition: TBBPCRaw.cxx:22
TBADCRawCont.h
TBBPCRaw::SignalSource
SignalSource
Definition: TBBPCRaw.h:44
TBBPCRaw::adc_begin
adc_store_iterator adc_begin() const
Definition: TBBPCRaw.h:211
TBTDCRaw::signal_type
unsigned int signal_type
Definition: TBTDCRaw.h:24
TBBPCRaw::tdcUp
@ tdcUp
Definition: TBBPCRaw.h:46
TBBPCRaw::adcVertical
@ adcVertical
Definition: TBBPCRaw.h:49
TBBPCRaw::unknown
@ unknown
Definition: TBBPCRaw.h:50
TBBPCRaw::m_adcSignals
adc_store_type m_adcSignals
Definition: TBBPCRaw.h:110
TBBPCRaw::tdc_store_type
std::vector< ElementLink< TBTDCRawCont > > tdc_store_type
Definition: TBBPCRaw.h:37
TBTDCRawCont.h
TBBPCRaw::getADCHorizontal
adc_signal_type getADCHorizontal() const
Definition: TBBPCRaw.h:192
TBBPCRaw::getTDCDown
tdc_signal_type getTDCDown() const
Definition: TBBPCRaw.h:187
TBBPCRaw::tdc_store_iterator
tdc_store_type::const_iterator tdc_store_iterator
Definition: TBBPCRaw.h:38
TBBPCRaw::tdc_signal_type
TBTDCRaw::signal_type tdc_signal_type
Definition: TBBPCRaw.h:36
TBBPCRaw::adc_store_type
std::vector< ElementLink< TBADCRawCont > > adc_store_type
Definition: TBBPCRaw.h:41
TBBPCRaw::getADCSignal
adc_signal_type getADCSignal(SignalSource theSource) const
Definition: TBBPCRaw.cxx:123
TBBPCRaw::adcHorizontal
@ adcHorizontal
Definition: TBBPCRaw.h:48
TBBPCRaw::tdcDown
@ tdcDown
Definition: TBBPCRaw.h:47
TBTDCRawCont
Definition: TBTDCRawCont.h:21
TBBPCRaw::adc_store_iterator
adc_store_type::const_iterator adc_store_iterator
Definition: TBBPCRaw.h:42
TBADCRaw::signal_type
unsigned int signal_type
Definition: TBADCRaw.h:24
TBBPCRaw::findIndex
size_t findIndex(const tdc_store_type &theStore, tdc_store_iterator &theIterator) const
Definition: TBBPCRaw.h:132
TBBPCRaw::findIndex
size_t findIndex(const adc_store_type &theStore, adc_store_type::const_iterator &theIterator) const
Definition: TBBPCRaw.h:145
TBBPCRaw::tdcLeft
@ tdcLeft
Definition: TBBPCRaw.h:44
TBBPCRaw::~TBBPCRaw
~TBBPCRaw()
Definition: TBBPCRaw.cxx:60
TBBPCRaw::m_tdcSignals
tdc_store_type m_tdcSignals
Definition: TBBPCRaw.h:109
TBBPCRaw::adc_end
adc_store_iterator adc_end() const
Definition: TBBPCRaw.h:215
TBBPCRaw::isOverflow
virtual bool isOverflow() const
Definition: TBBPCRaw.h:166
TBBPCRaw::adc_signal_type
TBADCRaw::signal_type adc_signal_type
Definition: TBBPCRaw.h:40
TBBPCRaw::getTDCUp
tdc_signal_type getTDCUp() const
Definition: TBBPCRaw.h:182
TBBeamDetector::m_overflow
bool m_overflow
Detector Name.
Definition: TBBeamDetector.h:81
TBBPCRaw::getADCVertical
adc_signal_type getADCVertical() const
Definition: TBBPCRaw.h:197
TBBPCRaw::getSignalSource
SignalSource getSignalSource(tdc_store_iterator &theTDCIterator) const
Definition: TBBPCRaw.cxx:144
TBBPCRaw::tdc_end
tdc_store_iterator tdc_end() const
Definition: TBBPCRaw.h:207
TBBPCRaw::tdcRight
@ tdcRight
Definition: TBBPCRaw.h:45
TBADCRawCont
Definition: TBADCRawCont.h:20
TBBeamDetector
Definition: TBBeamDetector.h:16
TBBPCRaw::setSignals
void setSignals(const TBTDCRawCont *theTDCCont, const std::vector< const TBTDCRaw * > &theTDCs, const TBADCRawCont *theADCCont, const std::vector< const TBADCRaw * > &theADCs)
Definition: TBBPCRaw.cxx:35
TBBPCRaw::getTDCLeft
tdc_signal_type getTDCLeft() const
Definition: TBBPCRaw.h:172