ATLAS Offline Software
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 
7 
10 
11 #include <vector>
12 
15 { }
16 
17 TBTailCatcherRaw::TBTailCatcherRaw(const std::string& 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 
35 { }
36 
37 void
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 {
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
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 {
82  unsigned int theIndex = 0;
83  while( first != this->end() && thisScintName != (*first)->getDetectorName() )
84  {
85  ++first;
86  ++theIndex;
87  }
88  return theIndex;
89 }
TBScintillator.h
TBTailCatcherRaw::~TBTailCatcherRaw
~TBTailCatcherRaw()
Definition: TBTailCatcherRaw.cxx:34
TBTailCatcherRaw::m_signals
std::vector< int > m_signals
Definition: TBTailCatcherRaw.h:69
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
lumiFormat.i
int i
Definition: lumiFormat.py:85
TBTailCatcherRaw::getSignals
const std::vector< signal_type > & getSignals() const
Definition: TBTailCatcherRaw.cxx:57
TBScintillatorRaw
Definition: TBScintillatorRaw.h:26
TBBeamDetector::getDetectorName
const std::string & getDetectorName() const
Definition: TBBeamDetector.h:61
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
TBTailCatcherRaw::TBTailCatcherRaw
TBTailCatcherRaw()
Definition: TBTailCatcherRaw.cxx:13
TBTailCatcherRaw::getSignal
signal_type getSignal(const std::string &thisScintName) const
Definition: TBTailCatcherRaw.cxx:63
TBTailCatcherRaw::addScintillator
void addScintillator(TBScintillatorRaw *thisScint)
Definition: TBTailCatcherRaw.cxx:38
DataVector< TBScintillatorRaw >::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector< TBScintillatorRaw >::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
TBBeamDetector::m_overflow
bool m_overflow
Detector Name.
Definition: TBBeamDetector.h:81
DeMoScan.first
bool first
Definition: DeMoScan.py:536
TBTailCatcherRaw.h
TBBeamDetector::isOverflow
bool isOverflow() const
Definition: TBBeamDetector.h:64
TBBeamDetector
Definition: TBBeamDetector.h:16
DataVector< TBScintillatorRaw >::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.