Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify L1TGlobal menu code and CondFormats to remove reinterpret_cast to and from utm firmware "es" types #41036

Merged
merged 1 commit into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CondFormats/L1TObjects/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<use name="CondFormats/External"/>
<use name="DataFormats/L1CaloTrigger"/>
<use name="FWCore/MessageLogger"/>
<use name="xerces-c"/>
<use name="utm"/>
<export>
<lib name="1"/>
</export>
Expand Down
28 changes: 28 additions & 0 deletions CondFormats/L1TObjects/interface/L1TUtmAlgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <string>
#include <vector>
#include "CondFormats/Serialization/interface/Serializable.h"
#include "tmEventSetup/esAlgorithm.hh"

/**
* This class implements data structure for Algorithm
Expand All @@ -29,6 +30,33 @@ class L1TUtmAlgorithm {
module_id_(),
module_index_(),
version(0){};
L1TUtmAlgorithm(std::string name,
std::string expression,
std::string expression_in_condition,
std::vector<std::string> rpn_vector,
unsigned int index,
unsigned int module_id,
unsigned int module_index,
unsigned int ver)
: name_(name),
expression_(expression),
expression_in_condition_(expression_in_condition),
rpn_vector_(rpn_vector),
index_(index),
module_id_(module_id),
module_index_(module_index),
version(ver){};

L1TUtmAlgorithm(const tmeventsetup::esAlgorithm& esAlg)
: L1TUtmAlgorithm(esAlg.getName(),
esAlg.getExpression(),
esAlg.getExpressionInCondition(),
esAlg.getRpnVector(),
esAlg.getIndex(),
esAlg.getModuleId(),
esAlg.getModuleIndex(),
0 //There is no version retrieval in esAlgorithm. However, it seems pretty hard coded to 0
){};

virtual ~L1TUtmAlgorithm() = default;

Expand Down
5 changes: 5 additions & 0 deletions CondFormats/L1TObjects/interface/L1TUtmBin.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <limits>
#include "CondFormats/Serialization/interface/Serializable.h"
#include "tmEventSetup/esBin.hh"

/**
* This class implements data structure for Bin
Expand All @@ -27,6 +28,10 @@ class L1TUtmBin {
L1TUtmBin(const unsigned int id, const double min, const double max)
: hw_index(id), minimum(min), maximum(max), version(0){};

L1TUtmBin(const tmeventsetup::esBin& bin) : L1TUtmBin(bin.hw_index, bin.minimum, bin.maximum){};

operator tmeventsetup::esBin() const { return tmeventsetup::esBin(hw_index, minimum, maximum); }

virtual ~L1TUtmBin() = default;

unsigned int hw_index; /**< HW index of bin */
Expand Down
15 changes: 15 additions & 0 deletions CondFormats/L1TObjects/interface/L1TUtmCondition.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "CondFormats/L1TObjects/interface/L1TUtmObject.h"
#include "CondFormats/Serialization/interface/Serializable.h"

#include "tmEventSetup/esCondition.hh"

#include <string>
#include <vector>

