Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tau L1 2023 #1087

Conversation

Duchstf
Copy link

@Duchstf Duchstf commented Mar 31, 2023

PR description:

This is a PR to update the TauNN with the latest training. The changes would include:

  • Adding HW option for the tau as well as the new e/m seeding for tau jets.
  • Updated Tau NN training with the lastest samples.
  • Migration to the new hls4ml external library.
  • GT formatting for Tau Jets (I'm not 100% sure if this will be included in this PR, but that's part of the plans)

Related materials:

I'll keep updating this overview as the PR moves along!

@epalencia
Copy link

Hi @Duchstf , could you please a description for this PR?

@aloeliger aloeliger added Phase-2 Pertains to phase-2 development Emulator Development Emulator development PR labels Mar 31, 2023
@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

Attempts to compile this PR failed.

The following is the stderr of the compilation attempt:

/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/L1TNtuples/plugins/L1PhaseIITreeProducer.cc: In constructor 'L1PhaseIITreeProducer::L1PhaseIITreeProducer(const edm::ParameterSet&)':
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/L1TNtuples/plugins/L1PhaseIITreeProducer.cc:189:78: warning: 'edm::EDAnalyzer::EDAnalyzer()' is deprecated [-Wdeprecated-declarations]
  189 | L1PhaseIITreeProducer::L1PhaseIITreeProducer(const edm::ParameterSet& iConfig) {
      |                                                                              ^
In file included from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/L1TNtuples/plugins/L1PhaseIITreeProducer.cc:25:
/cvmfs/cms.cern.ch/slc7_amd64_gcc10/cms/cmssw-patch/CMSSW_12_5_2_patch1/src/FWCore/Framework/interface/EDAnalyzer.h:43:20: note: declared here
   43 |     CMS_DEPRECATED EDAnalyzer();
      |                    ^~~~~~~~~~
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/L1TNtuples/plugins/L1PhaseIITreeProducer.cc: In member function 'virtual void L1PhaseIITreeProducer::analyze(const edm::Event&, const edm::EventSetup&)':
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/L1TNtuples/plugins/L1PhaseIITreeProducer.cc:370:9: warning: unused variable 'Z0' [-Wunused-variable]
  370 |   float Z0 = *z0Puppi;
      |         ^~
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc: In member function 'void L1NNTauProducer::addTau(const l1t::PFCandidate&, const PFCandidateCollection&, std::unique_ptr<std::vector<l1t::PFTau> >&)':
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc:196:33: error: 'class TauNNId' has no member named 'NNVectorVar'; did you mean 'std::vector<float> TauNNId::NNvectorVar_'? (not accessible from this context)
  196 |   float *lNNVector = fTauNNId_->NNVectorVar();
      |                                 ^~~~~~~~~~~
In file included from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc:14:
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/TauNNId.h:24:22: note: declared private here
   24 |   std::vector<float> NNvectorVar_;
      |                      ^~~~~~~~~~~~
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc:199:51: error: no matching function for call to 'l1t::PFTau::PFTau(math::PtEtaPhiMLorentzVector&, float*&, float&, int, int&)'
  199 |   l1t::PFTau l1PFTau(tempP4, lNNVector, NN, 0, lId);
      |                                                   ^
In file included from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc:12:
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:36:5: note: candidate: 'l1t::PFTau::PFTau(const PolarLorentzVector&, float, float, int, int, int, int)'
   36 |     PFTau(const PolarLorentzVector& p,
      |     ^~~~~
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:37:17: note:   no known conversion for argument 2 from 'float*' to 'float'
   37 |           float iso = -1,
      |           ~~~~~~^~~~~~~~
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:28:5: note: candidate: 'l1t::PFTau::PFTau(const LorentzVector&, float, float, int, int, int, int)'
   28 |     PFTau(const LorentzVector& p,
      |     ^~~~~
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:28:32: note:   no known conversion for argument 1 from 'math::PtEtaPhiMLorentzVector' {aka 'ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double> >'} to 'const LorentzVector&' {aka 'const ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >&'}
   28 |     PFTau(const LorentzVector& p,
      |           ~~~~~~~~~~~~~~~~~~~~~^
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:26:5: note: candidate: 'l1t::PFTau::PFTau()'
   26 |     PFTau() {}
      |     ^~~~~
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:26:5: note:   candidate expects 0 arguments, 5 provided
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:24:9: note: candidate: 'l1t::PFTau::PFTau(const l1t::PFTau&)'
   24 |   class PFTau : public L1Candidate {
      |         ^~~~~
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:24:9: note:   candidate expects 1 argument, 5 provided
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:24:9: note: candidate: 'l1t::PFTau::PFTau(l1t::PFTau&&)'
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:24:9: note:   candidate expects 1 argument, 5 provided
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc: In member function 'void L1NNTauProducer::makeTau_HW(const l1t::PFCandidate&, l1t::PFCandidateCollection&, std::unique_ptr<std::vector<l1t::PFTau> >&)':
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc:283:37: error: 'class TauNNIdHW' has no member named 'NNVectorVar'; did you mean 'std::vector<ap_fixed<16, 8> > TauNNIdHW::NNvectorVar_'? (not accessible from this context)
  283 |   input_t *lNNVector = fTauNNIdHW_->NNVectorVar();
      |                                     ^~~~~~~~~~~
In file included from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc:15:
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/TauNNIdHW.h:163:24: note: declared private here
  163 |   std::vector<input_t> NNvectorVar_;
      |                        ^~~~~~~~~~~~
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc:291:48: error: no matching function for call to 'l1t::PFTau::PFTau(math::PtEtaPhiMLorentzVector&, float [80], result_t&, int, unsigned int&)'
  291 |   l1t::PFTau l1PFTau(tempP4, pNNVec, NN, 0, lId);
      |                                                ^
In file included from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc:12:
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:36:5: note: candidate: 'l1t::PFTau::PFTau(const PolarLorentzVector&, float, float, int, int, int, int)'
   36 |     PFTau(const PolarLorentzVector& p,
      |     ^~~~~
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:37:17: note:   no known conversion for argument 2 from 'float [80]' to 'float'
   37 |           float iso = -1,
      |           ~~~~~~^~~~~~~~
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:28:5: note: candidate: 'l1t::PFTau::PFTau(const LorentzVector&, float, float, int, int, int, int)'
   28 |     PFTau(const LorentzVector& p,
      |     ^~~~~
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:28:32: note:   no known conversion for argument 1 from 'math::PtEtaPhiMLorentzVector' {aka 'ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double> >'} to 'const LorentzVector&' {aka 'const ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >&'}
   28 |     PFTau(const LorentzVector& p,
      |           ~~~~~~~~~~~~~~~~~~~~~^
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:26:5: note: candidate: 'l1t::PFTau::PFTau()'
   26 |     PFTau() {}
      |     ^~~~~
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:26:5: note:   candidate expects 0 arguments, 5 provided
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:24:9: note: candidate: 'l1t::PFTau::PFTau(const l1t::PFTau&)'
   24 |   class PFTau : public L1Candidate {
      |         ^~~~~
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:24:9: note:   candidate expects 1 argument, 5 provided
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:24:9: note: candidate: 'l1t::PFTau::PFTau(l1t::PFTau&&)'
/nfs_scratch/aloeliger/pr_1087/new/src/DataFormats/L1TParticleFlow/interface/PFTau.h:24:9: note:   candidate expects 1 argument, 5 provided
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc:295:12: warning: unused variable 'lPt' [-Wunused-variable]
  295 |   uint32_t lPt = pt.to_uint();
      |            ^~~
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc:296:12: warning: unused variable 'lEta' [-Wunused-variable]
  296 |   uint32_t lEta = eta.to_uint();
      |            ^~~~
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc:297:12: warning: unused variable 'lPhi' [-Wunused-variable]
  297 |   uint32_t lPhi = phi.to_uint();
      |            ^~~~
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc:298:12: warning: unused variable 'lNN' [-Wunused-variable]
  298 |   uint32_t lNN  = NN.to_uint();
      |            ^~~
gmake: *** [config/SCRAM/GMake/Makefile.rules:1712: tmp/slc7_amd64_gcc10/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1TriggerPhase2L1ParticleFlowAuto/L1NNTauProducer.cc.o] Error 1
gmake: *** Waiting for unfinished jobs....

Info Value
return code 2
command cmsenv && scram b -j 8

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

This PR failed the code checks.

I found the following lines where an "error" was mentioned, they may help in debugging

/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc:196:33: error: no member named 'NNVectorVar' in 'TauNNId' [clang-diagnostic-error]
...
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc:199:14: error: no matching constructor for initialization of 'l1t::PFTau' [clang-diagnostic-error]
...
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc:283:37: error: no member named 'NNVectorVar' in 'TauNNIdHW' [clang-diagnostic-error]
...
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc:291:14: error: no matching constructor for initialization of 'l1t::PFTau' [clang-diagnostic-error]
...

Please check and see if these lines help debugging.

Info Value
return code 2
command cmsenv && scram b -k -j 8 code-checks && scram b -k -j 8 code-checks

I found no issues with the headers!| Info | Value |
|:---------:|:------------:|
|return code|0|
|command|cmsenv && scram b -k -j 8 check-headers|

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

I found 1 files that did not meet formatting requirements:

  • L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc

Please run scram b code-format to auto-apply code formatting

@aloeliger
Copy link

@Duchstf Could you please fix the compilation errors in this PR?

@EmyrClement
Copy link

@Duchstf can you specify which of the four changes you mention are already included here, and which are to come?

For your second point, if needed would we be able to replicate the performance of the new NN ID without also migrating to the new hls4ml library?

@aloeliger
Copy link

@Duchstf Out of curiosity is this trying to run an existing tensorflow graph NN in CMSSW? Is this trying to implement an hls4ml model in CMSSW?

@aloeliger
Copy link

@Duchstf Pinging you again on the compilation issues and code format.

@Duchstf Duchstf changed the title Tau L1 2023 Draft Tau L1 2023 Apr 5, 2023
@Duchstf
Copy link
Author

Duchstf commented Apr 5, 2023

@aloeliger @EmyrClement Hello, thank you both for the pings and sorry for the late reply!! I pushed the necessary changes! Let me know if I need to fix anything! Note that the HW emulation is still not updated with the new training so you might want to use the SW emulation version for now. I'll look into replacing the weights in the HW emulated version and hopefully gets it merged soon as well.

Thanks,

Duc.

@cbotta
Copy link

cbotta commented Apr 5, 2023

@Duchstf Thank you very much. One question: do the performance plots we saw yesterday corresponds to HW flag + new training? Then, I understood that the HW flag is not so important for the performance, but I think it's pretty needed expecially now that we need to use the "emulator-matching-firmware" in the GT emulator for HLT (together with updating the GT format as discussed yesterday). Could you please discuss in today's software meeting if the HW emulated version (and the GT format) can arrive soon enough for the Menu/GT team? @EmyrClement @mcepeda

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

Attempts to compile this PR succeeded!

Info Value
return code 0
command cmsenv && scram b -j 8

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

I found no issues with the code checks!

Info Value
return code 0
command cmsenv && scram b -k -j 8 code-checks && scram b -k -j 8 code-checks

I found no issues with the headers!

Info Value
return code 0
command cmsenv && scram b -k -j 8 check-headers

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

I found 5 files that did not meet formatting requirements:

  • DataFormats/L1TParticleFlow/interface/PFTau.h
  • DataFormats/L1TParticleFlow/src/PFTau.cc
  • L1Trigger/Phase2L1ParticleFlow/interface/TauNNId.h
  • L1Trigger/Phase2L1ParticleFlow/interface/taus/TauNNIdHW.h
  • L1Trigger/Phase2L1ParticleFlow/plugins/L1NNTauProducer.cc

Please run scram b code-format to auto-apply code formatting

Info Value
return code 0
command cmsenv && scram b -k -j 8 code-format-all

@aloeliger
Copy link

@Duchstf Could you please fix the file formatting on this?

@EmyrClement
Copy link

@Duchstf I'm confused with something - in your latest commits you update a .pb file here, but this looks like the one that contains the model for the b tagging ID, not the Tau ID? The file that should contain the NN ID is specified here.

As @cbotta said, it would be good to confirm that the plots you showed yesterday can be reproduced with the changes you are proposing in this PR.

@aloeliger
Copy link

Ahh, thank you for reminding me @EmyrClement. Committing model files, data files and the like is not acceptable in CMSSW anymore. The file: L1Trigger/Phase2L1ParticleFlow/data/modelTT_PUP_Off_dXY_XYCut_Graph.pb needs to be removed from this commit, and removed from the git history. It will need to be committed separately to the data files.

@EmyrClement
Copy link

Just to clarify, that file was updated here, not added. And in any case, it shouldn't be touched by this PR - let's remove the change from the history.

I expect some model files should be updated though - given the tight timescale, do we update here for now to have them available, and then migrate them to cms-data when we make a PR to central?

@aloeliger
Copy link

Ahh, you are quite right. I am dealing with the removal of this very file in CMSSW right now from the correlator updates. Okay. In any case, let us not make a problem worse, and please discard any changes to this file in this commit.

My concern with committing files here is that it will prevent synchronization with central CMSSW. If we need to perform PRs, as in the correlator PR right now, it also falls us on to remove them from the history. If they are necessary, they need to go in the data externals as soon as possible. If they are inextricable from trigger function, we should come up with a better solution than their storage here.

@Duchstf
Copy link
Author

Duchstf commented Apr 6, 2023

Hi all,

I updated the HW weights, replaced the protobuf file and updated the file formatting.

Duc.

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

Attempts to compile this PR failed.

The following is the stderr of the compilation attempt:

/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/L1TNtuples/plugins/L1PhaseIITreeProducer.cc: In constructor 'L1PhaseIITreeProducer::L1PhaseIITreeProducer(const edm::ParameterSet&)':
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/L1TNtuples/plugins/L1PhaseIITreeProducer.cc:189:78: warning: 'edm::EDAnalyzer::EDAnalyzer()' is deprecated [-Wdeprecated-declarations]
  189 | L1PhaseIITreeProducer::L1PhaseIITreeProducer(const edm::ParameterSet& iConfig) {
      |                                                                              ^
In file included from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/L1TNtuples/plugins/L1PhaseIITreeProducer.cc:25:
/cvmfs/cms.cern.ch/slc7_amd64_gcc10/cms/cmssw-patch/CMSSW_12_5_2_patch1/src/FWCore/Framework/interface/EDAnalyzer.h:43:20: note: declared here
   43 |     CMS_DEPRECATED EDAnalyzer();
      |                    ^~~~~~~~~~
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/L1TNtuples/plugins/L1PhaseIITreeProducer.cc: In member function 'virtual void L1PhaseIITreeProducer::analyze(const edm::Event&, const edm::EventSetup&)':
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/L1TNtuples/plugins/L1PhaseIITreeProducer.cc:370:9: warning: unused variable 'Z0' [-Wunused-variable]
  370 |   float Z0 = *z0Puppi;
      |         ^~
In file included from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/TauNNIdHW.h:18,
                 from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc:2:
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w1.h:10:1: error: 'model_default_t' does not name a type; did you mean 'bias_default_t'?
   10 | model_default_t w2[2000];
      | ^~~~~~~~~~~~~~~
      | bias_default_t
In file included from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/TauNNIdHW.h:19,
                 from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc:2:
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b1.h:10:1: error: 'model_default_t' does not name a type; did you mean 'bias_default_t'?
   10 | model_default_t b2[25];
      | ^~~~~~~~~~~~~~~
      | bias_default_t
In file included from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/TauNNIdHW.h:20,
                 from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc:2:
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w2.h:10:1: error: 'model_default_t' does not name a type; did you mean 'bias_default_t'?
   10 | model_default_t w4[250];
      | ^~~~~~~~~~~~~~~
      | bias_default_t
In file included from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/TauNNIdHW.h:21,
                 from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc:2:
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b2.h:10:1: error: 'model_default_t' does not name a type; did you mean 'bias_default_t'?
   10 | model_default_t b4[10];
      | ^~~~~~~~~~~~~~~
      | bias_default_t
In file included from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/TauNNIdHW.h:22,
                 from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc:2:
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w3.h:10:1: error: 'model_default_t' does not name a type; did you mean 'bias_default_t'?
   10 | model_default_t w6[100];
      | ^~~~~~~~~~~~~~~
      | bias_default_t
In file included from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/TauNNIdHW.h:23,
                 from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc:2:
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b3.h:10:1: error: 'model_default_t' does not name a type; did you mean 'bias_default_t'?
   10 | model_default_t b6[10];
      | ^~~~~~~~~~~~~~~
      | bias_default_t
In file included from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/TauNNIdHW.h:24,
                 from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc:2:
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w4.h:10:1: error: 'model_default_t' does not name a type; did you mean 'bias_default_t'?
   10 | model_default_t w8[10];
      | ^~~~~~~~~~~~~~~
      | bias_default_t
In file included from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/TauNNIdHW.h:25,
                 from /nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc:2:
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b4.h:10:1: error: 'model_default_t' does not name a type; did you mean 'bias_default_t'?
   10 | model_default_t b8[1];
      | ^~~~~~~~~~~~~~~
      | bias_default_t
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc: In member function 'result_t TauNNIdHW::EvaluateNN()':
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc:46:66: error: 'w1' was not declared in this scope; did you mean 'y1'?
   46 |   nnet::compute_layer<input_t, layer1_t, config1>(data, logits1, w1, b1);
      |                                                                  ^~
      |                                                                  y1
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc:46:70: error: 'b1' was not declared in this scope; did you mean 'y1'?
   46 |   nnet::compute_layer<input_t, layer1_t, config1>(data, logits1, w1, b1);
      |                                                                      ^~
      |                                                                      y1
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc:51:73: error: 'w2' was not declared in this scope
   51 |   nnet::compute_layer<layer1_t, layer2_t, config2>(layer1_out, logits2, w2, b2);
      |                                                                         ^~
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc:51:77: error: 'b2' was not declared in this scope
   51 |   nnet::compute_layer<layer1_t, layer2_t, config2>(layer1_out, logits2, w2, b2);
      |                                                                             ^~
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc:56:73: error: 'w3' was not declared in this scope
   56 |   nnet::compute_layer<layer2_t, layer3_t, config3>(layer2_out, logits3, w3, b3);
      |                                                                         ^~
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc:56:77: error: 'b3' was not declared in this scope
   56 |   nnet::compute_layer<layer2_t, layer3_t, config3>(layer2_out, logits3, w3, b3);
      |                                                                             ^~
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc:60:73: error: 'w4' was not declared in this scope
   60 |   nnet::compute_layer<layer3_t, result_t, config4>(layer3_out, logits4, w4, b4);
      |                                                                         ^~
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/src/taus/TauNNIdHW.cc:60:77: error: 'b4' was not declared in this scope
   60 |   nnet::compute_layer<layer3_t, result_t, config4>(layer3_out, logits4, w4, b4);
      |                                                                             ^~
gmake: *** [config/SCRAM/GMake/Makefile.rules:1712: tmp/slc7_amd64_gcc10/src/L1Trigger/Phase2L1ParticleFlow/src/L1TriggerPhase2L1ParticleFlow/taus/TauNNIdHW.cc.o] Error 1
gmake: *** Waiting for unfinished jobs....

Info Value
return code 2
command cmsenv && scram b -j 8

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

This PR failed the code checks.

I found the following lines where an "error" was mentioned, they may help in debugging

/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b1.h:10:1: error: unknown type name 'model_default_t' [clang-diagnostic-error]
...
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b2.h:10:1: error: unknown type name 'model_default_t' [clang-diagnostic-error]
...
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b3.h:10:1: error: unknown type name 'model_default_t' [clang-diagnostic-error]
...
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b4.h:10:1: error: unknown type name 'model_default_t' [clang-diagnostic-error]
...
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w1.h:10:1: error: unknown type name 'model_default_t' [clang-diagnostic-error]
...
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w2.h:10:1: error: unknown type name 'model_default_t' [clang-diagnostic-error]
...
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w3.h:10:1: error: unknown type name 'model_default_t' [clang-diagnostic-error]
...
/nfs_scratch/aloeliger/pr_1087/new/src/L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w4.h:10:1: error: unknown type name 'model_default_t' [clang-diagnostic-error]
...

Please check and see if these lines help debugging.

Info Value
return code 2
command cmsenv && scram b -k -j 8 code-checks && scram b -k -j 8 code-checks

I found no issues with the headers!

Info Value
return code 0
command cmsenv && scram b -k -j 8 check-headers

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

I found 7 files that did not meet formatting requirements:

  • L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b1.h
  • L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b2.h
  • L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/b3.h
  • L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w1.h
  • L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w2.h
  • L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w3.h
  • L1Trigger/Phase2L1ParticleFlow/interface/taus/weights/w4.h

Please run scram b code-format to auto-apply code formatting

Info Value
return code 0
command cmsenv && scram b -k -j 8 code-format-all

@EmyrClement
Copy link

@Duchstf Thanks for the latest update! As you can see from the tests there are compilation errors and formatting requirements that need fixing. I had some questions related to those compilation errors, which I'll add inline to the code.

@EmyrClement
Copy link

I also tried testing the simulation by setting HW=false, and using the new .pb file in the PR to cms-data. However, the file appears corrupt, or in a different format/structure to the previous file. When I run, I get the following exception:

----- Begin Fatal Exception 06-Apr-2023 13:04:16 BST-----------------------
An exception of category 'InvalidGraphDef' occurred while
   [0] Constructing the EventProcessor
   [1] Constructing module: class=L1NNTauProducer label='l1tNNTauProducerPuppi'
Exception Message:
error while loading graphDef from '/scratch/ec6821/TauJetMet/NNPuppiTaus/CMSSW_12_5_2_patch1/src/L1Trigger/Phase2L1ParticleFlow/data/tau_3layer_puppi.pb': Data loss: Can't parse /scratch/ec6821/TauJetMet/NNPuppiTaus/CMSSW_12_5_2_patch1/src/L1Trigger/Phase2L1ParticleFlow/data/tau_3layer_puppi.pb as binary proto
----- End Fatal Exception -------------------------------------------------

Did it work for you?

lSeed = l1t::PFCandidate::Photon;
std::copy_if(work.begin(), work.end(), std::back_inserter(seeds), [&](const l1t::PFCandidate& part) {
return ((part.id() == l1t::PFCandidate::Electron || part.id() == l1t::PFCandidate::ChargedHadron ||
part.id() == lSeed) &&
Copy link

@EmyrClement EmyrClement Apr 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic looks ok, but it's a bit confusing so want to make sure there isn't a bug. When fEMSeed is false, this line becomes (part.id() == l1t::PFCandidate::Electron || part.id() == l1t::PFCandidate::ChargedHadron || part.id() == l1t::PFCandidate::ChargedHadron) i.e. the last conditional is repeated. Is that intended?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Duchstf can you check this comment?

@Duchstf
Copy link
Author

Duchstf commented Apr 27, 2023

@EmyrClement @aloeliger Hello, I squashed the comments but I'm a bit lost as to which branch of central cmssw I should make the PR to ... could you maybe provide me some pointers on this?

@aloeliger
Copy link

aloeliger commented Apr 27, 2023

@Duchstf I still see this as 21 commits. Please squash the commits in this PR (If you haven't done this before, please back up this branch with a duplicate before you do anything, just so it can be recovered if necessary).

Once you have this PR as 1 commit, please open a PR to the main CMSSW master branch. You can do this by getting the latest CMSSW 13_1_0 release (currently CMSSW_13_1_0_pre3), and using git cherry pick to move the single commit to that branch. From there, open a PR to the branch master. Make sure you have gone through the PR checklist that will show up in the PR template (some of it should be caught by my scripts).

@Duchstf
Copy link
Author

Duchstf commented May 4, 2023

Hi Andrew,

I put in the PR here: cms-sw#41492

However, I'm having troubles to even compile it locally, and the errors seem to be not related to my changes:

/uscms_data/d3/dhoang/Tau_PR/CMSSW_12_5_2_patch1/src/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuonShower.cc: In member function 'void L1Analysis::L1AnalysisL1UpgradeTfMuonShower::SetTfMuonShower(const RegionalMuonShowerBxCollection&, unsigned int)':
/uscms_data/d3/dhoang/Tau_PR/CMSSW_12_5_2_patch1/src/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuonShower.cc:19:67: error: 'const class l1t::RegionalMuonShower' has no member named 'isOneLooseInTime'; did you mean 'isTwoLooseInTime'?
   19 |         l1upgradetfmuonshower_.tfMuonShowerOneLoose.push_back(it->isOneLooseInTime());
      |                                                                   ^~~~~~~~~~~~~~~~
      |                                                                   isTwoLooseInTime
gmake: *** [config/SCRAM/GMake/Makefile.rules:1712: tmp/slc7_amd64_gcc10/src/L1Trigger/L1TNtuples/src/L1TriggerL1TNtuples/L1AnalysisL1UpgradeTfMuonShower.cc.o] Error 1
gmake: *** Waiting for unfinished jobs....
gmake: *** [There are compilation/build errors. Please see the detail log above.] Error 2

I'm wondering if anyone have any information on this. Or is there a separate set of instructions I need to follow in order to set things up for the cmssw master branch?

@dinyar
Copy link

dinyar commented May 4, 2023

Hi Andrew,

I put in the PR here: cms-sw#41492

However, I'm having troubles to even compile it locally, and the errors seem to be not related to my changes:

/uscms_data/d3/dhoang/Tau_PR/CMSSW_12_5_2_patch1/src/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuonShower.cc: In member function 'void L1Analysis::L1AnalysisL1UpgradeTfMuonShower::SetTfMuonShower(const RegionalMuonShowerBxCollection&, unsigned int)':
/uscms_data/d3/dhoang/Tau_PR/CMSSW_12_5_2_patch1/src/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuonShower.cc:19:67: error: 'const class l1t::RegionalMuonShower' has no member named 'isOneLooseInTime'; did you mean 'isTwoLooseInTime'?
   19 |         l1upgradetfmuonshower_.tfMuonShowerOneLoose.push_back(it->isOneLooseInTime());
      |                                                                   ^~~~~~~~~~~~~~~~
      |                                                                   isTwoLooseInTime
gmake: *** [config/SCRAM/GMake/Makefile.rules:1712: tmp/slc7_amd64_gcc10/src/L1Trigger/L1TNtuples/src/L1TriggerL1TNtuples/L1AnalysisL1UpgradeTfMuonShower.cc.o] Error 1
gmake: *** Waiting for unfinished jobs....
gmake: *** [There are compilation/build errors. Please see the detail log above.] Error 2

I'm wondering if anyone have any information on this. Or is there a separate set of instructions I need to follow in order to set things up for the cmssw master branch?

Hi,

It looks like your error seems to appear in a directory for the 12_5_2 release, but the main CMSSW branch is targeting 13_1_X if I remember correctly (Andrew, please correct me if I'm wrong). That might explain why you get that error when trying to compile locally. I suspect you have the L1TNtuple directory checked out locally with the changes from 13_1_X while the DataFormats/L1TMuon directory isn't checked out and therefore retrieved from the 12_5_2 release where the update of the muon showers hasn't happened yet..

Cheers,
Dinyar

@EmyrClement
Copy link

EmyrClement commented May 15, 2023

@Duchstf do you need any help from us to address the issues with the PR to master?

On another topic, I was looking at these lines again. I may have misunderstood something before, and need you to double check these are correct.

Looking at this line:

  L1TauEmu::etaphi_t eta = etaphi_t(seed.eta() * L1TauEmu::etaphi_base);

I previously said that seed.eta()/phi() where some digitized quantities (and just to confuse things, I may have also convinced you as well), but I now think I am wrong, and that it is eta in physical coordinates. Here the eta gets converted to the scale used internally by the Tau algorithm. Then this line:

  l1ctTau.hwEta = l1ct::Scales::makeGlbEta(float(eta));

is then wrong, and should be:

  l1ctTau.hwEta = l1ct::Scales::makeGlbEta(float(eta / L1TauEmu::etaphi_base));

or, depending on what's done in the firmware, just:

  l1ctTau.hwEta = l1ct::Scales::makeGlbEta(seed.eta());

And similar for phi.

Can you check this for me?

@Duchstf
Copy link
Author

Duchstf commented May 18, 2023

Hi @EmyrClement, sorry for the late reply! I've been busy with finals!!

I guess we could carefully go through each function/dataypes definition carefully here:

inline glbeta_t makeGlbEta(float eta) { return round(eta / ETAPHI_LSB); }

Where ETAPHI_LSB is in l1ct scales. And we want the output to be of typeglbeta_t, which is:

typedef ap_int<12> glbeta_t;

which I think it's a digitized quantity for eta as well. And we know that seed.eta() returns the digitized eta, I think we need to convert it to float by multiplying it by L1TauEmu::etaphi_base like what I did. After that this float number would be divided by the lsb when we use makeGlbEta and we correctly get the digitized version of glbeta_t.

So I personally think what we are doing here is correct ... Let me know what you think!!

Duc.

@EmyrClement
Copy link

Hi @Duchstf sorry for taking long to reply. Are you sure seed.eta() is a digitized quantity? seed is a l1t::PFCandidate, inheriting from l1t::L1Candidate. I believe seed.eta() returns the float value of eta, and seed.hwEta() should return the hardware/digitized value?

Experimentally, looking at a few candidates I also see eta isn't bounded between +/- 2.5, where as seed.eta() is.

@Duchstf
Copy link
Author

Duchstf commented Jun 1, 2023

@EmyrClement I did some printouts and I think you are right:

Seed.eta(): 
1.89368
HW eta:
-24
Converted eta:
2.95312
------------------
Seed.eta(): 
-0.597775
HW eta:
32
Converted eta:
-0.9375
------------------
Seed.eta(): 
0.846485
HW eta:
22
Converted eta:
1.3125

(Converted eta is the eta we are using, and it seems like it goes above 2.5 sometimes), so I think it's correct that eta is in the physical coordinates. Let me push a quick fix.

@epalencia
Copy link

@Duchstf, could you have a look at the existing conflict?

@epalencia
Copy link

epalencia commented Jun 27, 2023

@Duchstf, now that cms-sw#41492 is merged, could you please include here the commits added in master?

@Duchstf
Copy link
Author

Duchstf commented Jun 28, 2023

@epalencia Yes, sorry I'm checking to make sure what changes I should make here, since we included a fix for the newer version of CMSSW, but I'm not sure if that change would be compatible here.

@Duchstf
Copy link
Author

Duchstf commented Jun 28, 2023

Hello, I pulled the latest changes from phase2-l1t-integration-1252patch1, and I'm getting this error when trying to compile it:

/uscms_data/d3/dhoang/Tau_PR/CMSSW_12_5_2_patch1/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCtL2EgProducer.cc: In member function 'void L1TCtL2EgProducer::convertToEmu(const l1t::TkElectron&, L1TCtL2EgProducer::RefRemapper&, l1ct::OutputBoard&) const':
/uscms_data/d3/dhoang/Tau_PR/CMSSW_12_5_2_patch1/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCtL2EgProducer.cc:355:23: error: 'const class l1t::TkElectron' has no member named 'idScore'
  355 |   emu.idScore = tkele.idScore();
      |                       ^~~~~~~
/uscms_data/d3/dhoang/Tau_PR/CMSSW_12_5_2_patch1/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCtL2EgProducer.cc: In member function 'l1t::TkElectron L1TCtL2EgProducer::convertFromEmu(const l1ct::EGIsoEleObjEmu&, const L1TCtL2EgProducer::RefRemapper&) const':
/uscms_data/d3/dhoang/Tau_PR/CMSSW_12_5_2_patch1/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCtL2EgProducer.cc:425:9: error: 'class l1t::TkElectron' has no member named 'setIdScore'
  425 |   tkele.setIdScore(egele.idScore);
      |         ^~~~~~~~~~
/uscms_data/d3/dhoang/Tau_PR/CMSSW_12_5_2_patch1/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCorrelatorLayer1Producer.cc: In member function 'void L1TCorrelatorLayer1Producer::putEgObjects(edm::Event&, bool, const std::vector<edm::Ref<BXVector<l1t::EGamma> > >&, const string&, const string&, const string&, const string&) const':
/uscms_data/d3/dhoang/Tau_PR/CMSSW_12_5_2_patch1/src/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCorrelatorLayer1Producer.cc:1131:13: error: 'class l1t::TkElectron' has no member named 'setIdScore'
 1131 |       tkele.setIdScore(egele.idScore);

I don't think this is caused by my code, does anyone know what's going on here?

@EmyrClement
Copy link

@Duchstf @epalencia @aloeliger If I understand correctly, Duc has pulled over the additional commits made to master on top of this PR? The comment made by Duc was from trying to rebase to the tip of phase2-l1t-integration-1252patch1, but I don't think this needs to be done, and will be handled by the merge (and checked by triggerDoctor)?

The only other issue to resolve is with the TauNNCache, which we said would be best followed up in a separate PR.

@EmyrClement
Copy link

@Duchstf Looking at this again, I reproduced your problem, which can be fixed in my local checkout by doing:

git-cms-addpkg DataFormats/L1TCorrelator

and rebuilding. Can you try this and report back?

@Duchstf
Copy link
Author

Duchstf commented Aug 24, 2023

@EmyrClement Hello, I compiled it and everything looks fine! Sorry for the late response.

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

Attempts to compile this PR succeeded!

Info Value
return code 0
command eval scramv1 runtime -sh && scram b -j 8

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

I found no issues with the code checks!

Info Value
return code 0
command eval scramv1 runtime -sh && scram b -k -j 8 code-checks && scram b -k -j 8 code-checks

I found no issues with the headers!

Info Value
return code 0
command eval scramv1 runtime -sh && scram b -k -j 8 check-headers

@triggerDoctor
Copy link

Hello, I'm triggerDoctor. @aloeliger is testing this script for L1T offline software validation.

I found 1 files that did not meet formatting requirements:

  • L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc

Please run scram b code-format to auto-apply code formatting

Info Value
return code 0
command eval scramv1 runtime -sh && scram b -k -j 8 code-format-all

@epalencia epalencia merged commit 9a4c977 into cms-l1t-offline:phase2-l1t-integration-1252patch1 Aug 30, 2023
@epalencia
Copy link

Backport of cms-sw#41492.

@epalencia
Copy link

Tagged as l1t-phase2-v76.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Algorithm Development Emulator Development Emulator development PR Phase-2 Pertains to phase-2 development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants