Skip to content

Commit

Permalink
[WIP] added new calo data structures
Browse files Browse the repository at this point in the history
  • Loading branch information
Mmiglio committed Nov 17, 2023
1 parent b9c7ba3 commit 12b08e1
Show file tree
Hide file tree
Showing 12 changed files with 524 additions and 107 deletions.
2 changes: 0 additions & 2 deletions DataFormats/L1Scouting/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<use name="DataFormats/Candidate"/>
<use name="FWCore/Utilities"/>
<use name="DataFormats/Common"/>
<use name="DataFormats/FEDRawData"/>
<export>
<lib name="1"/>
</export>
149 changes: 149 additions & 0 deletions DataFormats/L1Scouting/interface/L1ScoutingCalo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
#ifndef DataFormats_L1Scouting_L1ScoutingCalo_h
#define DataFormats_L1Scouting_L1ScoutingCalo_h

#include "DataFormats/L1Trigger/interface/EtSum.h"
#include <cmath>

namespace scoutingRun3 {

class ScCaloObject {
public:
ScCaloObject()
: hwEt_(0),
hwEta_(0),
hwPhi_(0),
iso_(0){}

ScCaloObject(
int hwEt,
int hwEta,
int hwPhi,
int iso)
: hwEt_(hwEt),
hwEta_(hwEta),
hwPhi_(hwPhi),
iso_(iso) {}

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

inline void setHwEt(int hwEt) { hwEt_= hwEt;}
inline void setHwEta(int hwEta) { hwEta_= hwEta;}
inline void setHwPhi(int hwPhi) { hwPhi_= hwPhi;}
inline void setIso(int iso) { iso_= iso;}

inline int getHwEt() const {return hwEt_;}
inline int getHwEta() const {return hwEta_;}
inline int getHwPhi() const {return hwPhi_;}
inline int getIso() const {return iso_;}

inline float getEt() const {
return et_scale_* hwEt_;
}
inline float getEta()const {
return eta_scale_*hwEta_;
}
inline float getPhi() const {
float fPhi = phi_scale_*hwPhi_;
fPhi = fPhi>=2.*M_PI ? fPhi-2.*M_PI : fPhi;
return fPhi;
}

private:
int hwEt_;
int hwEta_;
int hwPhi_;
int iso_;

static constexpr float phi_scale_ = 2.*M_PI/144.;
static constexpr float eta_scale_ = 0.0435;
static constexpr float et_scale_ = 0.5;
};

class ScJet: public ScCaloObject {
public:
ScJet(): ScCaloObject(0, 0 ,0 , 0){}

ScJet(
int hwEt,
int hwEta,
int hwPhi,
int iso)
: ScCaloObject(hwEt, hwEta ,hwPhi , iso) {}
};

class ScEGamma: public ScCaloObject {
public:
ScEGamma(): ScCaloObject(0, 0 ,0 , 0){}

ScEGamma(
int hwEt,
int hwEta,
int hwPhi,
int iso)
: ScCaloObject(hwEt, hwEta ,hwPhi , iso) {}
};

class ScTau: public ScCaloObject {
public:
ScTau(): ScCaloObject(0, 0 ,0 , 0){}

ScTau(
int hwEt,
int hwEta,
int hwPhi,
int iso)
: ScCaloObject(hwEt, hwEta ,hwPhi , iso) {}
};


class ScEtSum {
public:
ScEtSum()
: hwEt_(0),
hwPhi_(0),
type_(l1t::EtSum::kUninitialized) {}

ScEtSum(
int hwEt,
int hwPhi,
l1t::EtSum::EtSumType type)
: hwEt_(hwEt),
hwPhi_(hwPhi),
type_(type) {}

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

inline void setHwEt(int hwEt) { hwEt_= hwEt;}
inline void setHwPhi(int hwPhi) { hwPhi_= hwPhi;}
inline void setType(l1t::EtSum::EtSumType type) { type_= type;}

inline int getHwEt() const {return hwEt_;}
inline int getHwPhi() const {return hwPhi_;}
inline l1t::EtSum::EtSumType getType() const {return type_;}

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

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

static constexpr float phi_scale_ = 2.*M_PI/144.;
static constexpr float et_scale_ = 0.5;
};

} // namespace scoutingRun3
#endif // DataFormats_L1Scouting_L1ScoutingCalo_h
126 changes: 114 additions & 12 deletions DataFormats/L1Scouting/interface/L1ScoutingMuon.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,120 @@

#include <cmath>

