Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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]), "EtSumZDC");
event_.put(std::move(jets_[0]), "Jet");
event_.put(std::move(taus_[0]), "Tau");
for (int i = 1; i < 6; ++i) {
event_.put(std::move(muons_[i]), "Muon" + std::to_string(i + 1));
event_.put(std::move(muonShowers_[i]), "MuonShower" + std::to_string(i + 1));
event_.put(std::move(egammas_[i]), "EGamma" + std::to_string(i + 1));
event_.put(std::move(etsums_[i]), "EtSum" + std::to_string(i + 1));
event_.put(std::move(zdcsums_[i]), "EtSumZDC" + std::to_string(i + 1));
event_.put(std::move(jets_[i]), "Jet" + std::to_string(i + 1));
event_.put(std::move(taus_[i]), "Tau" + std::to_string(i + 1));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace l1t {
muonShowers_.begin(), muonShowers_.end(), [] { return std::make_unique<MuonShowerBxCollection>(); });
std::generate(egammas_.begin(), egammas_.end(), [] { return std::make_unique<EGammaBxCollection>(); });
std::generate(etsums_.begin(), etsums_.end(), [] { return std::make_unique<EtSumBxCollection>(); });
std::generate(zdcsums_.begin(), zdcsums_.end(), [] { return std::make_unique<EtSumBxCollection>(); });
std::generate(jets_.begin(), jets_.end(), [] { return std::make_unique<JetBxCollection>(); });
std::generate(taus_.begin(), taus_.end(), [] { return std::make_unique<TauBxCollection>(); });
};
Expand All @@ -36,6 +37,7 @@ namespace l1t {
};
inline EGammaBxCollection* getEGammas(const unsigned int copy) override { return egammas_[copy].get(); };
inline EtSumBxCollection* getEtSums(const unsigned int copy) override { return etsums_[copy].get(); };
inline EtSumBxCollection* getZDCSums(const unsigned int copy) override { return zdcsums_[copy].get(); };
inline JetBxCollection* getJets(const unsigned int copy) override { return jets_[copy].get(); };
inline TauBxCollection* getTaus(const unsigned int copy) override { return taus_[copy].get(); };

Expand All @@ -47,6 +49,7 @@ namespace l1t {
std::array<std::unique_ptr<MuonShowerBxCollection>, 6> muonShowers_;
std::array<std::unique_ptr<EGammaBxCollection>, 6> egammas_;
std::array<std::unique_ptr<EtSumBxCollection>, 6> etsums_;
std::array<std::unique_ptr<EtSumBxCollection>, 6> zdcsums_;
std::array<std::unique_ptr<JetBxCollection>, 6> jets_;
std::array<std::unique_ptr<TauBxCollection>, 6> taus_;

Expand Down
10 changes: 10 additions & 0 deletions EventFilter/L1TRawToDigi/plugins/implementations_stage2/GTSetup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
#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"

#include "GTSetup.h"

const unsigned int l1t::stage2::zdc::nOutputFramePerBX = 6;

namespace l1t {
namespace stage2 {

std::unique_ptr<PackerTokens> GTSetup::registerConsumes(const edm::ParameterSet& cfg, edm::ConsumesCollector& cc) {
return std::unique_ptr<PackerTokens>(new GTTokens(cfg, cc));
}
Expand Down Expand Up @@ -55,6 +59,7 @@ namespace l1t {
prod.produces<MuonShowerBxCollection>("MuonShower");
prod.produces<EGammaBxCollection>("EGamma");
prod.produces<EtSumBxCollection>("EtSum");
prod.produces<EtSumBxCollection>("EtSumZDC");
prod.produces<JetBxCollection>("Jet");
prod.produces<TauBxCollection>("Tau");
prod.produces<GlobalAlgBlkBxCollection>();
Expand All @@ -64,6 +69,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>("EtSumZDC" + std::to_string(i));
prod.produces<JetBxCollection>("Jet" + std::to_string(i));
prod.produces<TauBxCollection>("Tau" + std::to_string(i));
}
Expand All @@ -80,6 +86,7 @@ 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"));

Expand All @@ -97,6 +104,7 @@ namespace l1t {
muon_unp->setMuonCopy(amc - 1);
egamma_unp->setEGammaCopy(amc - 1);
etsum_unp->setEtSumCopy(amc - 1);
zdc_unp->setEtSumZDCCopy(amc - 1);
jet_unp->setJetCopy(amc - 1);
tau_unp->setTauCopy(amc - 1);

Expand Down Expand Up @@ -135,6 +143,8 @@ namespace l1t {
res[45] = alg_unp;
res[47] = alg_unp;
res[49] = alg_unp;

res[142] = zdc_unp;
}

return res;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

namespace l1t {
namespace stage2 {

namespace zdc {
extern const unsigned int nOutputFramePerBX;
} // namespace zdc

class GTSetup : public PackingSetup {
public:
~GTSetup() override{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace l1t {
virtual MuonShowerBxCollection* getMuonShowers(const unsigned int copy) { return nullptr; }
virtual EGammaBxCollection* getEGammas(const unsigned int copy) { return nullptr; } //= 0;
virtual EtSumBxCollection* getEtSums(const unsigned int copy) { return nullptr; }
virtual EtSumBxCollection* getZDCSums(const unsigned int copy) { return nullptr; }
virtual JetBxCollection* getJets(const unsigned int copy) { return nullptr; }
virtual TauBxCollection* getTaus(const unsigned int copy) { return nullptr; }

Expand Down
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));

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

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