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

New DAQ source for L1Trigger scouting #43467

Merged
merged 21 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
8 changes: 4 additions & 4 deletions DataFormats/FEDRawData/interface/FEDRawData.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class FEDRawData {

/// Ctor specifying the size to be preallocated, in bytes.
/// It is required that the size is a multiple of the size of a FED
/// word (8 bytes)
FEDRawData(size_t newsize);
/// word (8 bytes default)
FEDRawData(size_t newsize, size_t wordsize = 8);

/// Copy constructor
FEDRawData(const FEDRawData &);
Expand All @@ -45,8 +45,8 @@ class FEDRawData {
size_t size() const { return data_.size(); }

/// Resize to the specified size in bytes. It is required that
/// the size is a multiple of the size of a FED word (8 bytes)
void resize(size_t newsize);
/// the size is a multiple of the size of a FED word (8 bytes default)
void resize(size_t newsize, size_t wordsize = 8);

private:
Data data_;
Expand Down
16 changes: 8 additions & 8 deletions DataFormats/FEDRawData/src/FEDRawData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ using namespace std;

FEDRawData::FEDRawData() {}

FEDRawData::FEDRawData(size_t newsize) : data_(newsize) {
if (newsize % 8 != 0)
throw cms::Exception("DataCorrupt") << "FEDRawData::resize: " << newsize << " is not a multiple of 8 bytes."
<< endl;
FEDRawData::FEDRawData(size_t newsize, size_t wordsize) : data_(newsize) {
if (newsize % wordsize != 0)
throw cms::Exception("DataCorrupt") << "FEDRawData::resize: " << newsize << " is not a multiple of " << wordsize
<< " bytes." << endl;
}

FEDRawData::FEDRawData(const FEDRawData &in) : data_(in.data_) {}
Expand All @@ -25,13 +25,13 @@ const unsigned char *FEDRawData::data() const { return data_.data(); }

unsigned char *FEDRawData::data() { return data_.data(); }

void FEDRawData::resize(size_t newsize) {
void FEDRawData::resize(size_t newsize, size_t wordsize) {
if (size() == newsize)
return;

data_.resize(newsize);

if (newsize % 8 != 0)
throw cms::Exception("DataCorrupt") << "FEDRawData::resize: " << newsize << " is not a multiple of 8 bytes."
<< endl;
if (newsize % wordsize != 0)
throw cms::Exception("DataCorrupt") << "FEDRawData::resize: " << newsize << " is not a multiple of " << wordsize
<< " bytes." << endl;
}
5 changes: 5 additions & 0 deletions DataFormats/L1Scouting/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<use name="FWCore/Utilities"/>
<use name="DataFormats/Common"/>
<export>
<lib name="1"/>
</export>
8 changes: 8 additions & 0 deletions DataFormats/L1Scouting/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# DataFormats/L1Scouting

## L1 Trigger Scouting data formats

Any changes to the L1 scouting data formats must be backwards compatible.
In order to ensure the L1 Scouting formats can be read by future CMSSW releases,
there is a `TestWriteL1ScoutingDataFormats` unit test, which makes use of the `TestReadL1Scouting` analyzer and the `TestWriteL1Scouting` producer.
The unit test checks that objects can be written and read properly.
198 changes: 198 additions & 0 deletions DataFormats/L1Scouting/interface/L1ScoutingCalo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
#ifndef DataFormats_L1Scouting_L1ScoutingCalo_h
#define DataFormats_L1Scouting_L1ScoutingCalo_h

#include "DataFormats/L1Scouting/interface/OrbitCollection.h"

namespace l1ScoutingRun3 {

class CaloObject {
public:
CaloObject() : hwEt_(0), hwEta_(0), hwPhi_(0), hwIso_(0) {}

CaloObject(int hwEt, int hwEta, int hwPhi, int iso) : hwEt_(hwEt), hwEta_(hwEta), hwPhi_(hwPhi), hwIso_(iso) {}

void setHwEt(int hwEt) { hwEt_ = hwEt; }
void setHwEta(int hwEta) { hwEta_ = hwEta; }
void setHwPhi(int hwPhi) { hwPhi_ = hwPhi; }
void setHwIso(int hwIso) { hwIso_ = hwIso; }

int hwEt() const { return hwEt_; }
int hwEta() const { return hwEta_; }
int hwPhi() const { return hwPhi_; }
int hwIso() const { return hwIso_; }

private:
int hwEt_;
int hwEta_;
int hwPhi_;
int hwIso_;
};

class Jet : public CaloObject {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If separate types are needed, please avoid the inheritance (to keep the structure simpler, and therefore easier to support for future evolution).

If separate types are not needed, how about just using CaloObject directly for the three cases?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that persistent data has already been created using these classes as they were in this PR (https://its.cern.ch/jira/browse/CMSTRANSF-799), perhaps it is easiest to just leave the inheritance as it is. The consequence is that the class hierarchy may not be changed in the future. In the PR adding the tests, please add comments here documenting this restriction.

public:
Jet() : CaloObject(0, 0, 0, 0) {}

Jet(int hwEt, int hwEta, int hwPhi, int hwQual) : CaloObject(hwEt, hwEta, hwPhi, hwQual) {}

// store quality instead of iso
void setHwQual(int hwQual) { setHwIso(hwQual); }
int hwQual() const { return hwIso(); }
};

class EGamma : public CaloObject {
public:
EGamma() : CaloObject(0, 0, 0, 0) {}

EGamma(int hwEt, int hwEta, int hwPhi, int iso) : CaloObject(hwEt, hwEta, hwPhi, iso) {}
};

class Tau : public CaloObject {
public:
Tau() : CaloObject(0, 0, 0, 0) {}

Tau(int hwEt, int hwEta, int hwPhi, int iso) : CaloObject(hwEt, hwEta, hwPhi, iso) {}
};

class BxSums {
public:
BxSums()
: hwTotalEt_(0),
hwTotalEtEm_(0),
hwTotalHt_(0),
hwMissEt_(0),
hwMissEtPhi_(0),
hwMissHt_(0),
hwMissHtPhi_(0),
hwMissEtHF_(0),
hwMissEtHFPhi_(0),
hwMissHtHF_(0),
hwMissHtHFPhi_(0),
hwAsymEt_(0),
hwAsymHt_(0),
hwAsymEtHF_(0),
hwAsymHtHF_(0),
minBiasHFP0_(0),
minBiasHFM0_(0),
minBiasHFP1_(0),
minBiasHFM1_(0),
towerCount_(0),
centrality_(0) {}

BxSums(int hwTotalEt,
int hwTotalEtEm,
int hwTotalHt,
int hwMissEt,
int hwMissEtPhi,
int hwMissHt,
int hwMissHtPhi,
int hwMissEtHF,
int hwMissEtHFPhi,
int hwMissHtHF,
int hwMissHtHFPhi,
int hwAsymEt,
int hwAsymHt,
int hwAsymEtHF,
int hwAsymHtHF,
int minBiasHFP0,
int minBiasHFM0,
int minBiasHFP1,
int minBiasHFM1,
int towerCount,
int centrality)
: hwTotalEt_(hwTotalEt),
hwTotalEtEm_(hwTotalEtEm),
hwTotalHt_(hwTotalHt),
hwMissEt_(hwMissEt),
hwMissEtPhi_(hwMissEtPhi),
hwMissHt_(hwMissHt),
hwMissHtPhi_(hwMissHtPhi),
hwMissEtHF_(hwMissEtHF),
hwMissEtHFPhi_(hwMissEtHFPhi),
hwMissHtHF_(hwMissHtHF),
hwMissHtHFPhi_(hwMissHtHFPhi),
hwAsymEt_(hwAsymEt),
hwAsymHt_(hwAsymHt),
hwAsymEtHF_(hwAsymEtHF),
hwAsymHtHF_(hwAsymHtHF),
minBiasHFP0_(minBiasHFP0),
minBiasHFM0_(minBiasHFM0),
minBiasHFP1_(minBiasHFP1),
minBiasHFM1_(minBiasHFM1),
towerCount_(towerCount),
centrality_(centrality) {}

void setHwTotalEt(int hwTotalEt) { hwTotalEt_ = hwTotalEt; }
void setHwTotalEtEm(int hwTotalEtEm) { hwTotalEtEm_ = hwTotalEtEm; }
void setMinBiasHFP0(int minBiasHFP0) { minBiasHFP0_ = minBiasHFP0; }
void setHwTotalHt(int hwTotalHt) { hwTotalHt_ = hwTotalHt; }
void setTowerCount(int towerCount) { towerCount_ = towerCount; }
void setMinBiasHFM0(int minBiasHFM0) { minBiasHFM0_ = minBiasHFM0; }
void setHwMissEt(int hwMissEt) { hwMissEt_ = hwMissEt; }
void setHwMissEtPhi(int hwMissEtPhi) { hwMissEtPhi_ = hwMissEtPhi; }
void setHwAsymEt(int hwAsymEt) { hwAsymEt_ = hwAsymEt; }
void setMinBiasHFP1(int minBiasHFP1) { minBiasHFP1_ = minBiasHFP1; }
void setHwMissHt(int hwMissHt) { hwMissHt_ = hwMissHt; }
void setHwMissHtPhi(int hwMissHtPhi) { hwMissHtPhi_ = hwMissHtPhi; }
void setHwAsymHt(int hwAsymHt) { hwAsymHt_ = hwAsymHt; }
void setMinBiasHFM1(int minBiasHFM1) { minBiasHFM1_ = minBiasHFM1; }
void setHwMissEtHF(int hwMissEtHF) { hwMissEtHF_ = hwMissEtHF; }
void setHwMissEtHFPhi(int hwMissEtHFPhi) { hwMissEtHFPhi_ = hwMissEtHFPhi; }
void setHwAsymEtHF(int hwAsymEtHF) { hwAsymEtHF_ = hwAsymEtHF; }
void setHwMissHtHF(int hwMissHtHF) { hwMissHtHF_ = hwMissHtHF; }
void setHwMissHtHFPhi(int hwMissHtHFPhi) { hwMissHtHFPhi_ = hwMissHtHFPhi; }
void setHwAsymHtHF(int hwAsymHtHF) { hwAsymHtHF_ = hwAsymHtHF; }
void setCentrality(int centrality) { centrality_ = centrality; }

const int hwTotalEt() const { return hwTotalEt_; }
const int hwTotalEtEm() const { return hwTotalEtEm_; }
const int minBiasHFP0() const { return minBiasHFP0_; }
const int hwTotalHt() const { return hwTotalHt_; }
const int towerCount() const { return towerCount_; }
const int minBiasHFM0() const { return minBiasHFM0_; }
const int hwMissEt() const { return hwMissEt_; }
const int hwMissEtPhi() const { return hwMissEtPhi_; }
const int hwAsymEt() const { return hwAsymEt_; }
const int minBiasHFP1() const { return minBiasHFP1_; }
const int hwMissHt() const { return hwMissHt_; }
const int hwMissHtPhi() const { return hwMissHtPhi_; }
const int hwAsymHt() const { return hwAsymHt_; }
const int minBiasHFM1() const { return minBiasHFM1_; }
const int hwMissEtHF() const { return hwMissEtHF_; }
const int hwMissEtHFPhi() const { return hwMissEtHFPhi_; }
const int hwAsymEtHF() const { return hwAsymEtHF_; }
const int hwMissHtHF() const { return hwMissHtHF_; }
const int hwMissHtHFPhi() const { return hwMissHtHFPhi_; }
const int hwAsymHtHF() const { return hwAsymHtHF_; }
const int centrality() const { return centrality_; }

private:
int hwTotalEt_;
int hwTotalEtEm_;
int hwTotalHt_;
int hwMissEt_;
int hwMissEtPhi_;
int hwMissHt_;
int hwMissHtPhi_;
int hwMissEtHF_;
int hwMissEtHFPhi_;
int hwMissHtHF_;
int hwMissHtHFPhi_;
int hwAsymEt_;
int hwAsymHt_;
int hwAsymEtHF_;
int hwAsymHtHF_;
int minBiasHFP0_;
int minBiasHFM0_;
int minBiasHFP1_;
int minBiasHFM1_;
int towerCount_;
int centrality_;
};

typedef OrbitCollection<Jet> JetOrbitCollection;
typedef OrbitCollection<EGamma> EGammaOrbitCollection;
typedef OrbitCollection<Tau> TauOrbitCollection;
typedef OrbitCollection<BxSums> BxSumsOrbitCollection;

} // namespace l1ScoutingRun3
#endif // DataFormats_L1Scouting_L1ScoutingCalo_h
95 changes: 95 additions & 0 deletions DataFormats/L1Scouting/interface/L1ScoutingMuon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#ifndef DataFormats_L1Scouting_L1ScoutingMuon_h
#define DataFormats_L1Scouting_L1ScoutingMuon_h

#include "DataFormats/L1Scouting/interface/OrbitCollection.h"

namespace l1ScoutingRun3 {

class Muon {
public:
Muon()
: hwPt_(0),
hwEta_(0),
hwPhi_(0),
hwQual_(0),
hwChrg_(0),
hwChrgv_(0),
hwIso_(0),
tfIndex_(0),
hwEtaAtVtx_(0),
hwPhiAtVtx_(0),
hwPtUnconstrained_(0),
hwDXY_(0) {}

Muon(int hwPt,
int hwEta,
int hwPhi,
int hwQual,
int hwChrg,
int hwChrgv,
int hwIso,
int tfIndex,
int hwEtaAtVtx,
int hwPhiAtVtx,
int hwPtUnconstrained,
int hwDXY)
: hwPt_(hwPt),
hwEta_(hwEta),
hwPhi_(hwPhi),
hwQual_(hwQual),
hwChrg_(hwChrg),
hwChrgv_(hwChrgv),
hwIso_(hwIso),
tfIndex_(tfIndex),
hwEtaAtVtx_(hwEtaAtVtx),
hwPhiAtVtx_(hwPhiAtVtx),
hwPtUnconstrained_(hwPtUnconstrained),
hwDXY_(hwDXY) {}

void setHwPt(int hwPt) { hwPt_ = hwPt; }
void setHwEta(int hwEta) { hwEta_ = hwEta; }
void setHwPhi(int hwPhi) { hwPhi_ = hwPhi; }
void setHwQual(int hwQual) { hwQual_ = hwQual; }
void setHwChrg(int hwChrg) { hwChrg_ = hwChrg; }
void setHwChrgv(int hwChrgv) { hwChrgv_ = hwChrgv; }
void setHwIso(int hwIso) { hwIso_ = hwIso; }
void setTfIndex(int tfIndex) { tfIndex_ = tfIndex; }
void setHwEtaAtVtx(int hwEtaAtVtx) { hwEtaAtVtx_ = hwEtaAtVtx; }
void setHwPhiAtVtx(int hwPhiAtVtx) { hwPhiAtVtx_ = hwPhiAtVtx; }
void setHwPtUnconstrained(int hwPtUnconstrained) { hwPtUnconstrained_ = hwPtUnconstrained; }
void setHwDXY(int hwDXY) { hwDXY_ = hwDXY; }

int hwPt() const { return hwPt_; }
int hwEta() const { return hwEta_; }
int hwPhi() const { return hwPhi_; }
int hwQual() const { return hwQual_; }
int hwCharge() const { return hwChrg_; }
int hwChargeValid() const { return hwChrgv_; }
int hwIso() const { return hwIso_; }
int hwIndex() const { return tfIndex_; }
int hwEtaAtVtx() const { return hwEtaAtVtx_; }
int hwPhiAtVtx() const { return hwPhiAtVtx_; }
int hwPtUnconstrained() const { return hwPtUnconstrained_; }
int hwDXY() const { return hwDXY_; }
int tfMuonIndex() const { return tfIndex_; }

private:
int hwPt_;
int hwEta_;
int hwPhi_;
int hwQual_;
int hwChrg_;
int hwChrgv_;
int hwIso_;
int tfIndex_;
int hwEtaAtVtx_;
int hwPhiAtVtx_;
int hwPtUnconstrained_;
int hwDXY_;
};

typedef OrbitCollection<Muon> MuonOrbitCollection;

} // namespace l1ScoutingRun3

#endif // DataFormats_L1Scouting_L1ScoutingMuon_h
Loading