File tree Expand file tree Collapse file tree
DataFormats/Detectors/ZDC Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ o2_add_library(DataFormatsZDC
1313 src/OrbitRawData.cxx src/OrbitRecData.cxx
1414 PUBLIC_LINK_LIBRARIES O2::CommonConstants O2::CommonDataFormat
1515 O2::ZDCBase ROOT::MathCore FairRoot::Base
16- O2::MathUtils )
16+ O2::MathUtils ms_gsl::ms_gsl )
1717
1818o2_target_root_dictionary (DataFormatsZDC
1919 HEADERS include /DataFormatsZDC/BCData.h include /DataFormatsZDC/ChannelData.h
Original file line number Diff line number Diff line change 1515#include " CommonDataFormat/RangeReference.h"
1616#include " ZDCBase/Constants.h"
1717#include < Rtypes.h>
18+ #include < gsl/span>
1819
1920// / \file BCData.h
2021// / \brief Class to describe fired triggered and/or stored channels for the BC and to refer to channel data
@@ -24,6 +25,7 @@ namespace o2
2425{
2526namespace zdc
2627{
28+ class ChannelData ;
2729
2830struct BCData {
2931 // / we are going to refer to at most 26 channels, so 5 bits for the NChannels and 27 for the reference
@@ -41,6 +43,8 @@ struct BCData {
4143 channels = chSto;
4244 triggers = chTrig;
4345 }
46+
47+ gsl::span<const ChannelData> getBunchChannelData (const gsl::span<const ChannelData> tfdata) const ;
4448 void print () const ;
4549
4650 ClassDefNV (BCData, 1 );
Original file line number Diff line number Diff line change 99// or submit itself to any jurisdiction.
1010
1111#include " DataFormatsZDC/BCData.h"
12+ #include " DataFormatsZDC/ChannelData.h"
1213#include < bitset>
1314
1415using namespace o2 ::zdc;
@@ -31,3 +32,9 @@ void BCData::print() const
3132 }
3233 printf (" ]\n " );
3334}
35+
36+ gsl::span<const ChannelData> BCData::getBunchChannelData (const gsl::span<const ChannelData> tfdata) const
37+ {
38+ // extract the span of channel data for this bunch from the whole TF data
39+ return gsl::span<const ChannelData>(&tfdata[ref.getFirstEntry ()], ref.getEntries ());
40+ }
Original file line number Diff line number Diff line change @@ -57,11 +57,18 @@ void readZDCDigits(std::string digiFName = "zdcdigits.root")
5757 }
5858 bcd .print ();
5959 //
60+ auto channels = bcd .getBunchChannelData (zdcChData );
61+ int nch = channels .size ();
62+ for (int ich = 0 ; ich < nch ; ich ++ ) {
63+ channels [ich ].print ();
64+ }
65+ /* // alternative way:
6066 int chEnt = bcd.ref.getFirstEntry();
6167 for (int ic = 0; ic < bcd.ref.getEntries(); ic++) {
6268 const auto& chd = zdcChData[chEnt++];
6369 chd.print();
6470 }
71+ */
6572 if (labelsPtr ) {
6673 const auto lbl = labelsPtr -> getLabels (ibc );
6774 for (int lb = 0 ; lb < lbl .size (); lb ++ ) {
You can’t perform that action at this time.
0 commit comments