ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TestBeam
TBCnv
src
TBCheckBCIDs.cxx
Go to the documentation of this file.
1
//Dear emacs, this is -*- c++ -*-
2
3
/*
4
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
8
#include "
TBCnv/TBCheckBCIDs.h
"
9
10
#include "GaudiKernel/MsgStream.h"
11
#include "
ByteStreamData/RawEvent.h
"
12
#include "
ByteStreamCnvSvcBase/FullEventAssembler.h
"
13
//#include "CLIDSvc/CLASS_DEF.h"
14
#include <map>
15
16
17
TBCheckBCIDs::TBCheckBCIDs
(
const
std::string& name, ISvcLocator* pSvcLocator)
18
:
AthAlgorithm
(name, pSvcLocator),
19
m_count
(0),
20
m_rdpSvc
(
"ROBDataProviderSvc"
, name),
21
m_ntuplePtr
(0)
22
{
23
}
24
25
TBCheckBCIDs::~TBCheckBCIDs
() {}
26
27
StatusCode
TBCheckBCIDs::initialize
()
28
{
29
ATH_MSG_DEBUG
(
" initialize "
);
30
31
//Get ByteStreamInputSvc (only necessary for reading of digits, not for writing and for channels)
32
ATH_CHECK
(
m_rdpSvc
.retrieve() );
33
34
//Book Ntuple
35
NTupleFilePtr file1(
ntupleSvc
(),
"/NTUPLES/FILE1"
);
36
if
(!file1) {
37
ATH_MSG_ERROR
(
"Booking of NTuple failed"
);
38
return
StatusCode::FAILURE;
39
}
40
NTuplePtr nt(
ntupleSvc
(),
"/NTUPLES/FILE1/BCIDS"
);
41
if
(!nt) {
42
nt=
ntupleSvc
()->book(
"/NTUPLES/FILE1/BCIDS"
,CLID_ColumnWiseTuple,
"BCIDs"
);
43
}
44
if
(!nt) {
45
ATH_MSG_ERROR
(
"Booking of NTuple failed"
);
46
return
StatusCode::FAILURE;
47
}
48
49
ATH_CHECK
( nt->addItem(
"GlobalEvtID"
,
m_EventID
,0,50000) );
50
ATH_CHECK
( nt->addItem(
"LVL1ID"
,
m_LVL1ID
,0,50000) );
51
ATH_CHECK
( nt->addItem(
"RODIndex"
,
m_RODIndex
,0,100) );
52
ATH_CHECK
( nt->addItem(
"RODID"
,
m_RODIndex
,
m_RODID
) );
53
ATH_CHECK
( nt->addItem(
"BCID"
,
m_RODIndex
,
m_BCID
) );
54
m_ntuplePtr
=nt;
55
return
StatusCode::SUCCESS;
56
}
57
58
59
//LArRawDataContByteStreamTool::ReadLArDigits(const RawEvent* re,LArDigitContainer* digitCont, const int gain, MsgStream& log)
60
StatusCode
TBCheckBCIDs::execute
(
const
EventContext& ctx)
61
{
62
ATH_MSG_DEBUG
(
"Executing event #"
<<
m_count
++ );
63
64
unsigned
RODCounter=0;
65
const
RawEvent
*
re
=
m_rdpSvc
->getEvent(ctx);
66
if
(!
re
) {
67
ATH_MSG_FATAL
(
"RawEvent retrieved by TBCheckBCIDs is a null pointer!"
);
68
return
StatusCode::FAILURE;
69
}
70
71
//Get ROB fragements from the raw event.
72
const
size_t
MAX_ROBFRAGMENTS = 2048*1024;
73
std::vector<OFFLINE_FRAGMENTS_NAMESPACE::PointerType> robF(MAX_ROBFRAGMENTS);
74
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
rePointer;
75
re
->start(rePointer);
76
size_t
robcount =
re
->children(robF.data(),MAX_ROBFRAGMENTS);
77
if
(robcount == MAX_ROBFRAGMENTS)
78
{
79
ATH_MSG_FATAL
(
"ROB buffer overflow"
);
80
return
StatusCode::FAILURE;
81
}
82
83
84
m_LVL1ID
=
re
->lvl1_id();
85
m_EventID
=
re
->global_id();
86
87
88
89
for
(
size_t
irob=0; irob<robcount; ++irob)
//Loop over all ROB-Fragments
90
{
91
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment
rob(robF[irob]);
92
93
try
94
{
95
rob.check();
96
}
97
catch
(...)
98
{
99
ATH_MSG_ERROR
(
"Got invalid ROB fragment!"
);
100
return
StatusCode::FAILURE;
101
}
102
103
ATH_MSG_VERBOSE
( MSG::hex <<
"\t\tFull source ID: "
<< rob.source_id()<<MSG::dec );
104
ATH_MSG_VERBOSE
(
"This ROD-Fragment consists of "
<< rob.rod_fragment_size_word() <<
" words"
);
105
106
m_RODIndex
=RODCounter;
107
m_RODID
[
m_RODIndex
]=rob.rod_source_id();
108
m_BCID
[
m_RODIndex
] =rob.rod_bc_id();
109
ATH_MSG_DEBUG
(
"RODID 0x"
<< MSG::hex << rob.rod_source_id() <<
" BCID 0x"
110
<< rob.rod_bc_id() << MSG::dec );
111
RODCounter++;
112
}
113
114
ATH_CHECK
(
ntupleSvc
()->writeRecord(
m_ntuplePtr
) );
115
return
StatusCode::SUCCESS;
116
}
117
118
StatusCode
TBCheckBCIDs::finalize
()
119
{
return
StatusCode::SUCCESS;}
re
const std::regex re(r_e)
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
FullEventAssembler.h
RawEvent.h
RawEvent
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition
RawEvent.h:37
ntupleSvc
INTupleSvc * ntupleSvc()
Definition
ServiceAccessor.h:14
TBCheckBCIDs.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
TBCheckBCIDs::TBCheckBCIDs
TBCheckBCIDs(const std::string &name, ISvcLocator *pSvcLocator)
Definition
TBCheckBCIDs.cxx:17
TBCheckBCIDs::m_rdpSvc
ServiceHandle< IROBDataProviderSvc > m_rdpSvc
Definition
TBCheckBCIDs.h:35
TBCheckBCIDs::m_RODIndex
NTuple::Item< long > m_RODIndex
Definition
TBCheckBCIDs.h:42
TBCheckBCIDs::finalize
StatusCode finalize()
Definition
TBCheckBCIDs.cxx:118
TBCheckBCIDs::m_EventID
NTuple::Item< long > m_EventID
Definition
TBCheckBCIDs.h:41
TBCheckBCIDs::~TBCheckBCIDs
~TBCheckBCIDs()
Definition
TBCheckBCIDs.cxx:25
TBCheckBCIDs::m_LVL1ID
NTuple::Item< long > m_LVL1ID
Definition
TBCheckBCIDs.h:41
TBCheckBCIDs::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
TBCheckBCIDs.cxx:60
TBCheckBCIDs::m_ntuplePtr
NTuple::Tuple * m_ntuplePtr
Definition
TBCheckBCIDs.h:40
TBCheckBCIDs::m_RODID
NTuple::Array< long > m_RODID
Definition
TBCheckBCIDs.h:43
TBCheckBCIDs::initialize
StatusCode initialize()
Definition
TBCheckBCIDs.cxx:27
TBCheckBCIDs::m_BCID
NTuple::Array< long > m_BCID
Definition
TBCheckBCIDs.h:44
TBCheckBCIDs::m_count
int m_count
Definition
TBCheckBCIDs.h:34
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
const DataType * PointerType
Definition
RawEvent.h:25
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment
eformat::ROBFragment< PointerType > ROBFragment
Definition
RawEvent.h:27
Generated on
for ATLAS Offline Software by
1.17.0