ATLAS Offline Software
Loading...
Searching...
No Matches
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
9
10#include "GaudiKernel/MsgStream.h"
13//#include "CLIDSvc/CLASS_DEF.h"
14#include <map>
15
16
17TBCheckBCIDs::TBCheckBCIDs(const std::string& name, ISvcLocator* pSvcLocator)
18 : AthAlgorithm(name, pSvcLocator),
19 m_count(0),
20 m_rdpSvc("ROBDataProviderSvc", name),
22{
23}
24
26
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)
61{
62 ATH_MSG_DEBUG( "Executing event #"<< m_count++ );
63
64 unsigned RODCounter=0;
65 const RawEvent* re = m_rdpSvc->getEvent(Gaudi::Hive::currentContext());
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);
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 {
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
119{return StatusCode::SUCCESS;}
const boost::regex re(r_e)
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
static const size_t MAX_ROBFRAGMENTS
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition RawEvent.h:37
INTupleSvc * ntupleSvc()
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
TBCheckBCIDs(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode execute()
ServiceHandle< IROBDataProviderSvc > m_rdpSvc
NTuple::Item< long > m_RODIndex
StatusCode finalize()
NTuple::Item< long > m_EventID
NTuple::Item< long > m_LVL1ID
NTuple::Tuple * m_ntuplePtr
NTuple::Array< long > m_RODID
StatusCode initialize()
NTuple::Array< long > m_BCID
const DataType * PointerType
Definition RawEvent.h:25
eformat::ROBFragment< PointerType > ROBFragment
Definition RawEvent.h:27