Skip to content

Commit 495cef2

Browse files
committed
feat(alpide):Added reader and data structures for monitoring the current and voltage of each flex
Minor change Minor change Minor change
1 parent 265ad0b commit 495cef2

10 files changed

Lines changed: 421 additions & 1 deletion

File tree

r3bdata/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ set(SRCS
2323
alpideData/R3BAlpideHitData.cxx
2424
alpideData/R3BAlpideMappedData.cxx
2525
alpideData/R3BAlpidePoint.cxx
26+
alpideData/R3BHmpMappedData.cxx
2627
amsData/R3BAmsHitData.cxx
2728
amsData/R3BAmsMappedData.cxx
2829
amsData/R3BAmsStripCalData.cxx
@@ -170,6 +171,7 @@ set(HEADERS
170171
alpideData/R3BAlpideHitData.h
171172
alpideData/R3BAlpideMappedData.h
172173
alpideData/R3BAlpidePoint.h
174+
alpideData/R3BHmpMappedData.h
173175
amsData/R3BAmsHitData.h
174176
amsData/R3BAmsMappedData.h
175177
amsData/R3BAmsStripCalData.h

r3bdata/DataLinkDef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#pragma link C++ class R3BAlpideMappedData+;
5959
#pragma link C++ class R3BAlpideCalData+;
6060
#pragma link C++ class R3BAlpideHitData+;
61+
#pragma link C++ class R3BHmpMappedData+;
6162
#pragma link C++ class R3BRpcMappedData+;
6263
#pragma link C++ class R3BRpcPreCalData+;
6364
#pragma link C++ class R3BRpcCalData+;
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/******************************************************************************
2+
* Copyright (C) 2022 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3+
* Copyright (C) 2022-2023 Members of R3B Collaboration *
4+
* *
5+
* This software is distributed under the terms of the *
6+
* GNU General Public Licence (GPL) version 3, *
7+
* copied verbatim in the file "LICENSE". *
8+
* *
9+
* In applying this license GSI does not waive the privileges and immunities *
10+
* granted to it by virtue of its status as an Intergovernmental Organization *
11+
* or submit itself to any jurisdiction. *
12+
******************************************************************************/
13+
14+
// --------------------------------------------------------------------
15+
// ----- R3BHmpMappedData source file -----
16+
// --------------------------------------------------------------------
17+
18+
#include "R3BHmpMappedData.h"
19+
#include <fmt/core.h>
20+
21+
R3BHmpMappedData::R3BHmpMappedData(uint32_t TSYS_LO,
22+
uint32_t TSYS_HI,
23+
uint32_t volt1,
24+
uint32_t curr1,
25+
uint32_t volt2,
26+
uint32_t curr2,
27+
uint32_t volt3,
28+
uint32_t curr3,
29+
uint32_t volt4,
30+
uint32_t curr4)
31+
: fTSLO(TSYS_LO)
32+
, fTSHI(TSYS_HI)
33+
, fVolt1(volt1)
34+
, fCurr1(curr1)
35+
, fVolt2(volt2)
36+
, fCurr2(curr2)
37+
, fVolt3(volt3)
38+
, fCurr3(curr3)
39+
, fVolt4(volt4)
40+
, fCurr4(curr4)
41+
{
42+
}
43+
44+
std::string R3BHmpMappedData::toString() const
45+
{
46+
return fmt::format("TSLO: {}, Region: {}, TSHI: {}, Volt1: {}, Curr1: {}, Volt2: {}, Curr2: {}, Volt3: {}, Curr3: "
47+
"{}, Volt4: {}, Curr4: {}",
48+
GetTSLO(),
49+
GetTSHI(),
50+
GetVolt1(),
51+
GetCurr1(),
52+
GetVolt2(),
53+
GetCurr2(),
54+
GetVolt3(),
55+
GetCurr3(),
56+
GetVolt4(),
57+
GetCurr4());
58+
}
59+
60+
void R3BHmpMappedData::Print(const Option_t*) const { std::cout << *this << std::endl; }
61+
62+
std::ostream& operator<<(std::ostream& os, const R3BHmpMappedData& data)
63+
{
64+
os << data.toString();
65+
return os;
66+
}
67+
68+
ClassImp(R3BHmpMappedData)
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/******************************************************************************
2+
* Copyright (C) 2022 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3+
* Copyright (C) 2022-2024 Members of R3B Collaboration *
4+
* *
5+
* This software is distributed under the terms of the *
6+
* GNU General Public Licence (GPL) version 3, *
7+
* copied verbatim in the file "LICENSE". *
8+
* *
9+
* In applying this license GSI does not waive the privileges and immunities *
10+
* granted to it by virtue of its status as an Intergovernmental Organization *
11+
* or submit itself to any jurisdiction. *
12+
******************************************************************************/
13+
14+
// ---------------------------------------------------------------
15+
// ----- R3BHmpMappedData -----
16+
// ----- Created 17/04/2025 by L. Rose -----
17+
// ---------------------------------------------------------------
18+
19+
#pragma once
20+
21+
#include <TObject.h>
22+
#include <cstdint>
23+
#include <iostream>
24+
#include <string>
25+
26+
class R3BHmpMappedData : public TObject
27+
{
28+
public:
29+
// Default Constructor
30+
R3BHmpMappedData() = default;
31+
32+
/** Standard Constructor
33+
HMP_TSYS_LO // Slow control computer time Low bits
34+
HMP_TSYS_HI // Slow control computer time High bits
35+
HMP_VOLT1 // Voltage channel 1
36+
HMP_VOLT2 // Voltage channel 2
37+
HMP_VOLT3 // Voltage channel 3
38+
HMP_VOLT4 // Voltage channel 4
39+
HMP_CURR1 // Current channel 1
40+
HMP_CURR2 // Current channel 2
41+
HMP_CURR3 // Current channel 3
42+
HMP_CURR4 // Current channel 4
43+
**/
44+
45+
explicit R3BHmpMappedData(uint32_t TSYS_LO,
46+
uint32_t TSYS_HI,
47+
uint32_t volt1,
48+
uint32_t curr1,
49+
uint32_t volt2,
50+
uint32_t curr2,
51+
uint32_t volt3,
52+
uint32_t curr3,
53+
uint32_t volt4,
54+
uint32_t curr4);
55+
56+
// Destructor
57+
virtual ~R3BHmpMappedData() = default;
58+
59+
// Accessors with [[nodiscard]]
60+
[[nodiscard]] inline const uint32_t GetTSLO() const { return fTSLO; }
61+
[[nodiscard]] inline const uint32_t GetTSHI() const { return fTSHI; }
62+
[[nodiscard]] inline const uint32_t GetVolt1() const { return fVolt1; }
63+
[[nodiscard]] inline const uint32_t GetCurr1() const { return fCurr1; }
64+
[[nodiscard]] inline const uint32_t GetVolt2() const { return fVolt2; }
65+
[[nodiscard]] inline const uint32_t GetCurr2() const { return fCurr2; }
66+
[[nodiscard]] inline const uint32_t GetVolt3() const { return fVolt3; }
67+
[[nodiscard]] inline const uint32_t GetCurr3() const { return fCurr3; }
68+
[[nodiscard]] inline const uint32_t GetVolt4() const { return fVolt4; }
69+
[[nodiscard]] inline const uint32_t GetCurr4() const { return fCurr4; }
70+
71+
// Support for printing
72+
[[nodiscard]] std::string toString() const;
73+
void Print(const Option_t*) const override;
74+
75+
protected:
76+
uint32_t fTSLO = 0;
77+
uint32_t fTSHI = 0;
78+
uint32_t fVolt1 = 0;
79+
uint32_t fCurr1 = 0;
80+
uint32_t fVolt2 = 0;
81+
uint32_t fCurr2 = 0;
82+
uint32_t fVolt3 = 0;
83+
uint32_t fCurr3 = 0;
84+
uint32_t fVolt4 = 0;
85+
uint32_t fCurr4 = 0;
86+
87+
public:
88+
ClassDefOverride(R3BHmpMappedData, 1); // NOLINT
89+
};
90+
91+
// Operator overloading for printing R3BHmpMappedData
92+
std::ostream& operator<<(std::ostream& os, const R3BHmpMappedData& data);

r3bsource/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ set(SRCS
105105
foot/R3BFootSiReader.cxx
106106
alpide/R3BAlpideReader.cxx
107107
alpide/R3BMosaicReader.cxx
108+
alpide/R3BHmpReader.cxx
108109
music/R3BMusicReader.cxx
109110
rpc/R3BRpcReader.cxx
110111
twim/R3BTwimReader.cxx
@@ -172,6 +173,7 @@ set(STRUCT_HEADERS
172173
foot/ext_h101_foot.h
173174
alpide/ext_h101_alpide.h
174175
alpide/ext_h101_mosaic.h
176+
alpide/ext_h101_hmp.h
175177
music/ext_h101_music.h
176178
twim/ext_h101_twim.h
177179
tttx/ext_h101_ttt10.h
@@ -245,6 +247,7 @@ set(HEADERS
245247
foot/R3BFootSiReader.h
246248
alpide/R3BAlpideReader.h
247249
alpide/R3BMosaicReader.h
250+
alpide/R3BHmpReader.h
248251
music/R3BMusicReader.h
249252
rpc/R3BRpcReader.h
250253
tttx/R3BTttxReader.h

r3bsource/SourceLinkDef.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
#pragma link C++ class R3BFootReader+;
7474
#pragma link C++ class R3BFootSiReader+;
7575
#pragma link C++ class R3BAlpideReader+;
76+
#pragma link C++ class R3BHmpReader+;
7677
#pragma link C++ class R3BCalifaJulichReader+;
7778
#pragma link C++ class R3BRpcReader+;
7879
#pragma link C++ class R3BTwimReader+;
@@ -147,6 +148,7 @@
147148
#pragma link C++ class EXT_STR_h101_RPC_t;
148149
#pragma link C++ class EXT_STR_h101_SYNC_CHECK_t;
149150
#pragma link C++ class EXT_STR_h101_MOSAIC_onion_t;
151+
#pragma link C++ class EXT_STR_h101_HMP_onion_t;
150152
#pragma link C++ class EXT_STR_h101_ACTAF_onion_t;
151153

152154
#endif

r3bsource/alpide/R3BAlpideReader.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,4 @@ void R3BAlpideReader::Reset()
131131
}
132132
}
133133

134-
ClassImp(R3BAlpideReader);
134+
ClassImp(R3BAlpideReader)

r3bsource/alpide/R3BHmpReader.cxx

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/******************************************************************************
2+
* Copyright (C) 2025 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3+
* Copyright (C) 2025 Members of R3B Collaboration *
4+
* *
5+
* This software is distributed under the terms of the *
6+
* GNU General Public Licence (GPL) version 3, *
7+
* copied verbatim in the file "LICENSE". *
8+
* *
9+
* In applying this license GSI does not waive the privileges and immunities *
10+
* granted to it by virtue of its status as an Intergovernmental Organization *
11+
* or submit itself to any jurisdiction. *
12+
******************************************************************************/
13+
14+
#include <FairRootManager.h>
15+
16+
#include "R3BHmpMappedData.h"
17+
#include "R3BHmpReader.h"
18+
#include "R3BLogger.h"
19+
20+
#include "ext_data_struct_info.hh"
21+
#include <TClonesArray.h>
22+
23+
/**
24+
** ext_h101_hmp.h was created by running
25+
** $unpacker --ntuple=STRUCT_HH,RAW:HMP,id=h101_HMP,NOTRIGEVENTNO,ext_h101_hmp.h
26+
**/
27+
28+
extern "C"
29+
{
30+
#include "ext_data_client.h"
31+
#include "ext_h101_hmp.h"
32+
}
33+
34+
R3BHmpReader::R3BHmpReader(EXT_STR_h101_HMP_onion* data, size_t offset)
35+
: R3BReader("R3BHmpReader")
36+
, fData(data)
37+
, fArray(new TClonesArray("R3BHmpMappedData"))
38+
{
39+
}
40+
41+
R3BHmpReader::~R3BHmpReader()
42+
{
43+
R3BLOG(debug1, "");
44+
if (fArray)
45+
{
46+
delete fArray;
47+
}
48+
}
49+
50+
Bool_t R3BHmpReader::Init(ext_data_struct_info* a_struct_info)
51+
{
52+
Int_t okay = 0;
53+
R3BLOG(info, "");
54+
EXT_STR_h101_HMP_ITEMS_INFO(okay, *a_struct_info, fOffset, EXT_STR_h101_HMP, 0);
55+
56+
R3BLOG_IF(fatal, !okay, "Failed to setup structure information.");
57+
58+
// Register output array in tree
59+
FairRootManager::Instance()->Register("HmpMappedData", "HMP_Map", fArray, !fOnline);
60+
Reset();
61+
memset(fData, 0, sizeof(*fData));
62+
63+
return kTRUE;
64+
}
65+
66+
Bool_t R3BHmpReader::R3BRead()
67+
{
68+
R3BLOG(debug1, "Event data: " << fNEvent);
69+
new ((*fArray)[fArray->GetEntriesFast()]) R3BHmpMappedData(fData->HMP_TSYS_LO,
70+
fData->HMP_TSYS_HI,
71+
fData->HMP_VOLT[0],
72+
fData->HMP_CURR[0],
73+
fData->HMP_VOLT[1],
74+
fData->HMP_CURR[1],
75+
fData->HMP_VOLT[2],
76+
fData->HMP_CURR[2],
77+
fData->HMP_VOLT[3],
78+
fData->HMP_CURR[3]);
79+
fNEvent++;
80+
return kTRUE;
81+
}
82+
83+
void R3BHmpReader::Reset()
84+
{
85+
// Reset the output array
86+
if (fArray)
87+
{
88+
fArray->Clear();
89+
}
90+
}
91+
92+
ClassImp(R3BHmpReader)

r3bsource/alpide/R3BHmpReader.h

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/******************************************************************************
2+
* Copyright (C) 2025 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3+
* Copyright (C) 2025 Members of R3B Collaboration *
4+
* *
5+
* This software is distributed under the terms of the *
6+
* GNU General Public Licence (GPL) version 3, *
7+
* copied verbatim in the file "LICENSE". *
8+
* *
9+
* In applying this license GSI does not waive the privileges and immunities *
10+
* granted to it by virtue of its status as an Intergovernmental Organization *
11+
* or submit itself to any jurisdiction. *
12+
******************************************************************************/
13+
14+
// ---------------------------------------------------------------------
15+
// ----- R3BHmpReader -----
16+
// ----- Created 17/04/2025 by L. Rose -----
17+
// ---------------------------------------------------------------------
18+
19+
#pragma once
20+
21+
#include "R3BReader.h"
22+
#include <stdint.h>
23+
24+
class TClonesArray;
25+
26+
struct EXT_STR_h101_HMP_t;
27+
typedef struct EXT_STR_h101_HMP_t EXT_STR_h101_HMP;
28+
typedef struct EXT_STR_h101_HMP_onion_t EXT_STR_h101_HMP_onion;
29+
class ext_data_struct_info;
30+
31+
class R3BHmpReader : public R3BReader
32+
{
33+
public:
34+
// Standard constructor
35+
R3BHmpReader(EXT_STR_h101_HMP_onion*, size_t);
36+
37+
// Destructor
38+
virtual ~R3BHmpReader();
39+
40+
// Setup structure information
41+
virtual Bool_t Init(ext_data_struct_info*) override;
42+
43+
// Read data from full event structure
44+
virtual Bool_t R3BRead() override;
45+
46+
// Reset
47+
virtual void Reset() override;
48+
49+
// Accessor to select online mode
50+
void SetOnline(bool option = true) { fOnline = option; }
51+
52+
private:
53+
// An event counter
54+
unsigned int fNEvent = 0;
55+
// Number of HMP sensors
56+
// Reader specific data structure from ucesb
57+
EXT_STR_h101_HMP_onion* fData;
58+
// Data offset
59+
size_t fOffset = 0;
60+
// Don't store data for online
61+
bool fOnline = false;
62+
// Output array
63+
TClonesArray* fArray = nullptr;
64+
65+
public:
66+
ClassDefOverride(R3BHmpReader, 1); // NOLINT
67+
};

0 commit comments

Comments
 (0)