CMS 3D CMS Logo

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

Classes

class  SimpleHGCluster
 
class  SimpleTowerCluster
 
class  SimpleTowerHit
 

Public Member Functions

 L1NNCaloTauProducer (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

enum  UseEmInterp { UseEmInterp::No, UseEmInterp::EmOnly, UseEmInterp::AllKeepHad, UseEmInterp::AllKeepTot }
 

Private Member Functions

int endcap_ieta (float &eta) const
 
int endcap_iphi (float &phi) const
 
float inputQuantizer (float inputF, float LSB, int nbits)
 
float inputScaler (float inputF, std::string feature)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
int tower_dIEta (int &iEta_1, int &iEta_2) const
 
int tower_dIPhi (int &iPhi_1, int &iPhi_2) const
 

Private Attributes

double CB_CE_split
 
bool DEBUG
 
double EcalEtMinForClustering
 
const float Eta_dim = 0.2
 
const float Eta_dim_seed = 0.35
 
const float Eta_limit = 2.83
 
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
 
const int IPhi_dim = 9
 
edm::Handle< l1tp2::CaloTowerCollectionl1CaloTowerHandle
 
edm::EDGetTokenT< l1tp2::CaloTowerCollectionl1TowersToken
 
const float Phi_dim = 0.4
 
const float Phi_dim_seed = 0.7
 
StringCutObjectSelector< l1t::HGCalMulticlusterpreEmId
 
UseEmInterp scenario
 
const int seedIdx = 22
 
l1tpf::HGC3DClusterEgID VsPuId
 

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 88 of file L1NNCaloTauProducer.cc.

Member Enumeration Documentation

◆ UseEmInterp

Enumerator
No 
EmOnly 
AllKeepHad 
AllKeepTot 

Definition at line 119 of file L1NNCaloTauProducer.cc.

119 { No, EmOnly, AllKeepHad, AllKeepTot };

Constructor & Destructor Documentation

◆ L1NNCaloTauProducer()

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

Definition at line 245 of file L1NNCaloTauProducer.cc.

References CB_CE_split, EcalEtMinForClustering, EtaRestriction, EtMinForSeeding, HcalEtMinForClustering, l1tpf::HGC3DClusterEgID::method(), l1tpf::HGC3DClusterEgID::prepareTMVA(), and VsPuId.

246  : l1TowersToken(consumes<l1tp2::CaloTowerCollection>(iConfig.getParameter<edm::InputTag>("l1CaloTowers"))),
247  hgcalTowersToken(consumes<l1t::HGCalTowerBxCollection>(iConfig.getParameter<edm::InputTag>("hgcalTowers"))),
248 
250  consumes<l1t::HGCalMulticlusterBxCollection>(iConfig.getParameter<edm::InputTag>("HgcalClusters"))),
252  preEmId(iConfig.getParameter<std::string>("preEmId")),
253  VsPuId(iConfig.getParameter<edm::ParameterSet>("VsPuId")),
254 
255  EcalEtMinForClustering(iConfig.getParameter<double>("EcalEtMinForClustering")),
256  HcalEtMinForClustering(iConfig.getParameter<double>("HcalEtMinForClustering")),
257  EtMinForSeeding(iConfig.getParameter<double>("EtMinForSeeding")),
258  EtaRestriction(iConfig.getParameter<double>("EtaRestriction")),
259  CB_CE_split(iConfig.getParameter<double>("CB_CE_split")),
260 
261  IdWp90_CB(iConfig.getParameter<double>("IdWp90_CB")),
262  IdWp95_CB(iConfig.getParameter<double>("IdWp95_CB")),
263  IdWp99_CB(iConfig.getParameter<double>("IdWp99_CB")),
264 
265  IdWp90_CE(iConfig.getParameter<double>("IdWp90_CE")),
266  IdWp95_CE(iConfig.getParameter<double>("IdWp95_CE")),
267  IdWp99_CE(iConfig.getParameter<double>("IdWp99_CE")),
268 
269  DEBUG(iConfig.getParameter<bool>("DEBUG")) {
270  // Initialize HGCAL BDTs
271  if (!VsPuId.method().empty()) {
273  }
274 
275  // Create produced outputs
276  produces<BXVector<l1t::Tau>>("L1NNCaloTauCollectionBXV");
277 
278  // Settings output
279  edm::LogInfo("Settings") << "EtaRestriction = " << EtaRestriction << " , CB_CE_split = " << CB_CE_split
280  << " , EtMinForSeeding = " << EtMinForSeeding
281  << " , HcalTpEtMin = " << HcalEtMinForClustering
282  << " , EcalTpEtMin = " << EcalEtMinForClustering << std::endl;
283 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
StringCutObjectSelector< l1t::HGCalMulticluster > preEmId
edm::EDGetTokenT< l1t::HGCalMulticlusterBxCollection > HGClusterToken
Log< level::Info, false > LogInfo
l1tpf::HGC3DClusterEgID VsPuId
edm::EDGetToken hgcalTowersToken
edm::EDGetTokenT< l1tp2::CaloTowerCollection > l1TowersToken

Member Function Documentation

◆ endcap_ieta()

int L1NNCaloTauProducer::endcap_ieta ( float &  eta) const
private

Definition at line 837 of file L1NNCaloTauProducer.cc.

References funct::abs(), and PVValHelper::eta.

Referenced by produce().

837  {
838  const float eta_step = 0.0845;
839  return floor(abs(eta) / eta_step) * std::copysign(1, eta);
840 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ endcap_iphi()

int L1NNCaloTauProducer::endcap_iphi ( float &  phi) const
private

Definition at line 828 of file L1NNCaloTauProducer.cc.

References phi.

Referenced by produce().

828  {
829  const float phi_step = 0.0872664;
830  if (phi > 0) {
831  return floor(phi / phi_step) + 1;
832  } else {
833  return floor(phi / phi_step) + 73;
834  }
835 }

◆ fillDescriptions()

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

Definition at line 853 of file L1NNCaloTauProducer.cc.

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

853  {
855 
856  desc.add<edm::InputTag>("l1CaloTowers", edm::InputTag("l1tEGammaClusterEmuProducer", "L1CaloTowerCollection"));
857  desc.add<edm::InputTag>("hgcalTowers", edm::InputTag("l1tHGCalTowerProducer", "HGCalTowerProcessor"));
858  desc.add<edm::InputTag>("HgcalClusters",
859  edm::InputTag("l1tHGCalBackEndLayer2Producer", "HGCalBackendLayer2Processor3DClustering"));
860 
861  desc.add<std::string>("preEmId", "hOverE < 0.3 && hOverE >= 0");
862  {
864  psd0.add<bool>("isPUFilter", true);
865  psd0.add<std::string>("preselection", "");
866  psd0.add<std::string>("method", "BDT");
867  {
869  vpsd2.add<std::string>("name");
870  vpsd2.add<std::string>("value");
871  std::vector<edm::ParameterSet> temp2;
872  temp2.reserve(5);
873  {
874  edm::ParameterSet temp3;
875  temp3.addParameter<std::string>("name", "eMax");
876  temp3.addParameter<std::string>("value", "eMax()");
877  temp2.push_back(temp3);
878  }
879  {
880  edm::ParameterSet temp3;
881  temp3.addParameter<std::string>("name", "eMaxOverE");
882  temp3.addParameter<std::string>("value", "eMax()/energy()");
883  temp2.push_back(temp3);
884  }
885  {
886  edm::ParameterSet temp3;
887  temp3.addParameter<std::string>("name", "sigmaPhiPhiTot");
888  temp3.addParameter<std::string>("value", "sigmaPhiPhiTot()");
889  temp2.push_back(temp3);
890  }
891  {
892  edm::ParameterSet temp3;
893  temp3.addParameter<std::string>("name", "sigmaRRTot");
894  temp3.addParameter<std::string>("value", "sigmaRRTot()");
895  temp2.push_back(temp3);
896  }
897  {
898  edm::ParameterSet temp3;
899  temp3.addParameter<std::string>("name", "triggerCells90percent");
900  temp3.addParameter<std::string>("value", "triggerCells90percent()");
901  temp2.push_back(temp3);
902  }
903  psd0.addVPSet("variables", vpsd2, temp2);
904  }
905  psd0.add<std::string>(
906  "weightsFile", "L1Trigger/Phase2L1ParticleFlow/data/hgcal_egID/Photon_Pion_vs_Neutrino_BDTweights_1116.xml.gz");
907  psd0.add<std::string>("wp", "-0.10");
908  desc.add<edm::ParameterSetDescription>("VsPuId", psd0);
909  }
910 
911  desc.add<double>("EcalEtMinForClustering", 0.0);
912  desc.add<double>("HcalEtMinForClustering", 0.0);
913  desc.add<double>("EtMinForSeeding", 2.5);
914  desc.add<double>("EtaRestriction", 2.4);
915  desc.add<double>("CB_CE_split", 1.55);
916 
917  desc.add<std::string>("CNNmodel_CB_path", "L1Trigger/L1CaloTrigger/data/Phase2_NNCaloTaus/v22/CNNmodel_CB.pb");
918  desc.add<std::string>("DNNident_CB_path", "L1Trigger/L1CaloTrigger/data/Phase2_NNCaloTaus/v22/DNNident_CB.pb");
919  desc.add<std::string>("DNNcalib_CB_path", "L1Trigger/L1CaloTrigger/data/Phase2_NNCaloTaus/v22/DNNcalib_CB.pb");
920  desc.add<std::string>("CNNmodel_CE_path", "L1Trigger/L1CaloTrigger/data/Phase2_NNCaloTaus/v22/CNNmodel_CE.pb");
921  desc.add<std::string>("DNNident_CE_path", "L1Trigger/L1CaloTrigger/data/Phase2_NNCaloTaus/v22/DNNident_CE.pb");
922  desc.add<std::string>("DNNcalib_CE_path", "L1Trigger/L1CaloTrigger/data/Phase2_NNCaloTaus/v22/DNNcalib_CE.pb");
923  desc.add<std::string>("FeatScaler_CE_path", "L1Trigger/L1CaloTrigger/data/Phase2_NNCaloTaus/Cl3dFeatScaler_CE.json");
924 
925  desc.add<double>("IdWp90_CB", 0.706);
926  desc.add<double>("IdWp95_CB", 0.3432);
927  desc.add<double>("IdWp99_CB", 0.0337);
928  desc.add<double>("IdWp90_CE", 0.5711);
929  desc.add<double>("IdWp95_CE", 0.2742);
930  desc.add<double>("IdWp99_CE", 0.0394);
931 
932  desc.add<bool>("DEBUG", false);
933 
934  descriptions.add("l1tNNCaloTauProducer", desc);
935 }
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)

◆ globalEndJob()

static void L1NNCaloTauProducer::globalEndJob ( const NNmodels_GlobalCache )
inlinestatic

Definition at line 94 of file L1NNCaloTauProducer.cc.

94 {/*do nothing*/};

◆ initializeGlobalCache()

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

Definition at line 205 of file L1NNCaloTauProducer.cc.

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

205  {
206  edm::LogInfo("Initialization") << "Init NN models Global Cache " << std::endl;
207 
208  std::unique_ptr<NNmodels_GlobalCache> GlobalCache(new NNmodels_GlobalCache);
209 
210  GlobalCache->CNNmodel_CB_path = iConfig.getParameter<std::string>("CNNmodel_CB_path");
211  GlobalCache->DNNident_CB_path = iConfig.getParameter<std::string>("DNNident_CB_path");
212  GlobalCache->DNNcalib_CB_path = iConfig.getParameter<std::string>("DNNcalib_CB_path");
213  GlobalCache->CNNmodel_CE_path = iConfig.getParameter<std::string>("CNNmodel_CE_path");
214  GlobalCache->DNNident_CE_path = iConfig.getParameter<std::string>("DNNident_CE_path");
215  GlobalCache->DNNcalib_CE_path = iConfig.getParameter<std::string>("DNNcalib_CE_path");
216  GlobalCache->FeatScaler_CE_path = iConfig.getParameter<std::string>("FeatScaler_CE_path");
217 
218  // Create sessions for Tensorflow inferece
219  (GlobalCache->CNNmodel_CB) = tensorflow::loadGraphDef(edm::FileInPath((GlobalCache->CNNmodel_CB_path)).fullPath());
220  (GlobalCache->CNNmodel_CBsession) = tensorflow::createSession((GlobalCache->CNNmodel_CB));
221 
222  (GlobalCache->DNNident_CB) = tensorflow::loadGraphDef(edm::FileInPath((GlobalCache->DNNident_CB_path)).fullPath());
223  (GlobalCache->DNNident_CBsession) = tensorflow::createSession((GlobalCache->DNNident_CB));
224 
225  (GlobalCache->DNNcalib_CB) = tensorflow::loadGraphDef(edm::FileInPath((GlobalCache->DNNcalib_CB_path)).fullPath());
226  (GlobalCache->DNNcalib_CBsession) = tensorflow::createSession((GlobalCache->DNNcalib_CB));
227 
228  (GlobalCache->CNNmodel_CE) = tensorflow::loadGraphDef(edm::FileInPath((GlobalCache->CNNmodel_CE_path)).fullPath());
229  (GlobalCache->CNNmodel_CEsession) = tensorflow::createSession((GlobalCache->CNNmodel_CE));
230 
231  (GlobalCache->DNNident_CE) = tensorflow::loadGraphDef(edm::FileInPath((GlobalCache->DNNident_CE_path)).fullPath());
232  (GlobalCache->DNNident_CEsession) = tensorflow::createSession((GlobalCache->DNNident_CE));
233 
234  (GlobalCache->DNNcalib_CE) = tensorflow::loadGraphDef(edm::FileInPath((GlobalCache->DNNcalib_CE_path)).fullPath());
235  (GlobalCache->DNNcalib_CEsession) = tensorflow::createSession((GlobalCache->DNNcalib_CE));
236 
237  // Read features scaler
238  boost::property_tree::read_json(edm::FileInPath((GlobalCache->FeatScaler_CE_path)).fullPath(),
239  (GlobalCache->FeatScaler_CE));
240 
241  return GlobalCache;
242 }
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

◆ inputQuantizer()

float L1NNCaloTauProducer::inputQuantizer ( float  inputF,
float  LSB,
int  nbits 
)
private

Definition at line 842 of file L1NNCaloTauProducer.cc.

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

Referenced by produce().

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

◆ inputScaler()

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

Definition at line 846 of file L1NNCaloTauProducer.cc.

References SiStripPI::mean.

Referenced by produce().

846  {
847  float mean = (globalCache()->FeatScaler_CE).get_child(feature).get<float>("mean");
848  float std = (globalCache()->FeatScaler_CE).get_child(feature).get<float>("std");
849 
850  return (inputF - mean) / std;
851 }

◆ produce()

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

Definition at line 285 of file L1NNCaloTauProducer.cc.

References a, funct::abs(), AllKeepHad, AllKeepTot, b, L1NNCaloTauProducer::SimpleTowerCluster::barrelSeeded, CB_CE_split, L1NNCaloTauProducer::SimpleHGCluster::coreshowerlength, DEBUG, reco::deltaPhi(), EmOnly, mps_fire::end, endcap_ieta(), endcap_iphi(), PVValHelper::eta, L1NNCaloTauProducer::SimpleHGCluster::eta, Eta_dim, Eta_dim_seed, Eta_limit, EtaRestriction, EtMinForSeeding, nano_mu_digi_cff::float, hgcalTowersHandle, hgcalTowersToken, HGClusterHandle, HGClusterToken, IdWp90_CB, IdWp90_CE, IdWp95_CB, IdWp95_CE, IdWp99_CB, IdWp99_CE, IEta_dim, iEvent, L1NNCaloTauProducer::SimpleTowerCluster::InitHits(), inputQuantizer(), inputScaler(), createfilelist::int, IPhi_dim, L1NNCaloTauProducer::SimpleTowerHit::isBarrel, l1CaloTowerHandle, SimL1Emulator_cff::l1CaloTowers, L1NNCaloTauProducer::SimpleTowerHit::l1egTowerEt, triggerObjects_cff::l1Tau, l1TowersToken, muonTagProbeFilters_cff::matched, L1NNCaloTauProducer::SimpleHGCluster::meanz, l1tpf::HGC3DClusterEgID::method(), eostools::move(), l1tpf::HGC3DClusterEgID::passID(), phi, L1NNCaloTauProducer::SimpleHGCluster::phi, Phi_dim, Phi_dim_seed, funct::pow(), preEmId, edm::Handle< T >::product(), reco::LeafCandidate::pt(), L1NNCaloTauProducer::SimpleHGCluster::pt, quality, L1NNCaloTauProducer::SimpleTowerCluster::rawEt, tensorflow::run(), scenario, L1NNCaloTauProducer::SimpleTowerCluster::seedEta, seedIdx, L1NNCaloTauProducer::SimpleTowerCluster::seedIeta, L1NNCaloTauProducer::SimpleTowerCluster::seedIphi, L1NNCaloTauProducer::SimpleTowerCluster::seedPhi, tensorflow::setLogging(), L1NNCaloTauProducer::SimpleHGCluster::showerlength, jetUpdater_cfi::sort, L1NNCaloTauProducer::SimpleHGCluster::spptot, L1NNCaloTauProducer::SimpleHGCluster::srrtot, L1NNCaloTauProducer::SimpleHGCluster::szz, L1TRate_Offline_cfi::Tau, tower_dIEta(), tower_dIPhi(), L1NNCaloTauProducer::SimpleTowerHit::towerEm, L1NNCaloTauProducer::SimpleTowerHit::towerEt, L1NNCaloTauProducer::SimpleTowerHit::towerEta, L1NNCaloTauProducer::SimpleTowerHit::towerHad, L1NNCaloTauProducer::SimpleTowerCluster::towerHits, L1NNCaloTauProducer::SimpleTowerHit::towerIeta, L1NNCaloTauProducer::SimpleTowerHit::towerIphi, L1NNCaloTauProducer::SimpleTowerHit::towerPhi, VsPuId, and GCP_Ntuples_cfg::warnings.

285  {
286  // Output collection
287  std::unique_ptr<BXVector<l1t::Tau>> L1NNCaloTauCollectionBXV(new l1t::TauBxCollection);
288 
289  // Create and Fill collection of all calotowers and their attributes
290  std::vector<SimpleTowerHit> l1CaloTowers;
291 
293  int warnings = 0;
294  for (auto& hit : *l1CaloTowerHandle.product()) {
295  // Skip this weird towers and store warning
296  if (hit.towerIEta() == -1016 && hit.towerIPhi() == -962) {
297  warnings += 1;
298  continue;
299  }
300 
301  SimpleTowerHit l1Hit;
302  l1Hit.isBarrel = true;
303  l1Hit.l1egTowerEt = hit.l1egTowerEt();
304  l1Hit.towerEta = hit.towerEta();
305  l1Hit.towerPhi = hit.towerPhi();
306  l1Hit.towerEm = hit.ecalTowerEt();
307  l1Hit.towerHad = hit.hcalTowerEt();
308  l1Hit.towerEt = l1Hit.towerEm + l1Hit.towerHad + l1Hit.l1egTowerEt;
309  l1Hit.towerIeta = hit.towerIEta();
310  l1Hit.towerIphi = hit.towerIPhi();
311 
312  l1CaloTowers.push_back(l1Hit);
313  }
314  if (warnings != 0 && DEBUG) {
315  edm::LogWarning("BrokenTowers") << " ** WARNING : FOUND " << warnings
316  << " TOWERS WITH towerIeta=-1016 AND towerIphi=-962" << std::endl;
317  }
318 
320  for (auto& hit : *hgcalTowersHandle.product()) {
321  SimpleTowerHit l1Hit;
322  l1Hit.isBarrel = false;
323  l1Hit.l1egTowerEt = 0.0;
324  l1Hit.towerEta = hit.eta();
325  l1Hit.towerPhi = hit.phi();
326  l1Hit.towerEm = hit.etEm();
327  l1Hit.towerHad = hit.etHad();
328  l1Hit.towerEt = l1Hit.towerEm + l1Hit.towerHad;
329  l1Hit.towerIeta = endcap_ieta(l1Hit.towerEta); // computed and filled but not used
330  l1Hit.towerIphi = endcap_iphi(l1Hit.towerPhi); // computed and filled but not used
331 
332  l1CaloTowers.push_back(l1Hit);
333  }
334 
335  // Sort the ECAL+HCAL+L1EGs tower sums based on total ET
336  std::sort(begin(l1CaloTowers), end(l1CaloTowers), [](const SimpleTowerHit& a, SimpleTowerHit& b) {
337  return a.towerEt > b.towerEt;
338  });
339 
340  // Create and Fill the collection of 3D clusters and their attributes
341  std::vector<SimpleHGCluster> AllHGClusters;
343 
344  for (auto cl3dIt = HGClusterHandle->begin(0); cl3dIt != HGClusterHandle->end(0); ++cl3dIt) {
345  auto& cl3d = *cl3dIt;
346 
347  // Implement cl3d PU ID as done in
348  // https://github.com/cms-sw/cmssw/blob/master/L1Trigger/Phase2L1ParticleFlow/plugins/PFClusterProducerFromHGC3DClusters.cc#L120
349  bool isEM = preEmId(*cl3dIt);
350  l1t::PFCluster cluster(cl3d.pt(), cl3d.eta(), cl3d.phi(), cl3d.hOverE());
351  if (scenario == UseEmInterp::EmOnly) // for emID objs, use EM interp as pT and set H = 0
352  {
353  if (isEM) {
354  float pt_new = cl3d.iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM);
355  float hoe_new = 0.;
356  cluster = l1t::PFCluster(pt_new, cl3d.eta(), cl3d.phi(), hoe_new, isEM);
357  }
358  } else if (scenario == UseEmInterp::AllKeepHad) // for all objs, replace EM part with EM interp, preserve H
359  {
360  float had_old = cl3d.pt() - cluster.emEt();
361  float em_new = cl3d.iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM);
362  float pt_new = had_old + em_new;
363  float hoe_new = em_new > 0 ? (had_old / em_new) : -1;
364  cluster = l1t::PFCluster(pt_new, cl3d.eta(), cl3d.phi(), hoe_new, isEM);
365  } else if (scenario == UseEmInterp::AllKeepTot) // for all objs, replace EM part with EM interp, preserve pT
366  {
367  float em_new = cl3d.iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM);
368  float hoe_new = em_new > 0 ? (cl3d.pt() / em_new - 1) : -1;
369  cluster = l1t::PFCluster(cl3d.pt(), cl3d.eta(), cl3d.phi(), hoe_new, isEM);
370  }
371 
372  if (!VsPuId.method().empty()) {
373  int id = VsPuId.passID(*cl3dIt, cluster);
374  if (!id) {
375  continue;
376  } // skip cl3d if it does not pass puid
377  }
378 
379  SimpleHGCluster HGCluster;
380  HGCluster.pt = cl3d.pt();
381  HGCluster.eta = cl3d.eta();
382  HGCluster.phi = cl3d.phi();
383  HGCluster.showerlength = cl3d.showerLength();
384  HGCluster.coreshowerlength = cl3d.coreShowerLength();
385  HGCluster.spptot = cl3d.sigmaPhiPhiTot();
386  HGCluster.szz = cl3d.sigmaZZ();
387  HGCluster.srrtot = cl3d.sigmaRRTot();
388  HGCluster.meanz = cl3d.zBarycenter();
389 
390  AllHGClusters.push_back(HGCluster);
391  }
392 
393  // Order the collection in pt (the input to the GCT will be pt ordered)
394  std::sort(begin(AllHGClusters), end(AllHGClusters), [](const SimpleHGCluster& a, SimpleHGCluster& b) {
395  return a.pt > b.pt;
396  });
397 
398  // Make NxM TowerClusters and HGClusters collections for TauMinator
399  std::vector<SimpleTowerCluster> l1TowerClustersNxM_CB;
400  std::vector<SimpleTowerCluster> l1TowerClustersNxM_CE;
401  std::vector<SimpleHGCluster> HGClusters;
402 
403  // Supporting collection of endcap clusters before cl3d matching
404  std::vector<SimpleTowerCluster> AllL1TowerClustersNxM_CE;
405 
406  bool caloTauSeedingFinished = false;
407  // Loop for seeding of clNxM objects
408  while (!caloTauSeedingFinished) {
409  SimpleTowerCluster clNxM;
410  clNxM.InitHits(IEta_dim, IPhi_dim);
411  bool seeded = false;
412 
413  for (auto& l1CaloTower : l1CaloTowers) {
414  // Skip seeding in towers that would make the cluster extend in HF
415  // Skip l1CaloTowers which are already used by this clusters' mask
416  if (abs(l1CaloTower.towerEta) > Eta_limit || abs(l1CaloTower.towerEta) > EtaRestriction ||
417  l1CaloTower.stale4seed) {
418  continue;
419  }
420 
421  // If not seded do the seeding
422  if (!seeded) {
423  // The leading unused tower has ET < min, stop jet clustering
424  if (l1CaloTower.towerEt < EtMinForSeeding) {
425  caloTauSeedingFinished = true;
426  continue;
427  }
428 
429  clNxM.seedIeta = l1CaloTower.towerIeta;
430  clNxM.seedIphi = l1CaloTower.towerIphi;
431  clNxM.seedEta = l1CaloTower.towerEta;
432  clNxM.seedPhi = l1CaloTower.towerPhi;
433  if (l1CaloTower.isBarrel) {
434  clNxM.barrelSeeded = true;
435  }
436 
437  clNxM.rawEt += l1CaloTower.towerEt;
438  clNxM.towerHits[seedIdx] = l1CaloTower;
439  l1CaloTower.stale4seed = true;
440  l1CaloTower.stale = true;
441  seeded = true;
442 
443  continue;
444  }
445 
446  int d_iEta = 99;
447  int d_iPhi = 99;
448  float d_Eta = 99.;
449  float d_Phi = 99.;
450  // Ese iEta/iPhi comparisons in the barrel and eta/phi in HGCal
451  if (clNxM.barrelSeeded && l1CaloTower.isBarrel) {
452  d_iEta = tower_dIEta(l1CaloTower.towerIeta, clNxM.seedIeta);
453  d_iPhi = tower_dIPhi(l1CaloTower.towerIphi, clNxM.seedIphi);
454  } else {
455  d_Eta = l1CaloTower.towerEta - clNxM.seedEta;
456  d_Phi = reco::deltaPhi(l1CaloTower.towerPhi, clNxM.seedPhi);
457  }
458 
459  // Stale tower for seeding if it would lead to overalp between clusters
460  if ((abs(d_iEta) <= IEta_dim - 1 && abs(d_iPhi) <= IPhi_dim - 1) ||
461  (abs(d_Eta) < Eta_dim_seed && abs(d_Phi) < Phi_dim_seed)) {
462  l1CaloTower.stale4seed = true;
463  }
464 
465  } // End for loop over TPs
466 
467  // Pushback seeds split in barrel and endcap
468  if (seeded) {
469  if (abs(clNxM.seedEta) < CB_CE_split) {
470  l1TowerClustersNxM_CB.push_back(clNxM);
471  } else {
472  AllL1TowerClustersNxM_CE.push_back(clNxM);
473  }
474  }
475 
476  } // End while loop of TowerClusters seeding
477 
478  // Loop for barrel NxM TowerClusters clustering starting from the seeds
479  for (auto& clNxM : l1TowerClustersNxM_CB) {
480  for (auto& l1CaloTower : l1CaloTowers) {
481  // Skip l1CaloTowers which are already used
482  if (l1CaloTower.stale) {
483  continue;
484  }
485 
486  int d_iEta = 99;
487  int d_iPhi = 99;
488  float d_Eta = 99.;
489  float d_Phi = 99.;
490  int hitIdx = 99.;
491  // Use iEta/iPhi comparisons in the barrel and use eta/phi in HGCal
492  if (l1CaloTower.isBarrel) {
493  d_iEta = tower_dIEta(l1CaloTower.towerIeta, clNxM.seedIeta);
494  d_iPhi = tower_dIPhi(l1CaloTower.towerIphi, clNxM.seedIphi);
495 
496  hitIdx = d_iEta * IPhi_dim + d_iPhi + seedIdx;
497  } else {
498  d_Eta = l1CaloTower.towerEta - clNxM.seedEta;
499  d_Phi = reco::deltaPhi(l1CaloTower.towerPhi, clNxM.seedPhi);
500 
501  int dieta = d_Eta / 0.0807; // minimal difference in endcap is 0.0808
502  int diphi = d_Phi / 0.0872;
503  hitIdx = dieta * IPhi_dim + diphi + seedIdx;
504  }
505 
506  // Cluster all towers in a NxM towers mask
507  if ((abs(d_iEta) <= (IEta_dim - 1) / 2 && abs(d_iPhi) <= (IPhi_dim - 1) / 2) ||
508  (abs(d_Eta) < Eta_dim && abs(d_Phi) < Phi_dim)) {
509  clNxM.rawEt += l1CaloTower.towerEt;
510  clNxM.towerHits[hitIdx] = l1CaloTower;
511  l1CaloTower.stale = true;
512  }
513 
514  } // End for loop over TPs
515 
516  } // End while loop of barrel TowerClusters creation
517 
518  // In the endcap cross-loop over clNxM and cl3d to match them
519  // (we can do it before full clustering just using the seed info)
520  for (auto& clNxM : AllL1TowerClustersNxM_CE) {
521  bool matched = false;
522  for (auto& HGCluster : AllHGClusters) {
523  // In case the clNxM or HGCluster have already been matched just continue through the list to the end
524  // only use cl3ds above 4GeV
525  if (matched || HGCluster.stale || HGCluster.pt < 4) {
526  continue;
527  }
528 
529  float d_Eta = HGCluster.eta - clNxM.seedEta;
530  float d_Phi = reco::deltaPhi(HGCluster.phi, clNxM.seedPhi);
531  float d_R2 = pow(d_Eta, 2) + pow(d_Phi, 2);
532 
533  if (d_R2 < 0.25) {
534  HGCluster.stale = true;
535  HGClusters.push_back(HGCluster);
536  l1TowerClustersNxM_CE.push_back(clNxM);
537  matched = true;
538  }
539 
540  } // End for loop over cl3ds
541 
542  } // End for loop over clNxM
543 
544  // Loop for endcap matched NxM TowerClusters clustering starting from the seeds just found
545  for (auto& clNxM : l1TowerClustersNxM_CE) {
546  for (auto& l1CaloTower : l1CaloTowers) {
547  // Skip l1CaloTowers which are already used
548  if (l1CaloTower.stale) {
549  continue;
550  }
551 
552  int d_iEta = 99;
553  int d_iPhi = 99;
554  float d_Eta = 99.;
555  float d_Phi = 99.;
556  int hitIdx = 99.;
557  // Use iEta/iPhi comparisons in the endcap and use eta/phi in HGCal
558  if (l1CaloTower.isBarrel) {
559  d_iEta = tower_dIEta(l1CaloTower.towerIeta, clNxM.seedIeta);
560  d_iPhi = tower_dIPhi(l1CaloTower.towerIphi, clNxM.seedIphi);
561 
562  hitIdx = d_iEta * IPhi_dim + d_iPhi + seedIdx;
563  } else {
564  d_Eta = l1CaloTower.towerEta - clNxM.seedEta;
565  d_Phi = reco::deltaPhi(l1CaloTower.towerPhi, clNxM.seedPhi);
566 
567  int dieta = d_Eta / 0.0807; // minimal difference in endcap is 0.0808
568  int diphi = d_Phi / 0.0872;
569  hitIdx = dieta * IPhi_dim + diphi + seedIdx;
570  }
571 
572  // Cluster all towers in a NxM towers mask
573  if ((abs(d_iEta) <= (IEta_dim - 1) / 2 && abs(d_iPhi) <= (IPhi_dim - 1) / 2) ||
574  (abs(d_Eta) < Eta_dim && abs(d_Phi) < Phi_dim)) {
575  clNxM.rawEt += l1CaloTower.towerEt;
576  clNxM.towerHits[hitIdx] = l1CaloTower;
577  l1CaloTower.stale = true;
578  }
579 
580  } // End for loop over TPs
581 
582  } // End while loop of endcap TowerClusters creation
583 
584  // Barrel TauMinator application
586  int batchSize_CB = (int)(l1TowerClustersNxM_CB.size());
587  tensorflow::TensorShape imageShape_CB({batchSize_CB, IEta_dim, IPhi_dim, 2});
588  tensorflow::TensorShape positionShape_CB({batchSize_CB, 2});
589  tensorflow::Tensor TowerClusterImage_CB(tensorflow::DT_FLOAT, imageShape_CB);
590  tensorflow::Tensor TowerClusterPosition_CB(tensorflow::DT_FLOAT, positionShape_CB);
591 
592  int clIdx = 0;
593  for (auto& clNxM : l1TowerClustersNxM_CB) {
594  // Fill inputs for Tensorflow inference
595  for (int eta = 0; eta < IEta_dim; ++eta) {
596  for (int phi = 0; phi < IPhi_dim; ++phi) {
597  int towerIdx = eta * IPhi_dim + phi;
598  TowerClusterImage_CB.tensor<float, 4>()(clIdx, eta, phi, 0) =
599  inputQuantizer(clNxM.towerHits[towerIdx].l1egTowerEt + clNxM.towerHits[towerIdx].towerEm, 0.25, 10);
600  TowerClusterImage_CB.tensor<float, 4>()(clIdx, eta, phi, 1) =
601  inputQuantizer(clNxM.towerHits[towerIdx].towerHad, 0.25, 10);
602  }
603  }
604 
605  TowerClusterPosition_CB.tensor<float, 2>()(clIdx, 0) = clNxM.seedEta;
606  TowerClusterPosition_CB.tensor<float, 2>()(clIdx, 1) = clNxM.seedPhi;
607 
608  clIdx++; // Increase batch index
609  }
610 
611  if (batchSize_CB >
612  0) // from CMSSW_14_0_X tensorflow does not seem to be able to deal with a tensor of dimension 0 anymore
613  {
614  // Apply CNN model
615  tensorflow::NamedTensorList CNNmodel_CBinputList = {{"TowerClusterImage", TowerClusterImage_CB},
616  {"TowerClusterPosition", TowerClusterPosition_CB}};
617  std::vector<tensorflow::Tensor> CNNmodel_CBoutputs;
618  tensorflow::run((globalCache()->CNNmodel_CBsession),
619  CNNmodel_CBinputList,
620  {"TauMinator_CB_conv/middleMan/concat"},
621  &CNNmodel_CBoutputs);
622  tensorflow::NamedTensorList DNN_CBinputsList = {{"middleMan", CNNmodel_CBoutputs[0]}};
623 
624  // Apply DNN for identification
625  std::vector<tensorflow::Tensor> DNN_CBoutputsIdent;
626  tensorflow::run((globalCache()->DNNident_CBsession),
627  DNN_CBinputsList,
628  {"TauMinator_CB_ident/sigmoid_IDout/Sigmoid"},
629  &DNN_CBoutputsIdent);
630 
631  // Apply DNN for calibration
632  std::vector<tensorflow::Tensor> DNN_CBoutputsCalib;
633  tensorflow::run((globalCache()->DNNcalib_CBsession),
634  DNN_CBinputsList,
635  {"TauMinator_CB_calib/LIN_DNNout/Relu"},
636  &DNN_CBoutputsCalib);
637 
638  // Fill TauMinator output variables of TowerClusters
639  clIdx = 0;
640  for (auto& clNxM : l1TowerClustersNxM_CB) {
641  clNxM.IDscore = DNN_CBoutputsIdent[0].matrix<float>()(0, clIdx);
642  clNxM.calibPt = DNN_CBoutputsCalib[0].matrix<float>()(0, clIdx);
643  clIdx++; // Increase batch index
644  }
645  }
646 
647  // Endcap TauMinator application
648  int batchSize_CE = (int)(l1TowerClustersNxM_CE.size());
649  tensorflow::TensorShape imageShape_CE({batchSize_CE, IEta_dim, IPhi_dim, 2});
650  tensorflow::TensorShape positionShape_CE({batchSize_CE, 2});
651  tensorflow::TensorShape cl3dfeatShape_CE({batchSize_CE, 8});
652  tensorflow::Tensor TowerClusterImage_CE(tensorflow::DT_FLOAT, imageShape_CE);
653  tensorflow::Tensor TowerClusterPosition_CE(tensorflow::DT_FLOAT, positionShape_CE);
654  tensorflow::Tensor Cl3dShapeFeatures_CE(tensorflow::DT_FLOAT, cl3dfeatShape_CE);
655 
656  clIdx = 0;
657  for (auto& clNxM : l1TowerClustersNxM_CE) {
658  // Indexing of cl3ds is the same as the one of clNxMs
659  SimpleHGCluster HGClu = HGClusters[clIdx];
660 
661  // Fill inputs for Tensorflow inference
662  for (int eta = 0; eta < IEta_dim; ++eta) {
663  for (int phi = 0; phi < IPhi_dim; ++phi) {
664  int towerIdx = eta * IPhi_dim + phi;
665  TowerClusterImage_CE.tensor<float, 4>()(clIdx, eta, phi, 0) =
666  inputQuantizer(clNxM.towerHits[towerIdx].l1egTowerEt + clNxM.towerHits[towerIdx].towerEm, 0.25, 10);
667  TowerClusterImage_CE.tensor<float, 4>()(clIdx, eta, phi, 1) =
668  inputQuantizer(clNxM.towerHits[towerIdx].towerHad, 0.25, 10);
669  }
670  }
671 
672  TowerClusterPosition_CE.tensor<float, 2>()(clIdx, 0) = clNxM.seedEta;
673  TowerClusterPosition_CE.tensor<float, 2>()(clIdx, 1) = clNxM.seedPhi;
674 
675  Cl3dShapeFeatures_CE.tensor<float, 2>()(clIdx, 0) = inputScaler(inputQuantizer(HGClu.pt, 0.25, 14), "pt");
676  Cl3dShapeFeatures_CE.tensor<float, 2>()(clIdx, 1) =
677  inputScaler(inputQuantizer(abs(HGClu.eta) - 1.321, 0.004, 9), "eta");
678  Cl3dShapeFeatures_CE.tensor<float, 2>()(clIdx, 2) = inputScaler(HGClu.showerlength, "showerlength");
679  Cl3dShapeFeatures_CE.tensor<float, 2>()(clIdx, 3) = inputScaler(HGClu.coreshowerlength, "coreshowerlength");
680  Cl3dShapeFeatures_CE.tensor<float, 2>()(clIdx, 4) =
681  inputScaler(inputQuantizer(HGClu.spptot, 0.0000153, 16), "spptot");
682  Cl3dShapeFeatures_CE.tensor<float, 2>()(clIdx, 5) = inputScaler(inputQuantizer(HGClu.szz, 0.00153, 16), "szz");
683  Cl3dShapeFeatures_CE.tensor<float, 2>()(clIdx, 6) =
684  inputScaler(inputQuantizer(HGClu.srrtot, 0.0000153, 16), "srrtot");
685  Cl3dShapeFeatures_CE.tensor<float, 2>()(clIdx, 7) =
686  inputScaler(inputQuantizer(10 * (abs(HGClu.meanz) - 321.05), 0.5, 12), "meanz");
687 
688  clIdx++; // Increase batch index
689  }
690 
691  if (batchSize_CE >
692  0) // from CMSSW_14_0_X tensorflow does not seem to be able to deal with a tensor of dimension 0 anymore
693  {
694  // Apply CNN model
695  tensorflow::NamedTensorList CNNmodel_CEinputList = {{"TowerClusterImage", TowerClusterImage_CE},
696  {"TowerClusterPosition", TowerClusterPosition_CE},
697  {"AssociatedCl3dFeatures", Cl3dShapeFeatures_CE}};
698  std::vector<tensorflow::Tensor> CNNmodel_CEoutputs;
699  tensorflow::run((globalCache()->CNNmodel_CEsession),
700  CNNmodel_CEinputList,
701  {"TauMinator_CE_conv/middleMan/concat"},
702  &CNNmodel_CEoutputs);
703  tensorflow::NamedTensorList DNN_CEinputsList = {{"middleMan", CNNmodel_CEoutputs[0]}};
704 
705  // Apply DNN for identification
706  std::vector<tensorflow::Tensor> DNN_CEoutputsIdent;
707  tensorflow::run((globalCache()->DNNident_CEsession),
708  DNN_CEinputsList,
709  {"TauMinator_CE_ident/sigmoid_IDout/Sigmoid"},
710  &DNN_CEoutputsIdent);
711 
712  // Apply DNN for calibration
713  std::vector<tensorflow::Tensor> DNN_CEoutputsCalib;
714  tensorflow::run((globalCache()->DNNcalib_CEsession),
715  DNN_CEinputsList,
716  {"TauMinator_CE_calib/LIN_DNNout/Relu"},
717  &DNN_CEoutputsCalib);
718 
719  // Fill TauMinator output variables of TowerClusters
720  clIdx = 0;
721  for (auto& clNxM : l1TowerClustersNxM_CE) {
722  clNxM.IDscore = DNN_CEoutputsIdent[0].matrix<float>()(0, clIdx);
723  clNxM.calibPt = DNN_CEoutputsCalib[0].matrix<float>()(0, clIdx);
724  clIdx++; // Increase batch index
725  }
726  }
727 
728  // Fill the output collection of L1 taus
729  for (auto& clNxM : l1TowerClustersNxM_CB) {
730  // Apply eta restriction
731  if (abs(clNxM.seedEta) > EtaRestriction) {
732  continue;
733  }
734 
735  // Assign increasing quality to higher scoring candidates
736  int quality = 0;
737  // 99% WP
738  if (clNxM.IDscore > IdWp99_CB) {
739  quality = 1;
740  }
741  // 95% WP
742  if (clNxM.IDscore > IdWp95_CB) {
743  quality = 2;
744  }
745  // 90% WP
746  if (clNxM.IDscore > IdWp90_CB) {
747  quality = 3;
748  }
749 
751  reco::Candidate::PolarLorentzVector(clNxM.calibPt, clNxM.seedEta, clNxM.seedPhi, 0);
752 
753  // store ID score multiplied by 10E4 to have good precision even using the Phase1 tau int iso format
754  // (this is stored just in case for possible additional offline studies)
755  // tau initialisation = (p4, pt, eta, phi, qual, iso)
756  l1t::Tau l1Tau = l1t::Tau(tauP4, clNxM.calibPt, clNxM.seedEta, clNxM.seedPhi, quality, clNxM.IDscore * 10E4);
757  l1Tau.setTowerIEta(clNxM.seedIeta);
758  l1Tau.setTowerIPhi(clNxM.seedIphi);
759  l1Tau.setRawEt(clNxM.rawEt);
760 
761  L1NNCaloTauCollectionBXV->push_back(0, l1Tau);
762  }
763 
764  for (auto& clNxM : l1TowerClustersNxM_CE) {
765  // Apply eta restriction
766  if (abs(clNxM.seedEta) > EtaRestriction) {
767  continue;
768  }
769 
770  // Assign increasing quality to higher scoring candidates
771  int quality = 0;
772  // 99% WP
773  if (clNxM.IDscore > IdWp99_CE) {
774  quality = 1;
775  }
776  // 95% WP
777  if (clNxM.IDscore > IdWp95_CE) {
778  quality = 2;
779  }
780  // 90% WP
781  if (clNxM.IDscore > IdWp90_CE) {
782  quality = 3;
783  }
784 
786  reco::Candidate::PolarLorentzVector(clNxM.calibPt, clNxM.seedEta, clNxM.seedPhi, 0);
787 
788  // store ID score multiplied by 10E4 to have good precision even using the Phase1 tau int iso format
789  // (this is stored just in case for possible additional offline studies)
790  // tau initialisation = (p4, pt, eta, phi, qual, iso)
791  l1t::Tau l1Tau = l1t::Tau(tauP4, clNxM.calibPt, clNxM.seedEta, clNxM.seedPhi, quality, clNxM.IDscore * 10E4);
792  l1Tau.setTowerIEta(clNxM.seedIeta);
793  l1Tau.setTowerIPhi(clNxM.seedIphi);
794  l1Tau.setRawEt(clNxM.rawEt);
795 
796  L1NNCaloTauCollectionBXV->push_back(0, l1Tau);
797  }
798 
799  // Fill output
800  iEvent.put(std::move(L1NNCaloTauCollectionBXV), "L1NNCaloTauCollectionBXV");
801 
802 } // End of produce function
edm::Handle< l1t::HGCalMulticlusterBxCollection > HGClusterHandle
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
std::vector< NamedTensor > NamedTensorList
Definition: TensorFlow.h:31
StringCutObjectSelector< l1t::HGCalMulticluster > preEmId
double pt() const final
transverse momentum
int tower_dIEta(int &iEta_1, int &iEta_2) const
Definition: Tau.h:20
T const * product() const
Definition: Handle.h:70
edm::Handle< l1t::HGCalTowerBxCollection > hgcalTowersHandle
int endcap_ieta(float &eta) const
string quality
int iEvent
Definition: GenABIO.cc:224
int tower_dIPhi(int &iPhi_1, int &iPhi_2) const
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
edm::EDGetTokenT< l1t::HGCalMulticlusterBxCollection > HGClusterToken
float inputScaler(float inputF, std::string feature)
edm::Handle< l1tp2::CaloTowerCollection > l1CaloTowerHandle
float inputQuantizer(float inputF, float LSB, int nbits)
void setLogging(const std::string &level="3")
Definition: TensorFlow.cc:90
double b
Definition: hdecay.h:120
int endcap_iphi(float &phi) const
l1tpf::HGC3DClusterEgID VsPuId
double a
Definition: hdecay.h:121
edm::EDGetToken hgcalTowersToken
edm::EDGetTokenT< l1tp2::CaloTowerCollection > l1TowersToken
Log< level::Warning, false > LogWarning
float passID(l1t::HGCalMulticluster c, l1t::PFCluster &cpf)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
def move(src, dest)
Definition: eostools.py:511
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:38

