Skip to content

Commit 1047de5

Browse files
syano0822shahor02
authored andcommitted
Add DCS Config -> CCDB codes in Detectors/ITSMFT/MFT/condition
1 parent dc26b3d commit 1047de5

13 files changed

Lines changed: 682 additions & 125 deletions

Detectors/ITSMFT/MFT/condition/CMakeLists.txt

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,20 @@
1111
o2_add_library(MFTCondition
1212
SOURCES src/MFTDCSProcessor.cxx
1313
src/DCSNameResolver.cxx
14+
src/DCSConfigInfo.cxx
15+
src/DCSConfigReader.cxx
16+
src/DCSConfigUtils.cxx
1417
PUBLIC_LINK_LIBRARIES O2::CCDB
15-
O2::DetectorsCalibration
16-
O2::DetectorsDCS
17-
Microsoft.GSL::GSL)
18+
O2::DetectorsCalibration
19+
O2::DetectorsDCS
20+
Microsoft.GSL::GSL)
1821

1922
o2_target_root_dictionary(MFTCondition
2023
HEADERS include/MFTCondition/MFTDCSProcessor.h
2124
include/MFTCondition/DCSNameResolver.h
25+
include/MFTCondition/DCSConfigInfo.h
26+
include/MFTCondition/DCSConfigReader.h
27+
include/MFTCondition/DCSConfigUtils.h
2228
LINKDEF src/MFTConditionLinkDef.h)
2329

