CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
L1NNCaloTauEmulator Class Reference
Inheritance diagram for L1NNCaloTauEmulator:
edm::stream::EDProducer< edm::GlobalCache< NNmodels_GlobalCache > >

Classes

class  InputHGCluster
 
class  InputTowerCluster
 
class  InputTowerCluster_pstn
 
class  SimpleHGCluster
 
class  SimpleTowerHit
 
class  SimplifiedTower
 

Public Member Functions

 L1NNCaloTauEmulator (const edm::ParameterSet &, const NNmodels_GlobalCache *)
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< NNmodels_GlobalCache > >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static void globalEndJob (const NNmodels_GlobalCache *)
 
static std::unique_ptr< NNmodels_GlobalCacheinitializeGlobalCache (const edm::ParameterSet &)
 

Private Types

typedef ap_ufixed< CALIBPT_W, CALIBPT_I, AP_TRN, AP_SAT > CalibPt_t
 
typedef ap_int< DETAPHI_WdEtaPhi_t
 
typedef ap_int< DIETAPHI_WdIEtaPhi_t
 
typedef ap_ufixed< ET_W, ET_I, AP_TRN, AP_SAT > Et_t
 
typedef ap_int< ETAPHI_WEtaPhi_t
 
typedef ap_ufixed< ID_W, ID_I, AP_TRN, AP_SAT > Id_t
 
typedef ap_int< IETAPHI_WIEta_t
 
typedef ap_uint< IETAPHI_WIPhi_t
 
typedef ap_uint< MEANZ_WMeanz_t
 
typedef ap_ufixed< PT_W, PT_I, AP_TRN, AP_SAT > Pt_t
 
typedef ap_int< PUID_WPUid_t
 
typedef ap_uint< SHAPEFEAT_WShapeFeat_t
 
typedef ap_uint< SHOWLEN_WShowLen_t
 
enum  UseEmInterp { UseEmInterp::No, UseEmInterp::EmOnly, UseEmInterp::AllKeepHad, UseEmInterp::AllKeepTot }
 

Private Member Functions

template<int W>
ap_int< W > ap_abs (ap_int< W > x)
 
template<int W, int I, ap_q_mode _AP_Q, ap_o_mode _AP_O>
ap_ufixed< W, I > ap_abs (ap_fixed< W, I, _AP_Q, _AP_O > x)
 
float apfixedQuantizer (float inputF, float LSB, int nbits)
 
int apintQuantizer (float inputF, float LSB, int nbits)
 
float correctInputEtaCl3d (float eta)
 
float correctInputMeanzCl3d (float meanz)
 
template<class outPrecision , class inPrecision >
outPrecision dPhi (inPrecision iPhi_1, inPrecision iPhi_2)
 
float floatEt (Et_t et)
 
float floatEta (EtaPhi_t eta)
 
float floatIEta (IEta_t eta)
 
float floatIPhi (IPhi_t phi)
 
float floatMeanZ (Meanz_t meanz)
 
float floatMeanZHgcalCoord (Meanz_t meanz)
 
float floatPhi (EtaPhi_t phi)
 
float floatPt (Pt_t pt)
 
float floatPuId (PUid_t pu)
 
float floatShape (ShapeFeat_t shape)
 
float floatSzz (ShapeFeat_t szz)
 
float inputScaler (float inputF, std::string feature)
 
IEta_t makeEndcapHwIEta (float eta)
 
IPhi_t makeEndcapHwIPhi (float phi)
 
l1t::Tau MakeTauCandidate (bool isBarrel, int clNxMIdx, std::vector< tensorflow::Tensor > outputsIdent, std::vector< tensorflow::Tensor > outputsCalib, std::vector< InputTowerCluster_pstn > clustersNxM_pstn)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
dIEtaPhi_t tower_dIEta (IEta_t iEta_1, IEta_t iEta_2)
 
dEtaPhi_t tw2cl_dEta (EtaPhi_t iEta_1, IEta_t iEta_2)
 
dEtaPhi_t tw2cl_dPhi (EtaPhi_t iPhi_1, IPhi_t iPhi_2)
 

Private Attributes

double CB_CE_split
 
bool DEBUG
 
double EcalEtMinForClustering
 
const int Eta_limit = 33
 
double EtaRestriction
 
double EtMinForSeeding
 
double HcalEtMinForClustering
 
edm::Handle< l1t::HGCalTowerBxCollectionhgcalTowersHandle
 
edm::EDGetToken hgcalTowersToken
 
edm::Handle< l1t::HGCalMulticlusterBxCollectionHGClusterHandle
 
edm::EDGetTokenT< l1t::HGCalMulticlusterBxCollectionHGClusterToken
 
double IdWp90_CB
 
double IdWp90_CE
 
double IdWp95_CB
 
double IdWp95_CE
 
double IdWp99_CB
 
double IdWp99_CE
 
const int IEta_dim = 5
 
IEta_t intCB_CE_split
 
IEta_t intEtaRestriction
 
PUid_t intPuidThr
 
const int IPhi_dim = 9
 
edm::Handle< l1tp2::CaloTowerCollectionl1CaloTowerHandle
 
edm::EDGetTokenT< l1tp2::CaloTowerCollectionl1TowersToken
 
StringCutObjectSelector< l1t::HGCalMulticlusterpreEmId
 
double PuidThr
 
UseEmInterp scenario
 
const int seedIdx = 22
 
l1tpf::HGC3DClusterEgID VsPuId
 

Static Private Attributes

static constexpr int CALIBPT_I = 9
 
static constexpr int CALIBPT_W = 10
 
static constexpr float CM2MM = 10
 
static constexpr int DETAPHI_W = 12
 
static constexpr int DIETAPHI_W = 8
 
static constexpr int ET_I = 8
 
static constexpr int ET_W = 10
 
static constexpr float ETAHGCAL_OFFSET = 1.321
 
static constexpr float ETAPHI_LSB = M_PI / FINEINTPHI_PI
 
static constexpr int ETAPHI_W = 11
 
static constexpr int FINEINTPHI_2PI = 2 * FINEINTPHI_PI
 
static constexpr int FINEINTPHI_PI = 720
 
static constexpr int ID_I = 1
 
static constexpr int ID_W = 8
 
static constexpr float IETAHGCAL_LSB = 0.0845
 
static constexpr float IETAHGCAL_LSBp = 0.0808
 
static constexpr int IETAHGCAL_OFFSET = 17
 
static constexpr float IETAPHI_LSB = M_PI / INTPHI_PI
 
static constexpr int IETAPHI_W = 7
 
static constexpr int INTPHI_2PI = 2 * INTPHI_PI
 
static constexpr int INTPHI_PI = 36
 
static constexpr float MEANZ_LSB = 0.5
 
static constexpr float MEANZ_OFFSET = 321.05
 
static constexpr int MEANZ_W = 12
 
static constexpr int PT_I = 12
 
static constexpr int PT_W = 14
 
static constexpr float PTET_LSB = 0.25
 
static constexpr float PUID_LSB = 0.00390625
 
static constexpr int PUID_W = 9
 
static constexpr int R2cone = 0.25 / ETAPHI_LSB / ETAPHI_LSB
 
static constexpr float SHAPEFEAT_LSB = 0.0000153
 
static constexpr int SHAPEFEAT_W = 16
 
static constexpr int SHOWLEN_W = 6
 
static constexpr float SZZ_LSB = SHAPEFEAT_LSB * 100
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< NNmodels_GlobalCache > >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 104 of file L1NNCaloTauEmulator.cc.

Member Typedef Documentation

◆ CalibPt_t

typedef ap_ufixed<CALIBPT_W, CALIBPT_I, AP_TRN, AP_SAT> L1NNCaloTauEmulator::CalibPt_t
private

Definition at line 158 of file L1NNCaloTauEmulator.cc.

◆ dEtaPhi_t

typedef ap_int<DETAPHI_W> L1NNCaloTauEmulator::dEtaPhi_t
private

Definition at line 163 of file L1NNCaloTauEmulator.cc.

◆ dIEtaPhi_t

Definition at line 162 of file L1NNCaloTauEmulator.cc.

◆ Et_t

typedef ap_ufixed<ET_W, ET_I, AP_TRN, AP_SAT> L1NNCaloTauEmulator::Et_t
private

Definition at line 156 of file L1NNCaloTauEmulator.cc.

◆ EtaPhi_t

typedef ap_int<ETAPHI_W> L1NNCaloTauEmulator::EtaPhi_t
private

Definition at line 165 of file L1NNCaloTauEmulator.cc.

◆ Id_t

typedef ap_ufixed<ID_W, ID_I, AP_TRN, AP_SAT> L1NNCaloTauEmulator::Id_t
private

Definition at line 159 of file L1NNCaloTauEmulator.cc.

◆ IEta_t

typedef ap_int<IETAPHI_W> L1NNCaloTauEmulator::IEta_t
private

Definition at line 167 of file L1NNCaloTauEmulator.cc.

◆ IPhi_t

typedef ap_uint<IETAPHI_W> L1NNCaloTauEmulator::IPhi_t
private

Definition at line 166 of file L1NNCaloTauEmulator.cc.

◆ Meanz_t

typedef ap_uint<MEANZ_W> L1NNCaloTauEmulator::Meanz_t
private

Definition at line 168 of file L1NNCaloTauEmulator.cc.

◆ Pt_t

typedef ap_ufixed<PT_W, PT_I, AP_TRN, AP_SAT> L1NNCaloTauEmulator::Pt_t
private

Definition at line 155 of file L1NNCaloTauEmulator.cc.

◆ PUid_t

typedef ap_int<PUID_W> L1NNCaloTauEmulator::PUid_t
private

Definition at line 169 of file L1NNCaloTauEmulator.cc.

◆ ShapeFeat_t

Definition at line 161 of file L1NNCaloTauEmulator.cc.

◆ ShowLen_t

typedef ap_uint<SHOWLEN_W> L1NNCaloTauEmulator::ShowLen_t
private

Definition at line 164 of file L1NNCaloTauEmulator.cc.

Member Enumeration Documentation

◆ UseEmInterp

Enumerator
No 
EmOnly 
AllKeepHad 
AllKeepTot 

Definition at line 222 of file L1NNCaloTauEmulator.cc.

222 { No, EmOnly, AllKeepHad, AllKeepTot };

Constructor & Destructor Documentation

◆ L1NNCaloTauEmulator()

L1NNCaloTauEmulator::L1NNCaloTauEmulator ( const edm::ParameterSet iConfig,
const NNmodels_GlobalCache globalCache 
)
explicit

Definition at line 402 of file L1NNCaloTauEmulator.cc.

