Skip to content

Commit 9fcc374

Browse files
cortesepshahor02
andauthored
Raw to digits (#5585)
* Sync to head * Correct assignment of trigger bits in Digitizer.cxx Triple trigger condition in Digitizer.cxx Improved printout of BC data * Cleanup * Correcting data type * Correcting assignment bug * Raw creation with new digits format * Clang format * Clang format * First raw 2 digit * Revert "First raw 2 digit" This reverts commit 5e146ce. * First raw 2 digit * First raw 2 digit * Writing convert digits to file (first attempt) * Corrected consistency checks * Corrected IR * Clang format * Remove UInt_t * Remove Int_t * Remove Int_t * Remove Double_t Float_t * Remove Float_t * Remove root types * Removing unused variable * Correct typo * Renaming raw2digits workflow * Correcting conflicting option * Correcting ref and updating printout * Updating printout * Simplify inheritance * Simplify inheritance * Clang format * Simplify inheritance * Dump digits * Clang format * ccdb-url as command line option * fixes, eliminate unneeded ZDCWorkflow * call mRawReader.setModuleConfig amd setTriggerMask only once for thr 1st TF * Move RawReaderZDC from workflow/ to raw/ * Sync to head * Correct assignment of trigger bits in Digitizer.cxx Triple trigger condition in Digitizer.cxx Improved printout of BC data * Cleanup * Correcting data type * Correcting assignment bug * Raw creation with new digits format * Clang format * Clang format * First raw 2 digit * Revert "First raw 2 digit" This reverts commit 5e146ce. * First raw 2 digit * First raw 2 digit * Writing convert digits to file (first attempt) * Corrected consistency checks * Corrected IR * Clang format * Remove UInt_t * Remove Int_t * Remove Int_t * Remove Double_t Float_t * Remove Float_t * Remove root types * Removing unused variable * Correct typo * Renaming raw2digits workflow * Correcting conflicting option * Correcting ref and updating printout * Updating printout * Simplify inheritance * Simplify inheritance * Clang format * Simplify inheritance * Dump digits * Clang format * ccdb-url as command line option * fixes, eliminate unneeded ZDCWorkflow * call mRawReader.setModuleConfig amd setTriggerMask only once for thr 1st TF * Move RawReaderZDC from workflow/ to raw/ * Clang format * Clang format * Clang format * Clang format * By default remove empty orbits and bc that don't satisfy trigger condition. Added option to keep all data * Mask of trigger bits during digitization to be coherent with HW + fixes * Clang format * Scaler data from raw to digits * Scaler data during digitization (limited to triggering channels) * Renaming class PedestalData to OrbitData * Renaming ZDCDigitPed to ZDCDigitOrbit * Disable MC labels * Clang format * Corrected use of --disable-mc * Correct formatting and one bug * Clang format * Remove ZDCDigitWriterSpec Co-authored-by: shahoian <ruben.shahoyan@cern.ch>
1 parent 4b18933 commit 9fcc374

38 files changed

Lines changed: 1217 additions & 549 deletions

DataFormats/Detectors/ZDC/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
o2_add_library(DataFormatsZDC
1212
SOURCES src/ChannelData.cxx src/BCData.cxx src/RecEvent.cxx src/RawEventData.cxx
13-
src/OrbitRawData.cxx src/OrbitRecData.cxx src/PedestalData.cxx
13+
src/OrbitRawData.cxx src/OrbitRecData.cxx src/OrbitData.cxx
1414
src/CTF.cxx
1515
PUBLIC_LINK_LIBRARIES O2::CommonConstants O2::CommonDataFormat
1616
O2::ZDCBase ROOT::MathCore FairRoot::Base
@@ -20,6 +20,6 @@ o2_add_library(DataFormatsZDC
2020
o2_target_root_dictionary(DataFormatsZDC
2121
HEADERS include/DataFormatsZDC/Hit.h include/DataFormatsZDC/MCLabel.h
2222
include/DataFormatsZDC/BCData.h include/DataFormatsZDC/ChannelData.h
23-
include/DataFormatsZDC/PedestalData.h include/DataFormatsZDC/CTF.h
23+
include/DataFormatsZDC/OrbitData.h include/DataFormatsZDC/CTF.h
2424
include/DataFormatsZDC/RecEvent.h include/DataFormatsZDC/OrbitRawData.h
2525
include/DataFormatsZDC/OrbitRecData.h include/DataFormatsZDC/RawEventData.h)

DataFormats/Detectors/ZDC/include/DataFormatsZDC/BCData.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,25 @@ namespace zdc
2727
{
2828
class ChannelData;
2929

30+
struct __attribute__((__packed__)) ModuleTriggerMap {
31+
unsigned Alice_0 : 1;
32+
unsigned Alice_1 : 1;
33+
unsigned Alice_2 : 1;
34+
unsigned Alice_3 : 1;
35+
unsigned Auto_m : 1;
36+
unsigned Auto_0 : 1;
37+
unsigned Auto_1 : 1;
38+
unsigned Auto_2 : 1;
39+
unsigned Auto_3 : 1;
40+
unsigned empty : 7;
41+
};
42+
43+
union ModuleTriggerMapData {
44+
uint16_t w;
45+
struct ModuleTriggerMap f;
46+
void reset();
47+
};
48+
3049
struct BCData {
3150
/// we are going to refer to at most 26 channels, so 5 bits for the NChannels and 27 for the reference
3251
o2::dataformats::RangeRefComp<5> ref;
@@ -48,7 +67,7 @@ struct BCData {
4867
}
4968

5069
gsl::span<const ChannelData> getBunchChannelData(const gsl::span<const ChannelData> tfdata) const;
51-
void print() const;
70+
void print(uint32_t triggerMask = 0, int diff = 0) const;
5271

5372
ClassDefNV(BCData, 2);
5473
};

DataFormats/Detectors/ZDC/include/DataFormatsZDC/CTF.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "DetectorsCommonDataFormats/EncodedBlocks.h"
2121
#include "DataFormatsZDC/ChannelData.h"
2222
#include "DataFormatsZDC/BCData.h"
23-
#include "DataFormatsZDC/PedestalData.h"
23+
#include "DataFormatsZDC/OrbitData.h"
2424

2525
namespace o2
2626
{

DataFormats/Detectors/ZDC/include/DataFormatsZDC/PedestalData.h renamed to DataFormats/Detectors/ZDC/include/DataFormatsZDC/OrbitData.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ namespace o2
2525
namespace zdc
2626
{
2727

28-
struct PedestalData {
28+
struct OrbitData {
2929
o2::InteractionRecord ir;
3030
std::array<int16_t, NChannels> data{};
31+
std::array<uint16_t, NChannels> scaler{};
3132

3233
float asFloat(int i) const { return data[i] / 8.; }
3334
void print() const;
3435

35-
ClassDefNV(PedestalData, 1);
36+
ClassDefNV(OrbitData, 1);
3637
};
3738
} // namespace zdc
3839
} // namespace o2

DataFormats/Detectors/ZDC/src/BCData.cxx

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@
1414

1515
using namespace o2::zdc;
1616

17-
void BCData::print() const
17+
void BCData::print(uint32_t triggerMask, int diff) const
1818
{
19-
printf("Orbit %9u bc %4u nch %2d pos %d\n", ir.orbit, ir.bc, ref.getEntries(), ref.getFirstEntry());
19+
if (diff == 0) {
20+
printf("Orbit %9u bc %4u nch %2d pos %d\n", ir.orbit, ir.bc, ref.getEntries(), ref.getFirstEntry());
21+
} else {
22+
printf("%9u.%04u ", ir.orbit, ir.bc);
23+
}
2024
printf("Read:");
2125
for (int ic = 0; ic < NDigiChannels; ic++) {
2226
if (ic % NChPerModule == 0) {
@@ -32,16 +36,11 @@ void BCData::print() const
3236
printf(" ");
3337
}
3438
}
35-
printf("]\nTrigs:");
36-
for (int i = 0; i < NChannels; i++) {
37-
std::bitset<10> bb(moduleTriggers[i]);
38-
printf("[%2d: %s]", i, bb.to_string().c_str());
39-
if (i % (NChannels / 3) == 0 && i) {
40-
printf("\n");
41-
}
39+
printf("]\n");
40+
if (diff) {
41+
printf("%9u.%04u ", ir.orbit, ir.bc);
4242
}
43-
44-
printf("]\nHits:");
43+
printf("Hits:");
4544
for (int ic = 0; ic < NDigiChannels; ic++) {
4645
if (ic % NChPerModule == 0) {
4746
if (ic == 0) {
@@ -50,13 +49,41 @@ void BCData::print() const
5049
printf("] %d[", ic / NChPerModule);
5150
}
5251
}
53-
if (triggers & (0x1 << ic)) {
54-
printf("H");
52+
bool is_hit = triggers & (0x1 << ic);
53+
bool is_trig = triggerMask & (0x1 << ic);
54+
if (is_trig) {
55+
if (is_hit) {
56+
printf("T");
57+
} else {
58+
printf(".");
59+
}
5560
} else {
56-
printf(" ");
61+
if (is_hit) {
62+
printf("H");
63+
} else {
64+
printf(" ");
65+
}
5766
}
5867
}
5968
printf("]\n");
69+
if (diff) {
70+
printf("%9u.%04u ", ir.orbit, ir.bc);
71+
}
72+
printf("AUTO:");
73+
for (int i = 0; i < NModules; i++) {
74+
std::bitset<10> bb(moduleTriggers[i]);
75+
printf(" %d %s%s%s%s%s", i, bb[8] ? "3" : "-", bb[7] ? "2" : "-", bb[6] ? "1" : "-", bb[5] ? "0" : "-", bb[4] ? "M" : "-");
76+
}
77+
printf("\n");
78+
if (diff) {
79+
printf("%9u.%04u ", ir.orbit, ir.bc);
80+
}
81+
printf("ALIT:");
82+
for (int i = 0; i < NModules; i++) {
83+
std::bitset<10> bb(moduleTriggers[i]);
84+
printf(" %d %s%s%s%s ", i, bb[3] ? "3" : "-", bb[2] ? "2" : "-", bb[1] ? "1" : "-", bb[0] ? "0" : "-");
85+
}
86+
printf("\n");
6087
}
6188

6289
gsl::span<const ChannelData> BCData::getBunchChannelData(const gsl::span<const ChannelData> tfdata) const

DataFormats/Detectors/ZDC/src/DataFormatsZDCLinkDef.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323

2424
#pragma link C++ class o2::zdc::ChannelData + ;
2525
#pragma link C++ class o2::zdc::BCData + ;
26-
#pragma link C++ class o2::zdc::PedestalData + ;
26+
#pragma link C++ class o2::zdc::OrbitData + ;
2727
#pragma link C++ class std::vector < o2::zdc::ChannelData> + ;
2828
#pragma link C++ class std::vector < o2::zdc::BCData> + ;
29-
#pragma link C++ class std::vector < o2::zdc::PedestalData> + ;
29+
#pragma link C++ class std::vector < o2::zdc::OrbitData> + ;
3030

3131
#pragma link C++ class std::vector < o2::zdc::RecEvent> + ;
3232
#pragma link C++ class std::vector < o2::zdc::OrbitRawData> + ;

DataFormats/Detectors/ZDC/src/PedestalData.cxx renamed to DataFormats/Detectors/ZDC/src/OrbitData.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
// granted to it by virtue of its status as an Intergovernmental Organization
99
// or submit itself to any jurisdiction.
1010

11-
#include "DataFormatsZDC/PedestalData.h"
11+
#include "DataFormatsZDC/OrbitData.h"
12+
#include "ZDCBase/Constants.h"
1213

1314
using namespace o2::zdc;
1415

15-
void PedestalData::print() const
16+
void OrbitData::print() const
1617
{
1718
printf("Orbit %9u bc %4u\n", ir.orbit, ir.bc);
1819
for (int i = 0; i < NChannels; i++) {
19-
printf("channel %2d : %9.3f\n", i, asFloat(i));
20+
printf("%2d %s: %9.3f cnt: %4u\n", i, ChannelNames[i].data(), asFloat(i), scaler[i]);
2021
}
2122
}

Detectors/CTF/test/test_ctf_io_zdc.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(CTFTest)
2828
{
2929
std::vector<BCData> bcdata;
3030
std::vector<ChannelData> chandata;
31-
std::vector<PedestalData> pedsdata;
31+
std::vector<OrbitData> pedsdata;
3232
// RS: don't understand why, but this library is not loaded automatically, although the dependencies are clearly
3333
// indicated. What it more weird is that for similar tests of other detectors the library is loaded!
3434
// Absence of the library leads to complains about the StreamerInfo and eventually segm.faul when appending the
@@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(CTFTest)
6262
}
6363
}
6464

65-
// PedestalData
65+
// OrbitData
6666
const auto &irFirst = bcdata.front().ir, irLast = bcdata.back().ir;
6767
o2::InteractionRecord irPed(o2::constants::lhc::LHCMaxBunches - 1, irFirst.orbit);
6868
int norbits = irLast.orbit - irFirst.orbit + 1;
@@ -111,7 +111,7 @@ BOOST_AUTO_TEST_CASE(CTFTest)
111111

112112
std::vector<BCData> bcdataD;
113113
std::vector<ChannelData> chandataD;
114-
std::vector<PedestalData> pedsdataD;
114+
std::vector<OrbitData> pedsdataD;
115115

116116
sw.Start();
117117
const auto ctfImage = o2::zdc::CTF::getImage(vec.data());
@@ -153,12 +153,12 @@ BOOST_AUTO_TEST_CASE(CTFTest)
153153
BOOST_CHECK(cmpChData);
154154
}
155155

156-
LOG(INFO) << "Testing PedestalData: BOOST_CHECK(pedsdataD.size() " << pedsdataD.size() << " pedsdata.size()) " << pedsdata.size();
156+
LOG(INFO) << "Testing OrbitData: BOOST_CHECK(pedsdataD.size() " << pedsdataD.size() << " pedsdata.size()) " << pedsdata.size();
157157
BOOST_CHECK(pedsdataD.size() == pedsdata.size());
158158
for (size_t i = 0; i < pedsdata.size(); i++) {
159159
bool cmpPdData = pedsdata[i].ir == pedsdataD[i].ir && pedsdata[i].data == pedsdataD[i].data;
160160
if (!cmpPdData) {
161-
LOG(ERROR) << "Mismatch in PedestalData " << i;
161+
LOG(ERROR) << "Mismatch in OrbitData " << i;
162162
pedsdata[i].print();
163163
pedsdataD[i].print();
164164
}

Detectors/ZDC/base/include/ZDCBase/Geometry.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ class Geometry
5050
static constexpr double ZEMPOSITION[3] = {9.69, 0., 760.};
5151

5252
private:
53-
static Int_t getDetector(const Int_t det);
54-
static Int_t getSector(const Int_t tow);
55-
static Int_t getVolumeId(const Int_t* vol);
53+
static int32_t getDetector(const int32_t det);
54+
static int32_t getSector(const int32_t tow);
55+
static int32_t getVolumeId(const int32_t* vol);
5656

5757
ClassDefNV(Geometry, 1);
5858
};

Detectors/ZDC/raw/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
# submit itself to any jurisdiction.
1010

1111
o2_add_library(ZDCRaw
12-
SOURCES src/DumpRaw.cxx src/raw-parser.cxx
12+
SOURCES src/DumpRaw.cxx
13+
src/raw-parser.cxx
14+
src/RawReaderZDC.cxx
1315
PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat O2::ZDCBase O2::ZDCSimulation
1416
O2::DataFormatsZDC O2::CCDB O2::SimConfig O2::DPLUtils
1517
O2::DetectorsRaw O2::Headers)
@@ -28,4 +30,3 @@ o2_add_executable(raw-parser
2830
O2::DetectorsRaw
2931
O2::DetectorsCommonDataFormats
3032
O2::CommonUtils)
31-

0 commit comments

Comments
 (0)