ATLAS Offline Software
Loading...
Searching...
No Matches
PixelRawDataProviderTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
7#include "PixelRodDecoder.h"
8
10
11//#define PIXEL_DEBUG
12//#define PLOTS
13
14// -------------------------------------------------------
15// default contructor
16
17PixelRawDataProviderTool::PixelRawDataProviderTool(const std::string& type, const std::string& name, const IInterface* parent):
18 AthAlgTool(type,name,parent),
20{
21 declareInterface<IPixelRawDataProviderTool>(this);
22}
23
25 ATH_CHECK(AthAlgTool::initialize());
26 ATH_CHECK(m_decoder.retrieve());
27
30
31 return StatusCode::SUCCESS;
32}
33
34StatusCode PixelRawDataProviderTool::convert(std::vector<const ROBFragment*>& vecRobs, IPixelRDO_Container* rdoIdc,
35 IDCInDetBSErrContainer& decodingErrors, const EventContext& ctx ) const {
36 if (vecRobs.size()==0) { return StatusCode::SUCCESS; }
37
38 std::vector<const ROBFragment*>::const_iterator rob_it = vecRobs.begin();
39
40#ifdef PIXEL_DEBUG
41 ATH_MSG_DEBUG(" New ROD collection found: LVL1=" << (*rob_it)->rod_lvl1_id() << " Size=" << vecRobs.size());
42#endif
43#ifdef PLOTS
44 std::cout << " New ROD collection found: LVL1=" << (*rob_it)->rod_lvl1_id() << " Size=" << vecRobs.size() << std::endl;
45#endif
46
49
51 // are we working on a new event ?
52 LVL1Collection = SG::makeHandle(m_LVL1CollectionKey,ctx);
53 ATH_CHECK(LVL1Collection.record(std::make_unique<InDetTimeCollection>()));
54 ATH_MSG_DEBUG("InDetTimeCollection " << LVL1Collection.name() << " registered in StoreGate");
55 LVL1Collection->reserve(vecRobs.size());
56
57 BCIDCollection = SG::makeHandle(m_BCIDCollectionKey,ctx);
58 ATH_CHECK(BCIDCollection.record(std::make_unique<InDetTimeCollection>()));
59 ATH_MSG_DEBUG("InDetTimeCollection " << BCIDCollection.name() << " registered in StoreGate");
60 BCIDCollection->reserve(vecRobs.size());
61 }
62
63#ifdef PIXEL_DEBUG
64 ATH_MSG_DEBUG(" New event, reset the collection set");
65#endif
66
67 // loop over the ROB fragments
68 for (; rob_it!=vecRobs.end(); ++rob_it) {
69 uint32_t robid = (*rob_it)->rob_source_id();
70#ifdef PIXEL_DEBUG
71 ATH_MSG_DEBUG("Found ROB " << std::hex << robid << std::dec);
72#endif
73
75 unsigned int lvl1id = (*rob_it)->rod_lvl1_id();
76 LVL1Collection->emplace_back(robid,lvl1id) ;
77
78 unsigned int bcid = (*rob_it)->rod_bc_id();
79 BCIDCollection->emplace_back(robid,bcid);
80
81#ifdef PIXEL_DEBUG
82 ATH_MSG_DEBUG("Stored LVL1ID "<<lvl1id<<" and BCID "<<bcid<<" in InDetTimeCollections");
83#endif
84
85 }
86
87 // here the code for the timing monitoring should be reinserted
88 // using 1 container per event and subdetector
89 StatusCode sc = m_decoder->fillCollection(&**rob_it, rdoIdc, decodingErrors,nullptr,ctx);
90
91 const int issuesMessageCountLimit = 100;
92 if (sc==StatusCode::FAILURE) {
93 if (m_DecodeErrCount < issuesMessageCountLimit) {
94 ATH_MSG_INFO("Problem with Pixel ByteStream Decoding!");
96 }
97 else if (issuesMessageCountLimit == m_DecodeErrCount) {
98 ATH_MSG_INFO("Too many Problems with Pixel Decoding messages. Turning message off.");
100 }
101 }
102 }
103 return StatusCode::SUCCESS;
104}
105
107 //=========================================================
108 // Size of Pixel BS Error container
109 //
110 // The error would be stored not only for module but also each FE (x16) per module.
111 // In addition, IBL FEI4 provides error counter between trigger, this also extends
112 // the size beyond nominal module + FE ID. These numbers come from the hardware
113 // specification so that there is no easy way to document in the header file.
114 // Rather, put the hardcoded number here.
115 //
116 // Total number of pixel modules: 2048
117 // Number of FE chips per module: 16
118 // -------------------------------------
119 // 2048 x 17 (module + FE) = 34816
120 //
121 // IBL extra error information :
122 // 280(module) x 2(FE) x 32(error counter) = 17920
123 // -------------------------------------
124 //
125 // isActive status : 2048
126 // -------------------------------------
127 // Total : 54784
128 //=========================================================
130}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
EventContainers::IIdentifiableCont< InDetRawDataCollection< PixelRDORawData > > IPixelRDO_Container
Handle class for recording to StoreGate.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
IDC like storage for BS errors, TODO, customise implementation further so that we store int rather th...
SG::WriteHandleKey< InDetTimeCollection > m_LVL1CollectionKey
Gaudi::Property< bool > m_storeInDetTimeColls
StatusCode initialize() override
initialize
PixelRawDataProviderTool(const std::string &type, const std::string &name, const IInterface *parent)
constructor
SG::WriteHandleKey< InDetTimeCollection > m_BCIDCollectionKey
int SizeOfIDCInDetBSErrContainer() const final
Size of IDCInDetBSErrContainer.
ToolHandle< IPixelRodDecoder > m_decoder
StatusCode convert(std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, IPixelRDO_Container *rdoIdc, IDCInDetBSErrContainer &decodingErrors, const EventContext &ctx) const final
this is the main decoding method
static constexpr size_t ERROR_CONTAINER_MAX
const std::string & name() const
Return the StoreGate ID for the referenced object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
eformat::ROBFragment< PointerType > ROBFragment
Definition RawEvent.h:27
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())