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