References apintQuantizer(), CB_CE_split, EcalEtMinForClustering, EtaRestriction, EtMinForSeeding, HcalEtMinForClustering, IETAPHI_LSB, IETAPHI_W, intCB_CE_split, intEtaRestriction, intPuidThr, l1tpf::HGC3DClusterEgID::method(), l1tpf::HGC3DClusterEgID::prepareTMVA(), PUID_LSB, PUID_W, PuidThr, and VsPuId.

403  : l1TowersToken(consumes<l1tp2::CaloTowerCollection>(iConfig.getParameter<edm::InputTag>("l1CaloTowers"))),
404  hgcalTowersToken(consumes<l1t::HGCalTowerBxCollection>(iConfig.getParameter<edm::InputTag>("hgcalTowers"))),
405 
407  consumes<l1t::HGCalMulticlusterBxCollection>(iConfig.getParameter<edm::InputTag>("HgcalClusters"))),
409  preEmId(iConfig.getParameter<std::string>("preEmId")),
410  VsPuId(iConfig.getParameter<edm::ParameterSet>("VsPuId")),
411 
412  EcalEtMinForClustering(iConfig.getParameter<double>("EcalEtMinForClustering")),
413  HcalEtMinForClustering(iConfig.getParameter<double>("HcalEtMinForClustering")),
414  EtMinForSeeding(iConfig.getParameter<double>("EtMinForSeeding")),
415  EtaRestriction(iConfig.getParameter<double>("EtaRestriction")),
416  CB_CE_split(iConfig.getParameter<double>("CB_CE_split")),
417  PuidThr(iConfig.getParameter<double>("PuidThr")),
418 
419  IdWp90_CB(iConfig.getParameter<double>("IdWp90_CB")),
420  IdWp95_CB(iConfig.getParameter<double>("IdWp95_CB")),
421  IdWp99_CB(iConfig.getParameter<double>("IdWp99_CB")),
422 
423  IdWp90_CE(iConfig.getParameter<double>("IdWp90_CE")),
424  IdWp95_CE(iConfig.getParameter<double>("IdWp95_CE")),
425  IdWp99_CE(iConfig.getParameter<double>("IdWp99_CE")),
426 
427  DEBUG(iConfig.getParameter<bool>("DEBUG")) {
428  // Initialize HGCAL BDTs
429  if (!VsPuId.method().empty()) {
431  }
432 
436 
437  // Create produced outputs
438  produces<BXVector<l1t::Tau>>("L1NNCaloTauCollectionBXV");
439 
440  // Settings output
441  edm::LogInfo("Settings") << "EtaRestriction = " << EtaRestriction << " (" << intEtaRestriction << ")"
442  << " , CB_CE_split = " << CB_CE_split << "(" << intCB_CE_split
443  << ") , EtMinForSeeding = " << EtMinForSeeding
444  << " , HcalTpEtMin = " << HcalEtMinForClustering
445  << " , EcalTpEtMin = " << EcalEtMinForClustering << " , PuidThr = " << PuidThr << "("
446  << intPuidThr << ")" << std::endl;
447 }
edm::EDGetToken hgcalTowersToken
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
static constexpr int PUID_W
int apintQuantizer(float inputF, float LSB, int nbits)
StringCutObjectSelector< l1t::HGCalMulticluster > preEmId
l1tpf::HGC3DClusterEgID VsPuId
Log< level::Info, false > LogInfo
static constexpr float PUID_LSB
static constexpr int IETAPHI_W
edm::EDGetTokenT< l1t::HGCalMulticlusterBxCollection > HGClusterToken
static constexpr float IETAPHI_LSB
edm::EDGetTokenT< l1tp2::CaloTowerCollection > l1TowersToken

Member Function Documentation

◆ ap_abs() [1/2]

template<int W>
ap_int< W > L1NNCaloTauEmulator::ap_abs ( ap_int< W >  x)
private

Definition at line 925 of file L1NNCaloTauEmulator.cc.

References mps_fire::result, and x.

Referenced by produce().

925  {
926  ap_int<W> result;
927  if (x < 0) {
928  result = -x;
929  } else {
930  result = x;
931  }
932 
933  return result;
934 }

◆ ap_abs() [2/2]

template<int W, int I, ap_q_mode _AP_Q, ap_o_mode _AP_O>
ap_ufixed< W, I > L1NNCaloTauEmulator::ap_abs ( ap_fixed< W, I, _AP_Q, _AP_O >  x)
private

Definition at line 937 of file L1NNCaloTauEmulator.cc.

References mps_fire::result, and x.

937  {
938  ap_ufixed<W, I> result;
939  if (x < 0) {
940  result = -x;
941  } else {
942  result = x;
943  }
944 
945  return result;
946 }

◆ apfixedQuantizer()

float L1NNCaloTauEmulator::apfixedQuantizer ( float  inputF,
float  LSB,
int  nbits 
)
private

Definition at line 948 of file L1NNCaloTauEmulator.cc.

References SiStripPI::min, and funct::pow().

Referenced by produce().

948  {
949  return min(floor(inputF / LSB), float(pow(2, nbits) - 1)) * LSB;
950 }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ apintQuantizer()

int L1NNCaloTauEmulator::apintQuantizer ( float  inputF,
float  LSB,
int  nbits 
)
private

Definition at line 952 of file L1NNCaloTauEmulator.cc.

References SiStripPI::min, and funct::pow().

Referenced by L1NNCaloTauEmulator(), and produce().

952  {
953  return min(floor(inputF / LSB), float(pow(2, nbits) - 1));
954 }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ correctInputEtaCl3d()

float L1NNCaloTauEmulator::correctInputEtaCl3d ( float  eta)
private

Definition at line 963 of file L1NNCaloTauEmulator.cc.

References PVValHelper::eta, and ETAHGCAL_OFFSET.

Referenced by produce().

963  {
964  return eta > 0 ? eta - ETAHGCAL_OFFSET : eta + ETAHGCAL_OFFSET;
965 }
static constexpr float ETAHGCAL_OFFSET

◆ correctInputMeanzCl3d()

float L1NNCaloTauEmulator::correctInputMeanzCl3d ( float  meanz)
private

Definition at line 967 of file L1NNCaloTauEmulator.cc.

References funct::abs(), CM2MM, and MEANZ_OFFSET.

Referenced by produce().

967 { return CM2MM * (abs(meanz) - MEANZ_OFFSET); }
static constexpr float MEANZ_OFFSET
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static constexpr float CM2MM

◆ dPhi()

template<class outPrecision , class inPrecision >
outPrecision L1NNCaloTauEmulator::dPhi ( inPrecision  iPhi_1,
inPrecision  iPhi_2 
)
private

Definition at line 865 of file L1NNCaloTauEmulator.cc.

References INTPHI_2PI, INTPHI_PI, CICADATestPatterns::iPhi_1, CICADATestPatterns::iPhi_2, and mps_fire::result.

865  {
866  outPrecision dphi = iPhi_1 - iPhi_2;
867 
868  outPrecision dphi0 = dphi > outPrecision(INTPHI_PI) ? outPrecision(dphi - INTPHI_2PI) : dphi;
869  outPrecision dphi1 = dphi <= outPrecision(-INTPHI_PI) ? outPrecision(dphi + INTPHI_2PI) : dphi;
870 
871  outPrecision result = dphi > outPrecision(0) ? dphi0 : dphi1;
872 
873  return result;
874 }
static constexpr int INTPHI_PI
static constexpr int INTPHI_2PI

◆ fillDescriptions()

