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 package DataFormats/L1TCalorimeterPhase2 for Phase2 L1T #29348

Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions DataFormats/L1TCalorimeterPhase2/BuildFile.xml
@@ -0,0 +1,12 @@
<use name="FWCore/Framework"/>
<use name="FWCore/PluginManager"/>
<use name="FWCore/ParameterSet"/>
<use name="DataFormats/Candidate"/>
<use name="DataFormats/Math"/>
<use name="DataFormats/SiPixelDetId"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

are you actually using DataFormats/Math and DataFormats/Math ?

<use name="DataFormats/L1Trigger"/>
<use name="rootrflx"/>
<export>
<lib name="1"/>
</export>

152 changes: 152 additions & 0 deletions DataFormats/L1TCalorimeterPhase2/interface/CaloCrystalCluster.h
@@ -0,0 +1,152 @@
#ifndef DataFormats_L1TCalorimeterPhase2_CaloCrystalsCluster_h
#define DataFormats_L1TCalorimeterPhase2_CaloCrystalsCluster_h

#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include "DataFormats/L1Trigger/interface/L1Candidate.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

namespace l1tp2 {

class CaloCrystalCluster : public l1t::L1Candidate {
public:
CaloCrystalCluster()
: l1t::L1Candidate(),
calibratedPt_(0.),
hovere_(0.),
iso_(0.),
PUcorrPt_(0.),
Copy link
Contributor

Choose a reason for hiding this comment

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

2.9 http://cms-sw.github.io/cms_coding_rules.html
Start data member names with lower case. A trailing “_” is the preferred method to distinguish a data member from the getter method (e.g. momentum_).

bremStrength_(0.),
e2x2_(0.),
e2x5_(0.),
e3x5_(0.),
e5x5_(0.),
standaloneWP_(0.),
electronWP98_(0.),
photonWP80_(0.),
electronWP90_(0.),
looseL1TkMatchWP_(0.),
stage2effMatch_(0.){};

CaloCrystalCluster(const PolarLorentzVector &p4,
float calibratedPt,
float hovere,
float iso,
DetId seedCrystal,
float PUcorrPt = 0.,
float bremStrength = 0.,
float e2x2 = 0.,
float e2x5 = 0.,
float e3x5 = 0.,
float e5x5 = 0.,
bool standaloneWP = false,
bool electronWP98 = false,
bool photonWP80 = false,
bool electronWP90 = false,
bool looseL1TkMatchWP = false,
bool stage2effMatch = false)
: l1t::L1Candidate(p4),
calibratedPt_(calibratedPt),
hovere_(hovere),
iso_(iso),
seedCrystal_(seedCrystal),
PUcorrPt_(PUcorrPt),
bremStrength_(bremStrength),
e2x2_(e2x2),
e2x5_(e2x5),
e3x5_(e3x5),
e5x5_(e5x5),
standaloneWP_(standaloneWP),
electronWP98_(electronWP98),
photonWP80_(photonWP80),
electronWP90_(electronWP90),
looseL1TkMatchWP_(looseL1TkMatchWP),
stage2effMatch_(stage2effMatch){};

virtual ~CaloCrystalCluster(){};
inline float calibratedPt() const { return calibratedPt_; };
inline float hovere() const { return hovere_; };
inline float isolation() const { return iso_; };
inline float PUcorrPt() const { return PUcorrPt_; };
Copy link
Contributor

Choose a reason for hiding this comment

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

@makortel commented

Convention is to start member function names with lowercase letter (2.1 in http://cms-sw.github.io/cms_coding_rules.html)

2.8 in http://cms-sw.github.io/cms_coding_rules.html
Start method names with lowercase, use upper case initials for following words, e.g. collisionPoint().

inline float bremStrength() const { return bremStrength_; };
inline DetId seedCrystal() const { return seedCrystal_; };
void SetCrystalPtInfo(std::vector<float> info) {
std::sort(info.begin(), info.end());
std::reverse(info.begin(), info.end());
crystalPt_ = std::move(info);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

4.3
Header files must not contain any implementation except for class templates and code to be inlined.

Copy link
Contributor

Choose a reason for hiding this comment

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

This function is implicitly inline.

void SetExperimentalParams(const std::map<std::string, float> &params) { experimentalParams_ = params; };
Copy link
Contributor

Choose a reason for hiding this comment

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

2.8 in http://cms-sw.github.io/cms_coding_rules.html
Start method names with lowercase, use upper case initials for following words, e.g. collisionPoint().

const std::map<std::string, float> &getExperimentalParams() const { return experimentalParams_; };
inline float experimentalParam(std::string name) const {
auto iter = experimentalParams_.find(name);
if (iter != experimentalParams_.end()) {
return iter->second;
} else {
edm::LogWarning("CaloCrystalCluster") << "Error: no mapping for ExperimentalParam: " << name << std::endl;
return -99.;
}
};

inline float e2x2() const { return e2x2_; };
inline float e2x5() const { return e2x5_; };
inline float e3x5() const { return e3x5_; };
inline float e5x5() const { return e5x5_; };
inline float standaloneWP() const { return standaloneWP_; };
inline float electronWP98() const { return electronWP98_; };
inline float photonWP80() const { return photonWP80_; };
inline float electronWP90() const { return electronWP90_; };
inline float looseL1TkMatchWP() const { return looseL1TkMatchWP_; };
inline float stage2effMatch() const { return stage2effMatch_; };

// The index range depends on the algorithm eta,phi window, currently 3x5
// The pt should always be ordered.
inline float crystalPt(unsigned int index) const { return (index < crystalPt_.size()) ? crystalPt_[index] : 0.; };

private:
// pT calibrated to Stage-2 (Phase-I) L1EG Objects. NOTE
// all working points are defined with respect to cluster.pt(),
// not cluster.calibratedPt()
float calibratedPt_;
// HCal energy in region behind cluster (for size, look in producer) / ECal energy in cluster
float hovere_;
// ECal isolation (for outer window size, again look in producer)
float iso_;
// DetId of seed crystal used to make cluster (could be EBDetId or EEDetId)
DetId seedCrystal_;
// Pileup-corrected energy deposit, not studied carefully yet, don't use
float PUcorrPt_;
Copy link
Contributor

Choose a reason for hiding this comment

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

2.9 in http://cms-sw.github.io/cms_coding_rules.html
Start data member names with lower case. A trailing “_” is the preferred method to distinguish a data member from the getter method (e.g. momentum_).

// Bremstrahlung strength, should be proportional to the likelihood of a brem.
float bremStrength_;
// Shower shape variable - max 2x2 energy containing seed crystal
float e2x2_;
// Shower shape variable - max 2x5 energy containing seed crystal, phi centered
float e2x5_;
// Shower shape variable - 3x5 energy containing seed crystal, phi centered
float e3x5_;
// Shower shape variable - 5x5 energy containing centered on seed crystal
float e5x5_;
// Standalone L1EG WP
bool standaloneWP_;
// 98% efficient electron WP, for electrons above 35 GeV
bool electronWP98_;
// 80% efficient photon WP, for photons above 35 GeV
bool photonWP80_;
// 90% efficient electron based WP, early rise to efficiency plateau
bool electronWP90_;
// loose isolation and shower shape requirements to be used in conjunction with L1Trk matching
bool looseL1TkMatchWP_;
// Stage-2 L1EG efficiency matched WP, for rate comparisons
bool stage2effMatch_;
// Crystal pt (in order of strength) for all crystals in the cluster
std::vector<float> crystalPt_;
// For investigating novel algorithm parameters
std::map<std::string, float> experimentalParams_;
};

// Concrete collection of output objects (with extra tuning information)
typedef std::vector<l1tp2::CaloCrystalCluster> CaloCrystalClusterCollection;
} // namespace l1tp2
#endif
59 changes: 59 additions & 0 deletions DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h
@@ -0,0 +1,59 @@
#ifndef DataFormats_L1TCalorimeterPhase2_CaloJets_h
#define DataFormats_L1TCalorimeterPhase2_CaloJets_h

#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include "DataFormats/L1Trigger/interface/L1Candidate.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

namespace l1tp2 {

class CaloJet : public l1t::L1Candidate {
public:
CaloJet() : l1t::L1Candidate(), calibratedPt_(0.), hovere_(0.), iso_(0.), pUcorrPt_(0.){};

CaloJet(const PolarLorentzVector& p4, float calibratedPt, float hovere, float iso, float PUcorrPt = 0.)
: l1t::L1Candidate(p4), calibratedPt_(calibratedPt), hovere_(hovere), iso_(iso), pUcorrPt_(PUcorrPt){};

inline float calibratedPt() const { return calibratedPt_; };
inline float hovere() const { return hovere_; };
inline float isolation() const { return iso_; };
inline float pUcorrPt() const { return pUcorrPt_; };
std::vector<std::vector<float>>& associated_l1EGs() { return associated_l1EGs_; };

void setExperimentalParams(const std::map<std::string, float>& params) { experimentalParams_ = params; };
void setAssociated_l1EGs(const std::vector<std::vector<float>> l1EGs) { associated_l1EGs_ = l1EGs; };

const std::map<std::string, float>& experimentalParams() const { return experimentalParams_; };

inline float experimentalParam(std::string const& name) const {
auto iter = experimentalParams_.find(name);
if (iter != experimentalParams_.end()) {
return iter->second;
} else {
edm::LogWarning("CaloJet") << "Error: no mapping for ExperimentalParam: " << name << std::endl;
return -99.;
}
};

private:
// pT calibrated to get
float calibratedPt_;
// HCal energy in region behind cluster (for size, look in producer) / ECal energy in cluster
float hovere_;
// ECal isolation (for outer window size, again look in producer)
float iso_;
// Pileup-corrected energy deposit, not studied carefully yet, don't use
float pUcorrPt_;
// For investigating novel algorithm parameters
std::map<std::string, float> experimentalParams_;
// For decay mode related checks with CaloTaus
std::vector<std::vector<float>> associated_l1EGs_;
};

// Concrete collection of output objects (with extra tuning information)
typedef std::vector<l1tp2::CaloJet> CaloJetsCollection;
} // namespace l1tp2
#endif
86 changes: 86 additions & 0 deletions DataFormats/L1TCalorimeterPhase2/interface/CaloTower.h
@@ -0,0 +1,86 @@
// Description: Collection representing remaining ECAL energy post-L1EG clustering
// and the associated HCAL tower. The ECAL crystal TPs "simEcalEBTriggerPrimitiveDigis"
// within a 5x5 tower region are clustered to retain this ECAL energy info for passing
// to the GCT or further algos. The HCAL energy from the "simHcalTriggerPrimitiveDigis"
// is not specifically used in the L1EG algo beyond H/E, so the HCAL values here
// correspond to the full, initial HCAL TP energy.

#ifndef DataFormats_L1TCalorimeterPhase2_CaloTower_HH
#define DataFormats_L1TCalorimeterPhase2_CaloTower_HH

#include <vector>
#include "DataFormats/L1Trigger/interface/L1Candidate.h"

namespace l1tp2 {

class CaloTower : public l1t::L1Candidate {
public:
CaloTower()
: l1t::L1Candidate(),
ecalTowerEt_(0.0),
hcalTowerEt_(0.0),
towerIPhi_(-99),
towerIEta_(-99),
towerPhi_(-99),
towerEta_(-99),
l1egTowerEt_(0.0),
nL1eg_(0),
l1egTrkSS_(0),
l1egTrkIso_(0),
l1egStandaloneSS_(0),
l1egStandaloneIso_(0),
isBarrel_(false){};

public:
inline float ecalTowerEt() const { return ecalTowerEt_; };
inline float hcalTowerEt() const { return hcalTowerEt_; };
inline int towerIPhi() const { return towerIPhi_; };
inline int towerIEta() const { return towerIEta_; };
inline float towerPhi() const { return towerPhi_; };
inline float towerEta() const { return towerEta_; };
inline float l1egTowerEt() const { return l1egTowerEt_; };
inline int nL1eg() const { return nL1eg_; };
inline int l1egTrkSS() const { return l1egTrkSS_; };
inline int l1egTrkIso() const { return l1egTrkIso_; };
inline int l1egStandaloneSS() const { return l1egStandaloneSS_; };
inline int l1egStandaloneIso() const { return l1egStandaloneIso_; };
inline bool isBarrel() const { return isBarrel_; };

void setEcalTowerEt(float et) { ecalTowerEt_ = et; };
void setHcalTowerEt(float et) { hcalTowerEt_ = et; };
void setTowerIPhi(int iPhi) { towerIPhi_ = iPhi; };
void setTowerIEta(int iEta) { towerIEta_ = iEta; };
void setTowerPhi(float phi) { towerPhi_ = phi; };
void setTowerEta(float eta) { towerEta_ = eta; };
void setL1egTowerEt(float et) { l1egTowerEt_ = et; };
void setNL1eg(int n) { nL1eg_ = n; };
void setL1egTrkSS(int trkSS) { l1egTrkSS_ = trkSS; };
void setL1egTrkIso(int trkIso) { l1egTrkIso_ = trkIso; };
void setL1egStandaloneSS(int staSS) { l1egStandaloneSS_ = staSS; };
void setL1egStandaloneIso(int staIso) { l1egStandaloneIso_ = staIso; };
void setIsBarrel(bool isBarrel) { isBarrel_ = isBarrel; };

private:
float ecalTowerEt_ = 0.0;
float hcalTowerEt_ = 0.0;
int towerIPhi_ = -99;
int towerIEta_ = -99;
float towerPhi_ = -99;
float towerEta_ = -99;

// L1EG info
float l1egTowerEt_ = 0.0;
int nL1eg_ = 0;
int l1egTrkSS_ = 0;
int l1egTrkIso_ = 0;
int l1egStandaloneSS_ = 0;
int l1egStandaloneIso_ = 0;

bool isBarrel_ = false;
};

// Collection of either ECAL or HCAL TPs with the Layer1 calibration constant attached, et_calibration
typedef std::vector<CaloTower> CaloTowerCollection;

} // namespace l1tp2
#endif
13 changes: 13 additions & 0 deletions DataFormats/L1TCalorimeterPhase2/src/classes.h
@@ -0,0 +1,13 @@
/// ////////////////////////////////////////
/// Stacked Tracker Simulations ///
/// ////////////////////////////////////////

#include "DataFormats/Common/interface/Wrapper.h"

/*********************/
/** L1 CALO TRIGGER **/
/*********************/

#include "DataFormats/L1TCalorimeterPhase2/interface/CaloCrystalCluster.h"
#include "DataFormats/L1TCalorimeterPhase2/interface/CaloTower.h"
#include "DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h"
29 changes: 29 additions & 0 deletions DataFormats/L1TCalorimeterPhase2/src/classes_def.xml
@@ -0,0 +1,29 @@
<!-- *********************************** -->
<!-- Phase-2 Calo data dictionaries -->
<!-- *********************************** -->

<lcgdict>

<class name="l1tp2::CaloCrystalCluster" ClassVersion="3">
<version ClassVersion="3" checksum="203754523"/>
</class>
<class name="std::vector<l1tp2::CaloCrystalCluster>" />
<class name="l1tp2::CaloCrystalClusterCollection" />
<class name="edm::Wrapper<l1tp2::CaloCrystalClusterCollection>" />

<class name="l1tp2::CaloTower" ClassVersion="3">
<version ClassVersion="3" checksum="2608605419"/>
</class>
<class name="std::vector<l1tp2::CaloTower>" />
<class name="l1tp2::CaloTowerCollection" />
<class name="edm::Wrapper<l1tp2::CaloTowerCollection>" />

<class name="l1tp2::CaloJet" ClassVersion="3">
<version ClassVersion="3" checksum="3671674640"/>
</class>
<class name="std::vector<l1tp2::CaloJet>" />
<class name="l1tp2::CaloJetsCollection" />
<class name="edm::Wrapper<l1tp2::CaloJetsCollection>" />

</lcgdict>