Skip to content

Commit

Permalink
New structure for EtSums
Browse files Browse the repository at this point in the history
  • Loading branch information
Mmiglio committed Nov 27, 2023
1 parent 4949fc8 commit afe8b59
Show file tree
Hide file tree
Showing 10 changed files with 265 additions and 73 deletions.
133 changes: 120 additions & 13 deletions DataFormats/L1Scouting/interface/L1ScoutingCalo.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ namespace l1ScoutingRun3 {
typedef OrbitCollection<ScTau> ScTauOrbitCollection;
class ScEtSum;
typedef OrbitCollection<ScEtSum> ScEtSumOrbitCollection;
class ScBxSums;
typedef OrbitCollection<ScBxSums> ScBxSumsOrbitCollection;

class ScCaloObject {
public:
Expand Down Expand Up @@ -72,8 +74,12 @@ namespace l1ScoutingRun3 {
int hwEt,
int hwEta,
int hwPhi,
int iso)
: ScCaloObject(hwEt, hwEta ,hwPhi , iso) {}
int hwQual)
: ScCaloObject(hwEt, hwEta ,hwPhi , hwQual) {}

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

};

Expand Down Expand Up @@ -137,22 +143,123 @@ namespace l1ScoutingRun3 {
inline int hwPhi() const {return hwPhi_;}
inline l1t::EtSum::EtSumType type() const {return type_;}

// inline float Et() const {
// return et_scale_* hwEt_;
// }
// inline float phi() const {
// float fPhi = phi_scale_*hwPhi_;
// fPhi = fPhi>=M_PI ? fPhi-2.*M_PI : fPhi;
// return fPhi;
// }

private:
int hwEt_;
int hwPhi_;
l1t::EtSum::EtSumType type_;
};

class ScBxSums {

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

// static constexpr float phi_scale_ = 2.*M_PI/144.;
// static constexpr float et_scale_ = 0.5;
ScBxSums(
int hwTotalEt, int hwTotalEtEm, int minBiasHFP0,
int hwTotalHt, int towerCount, int minBiasHFM0,
int hwMissEt, int hwMissEtPhi, int hwAsymEt, int minBiasHFP1,
int hwMissHt, int hwMissHtPhi, int hwAsymHt, int minBiasHFM1,
int hwMissEtHF, int hwMissEtHFPhi, int hwAsymEtHF,
int hwMissHtHF, int hwMissHtHFPhi, int hwAsymHtHF, int centrality
)
: hwTotalEt_(hwTotalEt), hwTotalEtEm_(hwTotalEtEm), minBiasHFP0_(minBiasHFP0),
hwTotalHt_(hwTotalHt), towerCount_(towerCount), minBiasHFM0_(minBiasHFM0),
hwMissEt_(hwMissEt), hwMissEtPhi_(hwMissEtPhi), hwAsymEt_(hwAsymEt),
minBiasHFP1_(minBiasHFP1), hwMissHt_(hwMissHt), hwMissHtPhi_(hwMissHtPhi),
hwAsymHt_(hwAsymHt), minBiasHFM1_(minBiasHFM1), hwMissEtHF_(hwMissEtHF),
hwMissEtHFPhi_(hwMissEtHFPhi), hwAsymEtHF_(hwAsymEtHF), hwMissHtHF_(hwMissHtHF),
hwMissHtHFPhi_(hwMissHtHFPhi), hwAsymHtHF_(hwAsymHtHF), centrality_(centrality)
{}

ScBxSums(const ScBxSums& other) = default;
ScBxSums(ScBxSums&& other) = default;
ScBxSums & operator=(const ScBxSums& other) = default;
ScBxSums & operator=(ScBxSums&& other) = default;

void swap(ScBxSums& other){
using std::swap;
swap(hwTotalEt_, other.hwTotalEt_);
swap(hwTotalEtEm_, other.hwTotalEtEm_);
swap(minBiasHFP0_, other.minBiasHFP0_);
swap(hwTotalHt_, other.hwTotalHt_);
swap(towerCount_, other.towerCount_);
swap(minBiasHFM0_, other.minBiasHFM0_);
swap(hwMissEt_, other.hwMissEt_);
swap(hwMissEtPhi_, other.hwMissEtPhi_);
swap(hwAsymEt_, other.hwAsymEt_);
swap(minBiasHFP1_, other.minBiasHFP1_);
swap(hwMissHt_, other.hwMissHt_);
swap(hwMissHtPhi_, other.hwMissHtPhi_);
swap(hwAsymHt_, other.hwAsymHt_);
swap(minBiasHFM1_, other.minBiasHFM1_);
swap(hwMissEtHF_, other.hwMissEtHF_);
swap(hwMissEtHFPhi_, other.hwMissEtHFPhi_);
swap(hwAsymEtHF_, other.hwAsymEtHF_);
swap(hwMissHtHF_, other.hwMissHtHF_);
swap(hwMissHtHFPhi_, other.hwMissHtHFPhi_);
swap(hwAsymHtHF_, other.hwAsymHtHF_);
swap(centrality_, other.centrality_);

}

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

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

private:
int hwTotalEt_, hwTotalEtEm_, minBiasHFP0_; // sums from ET block
int hwTotalHt_, towerCount_, minBiasHFM0_; // sums from HT block
int hwMissEt_, hwMissEtPhi_, hwAsymEt_, minBiasHFP1_; // sums from EtMiss block
int hwMissHt_, hwMissHtPhi_, hwAsymHt_, minBiasHFM1_; // sums from HTMiss block
int hwMissEtHF_, hwMissEtHFPhi_, hwAsymEtHF_; // sums from ETHFMiss block
int hwMissHtHF_, hwMissHtHFPhi_, hwAsymHtHF_, centrality_; // sums from HTHFMiss block
};

} // namespace l1ScoutingRun3
Expand Down
1 change: 1 addition & 0 deletions DataFormats/L1Scouting/src/classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ namespace l1ScoutingRun3 {
edm::Wrapper<ScEGammaOrbitCollection> ScEGammaOrbitCollectionWrapper;
edm::Wrapper<ScTauOrbitCollection> ScTauOrbitCollectionWrapper;
edm::Wrapper<ScEtSumOrbitCollection> ScEtSumOrbitCollectionWrapper;
edm::Wrapper<ScBxSumsOrbitCollection> ScBxSumsOrbitCollectionWrapper;
}
5 changes: 5 additions & 0 deletions DataFormats/L1Scouting/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@
<class name="std::vector<l1ScoutingRun3::ScEtSum>"/>
<class name="l1ScoutingRun3::ScEtSumOrbitCollection"/>
<class name="edm::Wrapper<l1ScoutingRun3::ScEtSumOrbitCollection>"/>