void L1NNCaloTauEmulator::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 1059 of file L1NNCaloTauEmulator.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSet::addParameter(), edm::ParameterSetDescription::addVPSet(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

1059  {
1061 
1062  desc.add<edm::InputTag>("l1CaloTowers", edm::InputTag("l1tEGammaClusterEmuProducer", "L1CaloTowerCollection"));
1063  desc.add<edm::InputTag>("hgcalTowers", edm::InputTag("l1tHGCalTowerProducer", "HGCalTowerProcessor"));
1064  desc.add<edm::InputTag>("HgcalClusters",
1065  edm::InputTag("l1tHGCalBackEndLayer2Producer", "HGCalBackendLayer2Processor3DClustering"));
1066 
1067  desc.add<std::string>("preEmId", "hOverE < 0.3 && hOverE >= 0");
1068  {
1070  psd0.add<bool>("isPUFilter", true);
1071  psd0.add<std::string>("preselection", "");
1072  psd0.add<std::string>("method", "BDT");
1073  {
1075  vpsd2.add<std::string>("name");
1076  vpsd2.add<std::string>("value");
1077  std::vector<edm::ParameterSet> temp2;
1078  temp2.reserve(5);
1079  {
1080  edm::ParameterSet temp3;
1081  temp3.addParameter<std::string>("name", "eMax");
1082  temp3.addParameter<std::string>("value", "eMax()");
1083  temp2.push_back(temp3);
1084  }
1085  {
1086  edm::ParameterSet temp3;
1087  temp3.addParameter<std::string>("name", "eMaxOverE");
1088  temp3.addParameter<std::string>("value", "eMax()/energy()");
1089  temp2.push_back(temp3);
1090  }
1091  {
1092  edm::ParameterSet temp3;
1093  temp3.addParameter<std::string>("name", "sigmaPhiPhiTot");
1094  temp3.addParameter<std::string>("value", "sigmaPhiPhiTot()");
1095  temp2.push_back(temp3);
1096  }
1097  {
1098  edm::ParameterSet temp3;
1099  temp3.addParameter<std::string>("name", "sigmaRRTot");
1100  temp3.addParameter<std::string>("value", "sigmaRRTot()");
1101  temp2.push_back(temp3);
1102  }
1103  {
1104  edm::ParameterSet temp3;
1105  temp3.addParameter<std::string>("name", "triggerCells90percent");
1106  temp3.addParameter<std::string>("value", "triggerCells90percent()");
1107  temp2.push_back(temp3);
1108  }
1109  psd0.addVPSet("variables", vpsd2, temp2);
1110  }
1111  psd0.add<std::string>(
1112  "weightsFile", "L1Trigger/Phase2L1ParticleFlow/data/hgcal_egID/Photon_Pion_vs_Neutrino_BDTweights_1116.xml.gz");
1113  psd0.add<std::string>("wp", "-0.10");
1114  desc.add<edm::ParameterSetDescription>("VsPuId", psd0);
1115  }
1116 
1117  desc.add<double>("EcalEtMinForClustering", 0.0);
1118  desc.add<double>("HcalEtMinForClustering", 0.0);
1119  desc.add<double>("EtMinForSeeding", 2.5);
1120  desc.add<double>("EtaRestriction", 2.4);
1121  desc.add<double>("CB_CE_split", 1.55);
1122  desc.add<double>("PuidThr", -0.1);
1123 
1124  desc.add<std::string>("CNNmodel_CB_path", "L1Trigger/L1CaloTrigger/data/Phase2_NNCaloTaus/v22/CNNmodel_CB.pb");
1125  desc.add<std::string>("DNNident_CB_path", "L1Trigger/L1CaloTrigger/data/Phase2_NNCaloTaus/v22/DNNident_CB.pb");
1126  desc.add<std::string>("DNNcalib_CB_path", "L1Trigger/L1CaloTrigger/data/Phase2_NNCaloTaus/v22/DNNcalib_CB.pb");
1127  desc.add<std::string>("CNNmodel_CE_path", "L1Trigger/L1CaloTrigger/data/Phase2_NNCaloTaus/v22/CNNmodel_CE.pb");
1128  desc.add<std::string>("DNNident_CE_path", "L1Trigger/L1CaloTrigger/data/Phase2_NNCaloTaus/v22/DNNident_CE.pb");
1129  desc.add<std::string>("DNNcalib_CE_path", "L1Trigger/L1CaloTrigger/data/Phase2_NNCaloTaus/v22/DNNcalib_CE.pb");
1130  desc.add<std::string>("FeatScaler_CE_path", "L1Trigger/L1CaloTrigger/data/Phase2_NNCaloTaus/Cl3dFeatScaler_CE.json");
1131 
1132  desc.add<double>("IdWp90_CB", 0.706);
1133  desc.add<double>("IdWp95_CB", 0.3432);
1134  desc.add<double>("IdWp99_CB", 0.0337);
1135  desc.add<double>("IdWp90_CE", 0.5711);
1136  desc.add<double>("IdWp95_CE", 0.2742);
1137  desc.add<double>("IdWp99_CE", 0.0394);
1138 
1139  desc.add<bool>("DEBUG", false);
1140 
1141  descriptions.add("l1tNNCaloTauEmulator", desc);
1142 }
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:136
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ floatEt()

float L1NNCaloTauEmulator::floatEt ( Et_t  et)
inlineprivate

Definition at line 195 of file L1NNCaloTauEmulator.cc.

References l1tnanotables_cff::et.

195 { return et.to_float(); }

◆ floatEta()

float L1NNCaloTauEmulator::floatEta ( EtaPhi_t  eta)
inlineprivate

Definition at line 196 of file L1NNCaloTauEmulator.cc.

References PVValHelper::eta, and ETAPHI_LSB.

Referenced by produce().

196 { return eta.to_float() * ETAPHI_LSB; }
static constexpr float ETAPHI_LSB

◆ floatIEta()

float L1NNCaloTauEmulator::floatIEta ( IEta_t  eta)
private

Definition at line 969 of file L1NNCaloTauEmulator.cc.

References funct::abs(), PVValHelper::eta, JetMETHLTOfflineSource_cfi::feta, IETAHGCAL_LSB, IETAHGCAL_LSBp, IETAHGCAL_OFFSET, and IETAPHI_LSB.

Referenced by MakeTauCandidate(), and produce().

969  {
970  // transform eta of towers from integer to float, correcting for different barrel/endcap LSB
971  float feta;
972  if (abs(eta) > IETAHGCAL_OFFSET) {
973  if (eta > 0) {
975  (eta.to_float() - IETAHGCAL_OFFSET) * IETAHGCAL_LSB;
976  } else {
978  (eta.to_float() + IETAHGCAL_OFFSET) * IETAHGCAL_LSB;
979  }
980  } else {
981  feta = eta.to_float() * IETAPHI_LSB;
982  }
983 
984  // shift by half a tower to consider the tower center instead of the edge
985  return feta > 0 ? feta - IETAPHI_LSB / 2 : feta + IETAPHI_LSB / 2;
986 }
static constexpr float IETAHGCAL_LSBp
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static constexpr int IETAHGCAL_OFFSET
static constexpr float IETAPHI_LSB
static constexpr float IETAHGCAL_LSB

◆ floatIPhi()

float L1NNCaloTauEmulator::floatIPhi ( IPhi_t  phi)
private

Definition at line 988 of file L1NNCaloTauEmulator.cc.

References IETAPHI_LSB, INTPHI_2PI, INTPHI_PI, and phi.

Referenced by MakeTauCandidate(), and produce().

988  {
989  float fphi = phi.to_float();
990  // add 2pi + 1 because tower 0 does not exist
991  fphi = fphi > INTPHI_PI ? fphi - INTPHI_2PI + 1 : fphi;
992  fphi *= IETAPHI_LSB;
993 
994  // shift by half a tower to consider the tower center instead of the edge
995  return fphi > 0 ? fphi - IETAPHI_LSB / 2 : fphi + IETAPHI_LSB / 2;
996 }
static constexpr int INTPHI_PI
static constexpr int INTPHI_2PI
static constexpr float IETAPHI_LSB

◆ floatMeanZ()

float L1NNCaloTauEmulator::floatMeanZ ( Meanz_t  meanz)
inlineprivate

Definition at line 200 of file L1NNCaloTauEmulator.cc.

References MEANZ_LSB, and MEANZ_OFFSET.

200 { return meanz.to_float() * MEANZ_LSB + MEANZ_OFFSET; };
static constexpr float MEANZ_LSB
static constexpr float MEANZ_OFFSET

◆ floatMeanZHgcalCoord()

float L1NNCaloTauEmulator::floatMeanZHgcalCoord ( Meanz_t  meanz)
inlineprivate

Definition at line 201 of file L1NNCaloTauEmulator.cc.

References MEANZ_LSB.

Referenced by produce().

201 { return meanz.to_float() * MEANZ_LSB; };
static constexpr float MEANZ_LSB

◆ floatPhi()

float L1NNCaloTauEmulator::floatPhi ( EtaPhi_t  phi)
inlineprivate

Definition at line 197 of file L1NNCaloTauEmulator.cc.

References ETAPHI_LSB, and phi.

197 { return phi.to_float() * ETAPHI_LSB; }
static constexpr float ETAPHI_LSB

◆ floatPt()

float L1NNCaloTauEmulator::floatPt ( Pt_t  pt)
inlineprivate

Definition at line 194 of file L1NNCaloTauEmulator.cc.

References DiDispStaMuonMonitor_cfi::pt.

194 { return pt.to_float(); }

◆ floatPuId()

float L1NNCaloTauEmulator::floatPuId ( PUid_t  pu)
inlineprivate

Definition at line 202 of file L1NNCaloTauEmulator.cc.

References displacedMuons_cfi::pu, and PUID_LSB.

202 { return pu.to_float() * PUID_LSB; };
static constexpr float PUID_LSB

◆ floatShape()

float L1NNCaloTauEmulator::floatShape ( ShapeFeat_t  shape)
inlineprivate

Definition at line 198 of file L1NNCaloTauEmulator.cc.

References l1trig_cff::shape, and SHAPEFEAT_LSB.

Referenced by produce().

198 { return shape.to_float() * SHAPEFEAT_LSB; };
static constexpr float SHAPEFEAT_LSB

◆ floatSzz()

float L1NNCaloTauEmulator::floatSzz ( ShapeFeat_t  szz)
inlineprivate

Definition at line 199 of file L1NNCaloTauEmulator.cc.

References SZZ_LSB.

Referenced by produce().

199 { return szz.to_float() * SZZ_LSB; };
static constexpr float SZZ_LSB

◆ globalEndJob()

static void L1NNCaloTauEmulator::globalEndJob ( const NNmodels_GlobalCache )
inlinestatic

Definition at line 110 of file L1NNCaloTauEmulator.cc.

110 {/*do nothing*/};

◆ initializeGlobalCache()

std::unique_ptr< NNmodels_GlobalCache > L1NNCaloTauEmulator::initializeGlobalCache ( const edm::ParameterSet iConfig)
static

Definition at line 362 of file L1NNCaloTauEmulator.cc.

References tensorflow::createSession(), contentValuesFiles::fullPath, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), tensorflow::loadGraphDef(), and AlCaHLTBitMon_QueryRunRegistry::string.

