Skip to content

Commit

Permalink
Merge pull request cms-sw#3 from vshang/test_CaloTaus_13_2_0
Browse files Browse the repository at this point in the history
Added GCTTaus to code.
  • Loading branch information
pallabidas authored Sep 14, 2023
2 parents c6b7835 + 64adb2f commit 61342e4
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 11 deletions.
9 changes: 8 additions & 1 deletion DataFormats/L1TCalorimeterPhase2/interface/Phase2L1CaloJet.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace l1tp2 {
Phase2L1CaloJet()
: l1t::L1Candidate(),
jetEt_(0.),
tauEt_(0.),
jetIEta_(-99),
jetIPhi_(-99),
jetEta_(-99.),
Expand All @@ -27,7 +28,8 @@ namespace l1tp2 {

Phase2L1CaloJet(const PolarLorentzVector& p4,
float jetEt,
int jetIEta,
float tauEt,
int jetIEta,
int jetIPhi,
float jetEta,
float jetPhi,
Expand All @@ -38,6 +40,7 @@ namespace l1tp2 {
float towerPhi)
: l1t::L1Candidate(p4),
jetEt_(jetEt),
tauEt_(tauEt),
jetIEta_(jetIEta),
jetIPhi_(jetIPhi),
jetEta_(jetEta),
Expand All @@ -49,6 +52,7 @@ namespace l1tp2 {
towerPhi_(towerPhi){};

inline float jetEt() const { return jetEt_; };
inline float tauEt() const { return tauEt_; };
inline int jetIEta() const { return jetIEta_; };
inline int jetIPhi() const { return jetIPhi_; };
inline float jetEta() const { return jetEta_; };
Expand All @@ -60,6 +64,7 @@ namespace l1tp2 {
inline float towerPhi() const { return towerPhi_; };

void setJetEt(float jetEtIn) { jetEt_ = jetEtIn; };
void setTauEt(float tauEtIn) { tauEt_ = tauEtIn; };
void setJetIEta(int jetIEtaIn) { jetIEta_ = jetIEtaIn; };
void setJetIPhi(int jetIPhiIn) { jetIPhi_ = jetIPhiIn; };
void setJetEta(float jetEtaIn) { jetEta_ = jetEtaIn; };
Expand All @@ -73,6 +78,8 @@ namespace l1tp2 {
private:
// ET
float jetEt_;
// Tau ET
float tauEt_;
// GCT ieta
int jetIEta_;
// GCT iphi
Expand Down
4 changes: 2 additions & 2 deletions DataFormats/L1TCalorimeterPhase2/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
<class name="l1tp2::CaloPFClusterCollection" />
<class name="edm::Wrapper<l1tp2::CaloPFClusterCollection>" />

<class name="l1tp2::Phase2L1CaloJet" ClassVersion="3">
<version ClassVersion="3" checksum="2152918872"/>
<class name="l1tp2::Phase2L1CaloJet" ClassVersion="4">
<version ClassVersion="4" checksum="289384850"/>
</class>
<class name="std::vector<l1tp2::Phase2L1CaloJet>" />
<class name="l1tp2::Phase2L1CaloJetCollection" />
Expand Down
15 changes: 13 additions & 2 deletions L1Trigger/L1CaloTrigger/interface/Phase2L1CaloJetEmulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class jetInfo{
public:
float seedEnergy;
float energy;
float tauEt;
int phi;
int eta;
float energyMax;
Expand All @@ -63,6 +64,7 @@ class jetInfo{
jetInfo(){
seedEnergy = 0;
energy = 0;
tauEt = 0;
phi = 0;
eta = 0;
energyMax = 0;
Expand All @@ -75,6 +77,7 @@ class jetInfo{
jetInfo& operator=(const jetInfo& rhs){
seedEnergy = rhs.seedEnergy;
energy = rhs.energy;
tauEt = rhs.tauEt;
phi = rhs.phi;
eta = rhs.eta;
energyMax = rhs.energyMax;
Expand Down Expand Up @@ -366,6 +369,7 @@ jetInfo getJetPosition(GCTsupertower_t temp[nSTEta][nSTPhi]){

jet.seedEnergy = peakIn6.energy;
jet.energy = 0;
jet.tauEt = 0;
jet.eta = peakIn6.eta;
jet.phi = peakIn6.phi;
jet.energyMax = peakIn6.energyMax;
Expand Down Expand Up @@ -414,6 +418,7 @@ jetInfo getJetValues(GCTsupertower_t tempX[nSTEta][nSTPhi], int seed_eta, int se
}

jet_tmp.energy = eta_slice[0] + eta_slice[1] + eta_slice[2] ;
jet_tmp.tauEt = eta_slice[1]; //set tau Pt to be sum of ST energies in center eta slice */
// To find the jet centre: note that seed supertower is always (1, 1)
jet_tmp.etaCenter = 3*seed_eta + tempX[seed_eta][seed_phi].centerEta; //this is the ET weighted eta centre of the ST
jet_tmp.phiCenter = 3*seed_phi + tempX[seed_eta][seed_phi].centerPhi; //this is the ET weighted phi centre of the ST
Expand All @@ -439,8 +444,14 @@ jetInfo getRegion(GCTsupertower_t temp[nSTEta][nSTPhi]){
int seed_eta = jet_tmp.eta ;
float seed_energy = jet_tmp.seedEnergy ;
jet = getJetValues(temp, seed_eta, seed_phi) ;
if(seed_energy > 10.) jet_tmp.energy = jet.energy; // suppress <= 10 GeV ST as seed
else jet_tmp.energy = 0.;
if(seed_energy > 10.) { // suppress <= 10 GeV ST as seed
jet_tmp.energy = jet.energy;
jet_tmp.tauEt = jet.tauEt;
}
else {
jet_tmp.energy = 0.;
jet_tmp.tauEt = 0.;
}
jet_tmp.etaCenter = jet.etaCenter; // this is the ET weighted eta centre of the ST
jet_tmp.phiCenter = jet.phiCenter; // this is the ET weighted eta centre of the ST
jet_tmp.etaMax = jet.etaMax; // this is the leading tower eta in the ST
Expand Down
13 changes: 13 additions & 0 deletions L1Trigger/L1CaloTrigger/plugins/Phase2L1CaloJetEmulator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ void Phase2L1CaloJetEmulator::produce(edm::Event& iEvent, const edm::EventSetup&
jet[i] = getRegion(tempST);
l1tp2::Phase2L1CaloJet tempJet;
tempJet.setJetEt(jet[i].energy);
tempJet.setTauEt(jet[i].tauEt);
int gctjeteta = jet[i].etaCenter;
int gctjetphi = jet[i].phiCenter;
tempJet.setJetIEta(gctjeteta+k*nBarrelEta/2);
Expand Down Expand Up @@ -272,6 +273,7 @@ void Phase2L1CaloJetEmulator::produce(edm::Event& iEvent, const edm::EventSetup&
jet[i] = getRegion(tempST_hgcal);
l1tp2::Phase2L1CaloJet tempJet;
tempJet.setJetEt(jet[i].energy);
tempJet.setTauEt(jet[i].tauEt);
int hgcaljeteta = jet[i].etaCenter;
int hgcaljetphi = jet[i].phiCenter;
tempJet.setJetIEta(hgcaljeteta+k*nHgcalEta/2);
Expand Down Expand Up @@ -313,6 +315,7 @@ void Phase2L1CaloJetEmulator::produce(edm::Event& iEvent, const edm::EventSetup&
jet[i] = getRegion(tempST_hf);
l1tp2::Phase2L1CaloJet tempJet;
tempJet.setJetEt(jet[i].energy);
tempJet.setTauEt(jet[i].tauEt);
int hfjeteta = jet[i].etaCenter;
int hfjetphi = jet[i].phiCenter;
tempJet.setJetIEta(hfjeteta+k*nHfEta/2);
Expand Down Expand Up @@ -352,9 +355,12 @@ void Phase2L1CaloJetEmulator::produce(edm::Event& iEvent, const edm::EventSetup&
float barrel_ieta = nHgcalEta/2 + halfBarrelJets.at(j).jetIEta();
if (abs(barrel_ieta - hgcal_ieta) < 3 && abs(halfBarrelJets.at(j).jetIPhi() - halfHgcalJets.at(i).jetIPhi()) < 3) {
float totalet = halfBarrelJets.at(j).jetEt() + halfHgcalJets.at(i).jetEt();
float totalTauEt = halfBarrelJets.at(j).tauEt() + halfHgcalJets.at(i).tauEt();
if (halfBarrelJets.at(j).jetEt() > halfHgcalJets.at(i).jetEt()) {
halfHgcalJets.at(i).setJetEt(0.);
halfHgcalJets.at(i).setTauEt(0.);
halfBarrelJets.at(j).setJetEt(totalet);
halfBarrelJets.at(j).setTauEt(totalTauEt);
reco::Candidate::PolarLorentzVector tempJetp4;
tempJetp4.SetPt(totalet);
tempJetp4.SetEta(halfBarrelJets.at(j).jetEta());
Expand All @@ -364,7 +370,9 @@ void Phase2L1CaloJetEmulator::produce(edm::Event& iEvent, const edm::EventSetup&
}
else {
halfHgcalJets.at(i).setJetEt(totalet);
halfHgcalJets.at(i).setTauEt(totalTauEt);
halfBarrelJets.at(j).setJetEt(0.);
halfBarrelJets.at(j).setTauEt(0.);
reco::Candidate::PolarLorentzVector tempJetp4;
tempJetp4.SetPt(totalet);
tempJetp4.SetEta(halfHgcalJets.at(i).jetEta());
Expand All @@ -381,9 +389,12 @@ void Phase2L1CaloJetEmulator::produce(edm::Event& iEvent, const edm::EventSetup&
float hf_ieta = k*nBarrelEta + k*nHgcalEta + halfHfJets.at(j).jetIEta();
if(abs(hgcal_ieta - hf_ieta) < 3 && abs(halfHfJets.at(j).jetIPhi() - halfHgcalJets.at(i).jetIPhi()) < 3) {
float totalet = halfHfJets.at(j).jetEt() + halfHgcalJets.at(i).jetEt();
float totalTauEt = halfHfJets.at(j).tauEt() + halfHgcalJets.at(i).tauEt();
if (halfHfJets.at(j).jetEt() > halfHgcalJets.at(i).jetEt()) {
halfHgcalJets.at(i).setJetEt(0.);
halfHgcalJets.at(i).setTauEt(0.);
halfHfJets.at(j).setJetEt(totalet);
halfHfJets.at(j).setTauEt(totalTauEt);
reco::Candidate::PolarLorentzVector tempJetp4;
tempJetp4.SetPt(totalet);
tempJetp4.SetEta(halfHfJets.at(j).jetEta());
Expand All @@ -393,7 +404,9 @@ void Phase2L1CaloJetEmulator::produce(edm::Event& iEvent, const edm::EventSetup&
}
else {
halfHgcalJets.at(i).setJetEt(totalet);
halfHgcalJets.at(i).setTauEt(totalTauEt);
halfHfJets.at(j).setJetEt(0.);
halfHfJets.at(j).setTauEt(0.);
reco::Candidate::PolarLorentzVector tempJetp4;
tempJetp4.SetPt(totalet);
tempJetp4.SetEta(halfHgcalJets.at(i).jetEta());
Expand Down
19 changes: 13 additions & 6 deletions L1Trigger/L1CaloTrigger/python/L1CaloJets_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# This cff file is based off of the L1T Phase-2 Menu group using
# the process name "REPR"

from L1Trigger.L1CaloTrigger.l1tPhase2L1CaloEGammaEmulator_cfi import *


# --------------------------------------------------------------------------------------------
#
Expand All @@ -18,17 +20,20 @@

from L1Trigger.L1CaloTrigger.l1tTowerCalibrationProducer_cfi import *
l1tTowerCalibrationProducer.L1HgcalTowersInputTag = cms.InputTag("l1tHGCalTowerProducer","HGCalTowerProcessor","")
l1tTowerCalibrationProducer.l1CaloTowers = cms.InputTag("l1tEGammaClusterEmuProducer","L1CaloTowerCollection","")
#l1tTowerCalibrationProducer.l1CaloTowers = cms.InputTag("l1tEGammaClusterEmuProducer","L1CaloTowerCollection","")
l1tTowerCalibrationProducer.l1CaloTowers = cms.InputTag("l1tPhase2L1CaloEGammaEmulator","GCTFullTowers","")



# --------------------------------------------------------------------------------------------
#
# ---- Produce the L1CaloJets

from L1Trigger.L1CaloTrigger.l1tCaloJetProducer_cfi import *
l1tCaloJetProducer.l1CaloTowers = cms.InputTag("l1tTowerCalibrationProducer","L1CaloTowerCalibratedCollection","")
l1tCaloJetProducer.L1CrystalClustersInputTag = cms.InputTag("l1tEGammaClusterEmuProducer", "L1EGXtalClusterEmulator","")
# from L1Trigger.L1CaloTrigger.l1tCaloJetProducer_cfi import *
# l1tCaloJetProducer.l1CaloTowers = cms.InputTag("l1tTowerCalibrationProducer","L1CaloTowerCalibratedCollection","")
# l1tCaloJetProducer.L1CrystalClustersInputTag = cms.InputTag("l1tEGammaClusterEmuProducer", "L1EGXtalClusterEmulator","")
from L1Trigger.L1CaloTrigger.l1tPhase2CaloJetEmulator_cfi import *
l1tPhase2CaloJetEmulator.gctFullTowers = cms.InputTag("l1tPhase2L1CaloEGammaEmulator","GCTFullTowers")



Expand All @@ -41,8 +46,10 @@


L1TCaloJetsSequence = cms.Sequence(
l1tEGammaClusterEmuProducer *
#l1tEGammaClusterEmuProducer *
l1tPhase2L1CaloEGammaEmulator*
l1tTowerCalibrationProducer *
l1tCaloJetProducer *
#l1tCaloJetProducer *
l1tPhase2CaloJetEmulator*
l1tCaloJetHTTProducer
)

0 comments on commit 61342e4

Please sign in to comment.