<class name="l1ScoutingRun3::ScBxSums"/>
<class name="std::vector<l1ScoutingRun3::ScBxSums>"/>
<class name="l1ScoutingRun3::ScBxSumsOrbitCollection"/>
<class name="edm::Wrapper<l1ScoutingRun3::ScBxSumsOrbitCollection>"/>

</lcgdict>
20 changes: 11 additions & 9 deletions EventFilter/L1ScoutingRawToDigi/interface/conversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
#include "EventFilter/L1ScoutingRawToDigi/interface/scales.h"

namespace l1ScoutingRun3 {

inline float _setPhiRange(float phi) {
phi = phi >= M_PI ? phi-2.*M_PI : phi;
return phi;
}

namespace ugmt {

Expand All @@ -14,9 +19,8 @@ namespace l1ScoutingRun3 {
return scales::eta_scale*hwEta;
};
inline float fPhi(int hwPhi) {
float fPhi_ = scales::phi_scale*hwPhi;
fPhi_ = fPhi_>=M_PI ? fPhi_-2.*M_PI : fPhi_;
return fPhi_;
//float fPhi_ = scales::phi_scale*hwPhi;
return _setPhiRange(scales::phi_scale*hwPhi);
};
inline float fPtUnconstrained(int hwPtUnconstrained) {
return scales::ptunconstrained_scale*(hwPtUnconstrained-1);
Expand All @@ -25,9 +29,8 @@ namespace l1ScoutingRun3 {
return scales::eta_scale*hwEtaAtVtx;
};
inline float fPhiAtVtx(int hwPhiAtVtx) {
float fPhi_ = scales::phi_scale*hwPhiAtVtx;
fPhi_ = fPhi_>=M_PI ? fPhi_-2.*M_PI : fPhi_;
return fPhi_;
//float fPhi_ = scales::phi_scale*hwPhiAtVtx;
return _setPhiRange(scales::phi_scale*hwPhiAtVtx);
};

} // namespace ugmt
Expand All @@ -41,9 +44,8 @@ namespace l1ScoutingRun3 {
return scales::eta_scale*hwEta;
};
inline float fPhi(int hwPhi) {
float fPhi_ = scales::phi_scale*hwPhi;
fPhi_ = fPhi_>= M_PI ? fPhi_-2.*M_PI : fPhi_;
return fPhi_;
//float fPhi_ = scales::phi_scale*hwPhi;
return _setPhiRange(scales::phi_scale*hwPhi);
};

} // namespace demux
Expand Down
8 changes: 5 additions & 3 deletions EventFilter/L1ScoutingRawToDigi/interface/masks.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ namespace demux {
static constexpr uint32_t ET = 0x07ff;
static constexpr uint32_t eta = 0x00ff;
static constexpr uint32_t phi = 0x00ff;
static constexpr uint32_t disp = 0x0001;
static constexpr uint32_t qual = 0x0003;
};

// struct masksCaloEGamma{
Expand All @@ -69,17 +71,17 @@ namespace demux {

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 HTMinBiasHF = 0x000f;

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 ETmissMinBiasHF = 0x000f;

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 HTmissMinBiasHF = 0x000f;

static constexpr uint32_t ETHFmissEt = 0x0fff;
static constexpr uint32_t ETHFmissPhi = 0x00ff;
Expand Down
2 changes: 2 additions & 0 deletions EventFilter/L1ScoutingRawToDigi/interface/shifts.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ namespace demux {
static constexpr uint32_t ET = 0;
static constexpr uint32_t eta = 11;
static constexpr uint32_t phi = 19;
static constexpr uint32_t disp = 27;
static constexpr uint32_t qual = 28;
};

// struct shiftsCaloEGamma{
Expand Down
Loading

0 comments on commit afe8b59

Please sign in to comment.