362  {
363  edm::LogInfo("Initialization") << "Init NN models Global Cache " << std::endl;
364 
365  std::unique_ptr<NNmodels_GlobalCache> GlobalCache(new NNmodels_GlobalCache);
366 
367  GlobalCache->CNNmodel_CB_path = iConfig.getParameter<std::string>("CNNmodel_CB_path");
368  GlobalCache->DNNident_CB_path = iConfig.getParameter<std::string>("DNNident_CB_path");
369  GlobalCache->DNNcalib_CB_path = iConfig.getParameter<std::string>("DNNcalib_CB_path");
370  GlobalCache->CNNmodel_CE_path = iConfig.getParameter<std::string>("CNNmodel_CE_path");
371  GlobalCache->DNNident_CE_path = iConfig.getParameter<std::string>("DNNident_CE_path");
372  GlobalCache->DNNcalib_CE_path = iConfig.getParameter<std::string>("DNNcalib_CE_path");
373  GlobalCache->FeatScaler_CE_path = iConfig.getParameter<std::string>("FeatScaler_CE_path");
374 
375  // Create sessions for Tensorflow inferece
376  (GlobalCache->CNNmodel_CB) = tensorflow::loadGraphDef(edm::FileInPath((GlobalCache->CNNmodel_CB_path)).fullPath());
377  (GlobalCache->CNNmodel_CBsession) = tensorflow::createSession((GlobalCache->CNNmodel_CB));
378 
379  (GlobalCache->DNNident_CB) = tensorflow::loadGraphDef(edm::FileInPath((GlobalCache->DNNident_CB_path)).fullPath());
380  (GlobalCache->DNNident_CBsession) = tensorflow::createSession((GlobalCache->DNNident_CB));
381 
382  (GlobalCache->DNNcalib_CB) = tensorflow::loadGraphDef(edm::FileInPath((GlobalCache->DNNcalib_CB_path)).fullPath());
383  (GlobalCache->DNNcalib_CBsession) = tensorflow::createSession((GlobalCache->DNNcalib_CB));
384 
385  (GlobalCache->CNNmodel_CE) = tensorflow::loadGraphDef(edm::FileInPath((GlobalCache->CNNmodel_CE_path)).fullPath());
386  (GlobalCache->CNNmodel_CEsession) = tensorflow::createSession((GlobalCache->CNNmodel_CE));
387 
388  (GlobalCache->DNNident_CE) = tensorflow::loadGraphDef(edm::FileInPath((GlobalCache->DNNident_CE_path)).fullPath());
389  (GlobalCache->DNNident_CEsession) = tensorflow::createSession((GlobalCache->DNNident_CE));
390 
391  (GlobalCache->DNNcalib_CE) = tensorflow::loadGraphDef(edm::FileInPath((GlobalCache->DNNcalib_CE_path)).fullPath());
392  (GlobalCache->DNNcalib_CEsession) = tensorflow::createSession((GlobalCache->DNNcalib_CE));
393 
394  // Read features scaler
395  boost::property_tree::read_json(edm::FileInPath((GlobalCache->FeatScaler_CE_path)).fullPath(),
396  (GlobalCache->FeatScaler_CE));
397 
398  return GlobalCache;
399 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::string fullPath() const
Definition: FileInPath.cc:161
GraphDef * loadGraphDef(const std::string &pbFile)
Definition: TensorFlow.cc:119
Session * createSession()
Definition: TensorFlow.cc:136
Log< level::Info, false > LogInfo

◆ inputScaler()

float L1NNCaloTauEmulator::inputScaler ( float  inputF,
std::string  feature 
)
private

Definition at line 956 of file L1NNCaloTauEmulator.cc.

References SiStripPI::mean.

Referenced by produce().

956  {
957  float mean = (globalCache()->FeatScaler_CE).get_child(feature).get<float>("mean");
958  float std = (globalCache()->FeatScaler_CE).get_child(feature).get<float>("std");
959 
960  return (inputF - mean) / std;
961 }

◆ makeEndcapHwIEta()

L1NNCaloTauEmulator::IEta_t L1NNCaloTauEmulator::makeEndcapHwIEta ( float  eta)
private

Definition at line 909 of file L1NNCaloTauEmulator.cc.

References PVValHelper::eta, hcalRecHitTable_cff::ieta, and IETAHGCAL_LSB.

Referenced by produce().

909  {
910  IEta_t ieta = floor(eta / IETAHGCAL_LSB);
911  // +1 because flooring gets it 1 unit lower when negative
912  ieta = ieta < IEta_t(0) ? IEta_t(ieta + 1) : ieta;
913 
914  return ieta;
915 }
ap_int< IETAPHI_W > IEta_t
static constexpr float IETAHGCAL_LSB

◆ makeEndcapHwIPhi()

L1NNCaloTauEmulator::IPhi_t L1NNCaloTauEmulator::makeEndcapHwIPhi ( float  phi)
private

Definition at line 917 of file L1NNCaloTauEmulator.cc.

References IETAPHI_LSB, M_PI, and phi.

Referenced by produce().

917  {
918  phi = phi < 0 ? phi + 2 * M_PI : phi;
919 
920  // +1 because tower 0 does not exist
921  return floor(phi / IETAPHI_LSB) + 1;
922 }
#define M_PI
static constexpr float IETAPHI_LSB

◆ MakeTauCandidate()

l1t::Tau L1NNCaloTauEmulator::MakeTauCandidate ( bool  isBarrel,
int  clNxMIdx,
std::vector< tensorflow::Tensor >  outputsIdent,
std::vector< tensorflow::Tensor >  outputsCalib,
std::vector< InputTowerCluster_pstn clustersNxM_pstn 
)
private

Definition at line 998 of file L1NNCaloTauEmulator.cc.

References floatIEta(), floatIPhi(), IdWp90_CB, IdWp90_CE, IdWp95_CB, IdWp95_CE, IdWp99_CB, IdWp99_CE, intEtaRestriction, PixelPluginsPhase0_cfi::isBarrel, triggerObjects_cff::l1Tau, quality, L1TRate_Offline_cfi::Tau, runTauDisplay::tau_eta, and runTauDisplay::tau_phi.

Referenced by produce().

1003  {
1004  int seedIeta = clustersNxM_pstn[clNxMIdx].seedIeta;
1005  int seedIphi = clustersNxM_pstn[clNxMIdx].seedIphi;
1006 
1007  if (seedIeta > intEtaRestriction) {
1008  return l1t::Tau(reco::Candidate::PolarLorentzVector(-1, 0, 0, 0), -1, 0, 0, 0, 0);
1009  ;
1010  }
1011 
1012  float tau_IDscore = outputsIdent[0].matrix<float>()(0, clNxMIdx);
1013  float tau_calibPt = outputsCalib[0].matrix<float>()(0, clNxMIdx);
1014  float tau_eta = floatIEta(seedIeta);
1015  float tau_phi = floatIPhi(seedIphi);
1016 
1017  // Assign increasing quality to higher scoring candidates
1018  int quality = 0;
1019  if (isBarrel) {
1020  // 99% WP
1021  if (tau_IDscore > IdWp99_CB) {
1022  quality = 1;
1023  }
1024  // 95% WP
1025  if (tau_IDscore > IdWp95_CB) {
1026  quality = 2;
1027  }
1028  // 90% WP
1029  if (tau_IDscore > IdWp90_CB) {
1030  quality = 3;
1031  }
1032  } else {
1033  // 99% WP
1034  if (tau_IDscore > IdWp99_CE) {
1035  quality = 1;
1036  }
1037  // 95% WP
1038  if (tau_IDscore > IdWp95_CE) {
1039  quality = 2;
1040  }
1041  // 90% WP
1042  if (tau_IDscore > IdWp90_CE) {
1043  quality = 3;
1044  }
1045  }
1046 
1048 
1049  // store ID score multiplied by 10E4 to have good precision even using the Phase1 tau int iso format
1050  // (this is stored just in case for possible additional offline studies)
1051  // tau initialisation = (p4, pt, eta, phi, qual, iso)
1052  l1t::Tau l1Tau = l1t::Tau(tauP4, tau_calibPt, tau_eta, tau_phi, quality, tau_IDscore * 10E4);
1053  l1Tau.setTowerIEta(seedIeta);
1054  l1Tau.setTowerIPhi(seedIphi);
1055 
1056  return l1Tau;
1057 }
Definition: Tau.h:20
string quality
float floatIPhi(IPhi_t phi)
float floatIEta(IEta_t eta)
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:38

◆ produce()

void L1NNCaloTauEmulator::produce ( edm::Event iEvent,
const edm::EventSetup eSetup 
)
overrideprivate

Definition at line 449 of file L1NNCaloTauEmulator.cc.

References a, funct::abs(), AllKeepHad, AllKeepTot, ap_abs(), apfixedQuantizer(), apintQuantizer(), b, L1NNCaloTauEmulator::InputTowerCluster::barrelSeeded, L1NNCaloTauEmulator::InputHGCluster::coreshowerlength, correctInputEtaCl3d(), correctInputMeanzCl3d(), DEBUG, EmOnly, mps_fire::end, ET_W, PVValHelper::eta, L1NNCaloTauEmulator::InputHGCluster::eta, Eta_limit, ETAPHI_LSB, ETAPHI_W, EtMinForSeeding, L1NNCaloTauEmulator::InputTowerCluster::fill(), L1NNCaloTauEmulator::InputTowerCluster_pstn::fill(), L1NNCaloTauEmulator::InputHGCluster::fill(), nano_mu_digi_cff::float, floatEta(), floatIEta(), floatIPhi(), floatMeanZHgcalCoord(), floatShape(), floatSzz(), hgcalTowersHandle, hgcalTowersToken, HGClusterHandle, HGClusterToken, IEta_dim, iEvent, L1NNCaloTauEmulator::InputTowerCluster::init(), inputScaler(), createfilelist::int, intCB_CE_split, intEtaRestriction, intPuidThr, IPhi_dim, L1NNCaloTauEmulator::SimpleTowerHit::isBarrel, l1CaloTowerHandle, SimL1Emulator_cff::l1CaloTowers, L1NNCaloTauEmulator::SimpleTowerHit::l1egTowerEt, triggerObjects_cff::l1Tau, l1TowersToken, makeEndcapHwIEta(), makeEndcapHwIPhi(), MakeTauCandidate(), muonTagProbeFilters_cff::matched, L1NNCaloTauEmulator::InputHGCluster::meanz, MEANZ_LSB, MEANZ_W, l1tpf::HGC3DClusterEgID::method(), eostools::move(), l1tpf::HGC3DClusterEgID::passID(), phi, preEmId, edm::Handle< T >::product(), reco::LeafCandidate::pt(), L1NNCaloTauEmulator::SimpleHGCluster::pt, L1NNCaloTauEmulator::InputHGCluster::pt, PT_W, PTET_LSB, PUID_LSB, PUID_W, R2cone, tensorflow::run(), scenario, seedIdx, L1NNCaloTauEmulator::InputTowerCluster_pstn::seedIeta, L1NNCaloTauEmulator::InputTowerCluster_pstn::seedIphi, SHAPEFEAT_LSB, SHAPEFEAT_W, L1NNCaloTauEmulator::InputHGCluster::showerlength, jetUpdater_cfi::sort, L1NNCaloTauEmulator::InputHGCluster::spptot, L1NNCaloTauEmulator::InputHGCluster::srrtot, L1NNCaloTauEmulator::InputHGCluster::szz, SZZ_LSB, tower_dIEta(), L1NNCaloTauEmulator::SimpleTowerHit::towerEm, L1NNCaloTauEmulator::SimpleTowerHit::towerEt, L1NNCaloTauEmulator::SimpleTowerHit::towerHad, L1NNCaloTauEmulator::SimpleTowerHit::towerIeta, L1NNCaloTauEmulator::SimpleTowerHit::towerIphi, tw2cl_dEta(), tw2cl_dPhi(), VsPuId, and GCP_Ntuples_cfg::warnings.

449  {
450  // Output collection
451  std::unique_ptr<BXVector<l1t::Tau>> L1NNCaloTauCollectionBXV(new l1t::TauBxCollection);
452 
453  // Create and Fill collection of all calotowers and their attributes
454  std::vector<SimpleTowerHit> l1CaloTowers;
455 
457  int warnings = 0;
458  for (auto& hit : *l1CaloTowerHandle.product()) {
459  // Skip this weird towers and store warning
460  if (hit.towerIEta() == -1016 && hit.towerIPhi() == -962) {
461  warnings += 1;
462  continue;
463  }
464 
465  SimpleTowerHit l1Hit;
466  l1Hit.isBarrel = 0x1;
467  l1Hit.l1egTowerEt = apfixedQuantizer(hit.l1egTowerEt(), PTET_LSB, ET_W);
468  l1Hit.towerEm = apfixedQuantizer(hit.ecalTowerEt(), PTET_LSB, ET_W);
469  l1Hit.towerHad = apfixedQuantizer(hit.hcalTowerEt(), PTET_LSB, ET_W);
470  l1Hit.towerEt = apfixedQuantizer(hit.ecalTowerEt() + hit.hcalTowerEt() + hit.l1egTowerEt(), PTET_LSB, ET_W);
471  l1Hit.towerIeta = hit.towerIEta();
472  l1Hit.towerIphi = hit.towerIPhi();
473 
474  l1CaloTowers.push_back(l1Hit);
475  }
476  if (warnings != 0 && DEBUG) {
477  edm::LogWarning("BrokenTowers") << " ** WARNING : FOUND " << warnings
478  << " TOWERS WITH towerIeta=-1016 AND towerIphi=-962" << std::endl;
479  }
480 
482  for (auto& hit : *hgcalTowersHandle.product()) {
483  SimpleTowerHit l1Hit;
484  l1Hit.isBarrel = 0x0;
485  l1Hit.l1egTowerEt = 0.0;
486  l1Hit.towerEm = apfixedQuantizer(hit.etEm(), PTET_LSB, ET_W);
487  l1Hit.towerHad = apfixedQuantizer(hit.etHad(), PTET_LSB, ET_W);
488  l1Hit.towerEt = apfixedQuantizer(hit.etEm() + hit.etHad(), PTET_LSB, ET_W);
489  l1Hit.towerIeta = makeEndcapHwIEta(hit.eta());
490  l1Hit.towerIphi = makeEndcapHwIPhi(hit.phi());
491 
492  l1CaloTowers.push_back(l1Hit);
493  }
494 
495  // Sort the ECAL+HCAL+L1EGs tower sums based on total ET
496  std::sort(begin(l1CaloTowers), end(l1CaloTowers), [](const SimpleTowerHit& a, SimpleTowerHit& b) {
497  return a.towerEt > b.towerEt;
498  });
499 
500  // Create and Fill the collection of 3D clusters and their attributes
501  std::vector<SimpleHGCluster> AllHGClusters;
503 
504  for (auto cl3dIt = HGClusterHandle->begin(0); cl3dIt != HGClusterHandle->end(0); ++cl3dIt) {
505  auto& cl3d = *cl3dIt;
506 
507  // Implement cl3d PU ID as done in
508  // https://github.com/cms-sw/cmssw/blob/master/L1Trigger/Phase2L1ParticleFlow/plugins/PFClusterProducerFromHGC3DClusters.cc#L120
509  bool isEM = preEmId(*cl3dIt);
510  l1t::PFCluster cluster(cl3d.pt(), cl3d.eta(), cl3d.phi(), cl3d.hOverE());
511  if (scenario == UseEmInterp::EmOnly) // for emID objs, use EM interp as pT and set H = 0
512  {
513  if (isEM) {
514  float pt_new = cl3d.iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM);
515  float hoe_new = 0.;
516  cluster = l1t::PFCluster(pt_new, cl3d.eta(), cl3d.phi(), hoe_new, isEM);
517  }
518  } else if (scenario == UseEmInterp::AllKeepHad) // for all objs, replace EM part with EM interp, preserve H
519  {
520  float had_old = cl3d.pt() - cluster.emEt();
521  float em_new = cl3d.iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM);
522  float pt_new = had_old + em_new;
523  float hoe_new = em_new > 0 ? (had_old / em_new) : -1;
524  cluster = l1t::PFCluster(pt_new, cl3d.eta(), cl3d.phi(), hoe_new, isEM);
525  } else if (scenario == UseEmInterp::AllKeepTot) // for all objs, replace EM part with EM interp, preserve pT
526  {
527  float em_new = cl3d.iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM);
528  float hoe_new = em_new > 0 ? (cl3d.pt() / em_new - 1) : -1;
529  cluster = l1t::PFCluster(cl3d.pt(), cl3d.eta(), cl3d.phi(), hoe_new, isEM);
530  }
531 
532  float idScore = -1.;
533  if (!VsPuId.method().empty()) {
534  idScore = VsPuId.passID(*cl3dIt, cluster);
535  idScore = cluster.egVsPUMVAOut();
536  }
537 
538  float eta_hgcalCoord = correctInputEtaCl3d(cl3d.eta());
539  float meanz_hgcalCoord = correctInputMeanzCl3d(cl3d.zBarycenter());
540 
541  SimpleHGCluster HGCluster;
542  HGCluster.pt = apfixedQuantizer(cl3d.pt(), PTET_LSB, PT_W);
543  HGCluster.eta = apintQuantizer(eta_hgcalCoord, ETAPHI_LSB, ETAPHI_W);
544  HGCluster.phi = apintQuantizer(cl3d.phi(), ETAPHI_LSB, ETAPHI_W);
545  HGCluster.showerlength = cl3d.showerLength();
546  HGCluster.coreshowerlength = cl3d.coreShowerLength();
547  HGCluster.spptot = apintQuantizer(cl3d.sigmaPhiPhiTot(), SHAPEFEAT_LSB, SHAPEFEAT_W);
548  HGCluster.szz = apintQuantizer(cl3d.sigmaZZ(), SZZ_LSB, SHAPEFEAT_W);
549  HGCluster.srrtot = apintQuantizer(cl3d.sigmaRRTot(), SHAPEFEAT_LSB, SHAPEFEAT_W);
550  HGCluster.meanz = apintQuantizer(meanz_hgcalCoord, MEANZ_LSB, MEANZ_W);
551  HGCluster.PUid = apintQuantizer(idScore, PUID_LSB, PUID_W);
552 
553  AllHGClusters.push_back(HGCluster);
554  }
555 
556  // Order the collection in pt (the input to the GCT will be pt ordered)
557  std::sort(begin(AllHGClusters), end(AllHGClusters), [](const SimpleHGCluster& a, SimpleHGCluster& b) {
558  return a.pt > b.pt;
559  });
560 
561  /*
562  // END OF SOFTWARE PRECISION SECTION
563  // up to here treated inputs from simulation with SW precision
564  // to massage them into the HW precision varibales as they are
565  // forseen (roughly) to be available at the GCT Sum card level
566  // ------------------------------------------------------------- */
567 
568  // Make NxM TowerClusters and HGClusters collections for TauMinator
569  std::vector<InputTowerCluster> l1TowerClustersNxM_CB;
570  std::vector<InputTowerCluster_pstn> l1TowerClustersNxM_CB_pstn;
571  std::vector<InputTowerCluster> l1TowerClustersNxM_CE;
572  std::vector<InputTowerCluster_pstn> l1TowerClustersNxM_CE_pstn;
573  std::vector<InputHGCluster> HGClusters;
574 
575  // Supporting collection of endcap clusters before cl3d matching
576  std::vector<InputTowerCluster> AllL1TowerClustersNxM_CE;
577  std::vector<InputTowerCluster_pstn> AllL1TowerClustersNxM_CE_pstn;
578 
579  int Nclusters_CB = 0;
580  int AllNclusters_CE = 0;
581  bool caloTauSeedingFinished = false;
582  // Loop for seeding of clNxM objects
583  while (!caloTauSeedingFinished) {
584  InputTowerCluster clNxM;
585  clNxM.init();
586  InputTowerCluster_pstn clNxM_pstn;
587  bool seeded = false;
588 
589  for (auto& l1CaloTower : l1CaloTowers) {
590  // Skip seeding in towers that would make the cluster extend in HF
591  // Skip l1CaloTowers which are already used by this clusters' mask
592  if (ap_abs(l1CaloTower.towerIeta) > Eta_limit || ap_abs(l1CaloTower.towerIeta) > intEtaRestriction ||
593  l1CaloTower.stale4seed) {
594  continue;
595  }
596 
597  // If not seded do the seeding
598  if (!seeded) {
599  // The leading unused tower has ET < min, stop jet clustering
600  if (l1CaloTower.towerEt < EtMinForSeeding) {
601  caloTauSeedingFinished = true;
602  continue;
603  }
604 
605  clNxM.fill(seedIdx, l1CaloTower);
606  clNxM_pstn.fill(l1CaloTower);
607  if (l1CaloTower.isBarrel) {
608  clNxM.barrelSeeded = 0x1;
609  }
610 
611  l1CaloTower.stale4seed = 0x1;
612  l1CaloTower.stale = 0x1;
613  seeded = true;
614 
615  continue;
616  }
617 
618  dIEtaPhi_t d_iEta = tower_dIEta(l1CaloTower.towerIeta, clNxM_pstn.seedIeta);
619  dIEtaPhi_t d_iPhi = dPhi<dIEtaPhi_t, IPhi_t>(l1CaloTower.towerIphi, clNxM_pstn.seedIphi);
620 
621  // Stale tower for seeding if it would lead to overalp between clusters
622  if ((ap_abs(d_iEta) <= IEta_dim - 1 && ap_abs(d_iPhi) <= IPhi_dim - 1)) {
623  l1CaloTower.stale4seed = 0x1;
624  }
625 
626  } // End for loop over TPs
627 
628  // Pushback seeds split in barrel and endcap
629  if (seeded) {
630  if (ap_abs(clNxM_pstn.seedIeta) <= intCB_CE_split) {
631  l1TowerClustersNxM_CB.push_back(clNxM);
632  l1TowerClustersNxM_CB_pstn.push_back(clNxM_pstn);
633  Nclusters_CB++;
634  } else {
635  AllL1TowerClustersNxM_CE.push_back(clNxM);
636  AllL1TowerClustersNxM_CE_pstn.push_back(clNxM_pstn);
637  AllNclusters_CE++;
638  }
639  }
640 
641  } // End while loop of TowerClusters seeding
642 
643  // Loop for barrel NxM TowerClusters clustering starting from the seeds
644  for (int clNxMIdx = 0; clNxMIdx < Nclusters_CB; clNxMIdx++) {
645  for (auto& l1CaloTower : l1CaloTowers) {
646  // Skip l1CaloTowers which are already used
647  if (l1CaloTower.stale) {
648  continue;
649  }
650 
651  dIEtaPhi_t d_iEta = tower_dIEta(l1CaloTower.towerIeta, l1TowerClustersNxM_CB_pstn[clNxMIdx].seedIeta);
652  dIEtaPhi_t d_iPhi =
653  dPhi<dIEtaPhi_t, IPhi_t>(l1CaloTower.towerIphi, l1TowerClustersNxM_CB_pstn[clNxMIdx].seedIphi);
654  int hitIdx = d_iEta * 9 + d_iPhi + seedIdx;
655 
656  // Cluster all towers in a NxM towers mask
657  if ((ap_abs(d_iEta) <= (IEta_dim - 1) / 2 && ap_abs(d_iPhi) <= (IPhi_dim - 1) / 2)) {
658  l1TowerClustersNxM_CB[clNxMIdx].fill(hitIdx, l1CaloTower);
659  l1CaloTower.stale = 0x1;
660  }
661 
662  } // End for loop over TPs
663 
664  } // End while loop of barrel TowerClusters creation
665 
666  // In the endcap cross-loop over clNxM and cl3d to match them
667  // (we can do it before full clustering just using the seed info)
668  int Nclusters_CE = 0;
669  for (int clNxMIdx = 0; clNxMIdx < AllNclusters_CE; clNxMIdx++) {
670  bool matched = false;
671  for (auto& HGCluster : AllHGClusters) {
672  // In case the clNxM or HGCluster have already been matched just continue through the list to the end
673  // only use cl3ds above 4GeV and above -0.10 pu id
674  if (matched || HGCluster.stale || HGCluster.pt < Pt_t(4.) || HGCluster.PUid < intPuidThr) {
675  continue;
676  }
677 
678  dEtaPhi_t d_iEta = tw2cl_dEta(HGCluster.eta, AllL1TowerClustersNxM_CE_pstn[clNxMIdx].seedIeta);
679  dEtaPhi_t d_iPhi = tw2cl_dPhi(HGCluster.phi, AllL1TowerClustersNxM_CE_pstn[clNxMIdx].seedIphi);
680  matched = d_iEta * d_iEta + d_iPhi * d_iPhi < R2cone;
681 
682  if (matched) {
683  HGCluster.stale = 0x1;
684  InputHGCluster cl3d;
685  cl3d.fill(HGCluster);
686  HGClusters.push_back(cl3d);
687  l1TowerClustersNxM_CE.push_back(AllL1TowerClustersNxM_CE[clNxMIdx]);
688  l1TowerClustersNxM_CE_pstn.push_back(AllL1TowerClustersNxM_CE_pstn[clNxMIdx]);
689  Nclusters_CE++;
690  }
691 
692  } // End for loop over cl3ds
693 
694  } // End for loop over clNxM
695 
696  // Loop for endcap matched NxM TowerClusters clustering starting from the seeds just found
697  for (int clNxMIdx = 0; clNxMIdx < Nclusters_CE; clNxMIdx++) {
698  for (auto& l1CaloTower : l1CaloTowers) {
699  // Skip l1CaloTowers which are already used
700  if (l1CaloTower.stale) {
701  continue;
702  }
703 
704  dIEtaPhi_t d_iEta = tower_dIEta(l1CaloTower.towerIeta, l1TowerClustersNxM_CE_pstn[clNxMIdx].seedIeta);
705  dIEtaPhi_t d_iPhi =
706  dPhi<dIEtaPhi_t, IPhi_t>(l1CaloTower.towerIphi, l1TowerClustersNxM_CE_pstn[clNxMIdx].seedIphi);
707  int hitIdx = d_iEta * 9 + d_iPhi + seedIdx;
708 
709  // Cluster all towers in a NxM towers mask
710  if ((ap_abs(d_iEta) <= (IEta_dim - 1) / 2 && ap_abs(d_iPhi) <= (IPhi_dim - 1) / 2)) {
711  l1TowerClustersNxM_CE[clNxMIdx].fill(hitIdx, l1CaloTower);
712  l1CaloTower.stale = 0x1;
713  }
714 
715  } // End for loop over TPs
716 
717  } // End while loop of barrel TowerClusters creation
718 
719  // Barrel TauMinator application
720  int batchSize_CB = (int)(Nclusters_CB);
721  tensorflow::TensorShape imageShape_CB({batchSize_CB, IEta_dim, IPhi_dim, 2});
722  tensorflow::TensorShape positionShape_CB({batchSize_CB, 2});
723  tensorflow::Tensor TowerClusterImage_CB(tensorflow::DT_FLOAT, imageShape_CB);
724  tensorflow::Tensor TowerClusterPosition_CB(tensorflow::DT_FLOAT, positionShape_CB);
725 
726  for (int clNxMIdx = 0; clNxMIdx < Nclusters_CB; clNxMIdx++) {
727  // Fill inputs for Tensorflow inference
728  for (int eta = 0; eta < IEta_dim; ++eta) {
729  for (int phi = 0; phi < IPhi_dim; ++phi) {
730  int towerIdx = eta * IPhi_dim + phi;
731  TowerClusterImage_CB.tensor<float, 4>()(clNxMIdx, eta, phi, 0) =
732  (l1TowerClustersNxM_CB[clNxMIdx].towerHits[towerIdx].l1egTowerEt.to_float() +
733  l1TowerClustersNxM_CB[clNxMIdx].towerHits[towerIdx].towerEm.to_float());
734  TowerClusterImage_CB.tensor<float, 4>()(clNxMIdx, eta, phi, 1) =
735  (l1TowerClustersNxM_CB[clNxMIdx].towerHits[towerIdx].towerHad.to_float());
736  }
737  }
738 
739  TowerClusterPosition_CB.tensor<float, 2>()(clNxMIdx, 0) = floatIEta(l1TowerClustersNxM_CB_pstn[clNxMIdx].seedIeta);
740  TowerClusterPosition_CB.tensor<float, 2>()(clNxMIdx, 1) = floatIPhi(l1TowerClustersNxM_CB_pstn[clNxMIdx].seedIphi);
741  }
742 
743  if (batchSize_CB >
744  0) // from CMSSW_14_0_X tensorflow does not seem to be able to deal with a tensor of dimension 0 anymore
745  {
746  // Apply CNN model
747  tensorflow::NamedTensorList CNNmodel_CBinputList = {{"TowerClusterImage", TowerClusterImage_CB},
748  {"TowerClusterPosition", TowerClusterPosition_CB}};
749  std::vector<tensorflow::Tensor> CNNmodel_CBoutputs;
750  tensorflow::run((globalCache()->CNNmodel_CBsession),
751  CNNmodel_CBinputList,
752  {"TauMinator_CB_conv/middleMan/concat"},
753  &CNNmodel_CBoutputs);
754  tensorflow::NamedTensorList DNN_CBinputsList = {{"middleMan", CNNmodel_CBoutputs[0]}};
755 
756  // Apply DNN for identification
757  std::vector<tensorflow::Tensor> DNN_CBoutputsIdent;
758  tensorflow::run((globalCache()->DNNident_CBsession),
759  DNN_CBinputsList,
760  {"TauMinator_CB_ident/sigmoid_IDout/Sigmoid"},
761  &DNN_CBoutputsIdent);
762 
763  // Apply DNN for calibration
764  std::vector<tensorflow::Tensor> DNN_CBoutputsCalib;
765  tensorflow::run((globalCache()->DNNcalib_CBsession),
766  DNN_CBinputsList,
767  {"TauMinator_CB_calib/DNNout/MatMul"},
768  &DNN_CBoutputsCalib);
769 
770  // Fill the output collection of L1 taus with the barrel candidates
771  for (int clNxMIdx = 0; clNxMIdx < Nclusters_CB; clNxMIdx++) {
772  l1t::Tau l1Tau =
773  MakeTauCandidate(true, clNxMIdx, DNN_CBoutputsIdent, DNN_CBoutputsCalib, l1TowerClustersNxM_CB_pstn);
774  if (l1Tau.pt() < 0) {
775  continue;
776  }
777  L1NNCaloTauCollectionBXV->push_back(0, l1Tau);
778  }
779  }
780 
781  // Endcap TauMinator application
782  int batchSize_CE = (int)(Nclusters_CE);
783  tensorflow::TensorShape imageShape_CE({batchSize_CE, IEta_dim, IPhi_dim, 2});
784  tensorflow::TensorShape positionShape_CE({batchSize_CE, 2});
785  tensorflow::TensorShape cl3dfeatShape_CE({batchSize_CE, 8});
786  tensorflow::Tensor TowerClusterImage_CE(tensorflow::DT_FLOAT, imageShape_CE);
787  tensorflow::Tensor TowerClusterPosition_CE(tensorflow::DT_FLOAT, positionShape_CE);
788  tensorflow::Tensor Cl3dShapeFeatures_CE(tensorflow::DT_FLOAT, cl3dfeatShape_CE);
789 
790  for (int clNxMIdx = 0; clNxMIdx < Nclusters_CE; clNxMIdx++) {
791  // Indexing of cl3ds is the same as the one of clNxMs
792  InputHGCluster HGClu = HGClusters[clNxMIdx];
793 
794  // Fill inputs for Tensorflow inference
795  for (int eta = 0; eta < IEta_dim; ++eta) {
796  for (int phi = 0; phi < IPhi_dim; ++phi) {
797  int towerIdx = eta * IPhi_dim + phi;
798  TowerClusterImage_CE.tensor<float, 4>()(clNxMIdx, eta, phi, 0) =
799  (l1TowerClustersNxM_CE[clNxMIdx].towerHits[towerIdx].l1egTowerEt.to_float() +
800  l1TowerClustersNxM_CE[clNxMIdx].towerHits[towerIdx].towerEm.to_float());
801  TowerClusterImage_CE.tensor<float, 4>()(clNxMIdx, eta, phi, 1) =
802  (l1TowerClustersNxM_CE[clNxMIdx].towerHits[towerIdx].towerHad.to_float());
803  }
804  }
805 
806  TowerClusterPosition_CE.tensor<float, 2>()(clNxMIdx, 0) = floatIEta(l1TowerClustersNxM_CE_pstn[clNxMIdx].seedIeta);
807  TowerClusterPosition_CE.tensor<float, 2>()(clNxMIdx, 1) = floatIPhi(l1TowerClustersNxM_CE_pstn[clNxMIdx].seedIphi);
808 
809  Cl3dShapeFeatures_CE.tensor<float, 2>()(clNxMIdx, 0) = inputScaler(HGClu.pt.to_float(), "pt");
810  Cl3dShapeFeatures_CE.tensor<float, 2>()(clNxMIdx, 1) = inputScaler(abs(floatEta(HGClu.eta)), "eta");
811  Cl3dShapeFeatures_CE.tensor<float, 2>()(clNxMIdx, 2) = inputScaler(HGClu.showerlength.to_float(), "showerlength");
812  Cl3dShapeFeatures_CE.tensor<float, 2>()(clNxMIdx, 3) =
813  inputScaler(HGClu.coreshowerlength.to_float(), "coreshowerlength");
814  Cl3dShapeFeatures_CE.tensor<float, 2>()(clNxMIdx, 4) = inputScaler(floatShape(HGClu.spptot), "spptot");
815  Cl3dShapeFeatures_CE.tensor<float, 2>()(clNxMIdx, 5) = inputScaler(floatSzz(HGClu.szz), "szz");
816  Cl3dShapeFeatures_CE.tensor<float, 2>()(clNxMIdx, 6) = inputScaler(floatShape(HGClu.srrtot), "srrtot");
817  Cl3dShapeFeatures_CE.tensor<float, 2>()(clNxMIdx, 7) = inputScaler(floatMeanZHgcalCoord(HGClu.meanz), "meanz");
818  }
819 
820  if (batchSize_CE >
821  0) // from CMSSW_14_0_X tensorflow does not seem to be able to deal with a tensor of dimension 0 anymore
822  {
823  // Apply CNN model
824  tensorflow::NamedTensorList CNNmodel_CEinputList = {{"TowerClusterImage", TowerClusterImage_CE},
825  {"TowerClusterPosition", TowerClusterPosition_CE},
826  {"AssociatedCl3dFeatures", Cl3dShapeFeatures_CE}};
827  std::vector<tensorflow::Tensor> CNNmodel_CEoutputs;
828  tensorflow::run((globalCache()->CNNmodel_CEsession),
829  CNNmodel_CEinputList,
830  {"TauMinator_CE_conv/middleMan/concat"},
831  &CNNmodel_CEoutputs);
832  tensorflow::NamedTensorList DNN_CEinputsList = {{"middleMan", CNNmodel_CEoutputs[0]}};
833 
834  // Apply DNN for identification
835  std::vector<tensorflow::Tensor> DNN_CEoutputsIdent;
836  tensorflow::run((globalCache()->DNNident_CEsession),
837  DNN_CEinputsList,
838  {"TauMinator_CE_ident/sigmoid_IDout/Sigmoid"},
839  &DNN_CEoutputsIdent);
840 
841  // Apply DNN for calibration
842  std::vector<tensorflow::Tensor> DNN_CEoutputsCalib;
843  tensorflow::run((globalCache()->DNNcalib_CEsession),
844  DNN_CEinputsList,
845  {"TauMinator_CE_calib/LIN_DNNout/Relu"},
846  &DNN_CEoutputsCalib);
847 
848  // Fill the output collection of L1 taus with the endcap candidates
849  for (int clNxMIdx = 0; clNxMIdx < Nclusters_CE; clNxMIdx++) {
850  l1t::Tau l1Tau =
851  MakeTauCandidate(false, clNxMIdx, DNN_CEoutputsIdent, DNN_CEoutputsCalib, l1TowerClustersNxM_CE_pstn);
852  if (l1Tau.pt() < 0) {
853  continue;
854  }
855  L1NNCaloTauCollectionBXV->push_back(0, l1Tau);
856  }
857  }
858 
859  // Fill output
860  iEvent.put(std::move(L1NNCaloTauCollectionBXV), "L1NNCaloTauCollectionBXV");
861 
862 } // End of produce function
edm::EDGetToken hgcalTowersToken
std::vector< NamedTensor > NamedTensorList
Definition: TensorFlow.h:31
static constexpr int PUID_W
int apintQuantizer(float inputF, float LSB, int nbits)
static constexpr int ET_W
StringCutObjectSelector< l1t::HGCalMulticluster > preEmId
double pt() const final
transverse momentum
static constexpr float MEANZ_LSB
static constexpr int PT_W
Definition: Tau.h:20
edm::Handle< l1tp2::CaloTowerCollection > l1CaloTowerHandle
T const * product() const
Definition: Handle.h:70
dEtaPhi_t tw2cl_dPhi(EtaPhi_t iPhi_1, IPhi_t iPhi_2)
static constexpr int MEANZ_W
float floatEta(EtaPhi_t eta)
float correctInputMeanzCl3d(float meanz)
static constexpr int SHAPEFEAT_W
ap_int< DIETAPHI_W > dIEtaPhi_t
int iEvent
Definition: GenABIO.cc:224
ap_int< DETAPHI_W > dEtaPhi_t
ap_ufixed< PT_W, PT_I, AP_TRN, AP_SAT > Pt_t
float floatSzz(ShapeFeat_t szz)
void run(Session *session, const NamedTensorList &inputs, const std::vector< std::string > &outputNames, std::vector< Tensor > *outputs, const thread::ThreadPoolOptions &threadPoolOptions)
Definition: TensorFlow.cc:271
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static constexpr float PTET_LSB
float inputScaler(float inputF, std::string feature)
IEta_t makeEndcapHwIEta(float eta)
IPhi_t makeEndcapHwIPhi(float phi)
ap_int< W > ap_abs(ap_int< W > x)
dIEtaPhi_t tower_dIEta(IEta_t iEta_1, IEta_t iEta_2)
l1tpf::HGC3DClusterEgID VsPuId
float apfixedQuantizer(float inputF, float LSB, int nbits)
edm::Handle< l1t::HGCalTowerBxCollection > hgcalTowersHandle
static constexpr float PUID_LSB
float correctInputEtaCl3d(float eta)
static constexpr float SZZ_LSB
static constexpr int R2cone
float floatIPhi(IPhi_t phi)
double b
Definition: hdecay.h:120
edm::EDGetTokenT< l1t::HGCalMulticlusterBxCollection > HGClusterToken
float floatIEta(IEta_t eta)
l1t::Tau MakeTauCandidate(bool isBarrel, int clNxMIdx, std::vector< tensorflow::Tensor > outputsIdent, std::vector< tensorflow::Tensor > outputsCalib, std::vector< InputTowerCluster_pstn > clustersNxM_pstn)
float floatShape(ShapeFeat_t shape)
double a
Definition: hdecay.h:121
static constexpr float SHAPEFEAT_LSB
edm::Handle< l1t::HGCalMulticlusterBxCollection > HGClusterHandle
Log< level::Warning, false > LogWarning
static constexpr float ETAPHI_LSB
float passID(l1t::HGCalMulticluster c, l1t::PFCluster &cpf)
static constexpr int ETAPHI_W
dEtaPhi_t tw2cl_dEta(EtaPhi_t iEta_1, IEta_t iEta_2)
def move(src, dest)
Definition: eostools.py:511
float floatMeanZHgcalCoord(Meanz_t meanz)
edm::EDGetTokenT< l1tp2::CaloTowerCollection > l1TowersToken

