Skip to content

Commit 987ea68

Browse files
authored
ITS and MFT dead damp builder workflow (#12459)
* ITS and MFT dead damp builder workflow * removing trailing spaces * removing unused struct * fixing format * optimization --------- Co-authored-by: Nicolo Valle <nicolo.valle@cern.ch>
1 parent 30c25cd commit 987ea68

File tree

4 files changed

+490
-0
lines changed

4 files changed

+490
-0
lines changed

Detectors/ITSMFT/common/workflow/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ o2_add_library(ITSMFTWorkflow
1616
src/STFDecoderSpec.cxx
1717
src/EntropyEncoderSpec.cxx
1818
src/EntropyDecoderSpec.cxx
19+
src/DeadMapBuilderSpec.cxx
1920
PUBLIC_LINK_LIBRARIES O2::Framework
2021
O2::DataFormatsITSMFT
2122
O2::SimulationDataFormat
2223
O2::ITSMFTReconstruction
2324
O2::ITSBase
2425
O2::MFTBase
26+
O2::DetectorsCalibration
2527
O2::DetectorsCommonDataFormats
2628
O2::DataFormatsParameters)
2729

@@ -50,3 +52,8 @@ o2_add_executable(trigges-writer-workflow
5052
SOURCES src/trigger-writer-workflow.cxx
5153
COMPONENT_NAME itsmft
5254
PUBLIC_LINK_LIBRARIES O2::ITSMFTWorkflow)
55+
56+
o2_add_executable(deadmap-builder-workflow
57+
SOURCES src/deadmap-builder-workflow.cxx
58+
COMPONENT_NAME itsmft
59+
PUBLIC_LINK_LIBRARIES O2::ITSMFTWorkflow)
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
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+
/// @file DeadMapBuilderSpec.h
13+
14+
#ifndef O2_ITSMFT_DEADMAP_BUILDER_
15+
#define O2_ITSMFT_DEADMAP_BUILDER_
16+
17+
#include <sys/stat.h>
18+
#include <filesystem>
19+
#include <string>
20+
#include <vector>
21+
#include <array>
22+
#include <set>
23+
#include <deque>
24+
25+
#include <iostream>
26+
#include <fstream>
27+
#include <sstream>
28+
29+
// Boost library for easy access of host name
30+
#include <boost/asio/ip/host_name.hpp>
31+
32+
#include "Framework/CCDBParamSpec.h"
33+
#include "Framework/DataProcessorSpec.h"
34+
#include "Framework/Task.h"
35+
#include "Framework/ControlService.h"
36+
#include "Framework/ConfigParamRegistry.h"
37+
#include "Framework/RawDeviceService.h"
38+
#include "Framework/WorkflowSpec.h"
39+
#include "Framework/Task.h"
40+
#include "Framework/DataTakingContext.h"
41+
#include "Framework/TimingInfo.h"
42+
#include <fairmq/Device.h>
43+
44+
#include <ITSMFTReconstruction/RawPixelDecoder.h> //o2::itsmft::RawPixelDecoder
45+
#include "DetectorsCalibration/Utils.h"
46+
#include "DetectorsCommonDataFormats/FileMetaData.h"
47+
#include "DetectorsBase/GRPGeomHelper.h" //nicolo
48+
#include "CCDB/CcdbApi.h"
49+
#include "CommonUtils/MemFileHelper.h"
50+
51+
// ROOT includes
52+
#include "TTree.h"
53+
#include "TH1F.h"
54+
#include "TH2F.h"
55+
#include "TF1.h"
56+
#include "TFile.h"
57+
58+
using namespace o2::framework;
59+
using namespace o2::itsmft;
60+
61+
namespace o2
62+
{
63+
namespace itsmft
64+
{
65+
66+
class ITSMFTDeadMapBuilder : public Task
67+
{
68+
public:
69+
ITSMFTDeadMapBuilder(std::string datasource, bool doMFT);
70+
~ITSMFTDeadMapBuilder() override;
71+
72+
void init(InitContext& ic) final;
73+
void run(ProcessingContext& pc) final;
74+
void endOfStream(EndOfStreamContext& ec) final;
75+
76+
void stop() final;
77+
78+
//////////////////////////////////////////////////////////////////
79+
private:
80+
std::string mSelfName;
81+
82+
bool mRunMFT = false;
83+
bool mDoLocalOutput = false;
84+
uint16_t N_CHIPS;
85+
uint16_t N_CHIPS_ITSIB = o2::itsmft::ChipMappingITS::getNChips(0);
86+
int mTFLength = 32; // TODO find utility for proper value -- o2::base::GRPGeomHelper::getNHBFPerTF() returns 128 see https://github.com/AliceO2Group/AliceO2/blob/051b56f9f136e7977e83f5d26d922db9bd6ecef5/Detectors/Base/src/GRPGeomHelper.cxx#L233 and correct also default option is getSpec
87+
88+
uint mStepCounter = 0;
89+
uint mTFCounter = 0;
90+
91+
std::string mObjectName;
92+
std::string mLocalOutputDir;
93+
94+
std::string MAP_VERSION = "1"; // to change in case the encoding or the format change
95+
96+
std::vector<uint16_t>* mDeadMapTF = nullptr;
97+
98+
Long64_t mFirstOrbitTF = 0x0;
99+
100+
std::string mDataSource = "chipsstatus";
101+
102+
int mTFSampling = 1000;
103+
104+
TTree* mTreeObject = nullptr;
105+
106+
void finalizeOutput();
107+
void PrepareOutputCcdb(DataAllocator& output);
108+
109+
// Utils
110+
111+
uint16_t getElementIDFromChip(uint16_t);
112+
113+
o2::framework::DataTakingContext mDataTakingContext{};
114+
o2::framework::TimingInfo mTimingInfo{};
115+
116+
// Flag to avoid that endOfStream and stop are both done
117+
bool isEnded = false;
118+
119+
// Run stop requested flag for EoS operations
120+
bool mRunStopRequested = false;
121+
};
122+
123+
// Create a processor spec
124+
o2::framework::DataProcessorSpec getITSMFTDeadMapBuilderSpec(std::string datasource, bool doMFT);
125+
126+
} // namespace itsmft
127+
} // namespace o2
128+
129+
#endif

0 commit comments

Comments
 (0)