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
 
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 400 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.

401  : l1TowersToken(consumes<l1tp2::CaloTowerCollection>(iConfig.getParameter<edm::InputTag>("l1CaloTowers"))),
402  hgcalTowersToken(consumes<l1t::HGCalTowerBxCollection>(iConfig.getParameter<edm::InputTag>("hgcalTowers"))),
403 
405  consumes<l1t::HGCalMulticlusterBxCollection>(iConfig.getParameter<edm::InputTag>("HgcalClusters"))),
407  preEmId(iConfig.getParameter<std::string>("preEmId")),
408  VsPuId(iConfig.getParameter<edm::ParameterSet>("VsPuId")),
409 
410  EcalEtMinForClustering(iConfig.getParameter<double>("EcalEtMinForClustering")),
411  HcalEtMinForClustering(iConfig.getParameter<double>("HcalEtMinForClustering")),
412  EtMinForSeeding(iConfig.getParameter<double>("EtMinForSeeding")),
413  EtaRestriction(iConfig.getParameter<double>("EtaRestriction")),
414  CB_CE_split(iConfig.getParameter<double>("CB_CE_split")),
415  PuidThr(iConfig.getParameter<double>("PuidThr")),
416 
417  IdWp90_CB(iConfig.getParameter<double>("IdWp90_CB")),
418  IdWp95_CB(iConfig.getParameter<double>("IdWp95_CB")),
419  IdWp99_CB(iConfig.getParameter<double>("IdWp99_CB")),
420 
421  IdWp90_CE(iConfig.getParameter<double>("IdWp90_CE")),
422  IdWp95_CE(iConfig.getParameter<double>("IdWp95_CE")),
423  IdWp99_CE(iConfig.getParameter<double>("IdWp99_CE")) {
424  // Initialize HGCAL BDTs
425  if (!VsPuId.method().empty()) {
427  }
428 
432 
433  // Create produced outputs
434  produces<BXVector<l1t::Tau>>("L1NNCaloTauCollectionBXV");
435 
436  // Settings output
437  edm::LogInfo("Settings") << "EtaRestriction = " << EtaRestriction << " (" << intEtaRestriction << ")"
438  << " , CB_CE_split = " << CB_CE_split << "(" << intCB_CE_split
439  << ") , EtMinForSeeding = " << EtMinForSeeding
440  << " , HcalTpEtMin = " << HcalEtMinForClustering
441  << " , EcalTpEtMin = " << EcalEtMinForClustering << " , PuidThr = " << PuidThr << "("
442  << intPuidThr << ")" << std::endl;
443 }
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 922 of file L1NNCaloTauEmulator.cc.

References mps_fire::result, and x.

Referenced by produce().

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

◆ 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 934 of file L1NNCaloTauEmulator.cc.

References mps_fire::result, and x.

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

◆ apfixedQuantizer()

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

Definition at line 945 of file L1NNCaloTauEmulator.cc.

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

Referenced by produce().

945  {
946  return min(floor(inputF / LSB), float(pow(2, nbits) - 1)) * LSB;
947 }
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 949 of file L1NNCaloTauEmulator.cc.

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

Referenced by L1NNCaloTauEmulator(), and produce().

949  {
950  return min(floor(inputF / LSB), float(pow(2, nbits) - 1));
951 }
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 960 of file L1NNCaloTauEmulator.cc.

References PVValHelper::eta, and ETAHGCAL_OFFSET.

Referenced by produce().

960  {
961  return eta > 0 ? eta - ETAHGCAL_OFFSET : eta + ETAHGCAL_OFFSET;
962 }
static constexpr float ETAHGCAL_OFFSET

◆ correctInputMeanzCl3d()

float L1NNCaloTauEmulator::correctInputMeanzCl3d ( float  meanz)
private

Definition at line 964 of file L1NNCaloTauEmulator.cc.

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

Referenced by produce().