◆ tower_dIEta()

L1NNCaloTauEmulator::dIEtaPhi_t L1NNCaloTauEmulator::tower_dIEta ( IEta_t  iEta_1,
IEta_t  iEta_2 
)
private

Definition at line 876 of file L1NNCaloTauEmulator.cc.

References VarParsing::mult, and mps_fire::result.

Referenced by produce().

876  {
877  ap_int<12> mult = iEta_1 * iEta_2;
878  dIEtaPhi_t result = iEta_1 - iEta_2;
879  if (mult < 0) {
880  result = iEta_1 > 0 ? result - 1 : result + 1;
881  }
882 
883  return result;
884 }
ap_int< DIETAPHI_W > dIEtaPhi_t

◆ tw2cl_dEta()

L1NNCaloTauEmulator::dEtaPhi_t L1NNCaloTauEmulator::tw2cl_dEta ( EtaPhi_t  iEta_1,
IEta_t  iEta_2 
)
private

Definition at line 897 of file L1NNCaloTauEmulator.cc.

References ETAPHI_LSB, IETAHGCAL_LSB, and IETAHGCAL_OFFSET.

Referenced by produce().

897  {
898  // change from hgcal frame to barrel-centered frame
899  EtaPhi_t framechangeCl3d = 303; // 303*pi/720 = 1.322
900  iEta_1 = iEta_1 > EtaPhi_t(0) ? EtaPhi_t(iEta_1 + framechangeCl3d) : EtaPhi_t(iEta_1 - framechangeCl3d);
901 
902  // the actual depth is 330 but 329 corrects for 0.0808 tower
903  EtaPhi_t barrelEtaDepth = 329;
904  EtaPhi_t fineiEta_2 = barrelEtaDepth + (iEta_2 - IETAHGCAL_OFFSET) * (IETAHGCAL_LSB / ETAPHI_LSB);
905 
906  return iEta_1 - fineiEta_2;
907 }
ap_int< ETAPHI_W > EtaPhi_t
static constexpr int IETAHGCAL_OFFSET
static constexpr float IETAHGCAL_LSB
static constexpr float ETAPHI_LSB