◆ tower_dIEta()

int L1NNCaloTauProducer::tower_dIEta ( int &  iEta_1,
int &  iEta_2 
) const
private

Definition at line 816 of file L1NNCaloTauProducer.cc.

Referenced by produce().

816  {
817  if (iEta_1 * iEta_2 > 0) {
818  return iEta_1 - iEta_2;
819  } else {
820  if (iEta_1 > 0) {
821  return iEta_1 - iEta_2 - 1;
822  } else {
823  return iEta_1 - iEta_2 + 1;
824  }
825  }
826 }

◆ tower_dIPhi()

int L1NNCaloTauProducer::tower_dIPhi ( int &  iPhi_1,
int &  iPhi_2 
) const
private

Definition at line 804 of file L1NNCaloTauProducer.cc.

References CICADATestPatterns::iPhi_1, CICADATestPatterns::iPhi_2, PI, and mps_fire::result.

Referenced by produce().

804  {
805  const int PI = 36;
806  int result = iPhi_1 - iPhi_2;
807  if (result > PI) {
808  result -= 2 * PI;
809  }
810  if (result <= -PI) {
811  result += 2 * PI;
812  }
813  return result;
814 }
#define PI
Definition: QcdUeDQM.h:37

Member Data Documentation

◆ CB_CE_split

