Skip to content

Commit 376fc00

Browse files
authored
ZDC: Task reconstruction First Version (#1430)
* ZDC: Task reconstruction First Version * Update CMakeLists.txt Add O2::DataFormatsZDC
1 parent 8f19a90 commit 376fc00

5 files changed

Lines changed: 753 additions & 2 deletions

File tree

Modules/ZDC/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
add_library(O2QcZDC)
44

5-
target_sources(O2QcZDC PRIVATE src/ZDCRawDataCheck.cxx src/ZDCRawDataTask.cxx )
5+
target_sources(O2QcZDC PRIVATE src/ZDCRecDataTask.cxx src/ZDCRawDataCheck.cxx src/ZDCRawDataTask.cxx )
66

77
target_include_directories(
88
O2QcZDC
99
PUBLIC $<INSTALL_INTERFACE:include>
1010
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
1111
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
1212

13-
target_link_libraries(O2QcZDC PUBLIC O2QualityControl)
13+
target_link_libraries(O2QcZDC PUBLIC O2QualityControl O2::DataFormatsZDC)
1414

1515
install(TARGETS O2QcZDC
1616
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
@@ -19,6 +19,7 @@ install(TARGETS O2QcZDC
1919

2020
add_root_dictionary(O2QcZDC
2121
HEADERS
22+
include/ZDC/ZDCRecDataTask.h
2223
include/ZDC/ZDCRawDataCheck.h
2324
include/ZDC/ZDCRawDataTask.h
2425
LINKDEF include/ZDC/LinkDef.h
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"qc": {
3+
"config": {
4+
"database": {
5+
"implementation": "CCDB",
6+
"host": "ccdb-test.cern.ch:8080",
7+
"username": "not_applicable",
8+
"password": "not_applicable",
9+
"name": "not_applicable"
10+
},
11+
"Activity": {
12+
"number": "42",
13+
"type": "2"
14+
},
15+
"monitoring": {
16+
"url": "infologger:///debug?qc"
17+
},
18+
"consul": {
19+
"url": "http://consul-test.cern.ch:8500"
20+
},
21+
"conditionDB": {
22+
"url": "ccdb-test.cern.ch:8080"
23+
}
24+
},
25+
"tasks": {
26+
"QcZDCTask": {
27+
"active": "true",
28+
"className": "o2::quality_control_modules::zdc::ZDCRecDataTask",
29+
"moduleName": "QcZDC",
30+
"detectorName": "ZDC",
31+
"cycleDurationSeconds": "10",
32+
"maxNumberCycles": "-1",
33+
"": "The other type of dataSource is \"direct\", see basic-no-sampling.json.",
34+
"dataSource": {
35+
"type": "dataSamplingPolicy",
36+
"name": "zdc-rec"
37+
},
38+
"taskParameters": {
39+
"myOwnKey": "myOwnValue"
40+
},
41+
"location": "remote",
42+
"saveObjectsToFile": "QcZDCRecData.root", "": "For debugging, path to the file where to save. If empty it won't save."
43+
}
44+
}
45+
},
46+
"dataSamplingPolicies": [
47+
{
48+
"id": "zdc-rec",
49+
"active": "true",
50+
"machines": [],
51+
"query": "zdc-bcrec:ZDC/BCREC/0;zdc-energyrec:ZDC/ENERGY/0;zdc-tdcrec:ZDC/TDCDATA/0;zdc-inforec:ZDC/INFO/0",
52+
"samplingConditions": [ ],
53+
"blocking": "false"
54+
}
55+
]
56+
}
57+

Modules/ZDC/include/ZDC/LinkDef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55

66
#pragma link C++ class o2::quality_control_modules::zdc::ZDCRawDataTask+;
77
#pragma link C++ class o2::quality_control_modules::zdc::ZDCRawDataCheck+;
8+
#pragma link C++ class o2::quality_control_modules::zdc::ZDCRecDataTask+;
89
#endif
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
// Copyright 2019-2022 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+
///
13+
/// \file ZDCRecDataTask.h
14+
/// \author Carlo Puggioni
15+
///
16+
17+
#ifndef QC_MODULE_ZDC_ZDCZDCRECDATATASK_H
18+
#define QC_MODULE_ZDC_ZDCZDCRECDATATASK_H
19+
20+
#include "QualityControl/TaskInterface.h"
21+
#include "ZDCBase/Constants.h"
22+
#include "ZDCSimulation/ZDCSimParam.h"
23+
#include "DataFormatsZDC/BCRecData.h"
24+
#include "DataFormatsZDC/RecEventFlat.h"
25+
#include "DataFormatsZDC/ZDCEnergy.h"
26+
#include "DataFormatsZDC/ZDCTDCData.h"
27+
#include "SimulationDataFormat/DigitizationContext.h"
28+
#include "ZDCBase/Constants.h"
29+
#include "ZDCSimulation/Digitizer.h"
30+
#include <TH1.h>
31+
#include <TH2.h>
32+
#include <map>
33+
#include <string>
34+
#include <vector>
35+
36+
class TH1F;
37+
38+
using namespace o2::quality_control::core;
39+
40+
namespace o2::quality_control_modules::zdc
41+
{
42+
43+
/// \brief Example Quality Control DPL Task
44+
/// \author My Name
45+
class ZDCRecDataTask final : public TaskInterface
46+
{
47+
public:
48+
/// \brief Constructor
49+
ZDCRecDataTask() = default;
50+
/// Destructor
51+
~ZDCRecDataTask() override;
52+
53+
struct sHisto1D {
54+
TH1* histo;
55+
std::string ch;
56+
std::string typeh;
57+
std::string typech;
58+
};
59+
struct sHisto2D {
60+
TH2* histo;
61+
std::string typeh;
62+
std::string ch1;
63+
std::string ch2;
64+
std::string typech1;
65+
std::string typech2;
66+
};
67+
68+
// Definition of the methods for the template method pattern
69+
void initialize(o2::framework::InitContext& ctx) override;
70+
void startOfActivity(Activity& activity) override;
71+
void startOfCycle() override;
72+
void monitorData(o2::framework::ProcessingContext& ctx) override;
73+
void endOfCycle() override;
74+
void endOfActivity(Activity& activity) override;
75+
void reset() override;
76+
void init();
77+
void initVecCh();
78+
void initVecType();
79+
void initHisto();
80+
void insertChVec(std::string ch);
81+
void insertTypeVec(std::string type);
82+
void setBinHisto1D(int numBinX, double minBinX, double maxBinX);
83+
void setBinHisto2D(int numBinX, double minBinX, double maxBinX, int numBinY, double minBinY, double maxBinY);
84+
void setNumBinX(int nbin) { fNumBinX = nbin; };
85+
void setMinBinX(double min) { fMinBinX = min; };
86+
void setMaxBinX(double max) { fMaxBinX = max; };
87+
void setNumBinY(int nbin) { fNumBinY = nbin; };
88+
void setMinBinY(double min) { fMinBinY = min; };
89+
void setMaxBinY(double max) { fMaxBinY = max; };
90+
int getNumBinX() { return fNumBinX; };
91+
int getMinBinX() { return fMinBinX; };
92+
int getMaxBinX() { return fMaxBinX; };
93+
int getNumBinY() { return fNumBinY; };
94+
int getMinBinY() { return fMinBinY; };
95+
int getMaxBinY() { return fMaxBinY; };
96+
float getADCRecValue(std::string typech, std::string ch);
97+
int getIdTDCch(std::string typech, std::string ch);
98+
// int getTDCRecValue(int tdcid);
99+
bool addNewHisto(std::string typeH, std::string name, std::string title, std::string typeCh1, std::string ch1, std::string typeCh2, std::string ch2);
100+
bool add1DHisto(std::string typeH, std::string name, std::string title, std::string typeCh1, std::string ch);
101+
bool add2DHisto(std::string typeH, std::string name, std::string title, std::string typeCh1, std::string ch1, std::string typeCh2, std::string ch2);
102+
void dumpHistoStructure();
103+
int process(const gsl::span<const o2::zdc::BCRecData>& RecBC, const gsl::span<const o2::zdc::ZDCEnergy>& Energy, const gsl::span<const o2::zdc::ZDCTDCData>& TDCData, const gsl::span<const uint16_t>& Info);
104+
bool FillTDCValueHisto();
105+
106+
private:
107+
std::vector<std::string> mVecCh;
108+
std::vector<std::string> mVecType;
109+
std::vector<std::string> mNameHisto;
110+
std::vector<sHisto1D> mHisto1D;
111+
std::vector<sHisto2D> mHisto2D;
112+
o2::zdc::RecEventFlat mEv;
113+
int fNumBinX = 0;
114+
double fMinBinX = 0;
115+
double fMaxBinX = 0;
116+
int fNumBinY = 0;
117+
double fMinBinY = 0;
118+
double fMaxBinY = 0;
119+
// TH1F* mHistogram = nullptr;
120+
};
121+
122+
} // namespace o2::quality_control_modules::zdc
123+
124+
#endif // QC_MODULE_ZDC_ZDCZDCRECDATATASK_H

0 commit comments

Comments
 (0)