43 LOG(info) <<
"\n\n\nProcessing new TF\n-----------------";
47 int ChamberStatusDPsCounter = 0;
48 int CFGtagDPsCounter = 0;
50 std::unordered_map<DPID, DPVAL> mapin;
51 for (
auto& it : dps) {
52 mapin[it.id] = it.data;
56 if (std::strstr(it.id.get_alias(),
"trd_chamberStatus") !=
nullptr) {
57 ChamberStatusDPsCounter++;
58 }
else if (std::strstr(it.id.get_alias(),
"trd_CFGtag") !=
nullptr) {
63 if (ChamberStatusDPsCounter >= mFedMinimunDPsForUpdate) {
64 mFedChamberStatusCompleteDPs =
true;
66 LOG(info) <<
"Minimum number of required DPs (" << mFedMinimunDPsForUpdate <<
") for ChamberStatus update were found.";
69 if (CFGtagDPsCounter >= mFedMinimunDPsForUpdate) {
70 mFedCFGtagCompleteDPs =
true;
72 LOG(info) <<
"Minimum number of required DPs (" << mFedMinimunDPsForUpdate <<
") for CFGtag update were found.";
76 LOG(info) <<
"Number of ChamberStatus DPs = " << ChamberStatusDPsCounter;
77 LOG(info) <<
"Number of CFGtag DPs = " << CFGtagDPsCounter;
81 for (
auto& it : mPids) {
82 const auto& el = mapin.find(it.first);
83 if (el == mapin.end()) {
84 LOG(info) <<
"DP " << it.first <<
" not found in map";
86 LOG(info) <<
"DP " << it.first <<
" found in map";
92 for (
const auto& it : dps) {
94 const auto& el = mPids.find(it.id);
95 if (el == mPids.end()) {
97 LOG(info) <<
"DP " << it.id <<
" not found in DCSProcessor, we will not process it";
115 auto& dpid = dpcom.
id;
117 if (mVerbosity > 1) {
119 LOG(info) <<
"Processing DP = " << dpcom <<
", with value = " << o2::dcs::getValue<double>(dpcom);
121 LOG(info) <<
"Processing DP = " << dpcom <<
", with value = " << o2::dcs::getValue<int32_t>(dpcom);
123 LOG(info) <<
"Processing DP = " << dpcom <<
", with value = " << o2::dcs::getValue<string>(dpcom);
134 if (std::strstr(dpid.get_alias(),
"trd_gas") !=
nullptr) {
135 if (!mGasStartTSset) {
136 mGasStartTS = mCurrentTS;
137 mGasStartTSset =
true;
139 auto& dpInfoGas = mTRDDCSGas[dpid];
140 if (dpInfoGas.nPoints == 0 || etime != mLastDPTimeStamps[dpid]) {
142 dpInfoGas.addPoint(o2::dcs::getValue<double>(dpcom), etime);
143 mLastDPTimeStamps[dpid] = etime;
148 if (std::strstr(dpid.get_alias(),
"Imon") !=
nullptr) {
149 if (!mCurrentsStartTSSet) {
150 mCurrentsStartTS = mCurrentTS;
151 mCurrentsStartTSSet =
true;
153 auto& dpInfoCurrents = mTRDDCSCurrents[dpid];
154 if (dpInfoCurrents.nPoints == 0 || etime != mLastDPTimeStamps[dpid]) {
156 dpInfoCurrents.addPoint(o2::dcs::getValue<double>(dpcom), etime);
157 mLastDPTimeStamps[dpid] = etime;
162 if (std::strstr(dpid.get_alias(),
"Umon") !=
nullptr) {
163 if (!mVoltagesStartTSSet) {
164 mVoltagesStartTS = mCurrentTS;
165 mVoltagesStartTSSet =
true;
167 auto& dpInfoVoltages = mTRDDCSVoltages[dpid];
168 if (etime != mLastDPTimeStamps[dpid]) {
170 if (mVoltageSet.test(chamberId)) {
171 if (std::fabs(dpInfoVoltages - o2::dcs::getValue<double>(dpcom)) > mUVariationTriggerForUpdate) {
173 mShouldUpdateVoltages =
true;
178 dpInfoVoltages = o2::dcs::getValue<double>(dpcom);
179 mLastDPTimeStamps[dpid] = etime;
180 mVoltageSet.set(chamberId);
186 if (!mEnvStartTSSet) {
187 mEnvStartTS = mCurrentTS;
188 mEnvStartTSSet =
true;
190 auto& dpInfoEnv = mTRDDCSEnv[dpid];
191 if (dpInfoEnv.nPoints == 0 || etime != mLastDPTimeStamps[dpid]) {
193 dpInfoEnv.addPoint(o2::dcs::getValue<double>(dpcom), etime);
194 mLastDPTimeStamps[dpid] = etime;
202 if (std::strstr(dpid.get_alias(),
"trd_fed_runNo") !=
nullptr) {
204 if (o2::dcs::getValue<int32_t>(dpcom) > 0) {
206 if (o2::dcs::getValue<int32_t>(dpcom) != mCurrentRunNumber) {
207 LOG(info) <<
"New run number " << o2::dcs::getValue<int32_t>(dpcom) <<
" differs from the old one " << mCurrentRunNumber;
209 mFirstRunEntryForFedChamberStatusUpdate =
true;
210 mFirstRunEntryForFedCFGtagUpdate =
true;
212 mFedChamberStatusAlarmCounter = 0;
213 mFedCFGtagAlarmCounter = 0;
217 mCurrentRunNumber = o2::dcs::getValue<int32_t>(dpcom);
220 if (mVerbosity > 2) {
221 LOG(info) <<
"Current Run Number: " << mCurrentRunNumber;
225 }
else if (std::strstr(dpid.get_alias(),
"trd_chamberStatus") !=
nullptr) {
226 if (!mFedChamberStatusStartTSSet) {
227 mFedChamberStatusStartTS = mCurrentTS;
228 mFedChamberStatusStartTSSet =
true;
233 auto& dpInfoFedChamberStatus = mTRDDCSFedChamberStatus[chamberId];
234 if (etime != mLastDPTimeStamps[dpid]) {
235 if (dpInfoFedChamberStatus != o2::dcs::getValue<int>(dpcom)) {
237 if (mPids[dpid] && !(mFedChamberStatusCompleteDPs && mFirstRunEntryForFedChamberStatusUpdate)) {
240 if (mFedChamberStatusAlarmCounter < mFedAlarmCounterMax) {
241 LOG(warn) <<
"ChamberStatus change " << dpid.get_alias() <<
" : " << dpInfoFedChamberStatus <<
" -> " << o2::dcs::getValue<int>(dpcom) <<
", run = " << mCurrentRunNumber;
242 mFedChamberStatusAlarmCounter++;
243 }
else if (mVerbosity > 0) {
244 LOG(warn) <<
"ChamberStatus change " << dpid.get_alias() <<
" : " << dpInfoFedChamberStatus <<
" -> " << o2::dcs::getValue<int>(dpcom) <<
", run = " << mCurrentRunNumber;
249 dpInfoFedChamberStatus = o2::dcs::getValue<int>(dpcom);
250 mLastDPTimeStamps[dpid] = etime;
258 if (std::strstr(dpid.get_alias(),
"trd_CFGtag") !=
nullptr) {
259 if (!mFedCFGtagStartTSSet) {
260 mFedCFGtagStartTS = mCurrentTS;
261 mFedCFGtagStartTSSet =
true;
266 auto& dpInfoFedCFGtag = mTRDDCSFedCFGtag[chamberId];
267 if (etime != mLastDPTimeStamps[dpid]) {
268 if (dpInfoFedCFGtag != o2::dcs::getValue<string>(dpcom)) {
270 if (mPids[dpid] && !(mFedCFGtagCompleteDPs && mFirstRunEntryForFedCFGtagUpdate)) {
272 if (mFedCFGtagAlarmCounter < mFedAlarmCounterMax) {
273 LOG(alarm) <<
"CFGtag change " << dpid.get_alias() <<
" : " << dpInfoFedCFGtag <<
" -> " << o2::dcs::getValue<string>(dpcom) <<
", run = " << mCurrentRunNumber;
274 mFedCFGtagAlarmCounter++;
275 }
else if (mVerbosity > 0) {
276 LOG(warn) <<
"CFGtag change " << dpid.get_alias() <<
" : " << dpInfoFedCFGtag <<
" -> " << o2::dcs::getValue<string>(dpcom) <<
", run = " << mCurrentRunNumber;
281 dpInfoFedCFGtag = o2::dcs::getValue<std::string>(dpcom);
282 mLastDPTimeStamps[dpid] = etime;