Skip to content

CICADA-Calo Layer 1 Packer #45863

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
@@ -0,0 +1,41 @@
#include "FWCore/Framework/interface/Event.h"
#include "EventFilter/L1TRawToDigi/plugins/PackerFactory.h"

#include "CaloLayer1Tokens.h"

#include "CICADAPacker.h"

namespace l1t {
namespace stage2 {
std::vector<uint32_t> CICADAPacker::makeCICADAWordsFromScore(float score) {
//turn the score into an integer to make it a bit easier to work with it bitwise
uint32_t cicadaBits = static_cast<uint32_t>(score * 256.f);
uint32_t firstWord = (cicadaBits & 0xF000) << 16;
uint32_t secondWord = (cicadaBits & 0x0F00) << 20;
uint32_t thirdWord = (cicadaBits & 0x00F0) << 24;
uint32_t fourthWord = (cicadaBits & 0x000F) << 28;
return {firstWord, secondWord, thirdWord, fourthWord};
}

Blocks CICADAPacker::pack(const edm::Event& event, const PackerTokens* toks) {
edm::Handle<CICADABxCollection> cicadaScores;
event.getByToken(static_cast<const CaloLayer1Tokens*>(toks)->getCICADAToken(), cicadaScores);

std::vector<uint32_t> payload;

//for the purposes of this packer, we really only have to care about the central BX
//Calo Layer 1 doesn't distinguish between BX's, it just sends the one.
float cicadaScore = 0.0;
if (cicadaScores->size(0) != 0) {
cicadaScore = cicadaScores->at(0, 0);
}
payload = makeCICADAWordsFromScore(cicadaScore);
payload.push_back(0);
payload.push_back(0);

return {Block(0, payload, 0, 0, CTP7)};
}
} // namespace stage2
} // namespace l1t

DEFINE_L1T_PACKER(l1t::stage2::CICADAPacker);
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef L1T_PACKER_STAGE2_CICADAPACKER_H
#define L1T_PACKER_STAGE2_CICADAPACKER_H

#include "EventFilter/L1TRawToDigi/interface/Packer.h"
#include "CaloLayer1Tokens.h"

namespace l1t {
namespace stage2 {
class CICADAPacker : public Packer {
public:
Blocks pack(const edm::Event&, const PackerTokens*) override;

private:
std::vector<uint32_t> makeCICADAWordsFromScore(float);
};
} // namespace stage2
} // namespace l1t

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace l1t {
desc.addOptional<edm::InputTag>("ecalDigis");
desc.addOptional<edm::InputTag>("hcalDigis");
desc.addOptional<edm::InputTag>("caloRegions");
desc.addOptional<edm::InputTag>("CICADAScore");
}

PackerMap CaloLayer1Setup::getPackers(int fed, unsigned int fw) {
Expand All @@ -37,6 +38,8 @@ namespace l1t {
res[{2, 15}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
res[{3, 16}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
res[{5, 17}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
// CICADA board
res[{7, 0}] = {PackerFactory::get()->make("stage2::CICADAPacker")};
res[{8, 0}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
res[{9, 1}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
res[{11, 2}] = {PackerFactory::get()->make("stage2::CaloLayer1Packer")};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ namespace l1t {
auto ecalTag = cfg.getParameter<edm::InputTag>("ecalDigis");
auto hcalTag = cfg.getParameter<edm::InputTag>("hcalDigis");
auto regionTag = cfg.getParameter<edm::InputTag>("caloRegions");
auto cicadaTag = cfg.getParameter<edm::InputTag>("CICADAScore");

ecalDigiToken_ = cc.consumes<EcalTrigPrimDigiCollection>(ecalTag);
hcalDigiToken_ = cc.consumes<HcalTrigPrimDigiCollection>(hcalTag);
caloRegionToken_ = cc.consumes<L1CaloRegionCollection>(regionTag);
cicadaToken_ = cc.consumes<CICADABxCollection>(cicadaTag);
}
} // namespace stage2
} // namespace l1t
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "EventFilter/L1TRawToDigi/interface/PackerTokens.h"
#include "DataFormats/L1CaloTrigger/interface/CICADA.h"

namespace l1t {
namespace stage2 {
Expand All @@ -16,11 +17,13 @@ namespace l1t {
inline const edm::EDGetTokenT<EcalTrigPrimDigiCollection>& getEcalDigiToken() const { return ecalDigiToken_; };
inline const edm::EDGetTokenT<HcalTrigPrimDigiCollection>& getHcalDigiToken() const { return hcalDigiToken_; };
inline const edm::EDGetTokenT<L1CaloRegionCollection>& getCaloRegionToken() const { return caloRegionToken_; };
inline const edm::EDGetTokenT<CICADABxCollection>& getCICADAToken() const { return cicadaToken_; };

private:
edm::EDGetTokenT<EcalTrigPrimDigiCollection> ecalDigiToken_;
edm::EDGetTokenT<HcalTrigPrimDigiCollection> hcalDigiToken_;
edm::EDGetTokenT<L1CaloRegionCollection> caloRegionToken_;
edm::EDGetTokenT<CICADABxCollection> cicadaToken_;
};
} // namespace stage2
} // namespace l1t
Expand Down
1 change: 1 addition & 0 deletions EventFilter/L1TRawToDigi/python/caloLayer1Raw_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
ecalDigis = cms.InputTag("simEcalTriggerPrimitiveDigis"),
hcalDigis = cms.InputTag("simHcalTriggerPrimitiveDigis"),
caloRegions = cms.InputTag("simCaloStage2Layer1Digis"),
CICADAScore = cms.InputTag("simCaloStage2Layer1Summary", "CICADAScore"),
FedId = cms.int32(1354),
FWId = cms.uint32(0x12345678),
lenSlinkHeader = cms.untracked.int32(8),
Expand Down