ATLAS Offline Software
ZdcByteStreamTester.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*
6  * ZdcByteStreamTester.cxx
7  *
8  * Created on: Jun 29, 2009
9  * Author: leite
10  *
11  * Based on Athena Algorithm this class must provide 3 methods:
12  *
13  * ZdcByteStreamTester::initialize (run once at run start)
14  * ZdcByteStreamTester::execute (run for every event)
15  * ZdcByteStreamTester::finalize (run one at run end)
16  *
17  * plus some helpers
18  */
19 
20 #include <utility>
21 
22 #include "GaudiKernel/ISvcLocator.h"
23 #include "GaudiKernel/MsgStream.h"
24 #include "GaudiKernel/StatusCode.h"
25 #include "StoreGate/StoreGateSvc.h"
26 
27 #include "ZdcEvent/ZdcDigits.h"
29 
30 #include "ZdcByteStream/ZdcDefs.h"
32 
33 
34 //==================================================================================================
35 ZdcByteStreamTester::ZdcByteStreamTester(const std::string& name, ISvcLocator* pSvcLocator) :
36  AthAlgorithm(name, pSvcLocator)
37 {
39  declareProperty("ForceSlicesLUT", m_forceSlicesLut = 0);
40  declareProperty("ForceSlicesFADC", m_forceSlicesFadc = 0);
41 }
42 //==================================================================================================
43 
44 
45 
46 //==================================================================================================
48 {
49  if (!msgLvl(MSG::INFO)) return StatusCode::SUCCESS;
50  msg(MSG::INFO);
51 
55 
56  const ZdcDigitsCollection* ttCollection = nullptr;
57  StatusCode sc = evtStore()->retrieve(ttCollection, m_ZdcDigitsCollectionLocation);
58  if (sc.isFailure() || !ttCollection || ttCollection->empty())
59  {
60  msg() << "No Zdc Digits found" << endmsg;
61  return StatusCode::SUCCESS;
62  }
63 
64  return StatusCode::SUCCESS;
65 }
66 //==================================================================================================
67 
68 
69 //==================================================================================================
70 //FIXME There is no such thing like ZdcDigitsMap
72 {
73  msg() << "Number of ZdcDigits = " << m_ZdcDigitsMap.size() << endmsg;
74 // ZdcDigitsMap::const_iterator mapIter = m_ZdcDigitsMap.begin();
75 // ZdcDigitsMap::const_iterator mapEnd = m_ZdcDigitsMap.end();
76 }
77 //==================================================================================================
78 
79 
80 //==================================================================================================
81 void ZdcByteStreamTester::printVec(const std::vector<int>& vec) const
82 {
83  std::vector<int>::const_iterator pos;
84  for (pos = vec.begin(); pos != vec.end(); ++pos)
85  {
86  if (pos != vec.begin()) msg() << ",";
87  msg() << *pos;
88  }
89  msg() << "/";
90 }
91 //==================================================================================================
92 
93 /* REMOVE
94 
95  // Set up trigger tower map
96  void ZdcByteStreamTester::setupZdcDigitsMap(const ZdcDigitsCollection* const ttCollection)
97  {
98  m_ZdcDigitsMap.clear();
99  ZdcDigitsCollection::const_iterator pos = ttCollection->begin();
100  ZdcDigitsCollection::const_iterator pose = ttCollection->end();
101  for (; pos != pose; ++pos) {
102  const ZdcDigits* const tt = *pos;
103  tt->get_ID();
104 
105  //const unsigned int key = m_towerKey->ttKey(tt->phi(), tt->eta());
106  //m_ttMap.insert(std::make_pair(key, tt));
107  }
108  }
109  */
ZdcByteStreamTester::m_ZdcDigitsMap
ZdcDigitsMap m_ZdcDigitsMap
Definition: ZdcByteStreamTester.h:55
ZdcByteStreamTester::execute
virtual StatusCode execute() override
Definition: ZdcByteStreamTester.cxx:47
ZdcByteStreamTester::m_forceSlicesFadc
int m_forceSlicesFadc
REMOVE Force number of FADC slices REMOVE.
Definition: ZdcByteStreamTester.h:54
ZdcByteStreamTester::printVec
void printVec(const std::vector< int > &vec) const
Definition: ZdcByteStreamTester.cxx:81
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
AthCommonMsg< Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
ZdcDigitsCollection.h
ZdcByteStreamTester::m_ZdcDigitsLocation
std::string m_ZdcDigitsLocation
ZDC Container and collection StoreGate key.
Definition: ZdcByteStreamTester.h:44
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
ZdcByteStreamTester::printZdcDigits
void printZdcDigits() const
Definition: ZdcByteStreamTester.cxx:71
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ZdcDefs::ZdcDigitsLocation
static const std::string ZdcDigitsLocation
Definition: ZdcDefs.h:19
AthAlgorithm
Definition: AthAlgorithm.h:47
ZdcByteStreamTester.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ZdcByteStreamTester::ZdcByteStreamTester
ZdcByteStreamTester(const std::string &name, ISvcLocator *pSvcLocator)
Definition: ZdcByteStreamTester.cxx:35
ZdcDigits.h
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
ZdcDefs.h
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
ZdcByteStreamTester::m_ZdcDigitsCollectionLocation
std::string m_ZdcDigitsCollectionLocation
Definition: ZdcByteStreamTester.h:45
ZdcDigitsCollection
Definition: ZdcDigitsCollection.h:20
ZdcByteStreamTester::m_forceSlicesLut
int m_forceSlicesLut
REMOVE Force number of LUT slices REMOVE.
Definition: ZdcByteStreamTester.h:51
StoreGateSvc.h
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.