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

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

244  : l1TowersToken(consumes<l1tp2::CaloTowerCollection>(iConfig.getParameter<edm::InputTag>("l1CaloTowers"))),
245  hgcalTowersToken(consumes<l1t::HGCalTowerBxCollection>(iConfig.getParameter<edm::InputTag>("hgcalTowers"))),
246 
248  consumes<l1t::HGCalMulticlusterBxCollection>(iConfig.getParameter<edm::InputTag>("HgcalClusters"))),
250  preEmId(iConfig.getParameter<std::string>("preEmId")),
251  VsPuId(iConfig.getParameter<edm::ParameterSet>("VsPuId")),
252 
253  EcalEtMinForClustering(iConfig.getParameter<double>("EcalEtMinForClustering")),
254  HcalEtMinForClustering(iConfig.getParameter<double>("HcalEtMinForClustering")),
255  EtMinForSeeding(iConfig.getParameter<double>("EtMinForSeeding")),
256  EtaRestriction(iConfig.getParameter<double>("EtaRestriction")),
257  CB_CE_split(iConfig.getParameter<double>("CB_CE_split")),
258 
259  IdWp90_CB(iConfig.getParameter<double>("IdWp90_CB")),
260  IdWp95_CB(iConfig.getParameter<double>("IdWp95_CB")),
261  IdWp99_CB(iConfig.getParameter<double>("IdWp99_CB")),
262 
263  IdWp90_CE(iConfig.getParameter<double>("IdWp90_CE")),
264  IdWp95_CE(iConfig.getParameter<double>("IdWp95_CE")),
265  IdWp99_CE(iConfig.getParameter<double>("IdWp99_CE")) {
266  // Initialize HGCAL BDTs
267  if (!VsPuId.method().empty()) {
269  }
270 
271  // Create produced outputs
272  produces<BXVector<l1t::Tau>>("L1NNCaloTauCollectionBXV");
273 
274  // Settings output
275  edm::LogInfo("Settings") << "EtaRestriction = " << EtaRestriction << " , CB_CE_split = " << CB_CE_split
276  << " , EtMinForSeeding = " << EtMinForSeeding
277  << " , HcalTpEtMin = " << HcalEtMinForClustering
278  << " , EcalTpEtMin = " << EcalEtMinForClustering << std::endl;
279 }
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 833 of file L1NNCaloTauProducer.cc.

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

Referenced by produce().

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

◆ endcap_iphi()

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

Definition at line 824 of file L1NNCaloTauProducer.cc.

References phi.

Referenced by produce().

824  {
825  const float phi_step = 0.0872664;
826  if (phi > 0) {
827  return floor(phi / phi_step) + 1;
828  } else {
829  return floor(phi / phi_step) + 73;
830  }
831 }

◆ fillDescriptions()

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

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

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

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

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

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

Referenced by produce().

838  {
839  return min(floor(inputF / LSB), float(pow(2, nbits) - 1)) * LSB;
840 }
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 842 of file L1NNCaloTauProducer.cc.

References SiStripPI::mean.

Referenced by produce().

842  {
843  float mean = (globalCache()->FeatScaler_CE).get_child(feature).get<float>("mean");
844  float std = (globalCache()->FeatScaler_CE).get_child(feature).get<float>("std");
845 
846  return (inputF - mean) / std;
847 }

◆ produce()

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

Definition at line 281 of file L1NNCaloTauProducer.cc.

References a, funct::abs(), AllKeepHad, AllKeepTot, b, L1NNCaloTauProducer::SimpleTowerCluster::barrelSeeded, CB_CE_split, L1NNCaloTauProducer::SimpleHGCluster::coreshowerlength, 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.

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

Referenced by produce().

812  {
813  if (iEta_1 * iEta_2 > 0) {
814  return iEta_1 - iEta_2;
815  } else {
816  if (iEta_1 > 0) {
817  return iEta_1 - iEta_2 - 1;
818  } else {
819  return iEta_1 - iEta_2 + 1;
820  }
821  }
822 }

◆ tower_dIPhi()

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

Definition at line 800 of file L1NNCaloTauProducer.cc.

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

Referenced by produce().

800  {
801  const int PI = 36;
802  int result = iPhi_1 - iPhi_2;
803  if (result > PI) {
804  result -= 2 * PI;
805  }
806  if (result <= -PI) {
807  result += 2 * PI;
808  }
809  return result;
810 }
#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().

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

Referenced by produce().

◆ Eta_dim_seed

const float L1NNCaloTauProducer::Eta_dim_seed = 0.35
private

Definition at line 144 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ Eta_limit

const float L1NNCaloTauProducer::Eta_limit = 2.83
private

Definition at line 146 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 140 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ IPhi_dim

const int L1NNCaloTauProducer::IPhi_dim = 9
private

Definition at line 141 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 143 of file L1NNCaloTauProducer.cc.

Referenced by produce().

◆ Phi_dim_seed

const float L1NNCaloTauProducer::Phi_dim_seed = 0.7
private

Definition at line 145 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 139 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().