double L1NNCaloTauProducer::CB_CE_split
private

Definition at line 128 of file L1NNCaloTauProducer.cc.

Referenced by L1NNCaloTauProducer(), and produce().

◆ DEBUG

bool L1NNCaloTauProducer::DEBUG
private

Definition at line 138 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ EcalEtMinForClustering

double L1NNCaloTauProducer::EcalEtMinForClustering
private

Definition at line 124 of file L1NNCaloTauProducer.cc.

Referenced by L1NNCaloTauProducer().

◆ Eta_dim

const float L1NNCaloTauProducer::Eta_dim = 0.2
private

Definition at line 144 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ Eta_dim_seed

const float L1NNCaloTauProducer::Eta_dim_seed = 0.35
private

Definition at line 146 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ Eta_limit

const float L1NNCaloTauProducer::Eta_limit = 2.83
private

Definition at line 148 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ EtaRestriction

double L1NNCaloTauProducer::EtaRestriction
private

Definition at line 127 of file L1NNCaloTauProducer.cc.

Referenced by L1NNCaloTauProducer(), and produce().

◆ EtMinForSeeding

double L1NNCaloTauProducer::EtMinForSeeding
private

Definition at line 126 of file L1NNCaloTauProducer.cc.

Referenced by L1NNCaloTauProducer(), and produce().