964 { 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 862 of file L1NNCaloTauEmulator.cc.

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

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

◆ fillDescriptions()

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

Definition at line 1056 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.

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

966  {
967  // transform eta of towers from integer to float, correcting for different barrel/endcap LSB
968  float feta;
969  if (abs(eta) > IETAHGCAL_OFFSET) {
970  if (eta > 0) {
972  (eta.to_float() - IETAHGCAL_OFFSET) * IETAHGCAL_LSB;
973  } else {
975  (eta.to_float() + IETAHGCAL_OFFSET) * IETAHGCAL_LSB;
976  }
977  } else {
978  feta = eta.to_float() * IETAPHI_LSB;
979  }
980 
981  // shift by half a tower to consider the tower center instead of the edge
982  return feta > 0 ? feta - IETAPHI_LSB / 2 : feta + IETAPHI_LSB / 2;
983 }
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 985 of file L1NNCaloTauEmulator.cc.

References IETAPHI_LSB, INTPHI_2PI, INTPHI_PI, and phi.

Referenced by MakeTauCandidate(), and produce().

985  {
986  float fphi = phi.to_float();
987  // add 2pi + 1 because tower 0 does not exist
988  fphi = fphi > INTPHI_PI ? fphi - INTPHI_2PI + 1 : fphi;
989  fphi *= IETAPHI_LSB;
990 
991  // shift by half a tower to consider the tower center instead of the edge
992  return fphi > 0 ? fphi - IETAPHI_LSB / 2 : fphi + IETAPHI_LSB / 2;
993 }
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 360 of file L1NNCaloTauEmulator.cc.

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

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

◆ inputScaler()

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

Definition at line 953 of file L1NNCaloTauEmulator.cc.

References SiStripPI::mean.

Referenced by produce().

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

◆ makeEndcapHwIEta()

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

Definition at line 906 of file L1NNCaloTauEmulator.cc.

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

Referenced by produce().

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

◆ makeEndcapHwIPhi()

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

Definition at line 914 of file L1NNCaloTauEmulator.cc.

References IETAPHI_LSB, M_PI, and phi.

Referenced by produce().

914  {
915  phi = phi < 0 ? phi + 2 * M_PI : phi;
916 
917  // +1 because tower 0 does not exist
918  return floor(phi / IETAPHI_LSB) + 1;
919 }
#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 995 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().

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

References a, funct::abs(), AllKeepHad, AllKeepTot, ap_abs(), apfixedQuantizer(), apintQuantizer(), b, L1NNCaloTauEmulator::InputTowerCluster::barrelSeeded, L1NNCaloTauEmulator::InputHGCluster::coreshowerlength, correctInputEtaCl3d(), correctInputMeanzCl3d(), 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, tensorflow::setLogging(), 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.

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

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

Referenced by produce().

873  {
874  ap_int<12> mult = iEta_1 * iEta_2;
875  dIEtaPhi_t result = iEta_1 - iEta_2;
876  if (mult < 0) {
877  result = iEta_1 > 0 ? result - 1 : result + 1;
878  }
879 
880  return result;
881 }
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 894 of file L1NNCaloTauEmulator.cc.

References ETAPHI_LSB, IETAHGCAL_LSB, and IETAHGCAL_OFFSET.

Referenced by produce().

894  {
895  // change from hgcal frame to barrel-centered frame
896  EtaPhi_t framechangeCl3d = 303; // 303*pi/720 = 1.322
897  iEta_1 = iEta_1 > EtaPhi_t(0) ? EtaPhi_t(iEta_1 + framechangeCl3d) : EtaPhi_t(iEta_1 - framechangeCl3d);
898 
899  // the actual depth is 330 but 329 corrects for 0.0808 tower
900  EtaPhi_t barrelEtaDepth = 329;
901  EtaPhi_t fineiEta_2 = barrelEtaDepth + (iEta_2 - IETAHGCAL_OFFSET) * (IETAHGCAL_LSB / ETAPHI_LSB);
902 
903  return iEta_1 - fineiEta_2;
904 }
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 883 of file L1NNCaloTauEmulator.cc.

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

Referenced by produce().

883  {
884  EtaPhi_t shiftediPhi_2 = iPhi_2 <= IPhi_t(36) ? EtaPhi_t(iPhi_2) : EtaPhi_t(iPhi_2 - INTPHI_2PI + 1);
885 
886  EtaPhi_t fineiPhi_2 = shiftediPhi_2 * (IETAPHI_LSB / ETAPHI_LSB);
887  // subrtaction of half rescaling corrects from edge to center of tower
888  fineiPhi_2 = fineiPhi_2 > EtaPhi_t(0) ? EtaPhi_t(fineiPhi_2 - (IETAPHI_LSB / ETAPHI_LSB) / 2)
889  : EtaPhi_t(fineiPhi_2 + (IETAPHI_LSB / ETAPHI_LSB) / 2);
890 
891  return dPhi<dEtaPhi_t, EtaPhi_t>(iPhi_1, fineiPhi_2);
892 }
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().

◆ 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().