Expand All @@ -23,6 +25,19 @@
class L1TUtmCondition {
public:
L1TUtmCondition() : name_(), type_(-9999), objects_(), cuts_(), version(0){};
L1TUtmCondition(
std::string name, int type, std::vector<L1TUtmObject> objects, std::vector<L1TUtmCut> cuts, unsigned int vers)
: name_(name), type_(type), objects_(objects), cuts_(cuts), version(vers){};

L1TUtmCondition(const tmeventsetup::esCondition& esCond)
: name_(esCond.getName()), type_(esCond.getType()), version(0) {
objects_.reserve(esCond.getObjects().size());
for (auto it = esCond.getObjects().begin(); it != esCond.getObjects().end(); ++it)
objects_.emplace_back(L1TUtmObject(*it));
cuts_.reserve(esCond.getCuts().size());
for (auto it = esCond.getCuts().begin(); it != esCond.getCuts().end(); ++it)
cuts_.emplace_back(L1TUtmCut(*it));
};

virtual ~L1TUtmCondition() = default;

Expand Down
28 changes: 28 additions & 0 deletions CondFormats/L1TObjects/interface/L1TUtmCut.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "CondFormats/L1TObjects/interface/L1TUtmCutValue.h"
#include "CondFormats/Serialization/interface/Serializable.h"

#include "tmEventSetup/esCut.hh"

#include <string>

/**
Expand All @@ -21,6 +23,32 @@
class L1TUtmCut {
public:
L1TUtmCut() : name_(), object_type_(), cut_type_(), minimum_(), maximum_(), data_(), key_(), version(0){};
L1TUtmCut(std::string name,
int object_type,
int cut_type,
L1TUtmCutValue minimum,
L1TUtmCutValue maximum,
std::string data,
std::string key,
unsigned int vers)
: name_(name),
object_type_(object_type),
cut_type_(cut_type),
minimum_(minimum),
maximum_(maximum),
data_(data),
key_(key),
version(vers){};

L1TUtmCut(const tmeventsetup::esCut& esC)
: L1TUtmCut(esC.getName(),
esC.getObjectType(),
esC.getCutType(),
L1TUtmCutValue(esC.getMinimum()),
L1TUtmCutValue(esC.getMaximum()),
esC.getData(),
esC.getKey(),
0){};

virtual ~L1TUtmCut() = default;

Expand Down
2 changes: 2 additions & 0 deletions CondFormats/L1TObjects/interface/L1TUtmCutValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@

#include <limits>
#include "CondFormats/Serialization/interface/Serializable.h"
#include "tmEventSetup/esCutValue.hh"

/**
* This class implements data structure for CutValue
*/
struct L1TUtmCutValue {
L1TUtmCutValue()
: value(std::numeric_limits<double>::max()), index(std::numeric_limits<unsigned int>::max()), version(0){};
L1TUtmCutValue(const tmeventsetup::esCutValue& esCV) : value(esCV.value), index(esCV.index), version(esCV.version){};

virtual ~L1TUtmCutValue() = default;

Expand Down
34 changes: 34 additions & 0 deletions CondFormats/L1TObjects/interface/L1TUtmObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "CondFormats/L1TObjects/interface/L1TUtmCut.h"
#include "CondFormats/Serialization/interface/Serializable.h"

#include "tmEventSetup/esObject.hh"

#include <limits>
#include <string>
#include <vector>
Expand All @@ -32,6 +34,38 @@ class L1TUtmObject {
ext_channel_id_(std::numeric_limits<unsigned int>::max()),
cuts_(),
version(0){};
L1TUtmObject(std::string name,
int type,
int comparison_operator,
int bx_offset,
double threshold,
std::string ext_signal_name,
unsigned int ext_channel_id,
std::vector<L1TUtmCut> cuts,
unsigned int vers)
: name_(name),
type_(type),
comparison_operator_(comparison_operator),
bx_offset_(bx_offset),
threshold_(threshold),
ext_signal_name_(ext_signal_name),
ext_channel_id_(ext_channel_id),
cuts_(cuts),
version(vers){};

L1TUtmObject(const tmeventsetup::esObject& esObj)
: name_(esObj.getName()),
type_(esObj.getType()),
comparison_operator_(esObj.getComparisonOperator()),
bx_offset_(esObj.getBxOffset()),
threshold_(esObj.getThreshold()),
ext_signal_name_(esObj.getExternalSignalName()),
ext_channel_id_(esObj.getExternalChannelId()),
version(0) {
cuts_.reserve(esObj.getCuts().size());
for (auto it = esObj.getCuts().begin(); it != esObj.getCuts().end(); ++it)
cuts_.emplace_back(L1TUtmCut(*it));
};

virtual ~L1TUtmObject() = default;

Expand Down
44 changes: 44 additions & 0 deletions CondFormats/L1TObjects/interface/L1TUtmScale.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "CondFormats/L1TObjects/interface/L1TUtmBin.h"
#include "CondFormats/Serialization/interface/Serializable.h"

#include "tmEventSetup/esScale.hh"

#include <map>
#include <string>
#include <vector>
Expand All @@ -24,8 +26,50 @@ class L1TUtmScale {
public:
L1TUtmScale() : name_(), object_(), type_(), minimum_(), maximum_(), step_(), n_bits_(), bins_(), version(0){};

L1TUtmScale(std::string name,
int object,
int type,
double minimum,
double maximum,
double step,
unsigned int n_bits,
std::vector<L1TUtmBin> bins,
unsigned int vers)
: name_(name),
object_(object),
type_(type),
minimum_(minimum),
maximum_(maximum),
step_(step),
n_bits_(n_bits),
bins_(bins),
version(vers){};

L1TUtmScale(const tmeventsetup::esScale& esSc)
: name_(esSc.getName()),
object_(esSc.getObjectType()),
type_(esSc.getScaleType()),
minimum_(esSc.getMinimum()),
maximum_(esSc.getMaximum()),
step_(esSc.getStep()),
n_bits_(esSc.getNbits()),
version(0) {
bins_.reserve(esSc.getBins().size());
for (auto it = esSc.getBins().begin(); it != esSc.getBins().end(); ++it)
bins_.emplace_back(L1TUtmBin(*it));
};

virtual ~L1TUtmScale() = default;

operator tmeventsetup::esScale() const {
std::vector<tmeventsetup::esBin> bins;
bins.reserve(getBins().size());
for (const auto& it : getBins())
bins.emplace_back(tmeventsetup::esBin(it.hw_index, it.minimum, it.maximum));
return tmeventsetup::esScale(
getName(), getObjectType(), getScaleType(), getMinimum(), getMaximum(), getStep(), getNbits(), bins);
}

/** get scale name */
const std::string& getName() const { return name_; };

Expand Down
45 changes: 45 additions & 0 deletions CondFormats/L1TObjects/interface/L1TUtmTriggerMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "CondFormats/L1TObjects/interface/L1TUtmAlgorithm.h"
#include "CondFormats/Serialization/interface/Serializable.h"

#include "tmEventSetup/esTriggerMenu.hh"

#include <map>
#include <string>

Expand All @@ -38,6 +40,49 @@ class L1TUtmTriggerMenu {
scale_set_name_(),
n_modules_(),
version(0){};
L1TUtmTriggerMenu(std::map<std::string, L1TUtmAlgorithm> algorithm_map,
std::map<std::string, L1TUtmCondition> condition_map,
std::map<std::string, L1TUtmScale> scale_map,
std::string name,
std::string ver_s,
std::string comment,
std::string datetime,
std::string uuid_firmware,
std::string scale_set_name,
unsigned int n_modules,
unsigned int ver_i)
: algorithm_map_(algorithm_map),
condition_map_(condition_map),
scale_map_(scale_map),
external_map_(),
token_to_condition_(),
name_(name),
version_(ver_s),
comment_(comment),
datetime_(datetime),
uuid_firmware_(uuid_firmware),
scale_set_name_(scale_set_name),
n_modules_(n_modules),
version(ver_i){};

L1TUtmTriggerMenu(const tmeventsetup::esTriggerMenu& esMenu)
: external_map_(), //These are null to my best knowledge
token_to_condition_(), //These are null to my best knowledge
name_(esMenu.getName()),
version_(esMenu.getVersion()),
comment_(esMenu.getComment()),
datetime_(esMenu.getDatetime()),
uuid_firmware_(esMenu.getFirmwareUuid()),
scale_set_name_(esMenu.getScaleSetName()),
n_modules_(esMenu.getNmodules()),
version(0) {
for (const auto& it : esMenu.getAlgorithmMap())
algorithm_map_.emplace(std::make_pair(it.first, L1TUtmAlgorithm(it.second)));
for (const auto& it : esMenu.getConditionMap())
condition_map_.emplace(std::make_pair(it.first, L1TUtmCondition(it.second)));
for (const auto& it : esMenu.getScaleMap())
scale_map_.emplace(std::make_pair(it.first, L1TUtmScale(it.second)));
};

virtual ~L1TUtmTriggerMenu() = default;

Expand Down
3 changes: 0 additions & 3 deletions DQM/CastorMonitor/interface/CastorMonitorModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "DataFormats/L1TGlobal/interface/GlobalAlgBlk.h"
#include "DataFormats/L1TGlobal/interface/GlobalExtBlk.h"
#include "DataFormats/L1Trigger/interface/BXVector.h"
#include "L1Trigger/L1TGlobal/interface/L1TGlobalUtil.h"

#include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"
#include "DQMServices/Core/interface/DQMStore.h"
Expand Down Expand Up @@ -98,8 +97,6 @@ class CastorMonitorModule : public DQMOneEDAnalyzer<> {

edm::ESGetToken<CastorDbService, CastorDbRecord> castorDbServiceToken_;

// std::shared_ptr<l1t::L1TGlobalUtil> gtUtil_;

std::unique_ptr<CastorRecHitMonitor> RecHitMon_;
std::unique_ptr<CastorDigiMonitor> DigiMon_;
std::unique_ptr<CastorLEDMonitor> LedMon_;
Expand Down
Loading