ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TestBeam
TBEvent
src
TBTailCatcherRaw.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
#include "
AthContainers/DataVector.h
"
7
8
#include "
TBEvent/TBTailCatcherRaw.h
"
9
#include "
TBEvent/TBScintillator.h
"
10
11
#include <vector>
12
13
TBTailCatcherRaw::TBTailCatcherRaw
() :
TBBeamDetector
(),
14
DataVector
<
TBScintillatorRaw
>()
15
{ }
16
17
TBTailCatcherRaw::TBTailCatcherRaw
(std::string_view thisTailCatcherName,
18
bool
overflow,
19
const
20
std::vector< TBScintillatorRaw* >&
21
theScints)
22
:
TBBeamDetector
(thisTailCatcherName,overflow)
23
{
24
// store scintillator signals internally
25
m_signals
.resize(theScints.size(),0);
26
for (
unsigned
int
i=0; i<theScints.size(); i++ )
27
{
28
m_signals
[i] = theScints[i]->getADCSignal();
29
m_overflow
=
m_overflow
|| theScints[i]->isOverflow();
30
push_back
(theScints[i]);
31
}
32
}
33
34
TBTailCatcherRaw::~TBTailCatcherRaw
()
35
{ }
36
37
void
38
TBTailCatcherRaw::addScintillator
(
TBScintillatorRaw
* thisScint)
39
{
40
m_overflow
=
m_overflow
|| thisScint->
isOverflow
();
41
this->
push_back
(thisScint);
42
}
43
44
const
TBScintillatorRaw
*
45
TBTailCatcherRaw::getScintillator
(
const
std::string& thisScintName)
const
46
{
47
DataVector< TBScintillatorRaw >::const_iterator
first = this->
begin
();
48
while
( first != this->
end
() && (*first)->getDetectorName() != thisScintName )
49
{
50
++first;
51
}
52
return
( first != this->
end
() )
53
? *first
54
: 0;
55
}
56
57
const
std::vector<int>&
TBTailCatcherRaw::getSignals
()
const
58
{
59
return
m_signals
;
60
}
61
62
int
63
TBTailCatcherRaw::getSignal
(
const
std::string& thisScintName)
const
64
{
65
return
( this->
findIndex
(thisScintName) <
m_signals
.size() )
66
?
m_signals
[this->
findIndex
(thisScintName)]
67
: 0;
68
}
69
70
int
71
TBTailCatcherRaw::getSignal
(
const
TBScintillatorRaw
* thisScint)
const
72
{
73
return
( this->
findIndex
(thisScint->
getDetectorName
()) <
m_signals
.size() )
74
?
m_signals
[this->
findIndex
(thisScint->
getDetectorName
())]
75
: 0;
76
}
77
78
unsigned
int
79
TBTailCatcherRaw::findIndex
(
const
std::string& thisScintName)
const
80
{
81
DataVector< TBScintillatorRaw >::const_iterator
first = this->
begin
();
82
unsigned
int
theIndex = 0;
83
while
( first != this->
end
() && thisScintName != (*first)->getDetectorName() )
84
{
85
++first;
86
++theIndex;
87
}
88
return
theIndex;
89
}
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
TBScintillator.h
TBTailCatcherRaw.h
DataVector::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition
DataVector.h:838
DataVector< TBScintillatorRaw >::push_back
value_type push_back(value_type pElem)
DataVector< TBScintillatorRaw >::DataVector
DataVector(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
DataVector< TBScintillatorRaw >::end
const_iterator end() const noexcept
DataVector< TBScintillatorRaw >::begin
const_iterator begin() const noexcept
TBBeamDetector::isOverflow
bool isOverflow() const
Definition
TBBeamDetector.h:65
TBBeamDetector::m_overflow
bool m_overflow
Detector Name.
Definition
TBBeamDetector.h:82
TBBeamDetector::getDetectorName
const std::string & getDetectorName() const
Definition
TBBeamDetector.h:62
TBBeamDetector::TBBeamDetector
TBBeamDetector()
Definition
TBBeamDetector.h:24
TBScintillatorRaw
Definition
TBScintillatorRaw.h:26
TBTailCatcherRaw::addScintillator
void addScintillator(TBScintillatorRaw *thisScint)
Definition
TBTailCatcherRaw.cxx:38
TBTailCatcherRaw::getSignals
const std::vector< signal_type > & getSignals() const
Definition
TBTailCatcherRaw.cxx:57
TBTailCatcherRaw::findIndex
unsigned int findIndex(const std::string &thisScintName) const
Definition
TBTailCatcherRaw.cxx:79
TBTailCatcherRaw::getScintillator
const TBScintillatorRaw * getScintillator(const std::string &thisScintName) const
Definition
TBTailCatcherRaw.cxx:45
TBTailCatcherRaw::getSignal
signal_type getSignal(const std::string &thisScintName) const
Definition
TBTailCatcherRaw.cxx:63
TBTailCatcherRaw::~TBTailCatcherRaw
~TBTailCatcherRaw()
Definition
TBTailCatcherRaw.cxx:34
TBTailCatcherRaw::TBTailCatcherRaw
TBTailCatcherRaw()
Definition
TBTailCatcherRaw.cxx:13
TBTailCatcherRaw::m_signals
std::vector< int > m_signals
Definition
TBTailCatcherRaw.h:69
Generated on
for ATLAS Offline Software by
1.17.0