-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Adding ZDC Unpacker to L1RawtoDigi #42733
Conversation
Added Et sum for ZDC unpacker in registerProducts
added zdc to GTCollections
added ZDCSum to GTCollections
Updating names due to GTCollection changes
Updated names due to GTCollection changes
Merging CMS-SW master to ZDCUnpacker
ZDCUnpacker::ZDCUnpacker() : ZDCSumCopy_(0) {} | ||
|
||
bool ZDCUnpacker::unpack(const Block& block, UnpackerCollections* coll) { | ||
using namespace l1t::stage2::layer2; |
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 should just be l1t::stage2
(ZDC is not part of Calo Layer 2)
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 addressed this in my commit, Fixing Issues for PR 42733 (First Attempt). I had to change demux::nOutputFramePerBX to layer2::demux::nOutputFramePerBX to solve compiler errors. The ZDC data has 6 frames for BX which is the value of nOutputFramePerBX but this may be coincident.
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.
Yeah, I was unsure whether to flag the use of demux::nOutputFramePerBX
in my first pass. I'd say this could technically change and become inconsistent with the number of input frames to the uGT, but in practice I have a hard time imagining how that would do. (So the bottom line from my side was that it's probably reasonable to leave it as you have it. If I remember correctly we just put the literal 6 in the muon unpacker which is also not nice.. ) @bundocka may have better thought through input than me, though.
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.
demux::nOutputFramePerBX == zdc::nOutputFramePerBX is a coincidence, I would not recommend using the demux constant, but instead create zdc::nOutputFramePerBX, for clarity. as Dinyar said, this should be fine as it is, and it shouldn't change, but the two numbers are technically unrelated so they shouldn't use the same constant.
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 tell a lie, it is not a coincidence at all :) 6bx is the maximum length allowed for the GT input packet. the input links are clocked at 240 MHz. 240 / 6 = 40 MHz.
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.
To add the zdc::nOutputFramePerBX variable. should I add it to the L1TStage2Layer2Constants.cc file or create a new constants file only for zdc. I could also add it to the ZDCUnpacker.h but I don't like that since I believe the variable will also be used by the zdc packer in the future.
I would have the variable be this in all cases
const unsigned int l1t::stage2::zdc::nOutputFramePerBX = 6;
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 would be tempted to put it somewhere like GTSetup.h, since it is a general parameter for the input to the GT. (Then technically this parameter should be used throughout the muon and layer 2 unpackers)
https://github.com/cms-sw/cmssw/blob/master/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GTSetup.h
-code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-42733/36824 ERROR: Build errors found during clang-tidy run.
|
@@ -9,13 +9,15 @@ namespace l1t { | |||
event_.put(std::move(muonShowers_[0]), "MuonShower"); | |||
event_.put(std::move(egammas_[0]), "EGamma"); | |||
event_.put(std::move(etsums_[0]), "EtSum"); | |||
event_.put(std::move(zdcsums_[0]), "ZDCSum"); |
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.
Please change this string to EtSumZDC
, here and elsewhere in this PR (see #42707 (comment)).
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 was addressed in Fixing Issues for PR 42733 (First Attempt). I did not update the zdcsums since I thought changing to etsumzdcs would be confusing but I can change that as well
@@ -55,6 +56,7 @@ namespace l1t { | |||
prod.produces<MuonShowerBxCollection>("MuonShower"); | |||
prod.produces<EGammaBxCollection>("EGamma"); | |||
prod.produces<EtSumBxCollection>("EtSum"); | |||
prod.produces<EtSumBxCollection>("ZDCSum"); // added addition EtSum collection for ZDC unpacker |
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.
added addition EtSum collection for ZDC unpacker
Please improve the comment (or remove it).
@@ -97,6 +102,7 @@ namespace l1t { | |||
muon_unp->setMuonCopy(amc - 1); | |||
egamma_unp->setEGammaCopy(amc - 1); | |||
etsum_unp->setEtSumCopy(amc - 1); | |||
zdc_unp->setZDCSumCopy(amc - 1); |
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.
zdc_unp->setZDCSumCopy(amc - 1); | |
zdc_unp->setEtSumZDCCopy(amc - 1); |
I would also change the name of this method.
@fwyzard & @Martin-Grunewald if you haven't seen this, I wanted to let you know this exists. I see @missirol has already found it. |
Notifying also @mmusich as @cms-sw/hlt-l2.
I would guess one needs to add a method here: |
@dinyar In case you were unaware that this has been opened, I also wanted you to know that this is available on github for review. |
uint32_t raw_data = block.payload().at(iFrame +1); // ZDC - info is found on frame 1 of each bx | ||
|
||
l1t::EtSum zdcm{l1t::EtSum::kZDCM}; | ||
zdcm.setHwPt(raw_data & 0xFFFF); |
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.
Just to make sure: the sum has 16 bits? (I couldn't find this documented anywhere, but maybe I just don't know where this is officially documented.. )
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.
The sum should be 10 bits if I'm not wrong but @jmmans can comment as for what Herbert says it is an exact copy of what the uHTR sends. As far as I know frame 1 is ZDC- and frame 2 is ZDC+
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.
Ok, in that case if I'm not miscounting:
zdcm.setHwPt(raw_data & 0xFFFF); | |
zdcm.setHwPt(raw_data & 0x3FF); | |
(but as mentioned below I would put that into a named constant)
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.
To close this comment, I will update the bit mask and put it into a variable. Are we sure bit shifting is not required to extract the zdc info (i.e. rawdata >> 8) ?
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.
@matt2275 My understanding of Herbert on the email was the uGT stores these in the same word format that ZDC hands them off to uGT. Does ZDC store bits unrelated to the overall HW Pt that will need to be masked or shifted away?
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 don't think there is any data other than the energy count (even so, it should always be masked to the know width).
ps. I found some doc, a search for ZDC gives quite a lot of useful info for this PR:
https://github.com/cms-l1-globaltrigger/mp7_ugt_legacy/blob/master/doc/mp7_ugt_firmware_specification/pdf/gt-mp7-firmware-specification.pdf
raw_data = block.payload().at(iFrame +2); // ZDC + info is found on frame 2 of each bx | ||
|
||
l1t::EtSum zdcp{l1t::EtSum::kZDCP}; | ||
zdcp.setHwPt(raw_data & 0xFFFF); |
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 would suggest to put the mask into a variable given that it's used in these two places and also in a future packer..
|
||
l1t::EtSum zdcm{l1t::EtSum::kZDCM}; | ||
zdcm.setHwPt(raw_data & 0xFFFF); | ||
zdcm.setP4(l1t::CaloTools::p4Demux(&zdcm)); |
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.
Just to check here: my understanding is that this function computes the four vector with the implicit understanding that the LSB is 0.5 GeV. Is that the case for the ZDC sums too? (Again this is based on me not finding documentation, so may be a moot point.)
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.
it is correct your interpretation but in ZDC we should use the numerical expression and not the conversion in energy as it is going to be wrong, in my understanding. @cfmcginn can comment.
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.
Right, I think the uGT emulator always uses the hw values anyway and gets the scales from the menu XML. The physical pT should, however be correct because that's what people usually look at in e.g. the ntuples.
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.
what about the ZDC L1 candidate used in the object map ?
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.
what about the ZDC L1 candidate used in the object map ?
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.
Yes, absolutely. If someone accesses the physical pT value of that object they would get a value of hw_code*0.5
GeV. I'm not entirely sure from Ivan's answer whether this is correct.
@@ -116,6 +122,7 @@ namespace l1t { | |||
res[16] = tau_unp; | |||
res[18] = tau_unp; | |||
res[20] = etsum_unp; | |||
res[22] = zdc_unp; |
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 suppose it's confirmed that ZDC inputs come on link 11 of the uGT?
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 understood it was link 71 (0x8E)
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 was not sure of the link. If the link is 71, then it should be res[142]?
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.
If the logical link ID is 71, then yes I think res[142] should be correct.
Cross referencing the GT input data format [1] with the unpacker [2] I think supports this.
[1] https://twiki.cern.ch/twiki/bin/viewauth/CMS/GlobalTriggerInputDataFormat
[2]
res[0] = muon_unp; |
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 think for res[X], even X is Rx and odd X is Tx)
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.
Yeah, my understanding is also that input ports get even numbers, so it would be 142 if it's link 71.
Addressing some of the issues raised by cms-sw
please test |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-49d39c/34776/summary.html Comparison SummarySummary:
|
Sorry @aloeliger , I'm not able to follow part of your last comment.
does this last point mean that
? |
It means ZDC sums were unpacked from uGT input as is done at HLT (to my understanding) and the resultant sums are not appreciably different than they were in the last step, so it is our understanding that HLT should be able to run this module this way. Edit: Forgot to mention, the uGT emulator runs on this and we can produce sensible L1Ntuples from the output of the GT emulator. This signals to me that the GT emulation should be working well enough to run HLT sensibly. |
OK, so if I understand correctly you are able to run these two workflows
Assuming that's correct, do you have a way to compare event by event the original and emulated results ? If they are identical, everything is fine. |
+l1
@cms-sw/orp-l2 when this is done, a new version of the software is likely needed urgently. I can discuss this at any point Monday if needed. I think it worth noting that I am signing this commit from the Acropolis of Athens :) |
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. @rappoccio, @antoniovilela, @sextonkennedy (and backports should be raised in the release meeting by the corresponding L2) |
@matt2275 Can you please prepare the 13_2_X backport? |
@matt2275 @aloeliger |
+1 |
To do the backport should I do a similar procedure as this: #42781 but add EventFilter/L1TRawtoDigi instead of L1Trigger/L1TGlobal? |
I suppose, although I'm not sure sure what procedure was followed for this other PR. Normally one should grab the latest CMSSW_13_2_X integration build, which at this moment you would do as follows: Ideally you would use the |
Repeated cherry-pick is not necessary. There are backporting instructions here: http://cms-sw.github.io/tutorial-resolve-conflicts.html#backporting-a-pr To make a backport simpler, you can first make a copy of your 13_3_X branch and squash all of your commits down to one commit, and then just rebase that single commit. |
We should really move the default action in CMSSW to "Squash and merge" ... |
on a similar tone, I am not sure why this PR was accepted with 18 commits (most of them with uninformative messages). A minimum squash would have made life simpler. |
Seems like something to consider. |
PR description:
Adding a ZDC unpacker for the L1 Emulation
This is a work in progress Andrew David Loeliger and Dinyar Rabady are more expect in this area and will help solve the issues with the PR
All file changes are in EventFilter/L1TRawToDigi/plugins/implementations_stage2/
2 files were created
ZDCUnpacker.cc
ZDCUnpacker.h
3 Files Changed:
GTSetup.cc
GTCollections.cc
GTCollections.h
Currently there is a complier error I'm not sure how to resolve:
/afs/cern.ch/user/m/mnickel/private/ZDC_Trig/New_WF/CMSSW_13_2_0_pre3/src/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GTCollections.h:40:33: error: 'l1t::EtSumBxCollection* l1t::stage2::GTCollections::getZDCSums(unsigned int)' marked 'override', but does not override
40 | inline EtSumBxCollection* getZDCSums(const unsigned int copy) override { return zdcsums_[copy].get(); };
PR validation:
No validation has been done yet.