◆ tw2cl_dPhi()

L1NNCaloTauEmulator::dEtaPhi_t L1NNCaloTauEmulator::tw2cl_dPhi ( EtaPhi_t  iPhi_1,
IPhi_t  iPhi_2 
)
private

Definition at line 886 of file L1NNCaloTauEmulator.cc.

References ETAPHI_LSB, IETAPHI_LSB, INTPHI_2PI, CICADATestPatterns::iPhi_1, and CICADATestPatterns::iPhi_2.

Referenced by produce().

886  {
887  EtaPhi_t shiftediPhi_2 = iPhi_2 <= IPhi_t(36) ? EtaPhi_t(iPhi_2) : EtaPhi_t(iPhi_2 - INTPHI_2PI + 1);
888 
889  EtaPhi_t fineiPhi_2 = shiftediPhi_2 * (IETAPHI_LSB / ETAPHI_LSB);
890  // subrtaction of half rescaling corrects from edge to center of tower
891  fineiPhi_2 = fineiPhi_2 > EtaPhi_t(0) ? EtaPhi_t(fineiPhi_2 - (IETAPHI_LSB / ETAPHI_LSB) / 2)
892  : EtaPhi_t(fineiPhi_2 + (IETAPHI_LSB / ETAPHI_LSB) / 2);
893 
894  return dPhi<dEtaPhi_t, EtaPhi_t>(iPhi_1, fineiPhi_2);
895 }
static constexpr int INTPHI_2PI
ap_int< ETAPHI_W > EtaPhi_t
static constexpr float IETAPHI_LSB
static constexpr float ETAPHI_LSB
ap_uint< IETAPHI_W > IPhi_t

