ATLAS Offline Software
TBBPCRaw.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 #include "AthLinks/ElementLink.h"
7 
9 #include "TBEvent/TBADCRaw.h"
10 #include "TBEvent/TBADCRawCont.h"
11 #include "TBEvent/TBTDCRaw.h"
12 #include "TBEvent/TBTDCRawCont.h"
13 #include "TBEvent/TBBPCRaw.h"
14 
15 #include <string>
16 #include <list>
17 
19 // Constructors and Destructors //
21 
23 { }
24 
25 TBBPCRaw::TBBPCRaw(const std::string& thisBPCName,
26  const TBTDCRawCont* theTDCCont,
27  const std::vector<const TBTDCRaw*>& theTDCs,
28  const TBADCRawCont* theADCCont,
29  const std::vector<const TBADCRaw*>& theADCs)
30  : TBBeamDetector(thisBPCName)
31 {
32  setSignals(theTDCCont,theTDCs,theADCCont,theADCs);
33 }
34 
35 void TBBPCRaw::setSignals(const TBTDCRawCont* theTDCCont,
36  const std::vector<const TBTDCRaw*>& theTDCs,
37  const TBADCRawCont* theADCCont,
38  const std::vector<const TBADCRaw*>& theADCs)
39 {
40  // store TDC measurement
41  for (const TBTDCRaw* tdc : theTDCs)
42  {
44  // const TBTDCRaw* tbtdc= tdc;
45  theLink.toContainedElement(*theTDCCont,tdc);
46  m_tdcSignals.push_back(theLink);
47  m_overflow = m_overflow || tdc->isOverflow();
48  }
49 
50  // store ADC measurement
51  for (const TBADCRaw* adc : theADCs)
52  {
54  theLink.toContainedElement(*theADCCont,adc);
55  m_adcSignals.push_back(theLink);
56  m_overflow = m_overflow || adc->isOverflow();
57  }
58 }
59 
61 { }
62 
64 // Data Access //
66 
67 // specific overflow condition
68 bool TBBPCRaw::isOverflow(SignalSource theSource) const
69 {
70  bool test;
71  switch ( theSource )
72  {
73  case TBBPCRaw::tdcLeft:
74  case TBBPCRaw::tdcRight:
75  case TBBPCRaw::tdcUp:
76  case TBBPCRaw::tdcDown:
77  {
78  size_t theIndex = (size_t)theSource;
79  const TBTDCRaw* theTDC = (*m_tdcSignals[theIndex]);
80  test = theTDC->isOverflow();
81  }
82  break;
85  {
86  size_t theIndex = (size_t)theSource - (size_t)TBBPCRaw::adcHorizontal;
87  const TBADCRaw* theADC = (*m_adcSignals[theIndex]);
88  test = theADC->isOverflow();
89  }
90  break;
91  default:
92  test = false;
93  break;
94  }
95  return test;
96 }
97 
98 // TDC data
101 {
102  tdc_signal_type theSignal;
103  switch ( theSource )
104  {
105  case TBBPCRaw::tdcLeft:
106  case TBBPCRaw::tdcRight:
107  case TBBPCRaw::tdcUp:
108  case TBBPCRaw::tdcDown:
109  {
110  size_t theIndex = (size_t)theSource;
111  theSignal = (*(*m_tdcSignals[theIndex])).getTDC();
112  }
113  break;
114  default:
115  theSignal = 0;
116  break;
117  }
118  return theSignal;
119 }
120 
121 // ADC data
124 {
125  adc_signal_type theSignal;
126  switch ( theSource )
127  {
130  {
131  size_t theIndex = (size_t)theSource - (size_t)TBBPCRaw::adcHorizontal;
132  theSignal = (*(*m_adcSignals[theIndex])).getADC();
133  }
134  break;
135  default:
136  theSignal = 0;
137  break;
138  }
139  return theSignal;
140 }
141 
142 // signal source from iterators
145 {
146  size_t theIndex = this->findIndex(m_tdcSignals,theIterator);
147  SignalSource theSource;
148  switch ( theIndex )
149  {
150  case 0:
151  theSource = TBBPCRaw::tdcLeft;
152  break;
153  case 1:
154  theSource = TBBPCRaw::tdcRight;
155  break;
156  case 2:
157  theSource = TBBPCRaw::tdcUp;
158  break;
159  case 3:
160  theSource = TBBPCRaw::tdcDown;
161  break;
162  default:
163  theSource = TBBPCRaw::unknown;
164  break;
165  }
166  return theSource;
167 }
168 
171 {
172  size_t theIndex = this->findIndex(m_adcSignals,theIterator);
173  SignalSource theSource;
174  switch ( theIndex )
175  {
176  case 0:
177  theSource = TBBPCRaw::adcHorizontal;
178  break;
179  case 1 :
180  theSource = TBBPCRaw::adcVertical;
181  break;
182  default:
183  theSource = TBBPCRaw::unknown;
184  break;
185  }
186  return theSource;
187 }
188 
TBTDCRaw
Definition: TBTDCRaw.h:21
TBBeamDetector.h
TBBPCRaw::getTDCSignal
tdc_signal_type getTDCSignal(SignalSource theSource) const
Definition: TBBPCRaw.cxx:100
TBADCRaw
Definition: TBADCRaw.h:21
TBBPCRaw::TBBPCRaw
TBBPCRaw()
Definition: TBBPCRaw.cxx:22
TBADCRawCont.h
TBBPCRaw::SignalSource
SignalSource
Definition: TBBPCRaw.h:44
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:144
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
TBTDCRawCont.h
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::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
TBBPCRaw::findIndex
size_t findIndex(const tdc_store_type &theStore, tdc_store_iterator &theIterator) const
Definition: TBBPCRaw.h:132
TBBPCRaw::tdcLeft
@ tdcLeft
Definition: TBBPCRaw.h:44
TBBPCRaw::~TBBPCRaw
~TBBPCRaw()
Definition: TBBPCRaw.cxx:60
TBADCRaw.h
TBBPCRaw::m_tdcSignals
tdc_store_type m_tdcSignals
Definition: TBBPCRaw.h:109
TBBPCRaw::isOverflow
virtual bool isOverflow() const
Definition: TBBPCRaw.h:166
TBBPCRaw::adc_signal_type
TBADCRaw::signal_type adc_signal_type
Definition: TBBPCRaw.h:40
TBBeamDetector::m_overflow
bool m_overflow
Detector Name.
Definition: TBBeamDetector.h:81
ReadFloatFromCool.adc
adc
Definition: ReadFloatFromCool.py:48
TBTDCRaw.h
TBBPCRaw::getSignalSource
SignalSource getSignalSource(tdc_store_iterator &theTDCIterator) const
Definition: TBBPCRaw.cxx:144
TBBPCRaw.h
TBBPCRaw::tdcRight
@ tdcRight
Definition: TBBPCRaw.h:45
TBBeamDetector::isOverflow
bool isOverflow() const
Definition: TBBeamDetector.h:64
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