ATLAS Offline Software
Loading...
Searching...
No Matches
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"
11#include "TBEvent/TBTDCRaw.h"
13#include "TBEvent/TBBPCRaw.h"
14
15#include <string>
16#include <list>
17
19// Constructors and Destructors //
21
24
25TBBPCRaw::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
35void 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
62
64// Data Access //
66
67// specific overflow condition
69{
70 bool test;
71 switch ( theSource )
72 {
75 case TBBPCRaw::tdcUp:
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 {
107 case TBBPCRaw::tdcUp:
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
float getTDC(const AFP_SiDigi &digi)
Definition AFP_SiDigi.h:25
float getADC(const AFP_SiDigi &digi)
Definition AFP_SiDigi.h:29
"TBEvent/TBADCRawCont.h"
Data object holding adc measurement.
Definition TBADCRaw.h:21
@ tdcLeft
Definition TBBPCRaw.h:44
@ unknown
Definition TBBPCRaw.h:50
@ tdcDown
Definition TBBPCRaw.h:47
@ adcVertical
Definition TBBPCRaw.h:49
@ tdcRight
Definition TBBPCRaw.h:45
@ adcHorizontal
Definition TBBPCRaw.h:48
SignalSource getSignalSource(tdc_store_iterator &theTDCIterator) const
Definition TBBPCRaw.cxx:144
tdc_signal_type getTDCSignal(SignalSource theSource) const
Definition TBBPCRaw.cxx:100
adc_signal_type getADCSignal(SignalSource theSource) const
Definition TBBPCRaw.cxx:123
size_t findIndex(const tdc_store_type &theStore, tdc_store_iterator &theIterator) const
Definition TBBPCRaw.h:132
adc_store_type m_adcSignals
Definition TBBPCRaw.h:110
virtual bool isOverflow() const
Definition TBBPCRaw.h:166
tdc_store_type::const_iterator tdc_store_iterator
Definition TBBPCRaw.h:38
tdc_store_type m_tdcSignals
Definition TBBPCRaw.h:109
TBADCRaw::signal_type adc_signal_type
Definition TBBPCRaw.h:40
TBTDCRaw::signal_type tdc_signal_type
Definition TBBPCRaw.h:36
void setSignals(const TBTDCRawCont *theTDCCont, const std::vector< const TBTDCRaw * > &theTDCs, const TBADCRawCont *theADCCont, const std::vector< const TBADCRaw * > &theADCs)
Definition TBBPCRaw.cxx:35
adc_store_type::const_iterator adc_store_iterator
Definition TBBPCRaw.h:42
bool isOverflow() const
bool m_overflow
Detector Name.
"TBEvent/TBTDCRawCont.h"
Data object holding tdc measurement.
Definition TBTDCRaw.h:21