File tree Expand file tree Collapse file tree 8 files changed +46
-14
lines changed
include/EMCALReconstruction Expand file tree Collapse file tree 8 files changed +46
-14
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ o2_add_library(EMCALBase
1212 SOURCES src/Geometry.cxx src/Hit.cxx
1313 src/ShishKebabTrd1Module.cxx
1414 src/Mapper.cxx
15- PUBLIC_LINK_LIBRARIES O2::CommonDataFormat Boost::serialization
15+ src/RCUTrailer.cxx
16+ PUBLIC_LINK_LIBRARIES O2::CommonDataFormat O2::Headers Boost::serialization
1617 O2::MathUtils O2::DataFormatsEMCAL
1718 O2::SimulationDataFormat ROOT::Physics )
1819
@@ -21,7 +22,9 @@ o2_target_root_dictionary(EMCALBase
2122 include /EMCALBase/Geometry.h
2223 include /EMCALBase/Hit.h
2324 include /EMCALBase/ShishKebabTrd1Module.h
24- include /EMCALBase/Mapper.h )
25+ include /EMCALBase/Mapper.h
26+ include /EMCALBase/RCUTrailer.h
27+ )
2528
2629o2_data_file (COPY files DESTINATION Detectors/EMC )
2730
Original file line number Diff line number Diff line change 1313#include < exception>
1414#include < iosfwd>
1515#include < string>
16+ #include < cstdint>
17+ #include < gsl/span>
1618#include " Rtypes.h"
17- #include " EMCALReconstruction/RawPayload.h"
1819
1920namespace o2
2021{
@@ -24,7 +25,7 @@ namespace emcal
2425
2526// / \class RCUTrailer
2627// / \brief Information stored in the RCU trailer
27- // / \ingroup EMCALreconstruction
28+ // / \ingroup EMCALbase
2829// /
2930// / The RCU trailer can be found at the end of
3031// / the payload and contains general information
@@ -90,7 +91,7 @@ class RCUTrailer
9091 // /
9192 // / Read the RCU trailer according to the RCU formware version
9293 // / specified in CDH.
93- void constructFromRawPayload (const RawPayload& buffer );
94+ void constructFromRawPayload (const gsl::span< const uint32_t > payloadwords );
9495
9596 unsigned int getFECErrorsA () const { return mFECERRA ; }
9697 unsigned int getFECErrorsB () const { return mFECERRB ; }
@@ -143,6 +144,8 @@ class RCUTrailer
143144 // / \return True if the trailer is initialized, false otherwise
144145 bool isInitialized () const { return mIsInitialized ; }
145146
147+ static RCUTrailer constructFromPayloadWords (const gsl::span<const uint32_t > payloadwords);
148+
146149 private:
147150 int mRCUId = -1 ; // /< current RCU identifier
148151 unsigned char mFirmwareVersion = 0 ; // /< RCU firmware version
Original file line number Diff line number Diff line change 1010#include < iostream>
1111#include < boost/format.hpp>
1212#include " CommonConstants/LHCConstants.h"
13- #include " EMCALReconstruction /RCUTrailer.h"
13+ #include " EMCALBase /RCUTrailer.h"
1414
1515using namespace o2 ::emcal;
1616
@@ -31,10 +31,9 @@ void RCUTrailer::reset()
3131 mIsInitialized = false ;
3232}
3333
34- void RCUTrailer::constructFromRawPayload (const RawPayload& buffer )
34+ void RCUTrailer::constructFromRawPayload (const gsl::span< const uint32_t > payloadwords )
3535{
3636 reset ();
37- auto payloadwords = buffer.getPayloadWords ();
3837 int index = payloadwords.size () - 1 ;
3938 auto word = payloadwords[index];
4039 if ((word >> 30 ) != 3 )
@@ -183,6 +182,13 @@ void RCUTrailer::printStream(std::ostream& stream) const
183182 stream << " ==================================================\n " ;
184183}
185184
185+ RCUTrailer RCUTrailer::constructFromPayloadWords (const gsl::span<const uint32_t > payloadwords)
186+ {
187+ RCUTrailer result;
188+ result.constructFromRawPayload (payloadwords);
189+ return result;
190+ }
191+
186192std::ostream& o2::emcal::operator <<(std::ostream& stream, const o2::emcal::RCUTrailer& trailer)
187193{
188194 trailer.printStream (stream);
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ o2_add_library(EMCALReconstruction
1616 src/RAWDataHeader.cxx
1717 src/RawPayload.cxx
1818 src/AltroDecoder.cxx
19- src/RCUTrailer.cxx
2019 src/Bunch.cxx
2120 src/Channel.cxx
2221 src/CaloFitResults.cxx
@@ -37,7 +36,6 @@ o2_target_root_dictionary(
3736 HEADERS include /EMCALReconstruction/RawReaderFile.h
3837 include /EMCALReconstruction/RawReaderMemory.h
3938 include /EMCALReconstruction/AltroDecoder.h
40- include /EMCALReconstruction/RCUTrailer.h
4139 include /EMCALReconstruction/RawPayload.h
4240 include /EMCALReconstruction/Bunch.h
4341 include /EMCALReconstruction/Channel.h
Original file line number Diff line number Diff line change 1414#include < iosfwd>
1515#include < gsl/span>
1616#include < string>
17- #include " EMCALReconstruction /RCUTrailer.h"
17+ #include " EMCALBase /RCUTrailer.h"
1818#include " EMCALReconstruction/Bunch.h"
1919#include " EMCALReconstruction/Channel.h"
2020
Original file line number Diff line number Diff line change @@ -40,7 +40,9 @@ template <class RawReader>
4040void AltroDecoder<RawReader>::readRCUTrailer()
4141{
4242 try {
43- mRCUTrailer .constructFromRawPayload (mRawReader .getPayload ());
43+ auto payloadwordsOrig = mRawReader .getPayload ().getPayloadWords ();
44+ gsl::span<const uint32_t > payloadwords (payloadwordsOrig.data (), payloadwordsOrig.size ());
45+ mRCUTrailer .constructFromRawPayload (payloadwords);
4446 } catch (RCUTrailer::Error& e) {
4547 AliceO2::InfoLogger::InfoLogger logger;
4648 logger << e.what ();
Original file line number Diff line number Diff line change 1111#include < iostream>
1212#include < iomanip>
1313
14+ #include " EMCALBase/RCUTrailer.h"
1415#include " EMCALReconstruction/RawHeaderStream.h"
1516#include " EMCALReconstruction/RawReaderFile.h"
1617#include " EMCALReconstruction/RawDecodingError.h"
@@ -59,9 +60,18 @@ template <class RawHeader>
5960void RawReaderFile<RawHeader>::next()
6061{
6162 mRawPayload .reset ();
63+ bool isDataTerminated = false ;
6264 do {
6365 nextPage (false );
64- } while (!isStop (mRawHeader ));
66+ // check if we find a valid RCU trailer
67+ // the payload must be at the end of the buffer
68+ // if not present and error will be thrown
69+ try {
70+ RCUTrailer::constructFromPayloadWords (mRawBuffer .getDataWords ());
71+ isDataTerminated = true ;
72+ } catch (...) {
73+ }
74+ } while (!isDataTerminated);
6575}
6676
6777template <class RawHeader >
Original file line number Diff line number Diff line change 1010
1111#include < sstream>
1212#include < string>
13+ #include " EMCALBase/RCUTrailer.h"
1314#include " EMCALReconstruction/RawHeaderStream.h"
1415#include " EMCALReconstruction/RawReaderMemory.h"
1516#include " EMCALReconstruction/RawDecodingError.h"
@@ -43,9 +44,18 @@ template <class RawHeader>
4344void RawReaderMemory<RawHeader>::next()
4445{
4546 mRawPayload .reset ();
47+ bool isDataTerminated = false ;
4648 do {
4749 nextPage (false );
48- } while (!isStop (mRawHeader ));
50+ // check if we find a valid RCU trailer
51+ // the payload must be at the end of the buffer
52+ // if not present and error will be thrown
53+ try {
54+ RCUTrailer::constructFromPayloadWords (mRawBuffer .getDataWords ());
55+ isDataTerminated = true ;
56+ } catch (...) {
57+ }
58+ } while (!isDataTerminated);
4959}
5060
5161template <class RawHeader >
You can’t perform that action at this time.
0 commit comments