ATLAS Offline Software
Loading...
Searching...
No Matches
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
7
11
12#include <vector>
13
17
18TBTailCatcher::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
37
38void
40{
41 m_overflow = m_overflow || thisScint->isOverflow();
42 this->push_back(thisScint);
43}
44
45const TBScintillator*
46TBTailCatcher::getScintillator(const std::string& thisScintName) const
47{
49 while ( first != this->end() && (*first)->getDetectorName() != thisScintName )
50 {
51 ++first;
52 }
53 return ( first != this->end() )
54 ? *first
55 : 0;
56}
57
58const std::vector<double>& TBTailCatcher::getSignals() const
59{
60 return m_signals;
61}
62
63double
64TBTailCatcher::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
71double
73{
74 return ( this->findIndex(thisScint->getDetectorName()) < m_signals.size() )
75 ? m_signals[this->findIndex(thisScint->getDetectorName())]
76 : 0.;
77}
78
79unsigned int
80TBTailCatcher::findIndex(const std::string& thisScintName) const
81{
83 unsigned int theIndex = 0;
84 while( first != this->end() && thisScintName != (*first)->getDetectorName() )
85 {
86 ++first;
87 ++theIndex;
88 }
89 return theIndex;
90}
An STL vector of pointers that by default owns its pointed-to elements.
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition DataVector.h:838
value_type push_back(value_type pElem)
DataVector(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
const_iterator end() const noexcept
const_iterator begin() const noexcept
bool isOverflow() const
bool m_overflow
Detector Name.
const std::string & getDetectorName() const
signal_type getSignal(const std::string &thisScintName) const
const std::vector< signal_type > & getSignals() const
unsigned int findIndex(const std::string &thisScintName) const
const TBScintillator * getScintillator(const std::string &thisScintName) const
std::vector< double > m_signals
void addScintillator(TBScintillator *thisScint)