ATLAS Offline Software
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 
10 #include "TBEvent/TBScintillator.h"
11 
12 #include <vector>
13 
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 
36 { }
37 
38 void
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 {
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
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 {
83  unsigned int theIndex = 0;
84  while( first != this->end() && thisScintName != (*first)->getDetectorName() )
85  {
86  ++first;
87  ++theIndex;
88  }
89  return theIndex;
90 }
TBBeamDetector::getDetectorName
std::string getDetectorName() const
Definition: TBBeamDetector.h:61
TBTailCatcher::~TBTailCatcher
~TBTailCatcher()
Definition: TBTailCatcher.cxx:35
TBBeamDetector.h
TBTailCatcher::TBTailCatcher
TBTailCatcher()
Definition: TBTailCatcher.cxx:14
TBScintillator.h
TBTailCatcher::getScintillator
const TBScintillator * getScintillator(const std::string &thisScintName) const
Definition: TBTailCatcher.cxx:46
lumiFormat.i
int i
Definition: lumiFormat.py:92
TBTailCatcher::m_signals
std::vector< double > m_signals
Definition: TBTailCatcher.h:70
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
TBTailCatcher::getSignal
signal_type getSignal(const std::string &thisScintName) const
Definition: TBTailCatcher.cxx:64
DataVector< TBScintillator >::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector< TBScintillator >::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
TBTailCatcher::addScintillator
void addScintillator(TBScintillator *thisScint)
Definition: TBTailCatcher.cxx:39
TBTailCatcher.h
DeMoScan.first
bool first
Definition: DeMoScan.py:534
TBScintillator
Definition: TBScintillator.h:25
TBTailCatcher::getSignals
const std::vector< signal_type > & getSignals() const
Definition: TBTailCatcher.cxx:58
TBBeamDetector::isOverflow
bool isOverflow() const
Definition: TBBeamDetector.h:64
TBBeamDetector
Definition: TBBeamDetector.h:16
TBTailCatcher::findIndex
unsigned int findIndex(const std::string &thisScintName) const
Definition: TBTailCatcher.cxx:80
DataVector< TBScintillator >::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.