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

References mps_fire::result, and x.

Referenced by produce().

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

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

References mps_fire::result, and x.

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

◆ apfixedQuantizer()

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

Definition at line 949 of file L1NNCaloTauEmulator.cc.

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

Referenced by produce().

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

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

Referenced by L1NNCaloTauEmulator(), and produce().

953  {
954  return min(floor(inputF / LSB), float(pow(2, nbits) - 1));
955 }
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 964 of file L1NNCaloTauEmulator.cc.

References PVValHelper::eta, and ETAHGCAL_OFFSET.

Referenced by produce().

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

◆ correctInputMeanzCl3d()

float L1NNCaloTauEmulator::correctInputMeanzCl3d ( float  meanz)
private

Definition at line 968 of file L1NNCaloTauEmulator.cc.

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

Referenced by produce().

968 { 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 866 of file L1NNCaloTauEmulator.cc.

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

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

◆ fillDescriptions()

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

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

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

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

References IETAPHI_LSB, INTPHI_2PI, INTPHI_PI, and phi.

Referenced by MakeTauCandidate(), and produce().

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

References SiStripPI::mean.

Referenced by produce().

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

◆ makeEndcapHwIEta()

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

Definition at line 910 of file L1NNCaloTauEmulator.cc.

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

Referenced by produce().

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

◆ makeEndcapHwIPhi()

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

Definition at line 918 of file L1NNCaloTauEmulator.cc.

References IETAPHI_LSB, M_PI, and phi.

Referenced by produce().

918  {
919  phi = phi < 0 ? phi + 2 * M_PI : phi;
920 
921  // +1 because tower 0 does not exist
922  return floor(phi / IETAPHI_LSB) + 1;
923 }
#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 999 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().

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

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
721  int batchSize_CB = (int)(Nclusters_CB);
722  tensorflow::TensorShape imageShape_CB({batchSize_CB, IEta_dim, IPhi_dim, 2});
723  tensorflow::TensorShape positionShape_CB({batchSize_CB, 2});
724  tensorflow::Tensor TowerClusterImage_CB(tensorflow::DT_FLOAT, imageShape_CB);
725  tensorflow::Tensor TowerClusterPosition_CB(tensorflow::DT_FLOAT, positionShape_CB);
726 
727  for (int clNxMIdx = 0; clNxMIdx < Nclusters_CB; clNxMIdx++) {
728  // Fill inputs for Tensorflow inference
729  for (int eta = 0; eta < IEta_dim; ++eta) {
730  for (int phi = 0; phi < IPhi_dim; ++phi) {
731  int towerIdx = eta * IPhi_dim + phi;
732  TowerClusterImage_CB.tensor<float, 4>()(clNxMIdx, eta, phi, 0) =
733  (l1TowerClustersNxM_CB[clNxMIdx].towerHits[towerIdx].l1egTowerEt.to_float() +
734  l1TowerClustersNxM_CB[clNxMIdx].towerHits[towerIdx].towerEm.to_float());
735  TowerClusterImage_CB.tensor<float, 4>()(clNxMIdx, eta, phi, 1) =
736  (l1TowerClustersNxM_CB[clNxMIdx].towerHits[towerIdx].towerHad.to_float());
737  }
738  }
739 
740  TowerClusterPosition_CB.tensor<float, 2>()(clNxMIdx, 0) = floatIEta(l1TowerClustersNxM_CB_pstn[clNxMIdx].seedIeta);
741  TowerClusterPosition_CB.tensor<float, 2>()(clNxMIdx, 1) = floatIPhi(l1TowerClustersNxM_CB_pstn[clNxMIdx].seedIphi);
742  }
743 
744  if (batchSize_CB >
745  0) // from CMSSW_14_0_X tensorflow does not seem to be able to deal with a tensor of dimension 0 anymore
746  {
747  // Apply CNN model
748  tensorflow::NamedTensorList CNNmodel_CBinputList = {{"TowerClusterImage", TowerClusterImage_CB},
749  {"TowerClusterPosition", TowerClusterPosition_CB}};
750  std::vector<tensorflow::Tensor> CNNmodel_CBoutputs;
751  tensorflow::run((globalCache()->CNNmodel_CBsession),
752  CNNmodel_CBinputList,
753  {"TauMinator_CB_conv/middleMan/concat"},
754  &CNNmodel_CBoutputs);
755  tensorflow::NamedTensorList DNN_CBinputsList = {{"middleMan", CNNmodel_CBoutputs[0]}};
756 
757  // Apply DNN for identification
758  std::vector<tensorflow::Tensor> DNN_CBoutputsIdent;
759  tensorflow::run((globalCache()->DNNident_CBsession),
760  DNN_CBinputsList,
761  {"TauMinator_CB_ident/sigmoid_IDout/Sigmoid"},
762  &DNN_CBoutputsIdent);
763 
764  // Apply DNN for calibration
765  std::vector<tensorflow::Tensor> DNN_CBoutputsCalib;
766  tensorflow::run((globalCache()->DNNcalib_CBsession),
767  DNN_CBinputsList,
768  {"TauMinator_CB_calib/DNNout/MatMul"},
769  &DNN_CBoutputsCalib);
770 
771  // Fill the output collection of L1 taus with the barrel candidates
772  for (int clNxMIdx = 0; clNxMIdx < Nclusters_CB; clNxMIdx++) {
773  l1t::Tau l1Tau =
774  MakeTauCandidate(true, clNxMIdx, DNN_CBoutputsIdent, DNN_CBoutputsCalib, l1TowerClustersNxM_CB_pstn);
775  if (l1Tau.pt() < 0) {
776  continue;
777  }
778  L1NNCaloTauCollectionBXV->push_back(0, l1Tau);
779  }
780  }
781 
782  // Endcap TauMinator application
783  int batchSize_CE = (int)(Nclusters_CE);
784  tensorflow::TensorShape imageShape_CE({batchSize_CE, IEta_dim, IPhi_dim, 2});
785  tensorflow::TensorShape positionShape_CE({batchSize_CE, 2});
786  tensorflow::TensorShape cl3dfeatShape_CE({batchSize_CE, 8});
787  tensorflow::Tensor TowerClusterImage_CE(tensorflow::DT_FLOAT, imageShape_CE);
788  tensorflow::Tensor TowerClusterPosition_CE(tensorflow::DT_FLOAT, positionShape_CE);
789  tensorflow::Tensor Cl3dShapeFeatures_CE(tensorflow::DT_FLOAT, cl3dfeatShape_CE);
790 
791  for (int clNxMIdx = 0; clNxMIdx < Nclusters_CE; clNxMIdx++) {
792  // Indexing of cl3ds is the same as the one of clNxMs
793  InputHGCluster HGClu = HGClusters[clNxMIdx];
794 
795  // Fill inputs for Tensorflow inference
796  for (int eta = 0; eta < IEta_dim; ++eta) {
797  for (int phi = 0; phi < IPhi_dim; ++phi) {
798  int towerIdx = eta * IPhi_dim + phi;
799  TowerClusterImage_CE.tensor<float, 4>()(clNxMIdx, eta, phi, 0) =
800  (l1TowerClustersNxM_CE[clNxMIdx].towerHits[towerIdx].l1egTowerEt.to_float() +
801  l1TowerClustersNxM_CE[clNxMIdx].towerHits[towerIdx].towerEm.to_float());
802  TowerClusterImage_CE.tensor<float, 4>()(clNxMIdx, eta, phi, 1) =
803  (l1TowerClustersNxM_CE[clNxMIdx].towerHits[towerIdx].towerHad.to_float());
804  }
805  }
806 
807  TowerClusterPosition_CE.tensor<float, 2>()(clNxMIdx, 0) = floatIEta(l1TowerClustersNxM_CE_pstn[clNxMIdx].seedIeta);
808  TowerClusterPosition_CE.tensor<float, 2>()(clNxMIdx, 1) = floatIPhi(l1TowerClustersNxM_CE_pstn[clNxMIdx].seedIphi);
809 
810  Cl3dShapeFeatures_CE.tensor<float, 2>()(clNxMIdx, 0) = inputScaler(HGClu.pt.to_float(), "pt");
811  Cl3dShapeFeatures_CE.tensor<float, 2>()(clNxMIdx, 1) = inputScaler(abs(floatEta(HGClu.eta)), "eta");
812  Cl3dShapeFeatures_CE.tensor<float, 2>()(clNxMIdx, 2) = inputScaler(HGClu.showerlength.to_float(), "showerlength");
813  Cl3dShapeFeatures_CE.tensor<float, 2>()(clNxMIdx, 3) =
814  inputScaler(HGClu.coreshowerlength.to_float(), "coreshowerlength");
815  Cl3dShapeFeatures_CE.tensor<float, 2>()(clNxMIdx, 4) = inputScaler(floatShape(HGClu.spptot), "spptot");
816  Cl3dShapeFeatures_CE.tensor<float, 2>()(clNxMIdx, 5) = inputScaler(floatSzz(HGClu.szz), "szz");
817  Cl3dShapeFeatures_CE.tensor<float, 2>()(clNxMIdx, 6) = inputScaler(floatShape(HGClu.srrtot), "srrtot");
818  Cl3dShapeFeatures_CE.tensor<float, 2>()(clNxMIdx, 7) = inputScaler(floatMeanZHgcalCoord(HGClu.meanz), "meanz");
819  }
820 
821  if (batchSize_CE >
822  0) // from CMSSW_14_0_X tensorflow does not seem to be able to deal with a tensor of dimension 0 anymore
823  {
824  // Apply CNN model
825  tensorflow::NamedTensorList CNNmodel_CEinputList = {{"TowerClusterImage", TowerClusterImage_CE},
826  {"TowerClusterPosition", TowerClusterPosition_CE},
827  {"AssociatedCl3dFeatures", Cl3dShapeFeatures_CE}};
828  std::vector<tensorflow::Tensor> CNNmodel_CEoutputs;
829  tensorflow::run((globalCache()->CNNmodel_CEsession),
830  CNNmodel_CEinputList,
831  {"TauMinator_CE_conv/middleMan/concat"},
832  &CNNmodel_CEoutputs);
833  tensorflow::NamedTensorList DNN_CEinputsList = {{"middleMan", CNNmodel_CEoutputs[0]}};
834 
835  // Apply DNN for identification
836  std::vector<tensorflow::Tensor> DNN_CEoutputsIdent;
837  tensorflow::run((globalCache()->DNNident_CEsession),
838  DNN_CEinputsList,
839  {"TauMinator_CE_ident/sigmoid_IDout/Sigmoid"},
840  &DNN_CEoutputsIdent);
841 
842  // Apply DNN for calibration
843  std::vector<tensorflow::Tensor> DNN_CEoutputsCalib;
844  tensorflow::run((globalCache()->DNNcalib_CEsession),
845  DNN_CEinputsList,
846  {"TauMinator_CE_calib/LIN_DNNout/Relu"},
847  &DNN_CEoutputsCalib);
848 
849  // Fill the output collection of L1 taus with the endcap candidates
850  for (int clNxMIdx = 0; clNxMIdx < Nclusters_CE; clNxMIdx++) {
851  l1t::Tau l1Tau =
852  MakeTauCandidate(false, clNxMIdx, DNN_CEoutputsIdent, DNN_CEoutputsCalib, l1TowerClustersNxM_CE_pstn);
853  if (l1Tau.pt() < 0) {
854  continue;
855  }
856  L1NNCaloTauCollectionBXV->push_back(0, l1Tau);
857  }
858  }
859 
860  // Fill output
861  iEvent.put(std::move(L1NNCaloTauCollectionBXV), "L1NNCaloTauCollectionBXV");
862 
863 } // 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:281
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 877 of file L1NNCaloTauEmulator.cc.

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

Referenced by produce().

877  {
878  ap_int<12> mult = iEta_1 * iEta_2;
879  dIEtaPhi_t result = iEta_1 - iEta_2;
880  if (mult < 0) {
881  result = iEta_1 > 0 ? result - 1 : result + 1;
882  }
883 
884  return result;
885 }
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 898 of file L1NNCaloTauEmulator.cc.

References ETAPHI_LSB, IETAHGCAL_LSB, and IETAHGCAL_OFFSET.

Referenced by produce().

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

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

Referenced by produce().

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