class ScMuon {
namespace scoutingRun3 {
class ScMuon {
public:
int pt, eta, phi, qual, chrg, chrgv;
int iso, index, etae, phie, ptUncon;
//float fpt, feta, fphi, fetae, fphie, fptUncon;

inline float getPt(){return 0.05*(pt-1);}
inline float getEta(){return 0.0870/8*eta;}
inline float getPhi(){return 2.*M_PI/576.*phi;}
inline float getPtUncon(){return 0.05*(ptUncon-1);}
inline float getEtaExt(){return 0.0870/8*etae;}
inline float getPhiExt(){return 2.*M_PI/576.*phie;}
};

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

ScMuon(
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) {}

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

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

inline int getHwPt() const {return hwPt_;}
inline int getHwEta() const {return hwEta_;}
inline int getHwPhi() const {return hwPhi_;}
inline int getHwQual() const {return hwQual_;}
inline int getHwChrg() const {return hwChrg_;}
inline int getHwChrgv() const {return hwChrgv_;}
inline int getHwIso() const {return hwIso_;}
inline int getHfIndex() const {return tfIndex_;}
inline int getHwEtaAtVtx() const {return hwEtaAtVtx_;}
inline int getHwPhiAtVtx() const {return hwPhiAtVtx_;}
inline int getHwPtUnconstrained() const {return hwPtUnconstrained_;}
inline int getHwDXY() const {return hwDXY_;}

inline float getPt() const {
return pt_scale_*(hwPt_-1);
}
inline float getEta()const {
return eta_scale_*hwEta_;
}
inline float getPhi() const {
return phi_scale_*hwPhi_;
}
inline float getPtUnconstrained() const {
return pt_scale_*(hwPtUnconstrained_-1);
}
inline float getEtaAtVtx() const {
return eta_scale_*hwEtaAtVtx_;
}
inline float getPhiAtVtx() const {
return phi_scale_*hwPhiAtVtx_;
}

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_;

// constants to convert from harware to physical quantities
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;
};

} // namespace scoutingRun3
#endif // DataFormats_L1Scouting_L1ScoutingMuon_h
23 changes: 18 additions & 5 deletions DataFormats/L1Scouting/interface/OrbitCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@

#include "DataFormats/Common/interface/traits.h"
#include "FWCore/Utilities/interface/GCCPrerequisite.h"

#include "DataFormats/L1Trigger/interface/Muon.h"
#include "DataFormats/L1Trigger/interface/EGamma.h"
#include "DataFormats/L1Trigger/interface/Jet.h"
#include "DataFormats/L1Trigger/interface/Tau.h"
#include "DataFormats/L1Trigger/interface/EtSum.h"

#include "DataFormats/L1Scouting/interface/L1ScoutingMuon.h"
#include "DataFormats/L1Scouting/interface/L1ScoutingCalo.h"

#include <cstdint>
#include <vector>
Expand All @@ -20,7 +26,7 @@ namespace scoutingRun3 {
// append one object to vector at bx
void addBxObject(int bx, T& object) {
assert(bx<=3564);
bxData_[bx].push_back(object);
bxData_[bx].emplace_back(object);
nObjects_ ++;
}

Expand Down Expand Up @@ -88,10 +94,17 @@ namespace scoutingRun3 {
int nObjects_;
};

typedef OrbitCollection<l1t::Muon> MuonOrbitCollection;

typedef OrbitCollection<ScMuon> ScMuonOrbitCollection;

typedef OrbitCollection<l1t::Muon> MuonOrbitCollection;
typedef OrbitCollection<l1t::Jet> JetOrbitCollection;
typedef OrbitCollection<l1t::EGamma> EGammaOrbitCollection;
typedef OrbitCollection<l1t::Tau> TauOrbitCollection;
typedef OrbitCollection<l1t::EtSum> EtSumOrbitCollection;

typedef OrbitCollection<scoutingRun3::ScMuon> ScMuonOrbitCollection;
typedef OrbitCollection<scoutingRun3::ScJet> ScJetOrbitCollection;
typedef OrbitCollection<scoutingRun3::ScEGamma> ScEGammaOrbitCollection;
typedef OrbitCollection<scoutingRun3::ScTau> ScTauOrbitCollection;
typedef OrbitCollection<scoutingRun3::ScEtSum> ScEtSumOrbitCollection;
}

#endif // DataFormats_L1Scouting_OrbitCollection_h
26 changes: 0 additions & 26 deletions DataFormats/L1Scouting/interface/SDSNumbering.h

This file was deleted.

Loading

0 comments on commit 12b08e1

Please sign in to comment.