Project
Loading...
Searching...
No Matches
DeadMapBuilderSpec.h
Go to the documentation of this file.
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
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
34#include "Framework/Task.h"
39#include "Framework/Task.h"
42#include <fairmq/Device.h>
43
44#include <ITSMFTReconstruction/RawPixelDecoder.h> //o2::itsmft::RawPixelDecoder
49#include "CCDB/CcdbApi.h"
51
52// ROOT includes
53#include "TTree.h"
54#include "TH1F.h"
55#include "TH2F.h"
56#include "TF1.h"
57#include "TFile.h"
58
59using namespace o2::framework;
60using namespace o2::itsmft;
61
62namespace o2
63{
64namespace itsmft
65{
66
68{
69 public:
70 ITSMFTDeadMapBuilder(std::string datasource, bool doMFT);
71 ~ITSMFTDeadMapBuilder() override;
72
73 void init(InitContext& ic) final;
74 void run(ProcessingContext& pc) final;
75 void endOfStream(EndOfStreamContext& ec) final;
76
77 void stop() final;
78
80 private:
81 std::string mSelfName;
82
83 bool mRunMFT = false;
84 bool mDoLocalOutput = false;
85 bool mSkipStaticMap = false;
86 bool mNoGroupITSLanes = false;
87 uint16_t N_CHIPS;
88 uint16_t N_CHIPS_ITSIB = o2::itsmft::ChipMappingITS::getNChips(0);
89 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
90
91 uint mStepCounter = 0;
92 uint mTFCounter = 0;
93
94 long mTimeStart = -1; // TODO: better to use RCT info?
95
96 std::string mCCDBUrl = "";
97 std::string mObjectName;
98 std::string mLocalOutputDir;
99
100 std::string MAP_VERSION = "4"; // to change in case the encoding or the format change
101
102 std::vector<bool> mStaticChipStatus{};
103
104 std::vector<uint16_t> mDeadMapTF{};
105
106 int mRunNumber = -1;
107 unsigned long mFirstOrbitTF = 0x0;
108 unsigned long mFirstOrbitRun = 0x0;
109
110 std::string mDataSource = "chipsstatus";
111
112 int mTFSampling = 350;
113
114 // utils for an improved sampling algorithm
115 std::unordered_set<long> mSampledTFs{};
116 std::deque<long> mSampledHistory{};
117 int mTFSamplingTolerance = 20;
118 int mSampledSlidingWindowSize = 1000; // units: mTFSampling
119
120 o2::itsmft::TimeDeadMap mMapObject;
121
122 void finalizeOutput();
123 void PrepareOutputCcdb(EndOfStreamContext* ec, std::string ccdburl);
124
125 // Utils
126
127 std::vector<uint16_t> getChipIDsOnSameCable(uint16_t);
128 bool acceptTF(long);
129
130 o2::framework::DataTakingContext mDataTakingContext{};
131 o2::framework::TimingInfo mTimingInfo{};
132
133 // Flag to avoid that endOfStream and stop are both done
134 bool isEnded = false;
135};
136
137// Create a processor spec
138o2::framework::DataProcessorSpec getITSMFTDeadMapBuilderSpec(std::string datasource, bool doMFT);
139
140} // namespace itsmft
141} // namespace o2
142
143#endif
Utils and constants for calibration and related workflows.
Helper for geometry and GRP related CCDB requests.
Definition of the Alpide pixel reader for raw data processing.
Definition of the ITSMFT time-dependend dead map.
static constexpr int getNChips()
number of chips per barrel
void endOfStream(EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void stop() final
This is invoked on stop.
void init(InitContext &ic) final
void run(ProcessingContext &pc) final
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
o2::framework::DataProcessorSpec getITSMFTDeadMapBuilderSpec(std::string datasource, bool doMFT)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...