2430
o2_add_executable(mft-dcs-sim-workflow
@@ -33,4 +39,12 @@ o2_add_executable(mft-dcs-workflow
3339
O2::MFTCondition
3440
O2::DetectorsDCS)
3541

42+
o2_add_executable(mft-dcs-config-workflow
43+
COMPONENT_NAME condition
44+
SOURCES testWorkflow/mft-dcs-config-workflow.cxx
45+
PUBLIC_LINK_LIBRARIES O2::Framework
46+
O2::DetectorsCommonDataFormats
47+
O2::MFTCondition
48+
O2::DetectorsDCS)
49+
3650
add_subdirectory(macros)
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#ifndef O2_MFT_DCSCONFIGINFO_H
13+
#define O2_MFT_DCSCONFIGINFO_H
14+
15+
#include <TString.h>
16+
#include <unordered_map>
17+
#include <iostream>
18+
19+
namespace o2
20+
{
21+
namespace mft
22+
{
23+
class DCSConfigInfo
24+
{
25+
26+
public:
27+
void clear()
28+
{
29+
mData = -999;
30+
mAdd = -999;
31+
mType = -999;
32+
mVersion = "v0";
33+
}
34+
void setData(int val)
35+
{
36+
mData = val;
37+
}
38+
void setAdd(int val)
39+
{
40+
mAdd = val;
41+
}
42+
void setType(int val)
43+
{
44+
mType = val;
45+
}
46+
void setVersion(std::string str)
47+
{
48+
mVersion = str;
49+
}
50+
51+
const int& getData() const
52+
{
53+
return mData;
54+
}
55+
const int& getAdd() const
56+
{
57+
return mAdd;
58+
}
59+
const int& getType() const
60+
{
61+
return mType;
62+
}
63+
const std::string& getVersion() const
64+
{
65+
return mVersion;
66+
}
67+
68+
private:
69+
int mData;
70+
int mAdd;
71+
int mType; // RU = 0, ALPIDE = 1
72+
std::string mVersion;
73+
74+
ClassDefNV(DCSConfigInfo, 1);
75+
};
76+
} // namespace mft
77+
} // namespace o2
78+
79+
#endif
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#ifndef MFTDCSCONFIGPROCESSOR_H_
13+
#define MFTDCSCONFIGPROCESSOR_H_
14+
15+
#include "Rtypes.h"
16+
#include "MFTCondition/DCSConfigInfo.h"
17+
#include <gsl/span>
18+
#include <memory>
19+
20+
/// @brief Class to read the MFT config information
21+
22+
namespace o2
23+
{
24+
namespace mft
25+
{
26+
27+
using namespace o2::mft;
28+
29+
class DCSConfigReader
30+
{
31+
32+
public:
33+
DCSConfigReader() = default; // default constructor
34+
~DCSConfigReader() = default; // default destructor
35+
36+
void init(bool);
37+
void loadConfig(gsl::span<const char> configBuf); // load MFT config
38+
void clear();
39+
40+
std::vector<o2::mft::DCSConfigInfo>& getConfigInfo() { return mDCSConfig; }
41+
42+
private:
43+
void parseConfig();
44+
45+
std::string mParams;
46+
47+
int mNumRow;
48+
int mNumRU;
49+
int mNumALPIDE;
50+
51+
bool mVerbose = false;
52+
53+
std::vector<o2::mft::DCSConfigInfo> mDCSConfig;
54+
55+
ClassDefNV(DCSConfigReader, 1);
56+
};
57+
58+
} // namespace mft
59+
} // namespace o2
60+
61+
#endif
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#ifndef O2_MFT_DNSUTILS_H
13+
#define O2_MFT_DNSUTILS_H
14+
15+
/// @file DCSConfigUtils.h
16+
/// @brief MFT Processor for DCS Config
17+
18+
#include <TString.h>
19+
#include <unordered_map>
20+
#include <iostream>
21+
#include "MFTCondition/DCSConfigInfo.h"
22+
23+
namespace o2
24+
{
25+
namespace mft
26+
{
27+
28+
class DCSConfigUtils
29+
{
30+
31+
public:
32+
void init(const DCSConfigInfo& info)
33+
{
34+
mData = info.getData();
35+
mAdd = info.getAdd();
36+
mType = info.getType();
37+
mVersion = info.getVersion();
38+
connectNameAdd();
39+
}
40+
41+
void clear()
42+
{
43+
mData = 0;
44+
mAdd = 0;
45+
mType = 0;
46+
mVersion = "";
47+
}
48+
49+
const int& getData() const
50+
{
51+
return mData;
52+
}
53+
const int& getAdd() const
54+
{
55+
return mAdd;
56+
}
57+
const int& getType() const
58+
{
59+
return mType;
60+
}
61+
const std::string& getVersion() const
62+
{
63+
return mVersion;
64+
}
65+
const std::string& getName() const
66+
{
67+
if (mType == 0) {
68+
return mMapAddNameRU.find(mAdd)->second;
69+
}
70+
return mMapAddNameALPIDE.find(mAdd)->second;
71+
}
72+
73+
const std::string& getTypeStr() const
74+
{
75+
if (mType == 0 || mType == 1) {
76+
return mTypeNameList[mType];
77+
}
78+
return mTypeNameList[2];
79+
}
80+
81+
private:
82+
int mData;
83+
int mAdd;
84+
int mType;
85+
std::string mVersion;
86+
87+
std::string mTypeNameList[3] = {"RU", "ALPIDE", "UNKNOWN"};
88+
89+
std::unordered_map<int, std::string> mMapAddNameRU;
90+
std::unordered_map<int, std::string> mMapAddNameALPIDE;
91+
92+
void connectNameAdd()
93+
{
94+
95+
mMapAddNameRU.clear();
96+
mMapAddNameALPIDE.clear();
97+
98+
mMapAddNameRU[1046] = "MANCHESTER";
99+
mMapAddNameRU[4096] = "ENABLE";
100+
mMapAddNameRU[4097] = "TRIGGER_PERIOD";
101+
mMapAddNameRU[4098] = "PULSE_nTRIGGER";
102+
mMapAddNameRU[4099] = "TRIGGER_MIN_DISTANCE";
103+
mMapAddNameRU[4101] = "OPCODE_GATING";
104+
mMapAddNameRU[4102] = "TRIGGER_DELAY";
105+
mMapAddNameRU[4103] = "ENABLE_PACKER_0";
106+
mMapAddNameRU[4104] = "ENABLE_PACKER_1";
107+
mMapAddNameRU[4105] = "ENABLE_PACKER_2";
108+
mMapAddNameRU[4106] = "TRIG_SOURCE";
109+
mMapAddNameRU[5376] = "TIMEOUT_TO_START";
110+
mMapAddNameRU[5377] = "TIMEOUT_TO_STOP";
111+
mMapAddNameRU[5378] = "TIMEOUT_IN_IDLE";
112+
113+
mMapAddNameALPIDE[1] = "Mode Control Register";
114+
mMapAddNameALPIDE[4] = "FROMU Configration Register 1";
115+
mMapAddNameALPIDE[5] = "FROMU Configration Register 2";
116+
mMapAddNameALPIDE[6] = "FROMU Configration Register 3";
117+
mMapAddNameALPIDE[7] = "FROMU Pulsing Register 1";
118+
mMapAddNameALPIDE[8] = "FROMU Pulsing Register 2";
119+
mMapAddNameALPIDE[16] = "CMU&DMU Configration Register";
120+
mMapAddNameALPIDE[20] = "DTU Configration Register";
121+
mMapAddNameALPIDE[21] = "DTU DACs Register";
122+
mMapAddNameALPIDE[24] = "DTU Test Register 1";
123+
mMapAddNameALPIDE[25] = "DTU Test Register 2";
124+
mMapAddNameALPIDE[26] = "DTU Test Register 3";
125+
mMapAddNameALPIDE[1539] = "VCASP";
126+
mMapAddNameALPIDE[1544] = "VCLIP";
127+
mMapAddNameALPIDE[1549] = "IBIAS";
128+
}
129+
130+
ClassDefNV(DCSConfigUtils, 1);
131+
132+
}; // end class
133+
} // namespace mft
134+
} // namespace o2
135+
136+
#endif

Detectors/ITSMFT/MFT/condition/macros/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@ o2_add_test_root_macro(
1313
readMFTDCSentries.C
1414
PUBLIC_LINK_LIBRARIES O2::DetectorsDCS O2::CCDB O2::MFTCondition)
1515

16+
o2_add_test_root_macro(
17+
readMFTDCSConfigEntries.C
18+
PUBLIC_LINK_LIBRARIES O2::DetectorsDCS O2::CCDB O2::MFTCondition)
19+
20+
1621
o2_add_test_root_macro(
1722
makeMFTCCDBEntryForDCS.C
1823
PUBLIC_LINK_LIBRARIES O2::DetectorsDCS O2::CCDB)
1924

2025
install(
2126
FILES makeMFTCCDBEntryForDCS.C
2227
readMFTDCSentries.C
28+
readMFTDCSConfigEntries.C
2329
DESTINATION share/macro/)

0 commit comments

Comments
 (0)