-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
unit test of L1TGlobalProducer
and small technical updates to GlobalBoard
#39832
Conversation
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-39832/32705
|
A new Pull Request was created by @missirol (Marino Missiroli) for master. It involves the following packages:
@epalencia, @cmsbuild, @cecilecaillol, @rekovic can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
test parameters: |
please test |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-6c6828/28453/summary.html Comparison SummarySummary:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added comments inline to guide the review.
@@ -114,7 +113,7 @@ namespace l1t { | |||
const int nrL1Jet); | |||
|
|||
/// run the uGT FDL (Apply Prescales and Veto) | |||
void runFDL(edm::Event& iEvent, | |||
void runFDL(const edm::Event& iEvent, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and elsewhere, the Event arg can be made const
.
|
||
PrescaleCounter(double prescale) : prescale_count(std::lround(prescale * m_singlestep)) { | ||
PrescaleCounter(double prescale, size_t const initial_counter = 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the 2nd arg to give a handle to set the value of trigger_counter
from this ctor, even though this 2nd arg is never used in the current implementation.
static std::vector<PrescaleCounter> prescaleCounters(std::vector<double> const& prescaleFactorsAlgoTrig); | ||
|
||
// create prescale counters, initialising trigger_counter to a semirandom number between 0 and prescale_count - 1 inclusive | ||
static std::vector<PrescaleCounter> prescaleCountersWithSemirandomInitialCounter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed the name of the method to clarify its purpose. I removed the const
keyword, b/c I didn't see the advantage of returning a const vector
(by value) rather than just returning a vector
.
@@ -147,9 +142,8 @@ void l1t::GlobalBoard::receiveCaloObjectData(edm::Event& iEvent, | |||
const int nrL1Jet, | |||
const bool receiveEtSums) { | |||
if (m_verbosity) { | |||
LogDebug("L1TGlobal") << "\n**** Board receiving Calo Data " | |||
//<< "\n from input tag " << caloInputTag << "\n" | |||
<< std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and below, I removed the endl
calls as they have no impact when passed to Log*
objects.
} | ||
|
||
// update and clear prescales at the beginning of the luminosity segment | ||
if (m_firstEvLumiSegment || (m_currentLumi != iEvent.luminosityBlock() && m_resetPSCountersEachLumiSec)) { | ||
if (m_prescaleCounterAlgoTrig.empty() or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_firstEv
and m_firstEvLumiSegment
are both removed. The very first time, the block is entered because m_prescaleCounterAlgoTrig.empty()
(then m_prescaleCounterAlgoTrig
becomes non-empty); later, if required, the block is re-accessed if the lumisection changes.
auto const& prescaleCountersAlgoTrig = | ||
m_semiRandomInitialPSCounters ? prescaleCountersWithSemirandomInitialCounter(prescaleFactorsAlgoTrig, iEvent) | ||
: prescaleCounters(prescaleFactorsAlgoTrig); | ||
for (int iBxInEvent = 0; iBxInEvent < totalBxInEvent; ++iBxInEvent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the range of the loop as discussed in https://github.com/cms-sw/cmssw/pull/39464/files#r979213382. (Many) details follow.
My take is that this change makes sense, at least for the case where the relevant python modules are configured correctly ('correctly' here means how they are configured currently in production). What happens in the general case (e.g. a user making a cfg where the relevant config parameters are set arbitrarily) is less easy to judge.
The vector is m_prescaleCounterAlgoTrig
, and the question is whether its size should be totalBxInEvent
or totalBxInEvent + 1
. The vector is only accessed once here, with index inBxInEvent = totalBxInEvent / 2 + iBxInEvent
. The complication is that totalBxInEvent
and iBxInEvent
come from independent parameters (also, note that m_uGtAlgBlk
depends on iBxInEvent
, due to the preceding call to runGTL
in L1TGlobalProducer
).
totalBxInEvent
comes from (StableParametersTrivialProducer).TotalBxInEvent
(where (StableParametersTrivialProducer)
means the instance of the ESProducer StableParametersTrivialProducer
in the cfg
file) [1], while iBxInEvent
runs from minEmulBxInEvent
to maxEmulBxInEvent
(both included), which is related to (L1TGlobalProducer).EmulateBxInEvent
[2].
If (StableParametersTrivialProducer).TotalBxInEvent
(default: 5) is odd and larger or equal to (L1TGlobalProducer).EmulateBxInEvent
(default: 1), then the index totalBxInEvent / 2 + iBxInEvent
goes at most up to totalBxInEvent / 2 + ((totalBxInEvent+1) / 2 - 1) = totalBxInEvent - 1
, meaning that the correct choice is size = totalBxInEvent
(not totalBxInEvent + 1
).
What happens in the (unlikely?) case (StableParametersTrivialProducer).TotalBxInEvent < (L1TGlobalProducer).EmulateBxInEvent
is much less clear to me. The unit test on MC did not crash, and returned the same results, even in this case (inBxInEvent
can go out-of-range in this case, but the plugin didn't not evaluate the vector m_prescaleCounterAlgoTrig
because no algo was accepting events for those BXs).
[1] totalBxInEvent
comes from
m_totalBxInEvent = data->totalBxInEvent(); |
and I think this number corresponds to the config parameter
(StableParametersTrivialProducer).TotalBxInEvent
(where (StableParametersTrivialProducer)
means the instance of the ESProducer StableParametersTrivialProducer
in the cfg
file). IIuc, in stage-2 L1T this is 5 (meaning the BXs are "-2,-1,0,1,2"), but in principle it could be set to anything.
[2] iBxInEvent
goes from minEmulBxInEvent
to maxEmulBxInEvent
(both included):
minEmulBxInEvent
andmaxEmulBxInEvent
are set based onm_emulateBxInEvent
.- The value of
m_emulateBxInEvent
can be set independently ofTotalBxInEvent
. m_emulateBxInEvent
is forced to be odd, unless it is negative and in that casem_emulateBxInEvent
is set tototalBxInEvent
(wheretotalBxInEvent
can in principle be anything).- It seems like the idea is that
m_emulateBxInEvent
is odd, and thenmin
andmax
are the first and last BX (e.g. ifm_emulateBxInEvent=7
,minEmulBxInEvent=-3
andmaxEmulBxInEvent=3
); but again, there is an edge case wherem_emulateBxInEvent
could be even (e.g. if(L1TGlobalProducer).EmulateBxInEvent = -1
and(StableParametersTrivialProducer).TotalBxInEvent
is even), and the L1T producer does not seem to guard against that. - In reality, we use
m_emulateBxInEvent == 1
andminEmulBxInEvent == maxEmulBxInEvent == 0
(meaning, only the "central" BX is considered).
cmssw/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc
Lines 317 to 318 in a993c0f
int minEmulBxInEvent = (m_emulateBxInEvent + 1) / 2 - m_emulateBxInEvent; int maxEmulBxInEvent = (m_emulateBxInEvent + 1) / 2 - 1;
|
||
LogTrace("L1TGlobal") << std::endl; | ||
// initialize prescale counters to zero | ||
std::vector<l1t::GlobalBoard::PrescaleCounter> l1t::GlobalBoard::prescaleCounters( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a new method; I just moved up an old one, and renamed it.
+l1 |
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @perrotta, @dpiparo, @rappoccio (and backports should be raised in the release meeting by the corresponding L2) |
@cecilecaillol can you also sign the cms-data PR? cms-data/L1Trigger-L1TGlobal#13 Thanks! |
+1
|
PR description:
This PR is a follow-up of #39464. It adds a unit test for the
L1TGlobalProducer
plugin, and applies small technical updates to the classGlobalBoard
, including the ones discussed in #39817.Because of the new unit test, this PR is tied to a
cms-data
update: cms-data/L1Trigger-L1TGlobal#13.Merely technical. No changes expected in the outputs of PR tests.
Attn: @elfontan
PR validation:
The new unit test passes in local tests.
If this PR is a backport, please specify the original PR and why you need to backport that PR. If this PR will be backported, please specify to which release cycle the backport is meant for:
N/A