Skip to content

Commit

Permalink
[WIP] added plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Mmiglio committed Nov 17, 2023
1 parent 12b08e1 commit 9029aab
Show file tree
Hide file tree
Showing 10 changed files with 1,106 additions and 0 deletions.
10 changes: 10 additions & 0 deletions EventFilter/L1ScoutingRawToDigi/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<use name="FWCore/Framework"/>
<use name="FWCore/Utilities"/>
<use name="EventFilter/Utilities"/>
<use name="DataFormats/FEDRawData"/>
<use name="DataFormats/L1Trigger"/>
<use name="DataFormats/L1Scouting"/>
<use name="DataFormats/L1ScoutingRawData"/>
<export>
<lib name="1"/>
</export>
123 changes: 123 additions & 0 deletions EventFilter/L1ScoutingRawToDigi/interface/blocks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#ifndef DataFormats_Scouting_BLOCKS_H
#define DataFormats_Scouting_BLOCKS_H

#include <cstdint>
#include <vector>
#include <string>
#include "scales.h"

namespace scoutingRun3 {

namespace ugmt {
struct hw_data_block{
std::vector<int> vorbit;
std::vector<int> vbx;
std::vector<int> vinterm;
std::vector<int> vipt;
std::vector<int> viptunconstrained;
std::vector<int> vcharge;
std::vector<int> viso;
std::vector<int> vindex;
std::vector<int> vqual;
std::vector<int> viphi;
std::vector<int> viphiext;
std::vector<int> vieta;
std::vector<int> vietaext;
std::vector<int> vidxy;

unsigned int size() {return vipt.size();}
bool empty() {return vipt.empty();}
static const unsigned int ncols = 14;

std::vector<int> iAt(int i) {
return {
vorbit[i],
vbx[i],
vinterm[i],
vipt[i],
viptunconstrained[i],
vcharge[i],
viso[i],
vindex[i],
vqual[i],
viphi[i],
viphiext[i],
vieta[i],
vietaext[i],
vidxy[i],
};
}
};

struct muon {
uint32_t f;
uint32_t s;
uint32_t extra;
};

struct block {
uint32_t bx;
uint32_t orbit;
muon mu[16];
};
}



namespace demux {
struct hw_data_block {
std::vector<int> vorbit;
std::vector<int> vbx;
std::vector<int> vET;
std::vector<int> vType;
std::vector<int> vEta;
std::vector<int> vPhi;
std::vector<int> vIso;

unsigned int size() {return vET.size();}
bool empty() {return vET.empty();}
static const unsigned int ncols = 13;

};

struct block_old {
uint32_t header;
uint32_t bx;
uint32_t orbit;
uint32_t frame[56]; // +8 for extra word containing link number
};

// unrolled frame block
struct block {
uint32_t header;
uint32_t bx;
uint32_t orbit;
uint32_t link0;
uint32_t jet1[6];
uint32_t link1;
uint32_t jet2[6];
uint32_t link2;
uint32_t egamma1[6];
uint32_t link3;
uint32_t egamma2[6];
uint32_t link4;
uint32_t empty[6];
uint32_t link5;
uint32_t sum[6];
uint32_t link6;
uint32_t tau1[6];
uint32_t link7;
uint32_t tau2[6];
};
}



namespace bmtf {
struct block {
uint64_t stub[8];
};
}

}
#endif
125 changes: 125 additions & 0 deletions EventFilter/L1ScoutingRawToDigi/interface/masks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
#ifndef DF_S_MASKS_H
#define DF_S_MASKS_H

#include <cstdint>
#include "shifts.h"

namespace scoutingRun3 {

namespace ugmt {
// struct masks{
struct masksMuon {
// bx word: 16 bits used for actual bx, MS 4 bits are muon type
// 0xf intermediate,
// 0x0 final
// following 4 bits for link id
static constexpr uint32_t bx = 0x1fff;
static constexpr uint32_t interm = 0x0001;
//masks for muon 64 bits
static constexpr uint32_t phiext = 0x03ff;
static constexpr uint32_t pt = 0x01ff;
static constexpr uint32_t ptuncon = 0x00ff; // 8 bits
static constexpr uint32_t qual = 0x000f;
static constexpr uint32_t etaext = 0x01ff;
static constexpr uint32_t etaextv = 0x00ff;
static constexpr uint32_t etaexts = 0x0100;
static constexpr uint32_t iso = 0x0003;
static constexpr uint32_t chrg = 0x0001;
static constexpr uint32_t chrgv = 0x0001;
static constexpr uint32_t index = 0x007f;
static constexpr uint32_t phi = 0x03ff;
static constexpr uint32_t eta = 0x01ff;
static constexpr uint32_t etav = 0x00ff;
static constexpr uint32_t etas = 0x0100;
static constexpr uint32_t dxy = 0x0003;
};
}



namespace demux {
// struct masksCaloJet{
struct masksJet {
static constexpr uint32_t ET = 0x07ff;
static constexpr uint32_t eta = 0x00ff;
static constexpr uint32_t phi = 0x00ff;
};

// struct masksCaloEGamma{
struct masksEGamma {
static constexpr uint32_t ET = 0x01ff;
static constexpr uint32_t eta = 0x00ff;
static constexpr uint32_t phi = 0x00ff;
static constexpr uint32_t iso = 0x0003;
};

// struct masksCaloTau{
struct masksTau {
static constexpr uint32_t ET = 0x01ff;
static constexpr uint32_t eta = 0x00ff;
static constexpr uint32_t phi = 0x00ff;
static constexpr uint32_t iso = 0x0003;
};

// struct masksCaloESums{
struct masksESums {
static constexpr uint32_t ETEt = 0x0fff; // Et of ET object
static constexpr uint32_t ETEttem = 0x0fff;
static constexpr uint32_t ETMinBiasHF = 0x000f;

static constexpr uint32_t HTEt = 0x0fff; // Et of HT object
static constexpr uint32_t HTtowerCount = 0x1fff;
static constexpr uint32_t HTMinBiasHF = 0x0003;

static constexpr uint32_t ETmissEt = 0x0fff;
static constexpr uint32_t ETmissPhi = 0x00ff;
static constexpr uint32_t ETmissASYMET = 0x00ff;
static constexpr uint32_t ETmissMinBiasHF = 0x0003;

static constexpr uint32_t HTmissEt = 0x0fff;
static constexpr uint32_t HTmissPhi = 0x00ff;
static constexpr uint32_t HTmissASYMHT = 0x00ff;
static constexpr uint32_t HTmissMinBiasHF = 0x0003;

static constexpr uint32_t ETHFmissEt = 0x0fff;
static constexpr uint32_t ETHFmissPhi = 0x00ff;
static constexpr uint32_t ETHFmissASYMETHF = 0x00ff;
static constexpr uint32_t ETHFmissCENT = 0x0003;

static constexpr uint32_t HTHFmissEt = 0x0fff;
static constexpr uint32_t HTHFmissPhi = 0x00ff;
static constexpr uint32_t HTHFmissASYMHTHF = 0x00ff;
static constexpr uint32_t HTHFmissCENT = 0x0003;
};
}



namespace bmtf {
struct masksStubs {
static constexpr uint64_t valid = 0x0001;
static constexpr uint64_t phi = 0x0fff;
static constexpr uint64_t phiB = 0x03ff;
static constexpr uint64_t qual = 0x0007;
static constexpr uint64_t eta = 0x007f;
static constexpr uint64_t qeta = 0x007f;
static constexpr uint64_t station = 0x0003;
static constexpr uint64_t wheel = 0x0007;
static constexpr uint64_t reserved = 0x0007;
static constexpr uint64_t bx = 0xffff;
};
}



struct header_masks {
static constexpr uint32_t bxmatch = 0x00ff << header_shifts::bxmatch;
static constexpr uint32_t mAcount = 0x000f << header_shifts::mAcount;
static constexpr uint32_t orbitmatch = 0x00ff << header_shifts::orbitmatch;
static constexpr uint32_t warningTestEnabled = 0x0001 << header_shifts::warningTestEnabled;
static constexpr uint32_t mBcount = 0x000f << header_shifts::mBcount;
static constexpr uint32_t sBmtfCount = 0x000f << header_shifts::sBmtfCount;
};

}
#endif
32 changes: 32 additions & 0 deletions EventFilter/L1ScoutingRawToDigi/interface/scales.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef DF_S_SCALES_H
#define DF_S_SCALES_H

#include <cstdint>
#include <cmath>

namespace scoutingRun3 {

namespace ugmt {
// struct gmt_scales{
struct scales {
static constexpr float pt_scale = 0.5;
static constexpr float ptunconstrained_scale = 1.0;
static constexpr float phi_scale = 2.*M_PI/576.;
static constexpr float eta_scale = 0.0870/8; // 9th MS bit is sign
static constexpr float phi_range = M_PI;
};
}



namespace demux {
// struct gmt_scales{
struct scales {
static constexpr float phi_scale = 2.*M_PI/144.;
static constexpr float eta_scale = 0.0435;
static constexpr float et_scale = 0.5;
};
}

}
#endif
Loading

0 comments on commit 9029aab

Please sign in to comment.