-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Adding ZDC Unpacker to L1RawtoDigi #42733
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
Changes from 12 commits
000f129
94a8788
a398a77
a7910cc
345bb42
f2b08ff
b5df094
80b4e2e
579f7e3
eff61c7
76e8be8
440318c
44d6172
7751df5
15fc44b
251e158
f72facd
7422859
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |||||
| #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonUnpacker.h" | ||||||
| #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/EGammaUnpacker.h" | ||||||
| #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/EtSumUnpacker.h" | ||||||
| #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/ZDCUnpacker.h" | ||||||
| #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/JetUnpacker.h" | ||||||
| #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/TauUnpacker.h" | ||||||
|
|
||||||
|
|
@@ -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 | ||||||
|
||||||
| prod.produces<JetBxCollection>("Jet"); | ||||||
| prod.produces<TauBxCollection>("Tau"); | ||||||
| prod.produces<GlobalAlgBlkBxCollection>(); | ||||||
|
|
@@ -64,6 +66,7 @@ namespace l1t { | |||||
| prod.produces<MuonShowerBxCollection>("MuonShower" + std::to_string(i)); | ||||||
| prod.produces<EGammaBxCollection>("EGamma" + std::to_string(i)); | ||||||
| prod.produces<EtSumBxCollection>("EtSum" + std::to_string(i)); | ||||||
| prod.produces<EtSumBxCollection>("ZDCSum" + std::to_string(i)); | ||||||
| prod.produces<JetBxCollection>("Jet" + std::to_string(i)); | ||||||
| prod.produces<TauBxCollection>("Tau" + std::to_string(i)); | ||||||
| } | ||||||
|
|
@@ -80,6 +83,8 @@ namespace l1t { | |||||
| static_pointer_cast<l1t::stage2::EGammaUnpacker>(UnpackerFactory::get()->make("stage2::EGammaUnpacker")); | ||||||
| auto etsum_unp = | ||||||
| static_pointer_cast<l1t::stage2::EtSumUnpacker>(UnpackerFactory::get()->make("stage2::EtSumUnpacker")); | ||||||
| auto zdc_unp = | ||||||
| static_pointer_cast<l1t::stage2::ZDCUnpacker>(UnpackerFactory::get()->make("stage2::ZDCUnpacker")); | ||||||
| auto jet_unp = static_pointer_cast<l1t::stage2::JetUnpacker>(UnpackerFactory::get()->make("stage2::JetUnpacker")); | ||||||
| auto tau_unp = static_pointer_cast<l1t::stage2::TauUnpacker>(UnpackerFactory::get()->make("stage2::TauUnpacker")); | ||||||
|
|
||||||
|
|
@@ -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); | ||||||
|
||||||
| zdc_unp->setZDCSumCopy(amc - 1); | |
| zdc_unp->setEtSumZDCCopy(amc - 1); |
I would also change the name of this method.
Outdated
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.
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,71 @@ | ||||||||||||||||
| #include "FWCore/MessageLogger/interface/MessageLogger.h" | ||||||||||||||||
| #include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h" | ||||||||||||||||
|
|
||||||||||||||||
| #include "L1Trigger/L1TCalorimeter/interface/CaloTools.h" | ||||||||||||||||
|
|
||||||||||||||||
| #include "L1TObjectCollections.h" | ||||||||||||||||
|
|
||||||||||||||||
| #include "L1TStage2Layer2Constants.h" | ||||||||||||||||
| #include "ZDCUnpacker.h" | ||||||||||||||||
|
|
||||||||||||||||
| namespace l1t { | ||||||||||||||||
| namespace stage2 { | ||||||||||||||||
| ZDCUnpacker::ZDCUnpacker() : ZDCSumCopy_(0) {} | ||||||||||||||||
|
|
||||||||||||||||
| bool ZDCUnpacker::unpack(const Block& block, UnpackerCollections* coll) { | ||||||||||||||||
| using namespace l1t::stage2::layer2; | ||||||||||||||||
|
||||||||||||||||
|
|
||||||||||||||||
| LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize(); | ||||||||||||||||
|
|
||||||||||||||||
| int nBX = int( | ||||||||||||||||
| ceil(block.header().getSize() / demux::nOutputFramePerBX)); // Since there 6 frames per demux output event | ||||||||||||||||
| // expect the first four frames to be the first 4 EtSum objects reported per event (see CMS IN-2013/005) | ||||||||||||||||
|
|
||||||||||||||||
| // Find the central, first and last BXs | ||||||||||||||||
| int firstBX = -(ceil((double)nBX / 2.) - 1); | ||||||||||||||||
|
||||||||||||||||
| int firstBX = -(ceil((double)nBX / 2.) - 1); | |
| int firstBX = (nBX / 2) - nBX + 1; |
Outdated
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 was just checked that nBX is even, so there is no need to cast to double and call ceil.
Just
| lastBX = ceil((double)nBX / 2.); | |
| lastBX = nBX / 2; |
Outdated
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 nBX is odd, so this is equivalent to
| lastBX = ceil((double)nBX / 2.) - 1; | |
| lastBX = nBX / 2; |
Outdated
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.
In fact, this whole block can be simplified to
| int lastBX; | |
| if (nBX % 2 == 0) { | |
| lastBX = ceil((double)nBX / 2.); | |
| } else { | |
| lastBX = ceil((double)nBX / 2.) - 1; | |
| } | |
| int lastBX = nBX / 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 can apply these changes but these lines were copied from the etsumunpacker (https://github.com/matt2275/cmssw/blob/ZDCUnpacker/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EtSumUnpacker.cc#L24).
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 fix the new code in this PR.
A separate PR can be made to fix the other instances.
Outdated
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
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.
Outdated
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'll ask this again here since I asked on the email chain. @elfontan Is there an expected order of these sums at the GT emulator? Do these need to be in a specific order?
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 the EtSums are selected using the sumType Enum (rather than index in the EtSum vector):
https://github.com/cms-sw/cmssw/blob/master/L1Trigger/L1TGlobal/src/EnergySumZdcCondition.cc#L139
https://github.com/cms-sw/cmssw/blob/master/L1Trigger/L1TGlobal/src/EnergySumCondition.cc#L125
Outdated
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..
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||||
| #ifndef L1T_PACKER_STAGE2_ZDCUnpacker_H | ||||||||
| #define L1T_PACKER_STAGE2_ZDCUnpacker_H | ||||||||
|
|
||||||||
| #include "EventFilter/L1TRawToDigi/interface/Unpacker.h" | ||||||||
|
|
||||||||
| namespace l1t { | ||||||||
| namespace stage2 { | ||||||||
| class ZDCUnpacker : public Unpacker { | ||||||||
| public: | ||||||||
| ZDCUnpacker(); | ||||||||
| ~ZDCUnpacker() override{}; | ||||||||
|
||||||||
| ~ZDCUnpacker() override{}; | |
| ~ZDCUnpacker() override = default; | |
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