ATLAS Offline Software
Loading...
Searching...
No Matches
TileTTL1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5//*****************************************************************************
6// Filename : TileDigit.cxx
7// Author : Chicago( Merritt)
8// Created : February 2003
9//
10// DESCRIPTION:
11// Implementation comments only. Class level comments go in .h file.
12//
13// HISTORY:
14//
15// BUGS:
16//
17//
18//*****************************************************************************
19
20#include "TileEvent/TileTTL1.h"
22
24
25#include <iostream>
26#include <sstream>
27#include <iomanip>
28
29// get cabling
30namespace {
31const TileCablingService * const s_cabling = TileCablingService::getInstance();
32}
33
35 const std::vector<float>& digits ) :
36 m_ID (id),
37 m_TTL1digits (digits)
38 { }
39
40
42 std::vector<float>&& digits ) :
43 m_ID (id),
44 m_TTL1digits (std::move(digits))
45 { }
46
47
49 const std::vector<double>& digits ) :
50 m_ID (id)
51 {
52
53 m_TTL1digits.reserve(digits.size());
54
55 std::vector<double>::const_iterator it1=digits.begin();
56 std::vector<double>::const_iterator it2=digits.end();
57
58 float dig;
59 for ( ; it1!=it2; ++it1) {
60 dig = (*it1);
61 m_TTL1digits.push_back(dig);
62 }
63 }
64
65/* return Identifier */
67 return m_ID;
68}
69
70/* return number of time slices (dim of vector)*/
71short TileTTL1::nsamples() const {
72 return m_TTL1digits.size();
73}
74
75
76/* return reference to the vector of digits (float, not int) */
77const std::vector<float>& TileTTL1::fsamples() const {
78 return m_TTL1digits;
79}
80
81
82/* return vector of digits (double, not int) */
83const std::vector<double> TileTTL1::samples() const {
84 std::vector<double> dTTL1digits(m_TTL1digits.size());
85 for (unsigned int i=0; i<m_TTL1digits.size(); ++i) dTTL1digits[i] = m_TTL1digits[i];
86 return dTTL1digits;
87}
88
89void TileTTL1::print() const
90{
91 std::cout << (std::string) (*this) << std::endl;
92}
93
94TileTTL1::operator std::string() const
95{
96 std::ostringstream text(std::ostringstream::out);
97
98 text << whoami();
99
100 if (s_cabling->getTileTBID()->is_tiletb(m_ID)) {
101 text << "MBTS Id = " << s_cabling->getTileTBID()->to_string(m_ID);
102 } else {
103 text << " Id = " << s_cabling->getCaloLVL1_ID()->show_to_string(m_ID);
104 }
105
106 text << " Val:";
107 text << std::setiosflags( std::ios::fixed );
108 text << std::setiosflags( std::ios::showpoint );
109 text << std::setprecision(2);
110
111 std::vector<float>::const_iterator it1=m_TTL1digits.begin();
112 std::vector<float>::const_iterator it2=m_TTL1digits.end();
113
114 for ( ; it1!=it2; ++it1) text << " " << (*it1);
115
116 return text.str();
117}
118
static const TileCablingService * getInstance()
get pointer to service instance
short nsamples() const
Definition TileTTL1.cxx:71
const Identifier & TTL1_ID() const
Definition TileTTL1.cxx:66
Identifier m_ID
Definition TileTTL1.h:67
std::vector< float > m_TTL1digits
Definition TileTTL1.h:68
std::string whoami(void) const
Definition TileTTL1.h:58
void print(void) const
Definition TileTTL1.cxx:89
const std::vector< float > & fsamples() const
Definition TileTTL1.cxx:77
TileTTL1()
Definition TileTTL1.h:32
const std::vector< double > samples() const
Definition TileTTL1.cxx:83
STL namespace.