-
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
Adding ZDC Unpacker to L1RawtoDigi #42733
Changes from all 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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#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" | ||
#include "GTSetup.h" | ||
|
||
namespace l1t { | ||
namespace stage2 { | ||
ZDCUnpacker::ZDCUnpacker() : EtSumZDCCopy_(0) {} | ||
|
||
bool ZDCUnpacker::unpack(const Block& block, UnpackerCollections* coll) { | ||
using namespace l1t::stage2; | ||
uint32_t zdc_mask = 0x3FF; | ||
LogDebug("L1T") << "Block ID = " << block.header().getID() << " size = " << block.header().getSize(); | ||
|
||
int nBX = int(ceil(block.header().getSize() / zdc::nOutputFramePerBX)); | ||
// 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 = (nBX / 2) - nBX + 1; | ||
int lastBX = nBX / 2; | ||
|
||
auto res_ = static_cast<L1TObjectCollections*>(coll)->getZDCSums(EtSumZDCCopy_); | ||
res_->setBXRange(firstBX, lastBX); | ||
|
||
LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX; | ||
|
||
// Loop over multiple BX and fill EtSums collection | ||
for (int bx = firstBX; bx <= lastBX; bx++) { | ||
// ZDC - | ||
int iFrame = (bx - firstBX) * zdc::nOutputFramePerBX; | ||
|
||
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 & zdc_mask); | ||
zdcm.setP4(l1t::CaloTools::p4Demux(&zdcm)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 commentThe 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 commentThe 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 commentThe 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 |
||
|
||
LogDebug("L1T") << "ZDC -: pT " << zdcm.hwPt() << " bx " << bx; | ||
|
||
res_->push_back(bx, zdcm); | ||
|
||
// ZDC + | ||
raw_data = block.payload().at(iFrame + 2); // ZDC + info is found on frame 2 of each bx | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for the silly question; does the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right now this based on the word order given to us by Herbert. Last I checked, the |
||
|
||
l1t::EtSum zdcp{l1t::EtSum::kZDCP}; | ||
zdcp.setHwPt(raw_data & zdc_mask); | ||
zdcp.setP4(l1t::CaloTools::p4Demux(&zdcp)); | ||
|
||
LogDebug("L1T") << "ZDC +: pT " << zdcp.hwPt() << " bx " << bx; | ||
|
||
res_->push_back(bx, zdcp); | ||
} | ||
|
||
return true; | ||
} | ||
} // namespace stage2 | ||
} // namespace l1t | ||
|
||
DEFINE_L1T_UNPACKER(l1t::stage2::ZDCUnpacker); |
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 = default; | ||
|
||
bool unpack(const Block& block, UnpackerCollections* coll) override; | ||
|
||
inline void setEtSumZDCCopy(const unsigned int copy) { EtSumZDCCopy_ = copy; }; | ||
|
||
private: | ||
unsigned int EtSumZDCCopy_; | ||
}; | ||
} // namespace stage2 | ||
} // namespace l1t | ||
|
||
#endif |
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, remove
int(ceil(
, since it doesn't do anything on the result of an integer division.If you need to round the result up, please change it to