Project
Loading...
Searching...
No Matches
MFTDCSProcessor.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
12#ifndef DETECTOR_MFTDCSPROCESSOR_H_
13#define DETECTOR_MFTDCSPROCESSOR_H_
14
15#include <memory>
16#include <Rtypes.h>
17#include <unordered_map>
18#include <deque>
19#include <numeric>
20#include "Framework/Logger.h"
25#include "Framework/O2LongInt.h"
26#include "CCDB/CcdbObjectInfo.h"
28#include "CCDB/CcdbApi.h"
29#include <gsl/gsl>
30
32
33namespace o2
34{
35namespace mft
36{
37
41
42struct MFTDCSinfo {
43
44 std::pair<O2LongUInt, double> firstValue; // first value seen by the MFT DCS processor
45 std::pair<O2LongUInt, double> lastValue; // last value seen by the MFT DCS processor
46 std::pair<O2LongUInt, double> meanValue; // mean value seen by the MFT DCS processor
47 std::pair<O2LongUInt, double> stddevValue; // standard deviation value seen by the MFT DCS processor
48 std::pair<O2LongUInt, double> midValue; // mid value seen by the MFT DCS processor
49 std::pair<O2LongUInt, double> maxChange; // maximum variation seen by the MFT DCS processor
50 std::pair<O2LongUInt, double> summary; // number of entries by the MFT DCS processor
51
53 {
54 firstValue = std::make_pair(0, -999999999);
55 lastValue = std::make_pair(0, -999999999);
56 meanValue = std::make_pair(0, -999999999);
57 stddevValue = std::make_pair(0, -999999999);
58 midValue = std::make_pair(0, -999999999);
59 maxChange = std::make_pair(0, -999999999);
60 summary = std::make_pair(0, -999999999);
61 }
62 void makeEmpty()
63 {
64 firstValue.first = lastValue.first = midValue.first = meanValue.first = stddevValue.first = maxChange.first = summary.first = 0.;
65 firstValue.second = lastValue.second = midValue.second = meanValue.second = stddevValue.second = maxChange.second = summary.second = -999999999;
66 }
67 void print() const;
68
70};
71
73{
74
75 public:
78 using DQDoubles = std::deque<double>;
79
80 MFTDCSProcessor() = default;
81 ~MFTDCSProcessor() = default;
82
83 void init(const std::vector<DPID>& pids);
84
85 int process(const gsl::span<const DPCOM> dps);
86 int processDP(const DPCOM& dpcom);
87
88 bool sendDPsCCDB();
89 void updateDPsCCDB();
90
91 const CcdbObjectInfo& getccdbDPsInfo() const { return mccdbDPsInfo; }
92 CcdbObjectInfo& getccdbDPsInfo() { return mccdbDPsInfo; }
93 const std::unordered_map<DPID, MFTDCSinfo>& getMFTDPsInfo() const { return mMFTDCS; }
94
95 template <typename T>
96 void prepareCCDBobjectInfo(T& obj, CcdbObjectInfo& info, const std::string& path, TFType tf, const std::map<std::string, std::string>& md);
97
98 void setTF(TFType tf) { mTF = tf; }
99 void useVerboseMode() { mVerbose = true; }
100
101 void setThreBackBiasCurrent(float thre)
102 {
103 mThresholdBackBiasCurrent = thre;
104 }
105 void setThreDigitCurrent(float thre)
106 {
107 mThresholdDigitalCurrent = thre;
108 }
109 void setThreAnalogCurrent(float thre)
110 {
111 mThresholdAnalogCurrent = thre;
112 }
113 void setThreBackBiasVoltage(float thre)
114 {
115 mThresholdBackBiasVoltage = thre;
116 }
117 void setThreRULV(float thre)
118 {
119 mThresholdRULV = thre;
120 }
122 {
123 mDpsdoublesmap.clear();
124 mMFTDCS.clear();
125 }
126
127 private:
128 std::unordered_map<DPID, MFTDCSinfo> mMFTDCS; // this is the object that will go to the CCDB
129 std::unordered_map<DPID, bool> mPids; // contains all PIDs for the processor, the bool
130 // will be true if the DP was processed at least once
131 std::unordered_map<DPID, std::vector<DPVAL>> mDpsdoublesmap; // this is the map that will hold the DPs for the
132 // double type (voltages and currents)
133 CcdbObjectInfo mccdbDPsInfo;
134
135 TFType mStartTF; // TF index for processing of first processed TF, used to store CCDB object
136 TFType mTF = 0; // TF index for processing, used to store CCDB object
137 bool mStartTFset = false;
138
139 bool mVerbose = false;
140
141 bool mSendToCCDB = false;
142
143 double mThresholdAnalogCurrent;
144 double mThresholdBackBiasCurrent;
145 double mThresholdDigitalCurrent;
146 double mThresholdBackBiasVoltage;
147 double mThresholdRULV;
148
149 ClassDefNV(MFTDCSProcessor, 1);
150};
151
152template <typename T>
153void MFTDCSProcessor::prepareCCDBobjectInfo(T& obj, CcdbObjectInfo& info, const std::string& path, TFType tf, const std::map<std::string, std::string>& md)
154{
155
156 // prepare all info to be sent to CCDB for object obj
158 auto flName = o2::ccdb::CcdbApi::generateFileName(clName);
159 info.setPath(path);
160 info.setObjectType(clName);
161 info.setFileName(flName);
162 info.setStartValidityTimestamp(tf);
163 info.setEndValidityTimestamp(tf + o2::ccdb::CcdbObjectInfo::MONTH);
164 info.setMetaData(md);
165}
166
167} // namespace mft
168} // namespace o2
169
170#endif
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to process
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
uint64_t TFType
static std::string generateFileName(const std::string &inp)
Definition CcdbApi.cxx:905
static constexpr long MONTH
void setThreAnalogCurrent(float thre)
void prepareCCDBobjectInfo(T &obj, CcdbObjectInfo &info, const std::string &path, TFType tf, const std::map< std::string, std::string > &md)
std::deque< double > DQDoubles
int processDP(const DPCOM &dpcom)
void setThreRULV(float thre)
void setThreDigitCurrent(float thre)
CcdbObjectInfo & getccdbDPsInfo()
void setThreBackBiasVoltage(float thre)
void setThreBackBiasCurrent(float thre)
const std::unordered_map< DPID, MFTDCSinfo > & getMFTDPsInfo() const
const CcdbObjectInfo & getccdbDPsInfo() const
void init(const std::vector< DPID > &pids)
GLsizei const GLchar *const * path
Definition glcorearb.h:3591
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::unique_ptr< GPUReconstructionTimeframe > tf
std::pair< O2LongUInt, double > summary
std::pair< O2LongUInt, double > stddevValue
std::pair< O2LongUInt, double > meanValue
std::pair< O2LongUInt, double > maxChange
std::pair< O2LongUInt, double > midValue
ClassDefNV(MFTDCSinfo, 2)
std::pair< O2LongUInt, double > lastValue
std::pair< O2LongUInt, double > firstValue
static std::string getClassName(const T &obj)
get the class name of the object