Project
Loading...
Searching...
No Matches
DeadChannelMapCreator.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 ALICEO2_TPC_DeadChannelMapCreator_H_
13#define ALICEO2_TPC_DeadChannelMapCreator_H_
14
15#include <string_view>
16#include <unordered_map>
17#include <memory>
18#include <string_view>
19
20#include "Rtypes.h"
21
22#include "CCDB/CcdbApi.h"
23
26#include "TPCBase/CalDet.h"
27#include "TPCBase/FEEConfig.h"
28
29namespace o2::tpc
30{
31
32enum class SourcesDeadMap : unsigned short {
33 None = 0,
34 IDCPadStatus = 1 << 0,
35 FEEConfig = 1 << 1,
37};
38inline SourcesDeadMap operator&(SourcesDeadMap a, SourcesDeadMap b) { return static_cast<SourcesDeadMap>(static_cast<unsigned short>(a) & static_cast<unsigned short>(b)); }
39inline SourcesDeadMap operator~(SourcesDeadMap a) { return static_cast<SourcesDeadMap>(~static_cast<unsigned short>(a)); }
40inline SourcesDeadMap operator|(SourcesDeadMap a, SourcesDeadMap b) { return static_cast<SourcesDeadMap>(static_cast<unsigned short>(a) | static_cast<unsigned short>(b)); }
41
42struct FEEConfig;
43
45{
46 struct ValidityRange {
47 long startvalidity = 0;
48 long endvalidity = -1;
49 bool isValid(long ts) const { return ts < endvalidity && ts > startvalidity; }
50 };
51
52 public:
54
55 void reset();
56
57 void init(std::string_view url = "");
58 void load(long timeStampOrRun);
59 void loadFEEConfigViaRunInfoTS(long timeStamp);
60 void loadFEEConfigViaRunInfo(long timeStampOrRun);
61 void loadFEEConfig(long timeStamp = -1);
62 void loadIDCPadFlags(long timeStampOrRun);
63
65 void setDeadChannelMapFEEConfig(const FEEConfig& feeConfig) { mDeadChannelMapFEE = feeConfig.getDeadChannelMap(); }
66
67 const CalDet<bool>& getDeadChannelMapIDC() const { return mDeadChannelMapIDC; }
68 const CalDet<bool>& getDeadChannelMapFEE() const { return mDeadChannelMapFEE; }
69 const CalDet<bool>& getDeadChannelMap() const { return mDeadChannelMap; }
70
71 const FEEConfig* getFEEConfig() const { return mFEEConfig.get(); }
72 const CalDetFlag_t* getPadFlags() const { return mPadStatusMap.get(); }
73
76 void drawDeadChannelMap();
77
78 long getTimeStamp(long timeStampOrRun) const;
79
81 void resetDeadChannelMap() { mDeadChannelMap = false; }
82
83 void setSource(SourcesDeadMap s) { mSources = s; }
84 void addSource(SourcesDeadMap s) { mSources = s | mSources; }
85 bool useSource(SourcesDeadMap s) const { return (mSources & s) == s; }
86 SourcesDeadMap getSources() const { return mSources; }
87
88 private:
89 std::unique_ptr<FEEConfig> mFEEConfig;
90 std::unique_ptr<CalDetFlag_t> mPadStatusMap;
91 // FEEConfig::CalPadMapType* mPulserData; ///< Pulser information
92 // FEEConfig::CalPadMapType* mCEData; ///< CE information
93
94 std::unordered_map<CDBType, ValidityRange> mObjectValidity;
96 ccdb::CcdbApi mCCDBApi;
97 CalDet<bool> mDeadChannelMapIDC{"DeadChannelMapIDC"};
98 CalDet<bool> mDeadChannelMapFEE{"DeadChannelMapFEE"};
99 CalDet<bool> mDeadChannelMap{"DeadChannelMap"};
100
101 ClassDefNV(DeadChannelMapCreator, 0);
102};
103
104inline long DeadChannelMapCreator::getTimeStamp(long timeStampOrRun) const
105{
106 if (timeStampOrRun < 1000000) {
107 // assume run number
108 const auto c = mCCDBApi.retrieveHeaders("RCT/Info/RunInformation", {}, timeStampOrRun);
109 timeStampOrRun = (std::stol(c.at("SOR")) + std::stol(c.at("EOR"))) / 2;
110 }
111
112 return timeStampOrRun;
113}
114
115} // namespace o2::tpc
116
117#endif
std::string url
CDB Type definitions for TPC.
Frontend electronics configuration values.
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 s
uint32_t c
Definition RawData.h:2
std::map< std::string, std::string > retrieveHeaders(std::string const &path, std::map< std::string, std::string > const &metadata, long timestamp=-1) const
Definition CcdbApi.cxx:1569
void loadFEEConfigViaRunInfo(long timeStampOrRun)
long getTimeStamp(long timeStampOrRun) const
const CalDet< bool > & getDeadChannelMapFEE() const
const CalDet< bool > & getDeadChannelMapIDC() const
bool useSource(SourcesDeadMap s) const
const CalDetFlag_t * getPadFlags() const
void setDeadChannelMapIDCPadStatus(const CalDetFlag_t &padStatusMap, PadFlags mask=PadFlags::flagAllNoneGood)
void init(std::string_view url="")
void loadIDCPadFlags(long timeStampOrRun)
void setDeadChannelMapFEEConfig(const FEEConfig &feeConfig)
void loadFEEConfigViaRunInfoTS(long timeStamp)
const FEEConfig * getFEEConfig() const
const CalDet< bool > & getDeadChannelMap() const
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
GLint GLuint mask
Definition glcorearb.h:291
Global TPC definitions and constants.
SourcesDeadMap operator|(SourcesDeadMap a, SourcesDeadMap b)
SourcesDeadMap operator&(SourcesDeadMap a, SourcesDeadMap b)
SourcesDeadMap operator~(SourcesDeadMap a)
@ IDCPadStatus
use idc pad status map
Marks an empty item in the context.
CalDet< bool > getDeadChannelMap() const
Dead channel map including deactivated links and single channels.