ATLAS Offline Software
Loading...
Searching...
No Matches
TileRawDataContainer.icc
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5// implementation of TileRawDataContainer
6
7#include "AthenaKernel/errorcheck.h"
8#include "Identifier/IdentifierHash.h"
9#include "TileConditions/TileCablingService.h"
10
11#include <iostream>
12#include <sstream>
13#include <iomanip>
14
15template <typename TCOLLECTION>
16void TileRawDataContainer<TCOLLECTION>::initialize(bool createColl, TYPE type,
17 SG::OwnershipPolicy ownPolicy)
18{
19 // initialize HashFunc
20 this->m_hashFunc.initialize(TileCablingService::getInstance()->getTileHWID(),type);
21
22 if (createColl) {
23 int ncoll = this->m_hashFunc.max();
24 for(int i=0; i<ncoll;++i){
25 TileFragHash::ID frag = this->m_hashFunc.identifier(i);
26 TCOLLECTION * coll = new TCOLLECTION(frag,ownPolicy) ;
27 StatusCode sc = this->addCollection(coll,static_cast<IdentifierHash>(i));
28 if (sc.isFailure()) {
29 REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "TileRawDataContainer") <<
30 "Can not create collection for frag 0x" << MSG::hex << frag <<
31 " in container with CLID " << MSG::dec << this->clID() << endmsg;
32 }
33 }
34 }
35
36 return;
37}
38
39template <typename TCOLLECTION>
40TileRawDataContainer<TCOLLECTION>::TileRawDataContainer(bool createColl,
41 TYPE type,
42 UNIT unit,
43 SG::OwnershipPolicy ownPolicy)
44 : MyBase(TileCablingService::getInstance()->getTileHWID()->drawer_hash_max())
45 , m_unit(unit)
46 , m_type(type)
47 , m_bsflags(0)
48{
49 // initialize all the rest
50 initialize(createColl,m_type,ownPolicy);
51 return;
52}
53
54template <typename TCOLLECTION>
55TileRawDataContainer<TCOLLECTION>::TileRawDataContainer(bool createColl,
56 SG::OwnershipPolicy ownPolicy)
57 : MyBase(TileCablingService::getInstance()->getTileHWID()->drawer_hash_max())
58 , m_unit(TileRawChannelUnit::ADCcounts)
59 , m_type(TileFragHash::Digitizer)
60 , m_bsflags(0)
61{
62 // initialize all the rest
63 initialize(createColl,m_type,ownPolicy);
64 return;
65}
66
67
68template <typename TCOLLECTION>
69void TileRawDataContainer<TCOLLECTION>::print() const
70{
71 std::cout << (std::string) (*this) << std::endl;
72}
73
74template <typename TCOLLECTION>
75TileRawDataContainer<TCOLLECTION>::operator std::string() const
76{
77 std::ostringstream text(std::ostringstream::out);
78
79 text << whoami();
80 text << " size = " << this->size() << std::endl;
81
82 std::string result(text.str());
83 std::string newline("\n");
84
85 TContainer_const_iterator it1 = this->begin();
86 TContainer_const_iterator it2 = this->end();
87
88 const TCOLLECTION * coll;
89
90 for(;it1!=it2;++it1){
91 coll = (*it1);
92 result += (std::string) (*coll) + newline;
93 }
94
95 return result;
96}