Member Data Documentation

◆ CALIBPT_I

constexpr int L1NNCaloTauEmulator::CALIBPT_I = 9
staticprivate

Definition at line 151 of file L1NNCaloTauEmulator.cc.

◆ CALIBPT_W

constexpr int L1NNCaloTauEmulator::CALIBPT_W = 10
staticprivate

Definition at line 150 of file L1NNCaloTauEmulator.cc.

◆ CB_CE_split

double L1NNCaloTauEmulator::CB_CE_split
private

Definition at line 231 of file L1NNCaloTauEmulator.cc.

Referenced by L1NNCaloTauEmulator().

◆ CM2MM

constexpr float L1NNCaloTauEmulator::CM2MM = 10
staticprivate

Definition at line 132 of file L1NNCaloTauEmulator.cc.

Referenced by correctInputMeanzCl3d().

◆ DEBUG

bool L1NNCaloTauEmulator::DEBUG
private

Definition at line 246 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ DETAPHI_W

constexpr int L1NNCaloTauEmulator::DETAPHI_W = 12
staticprivate

Definition at line 136 of file L1NNCaloTauEmulator.cc.

◆ DIETAPHI_W

constexpr int L1NNCaloTauEmulator::DIETAPHI_W = 8
staticprivate

Definition at line 137 of file L1NNCaloTauEmulator.cc.

◆ EcalEtMinForClustering

double L1NNCaloTauEmulator::EcalEtMinForClustering
private

Definition at line 227 of file L1NNCaloTauEmulator.cc.

Referenced by L1NNCaloTauEmulator().

◆ ET_I

constexpr int L1NNCaloTauEmulator::ET_I = 8
staticprivate

Definition at line 147 of file L1NNCaloTauEmulator.cc.

◆ ET_W

constexpr int L1NNCaloTauEmulator::ET_W = 10
staticprivate

Definition at line 146 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ Eta_limit

const int L1NNCaloTauEmulator::Eta_limit = 33
private

Definition at line 175 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ ETAHGCAL_OFFSET