◆ HcalEtMinForClustering

double L1NNCaloTauProducer::HcalEtMinForClustering
private

Definition at line 125 of file L1NNCaloTauProducer.cc.

Referenced by L1NNCaloTauProducer().

◆ hgcalTowersHandle

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

Definition at line 113 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ hgcalTowersToken

edm::EDGetToken L1NNCaloTauProducer::hgcalTowersToken
private

Definition at line 112 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ HGClusterHandle

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

Definition at line 116 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ HGClusterToken

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

Definition at line 115 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ IdWp90_CB

double L1NNCaloTauProducer::IdWp90_CB
private

Definition at line 130 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ IdWp90_CE

double L1NNCaloTauProducer::IdWp90_CE
private

Definition at line 134 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ IdWp95_CB

double L1NNCaloTauProducer::IdWp95_CB
private

Definition at line 131 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ IdWp95_CE

double L1NNCaloTauProducer::IdWp95_CE
private

Definition at line 135 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ IdWp99_CB

double L1NNCaloTauProducer::IdWp99_CB
private

Definition at line 132 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ IdWp99_CE

double L1NNCaloTauProducer::IdWp99_CE
private

Definition at line 136 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ IEta_dim

const int L1NNCaloTauProducer::IEta_dim = 5
private

Definition at line 142 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ IPhi_dim

const int L1NNCaloTauProducer::IPhi_dim = 9
private

Definition at line 143 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ l1CaloTowerHandle

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

Definition at line 110 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ l1TowersToken

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

Definition at line 109 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ Phi_dim

const float L1NNCaloTauProducer::Phi_dim = 0.4
private

Definition at line 145 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ Phi_dim_seed

const float L1NNCaloTauProducer::Phi_dim_seed = 0.7
private

Definition at line 147 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ preEmId

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

Definition at line 121 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ scenario

UseEmInterp L1NNCaloTauProducer::scenario
private

Definition at line 120 of file L1NNCaloTauProducer.cc.

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

◆ seedIdx

const int L1NNCaloTauProducer::seedIdx = 22
private

Definition at line 141 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ VsPuId

l1tpf::HGC3DClusterEgID L1NNCaloTauProducer::VsPuId
private

Definition at line 122 of file L1NNCaloTauProducer.cc.

Referenced by L1NNCaloTauProducer(), and produce().