Project
Loading...
Searching...
No Matches
TriggerDCS.cxx
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
15
16#include <fairlogger/Logger.h>
17
18#include <bitset>
19#include <iomanip>
20#include <iostream>
21#include <sstream>
22
23using namespace o2::emcal;
24
26{
27 return (mSTUEMCal == other.mSTUEMCal) && (mSTUDCAL == other.mSTUDCAL) && (mTRUArr == other.mTRUArr);
28}
29
30bool TriggerDCS::isTRUEnabled(int itru) const
31{
32 if (itru < 32) {
33 return std::bitset<32>(mSTUEMCal.getRegion()).test(itru);
34 } else {
35 return std::bitset<32>(mSTUDCAL.getRegion()).test(itru - 32);
36 }
37}
38
39std::ostream& o2::emcal::operator<<(std::ostream& stream, const TriggerDCS& config)
40{
41 stream << "EMCAL trigger DCS config:" << std::endl;
42 stream << "================================" << std::endl;
43 for (int i = 0; i < config.getTRUArr().size(); i++) {
44 TriggerTRUDCS tru = config.getTRUDCS(i);
45 stream << "TRU" << i << ": " << tru;
46 }
47
48 TriggerSTUDCS emcalstu(config.getSTUDCSEMCal()), dcalstu(config.getSTUDCSDCal());
49 stream << "EMCAL STU: " << emcalstu;
50 stream << "DCAL STU: " << dcalstu;
51 return stream;
52}
53
54std::string TriggerDCS::toJSON() const
55{
56 std::stringstream jsonstring;
57 jsonstring << "{";
58 jsonstring << "\"mSTUEMCal\":" << mSTUEMCal.toJSON() << ",";
59 jsonstring << "\"mSTUDCAL\":" << mSTUDCAL.toJSON() << ",";
60 jsonstring << "mTRUArr:[";
61 for (int ien = 0; ien < mTRUArr.size(); ien++) {
62 jsonstring << "{\"TRU" << ien << "\":" << mTRUArr.at(ien).toJSON() << "}";
63 if (ien != mTRUArr.size() - 1) {
64 jsonstring << ",";
65 }
66 }
67 jsonstring << "]}";
68 return jsonstring.str();
69}
int32_t i
CCDB container for the DCS data in EMCAL.
Definition TriggerDCS.h:37
bool isTRUEnabled(int iTRU) const
Check whether TRU is enabled.
std::array< TriggerTRUDCS, 46 > getTRUArr() const
Definition TriggerDCS.h:65
TriggerSTUDCS getSTUDCSEMCal() const
Definition TriggerDCS.h:67
TriggerSTUDCS getSTUDCSDCal() const
Definition TriggerDCS.h:68
bool operator==(const TriggerDCS &other) const
Comparison of two DCS data.
TriggerTRUDCS getTRUDCS(Int_t iTRU) const
Definition TriggerDCS.h:69
std::string toJSON() const
Serialize object to JSON format.
CCDB container for STU DCS data in EMCAL.
std::string toJSON() const
Serialize object to JSON format.
CCDB container for TRU DCS data in EMCAL.
GLsizeiptr size
Definition glcorearb.h:659
GLuint GLuint stream
Definition glcorearb.h:1806
std::ostream & operator<<(std::ostream &stream, const Cell &cell)
Stream operator for EMCAL cell.
Definition Cell.cxx:355
VectorOfTObjectPtrs other