constexpr float L1NNCaloTauEmulator::ETAHGCAL_OFFSET = 1.321
staticprivate

Definition at line 124 of file L1NNCaloTauEmulator.cc.

Referenced by correctInputEtaCl3d().

◆ ETAPHI_LSB

constexpr float L1NNCaloTauEmulator::ETAPHI_LSB = M_PI / FINEINTPHI_PI
staticprivate

Definition at line 120 of file L1NNCaloTauEmulator.cc.

Referenced by floatEta(), floatPhi(), produce(), tw2cl_dEta(), and tw2cl_dPhi().

◆ ETAPHI_W

constexpr int L1NNCaloTauEmulator::ETAPHI_W = 11
staticprivate

Definition at line 140 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ EtaRestriction

double L1NNCaloTauEmulator::EtaRestriction
private

Definition at line 230 of file L1NNCaloTauEmulator.cc.

Referenced by L1NNCaloTauEmulator().

◆ EtMinForSeeding

double L1NNCaloTauEmulator::EtMinForSeeding
private

Definition at line 229 of file L1NNCaloTauEmulator.cc.

Referenced by L1NNCaloTauEmulator(), and produce().

◆ FINEINTPHI_2PI

constexpr int L1NNCaloTauEmulator::FINEINTPHI_2PI = 2 * FINEINTPHI_PI
staticprivate

Definition at line 119 of file L1NNCaloTauEmulator.cc.

◆ FINEINTPHI_PI

constexpr int L1NNCaloTauEmulator::FINEINTPHI_PI = 720
staticprivate

Definition at line 118 of file L1NNCaloTauEmulator.cc.

◆ HcalEtMinForClustering

double L1NNCaloTauEmulator::HcalEtMinForClustering
private

Definition at line 228 of file L1NNCaloTauEmulator.cc.

Referenced by L1NNCaloTauEmulator().

◆ hgcalTowersHandle

edm::Handle<l1t::HGCalTowerBxCollection> L1NNCaloTauEmulator::hgcalTowersHandle
private

Definition at line 216 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ hgcalTowersToken

edm::EDGetToken L1NNCaloTauEmulator::hgcalTowersToken
private

Definition at line 215 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ HGClusterHandle

edm::Handle<l1t::HGCalMulticlusterBxCollection> L1NNCaloTauEmulator::HGClusterHandle
private

Definition at line 219 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ HGClusterToken

edm::EDGetTokenT<l1t::HGCalMulticlusterBxCollection> L1NNCaloTauEmulator::HGClusterToken
private

Definition at line 218 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ ID_I

constexpr int L1NNCaloTauEmulator::ID_I = 1
staticprivate

Definition at line 153 of file L1NNCaloTauEmulator.cc.

◆ ID_W

constexpr int L1NNCaloTauEmulator::ID_W = 8
staticprivate

Definition at line 152 of file L1NNCaloTauEmulator.cc.

◆ IdWp90_CB

double L1NNCaloTauEmulator::IdWp90_CB
private

Definition at line 234 of file L1NNCaloTauEmulator.cc.

Referenced by MakeTauCandidate().

◆ IdWp90_CE

double L1NNCaloTauEmulator::IdWp90_CE
private

Definition at line 238 of file L1NNCaloTauEmulator.cc.

Referenced by MakeTauCandidate().

◆ IdWp95_CB

double L1NNCaloTauEmulator::IdWp95_CB
private

Definition at line 235 of file L1NNCaloTauEmulator.cc.

Referenced by MakeTauCandidate().

◆ IdWp95_CE

double L1NNCaloTauEmulator::IdWp95_CE
private

Definition at line 239 of file L1NNCaloTauEmulator.cc.

Referenced by MakeTauCandidate().

◆ IdWp99_CB

double L1NNCaloTauEmulator::IdWp99_CB
private

Definition at line 236 of file L1NNCaloTauEmulator.cc.

Referenced by MakeTauCandidate().

◆ IdWp99_CE

double L1NNCaloTauEmulator::IdWp99_CE
private

Definition at line 240 of file L1NNCaloTauEmulator.cc.

Referenced by MakeTauCandidate().

◆ IEta_dim

const int L1NNCaloTauEmulator::IEta_dim = 5
private

Definition at line 173 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ IETAHGCAL_LSB

constexpr float L1NNCaloTauEmulator::IETAHGCAL_LSB = 0.0845
staticprivate

Definition at line 126 of file L1NNCaloTauEmulator.cc.

Referenced by floatIEta(), makeEndcapHwIEta(), and tw2cl_dEta().

◆ IETAHGCAL_LSBp

constexpr float L1NNCaloTauEmulator::IETAHGCAL_LSBp = 0.0808
staticprivate

Definition at line 125 of file L1NNCaloTauEmulator.cc.

Referenced by floatIEta().

◆ IETAHGCAL_OFFSET

constexpr int L1NNCaloTauEmulator::IETAHGCAL_OFFSET = 17
staticprivate

Definition at line 129 of file L1NNCaloTauEmulator.cc.

Referenced by floatIEta(), and tw2cl_dEta().

◆ IETAPHI_LSB

constexpr float L1NNCaloTauEmulator::IETAPHI_LSB = M_PI / INTPHI_PI
staticprivate

◆ IETAPHI_W

constexpr int L1NNCaloTauEmulator::IETAPHI_W = 7
staticprivate

Definition at line 138 of file L1NNCaloTauEmulator.cc.

Referenced by L1NNCaloTauEmulator().

◆ intCB_CE_split

IEta_t L1NNCaloTauEmulator::intCB_CE_split
private

Definition at line 244 of file L1NNCaloTauEmulator.cc.

Referenced by L1NNCaloTauEmulator(), and produce().

◆ intEtaRestriction

IEta_t L1NNCaloTauEmulator::intEtaRestriction
private

Definition at line 243 of file L1NNCaloTauEmulator.cc.

Referenced by L1NNCaloTauEmulator(), MakeTauCandidate(), and produce().

◆ INTPHI_2PI

constexpr int L1NNCaloTauEmulator::INTPHI_2PI = 2 * INTPHI_PI
staticprivate

Definition at line 115 of file L1NNCaloTauEmulator.cc.

Referenced by dPhi(), floatIPhi(), and tw2cl_dPhi().

◆ INTPHI_PI

constexpr int L1NNCaloTauEmulator::INTPHI_PI = 36
staticprivate

Definition at line 114 of file L1NNCaloTauEmulator.cc.

Referenced by dPhi(), and floatIPhi().

◆ intPuidThr

PUid_t L1NNCaloTauEmulator::intPuidThr
private

Definition at line 242 of file L1NNCaloTauEmulator.cc.

Referenced by L1NNCaloTauEmulator(), and produce().

◆ IPhi_dim

const int L1NNCaloTauEmulator::IPhi_dim = 9
private

Definition at line 174 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ l1CaloTowerHandle

edm::Handle<l1tp2::CaloTowerCollection> L1NNCaloTauEmulator::l1CaloTowerHandle
private

Definition at line 213 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ l1TowersToken

edm::EDGetTokenT<l1tp2::CaloTowerCollection> L1NNCaloTauEmulator::l1TowersToken
private

Definition at line 212 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ MEANZ_LSB

constexpr float L1NNCaloTauEmulator::MEANZ_LSB = 0.5
staticprivate

Definition at line 130 of file L1NNCaloTauEmulator.cc.

Referenced by floatMeanZ(), floatMeanZHgcalCoord(), and produce().

◆ MEANZ_OFFSET

constexpr float L1NNCaloTauEmulator::MEANZ_OFFSET = 321.05
staticprivate

Definition at line 128 of file L1NNCaloTauEmulator.cc.

Referenced by correctInputMeanzCl3d(), and floatMeanZ().

◆ MEANZ_W

constexpr int L1NNCaloTauEmulator::MEANZ_W = 12
staticprivate

Definition at line 141 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ preEmId

StringCutObjectSelector<l1t::HGCalMulticluster> L1NNCaloTauEmulator::preEmId
private

Definition at line 224 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ PT_I

constexpr int L1NNCaloTauEmulator::PT_I = 12
staticprivate

Definition at line 145 of file L1NNCaloTauEmulator.cc.

◆ PT_W

constexpr int L1NNCaloTauEmulator::PT_W = 14
staticprivate

Definition at line 144 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ PTET_LSB

constexpr float L1NNCaloTauEmulator::PTET_LSB = 0.25
staticprivate

Definition at line 131 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ PUID_LSB

constexpr float L1NNCaloTauEmulator::PUID_LSB = 0.00390625
staticprivate

Definition at line 127 of file L1NNCaloTauEmulator.cc.

Referenced by floatPuId(), L1NNCaloTauEmulator(), and produce().

◆ PUID_W

constexpr int L1NNCaloTauEmulator::PUID_W = 9
staticprivate

Definition at line 142 of file L1NNCaloTauEmulator.cc.

Referenced by L1NNCaloTauEmulator(), and produce().

◆ PuidThr

double L1NNCaloTauEmulator::PuidThr
private

Definition at line 232 of file L1NNCaloTauEmulator.cc.

Referenced by L1NNCaloTauEmulator().

◆ R2cone

constexpr int L1NNCaloTauEmulator::R2cone = 0.25 / ETAPHI_LSB / ETAPHI_LSB
staticprivate

Definition at line 133 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ scenario

UseEmInterp L1NNCaloTauEmulator::scenario
private

Definition at line 223 of file L1NNCaloTauEmulator.cc.

Referenced by validation.Sample::digest(), and produce().

◆ seedIdx

const int L1NNCaloTauEmulator::seedIdx = 22
private

Definition at line 172 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ SHAPEFEAT_LSB

constexpr float L1NNCaloTauEmulator::SHAPEFEAT_LSB = 0.0000153
staticprivate

Definition at line 122 of file L1NNCaloTauEmulator.cc.

Referenced by floatShape(), and produce().

◆ SHAPEFEAT_W

constexpr int L1NNCaloTauEmulator::SHAPEFEAT_W = 16
staticprivate

Definition at line 135 of file L1NNCaloTauEmulator.cc.

Referenced by produce().

◆ SHOWLEN_W

constexpr int L1NNCaloTauEmulator::SHOWLEN_W = 6
staticprivate

Definition at line 139 of file L1NNCaloTauEmulator.cc.

◆ SZZ_LSB

constexpr float L1NNCaloTauEmulator::SZZ_LSB = SHAPEFEAT_LSB * 100
staticprivate

Definition at line 123 of file L1NNCaloTauEmulator.cc.

Referenced by floatSzz(), and produce().

◆ VsPuId

l1tpf::HGC3DClusterEgID L1NNCaloTauEmulator::VsPuId
private

Definition at line 225 of file L1NNCaloTauEmulator.cc.

Referenced by L1NNCaloTauEmulator(), and produce().