Skip to content

Commit 307f456

Browse files
authored
Merge pull request #44222 from aloeliger/CICADA_uGT_Emulator
CICADA-uGT emulator additions
2 parents d52e3a5 + 3d72abe commit 307f456

36 files changed

+605
-11
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ifndef DataFormats_L1Trigger_CICADA_h
2+
#define DataFormats_L1Trigger_CICADA_h
3+
4+
#include "DataFormats/L1Trigger/interface/BXVector.h"
5+
6+
namespace l1t {
7+
typedef BXVector<float> CICADABxCollection;
8+
}
9+
10+
#endif

DataFormats/L1CaloTrigger/src/classes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
#include <vector>
33
#include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
44
#include "DataFormats/Common/interface/Wrapper.h"
5+
#include "DataFormats/L1CaloTrigger/interface/CICADA.h"

DataFormats/L1CaloTrigger/src/classes_def.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@
1313
<class name="std::vector<L1CaloRegion>"/>
1414
<class name="edm::Wrapper<std::vector<L1CaloEmCand>>" splitLevel="0"/>
1515
<class name="edm::Wrapper<std::vector<L1CaloRegion>>" splitLevel="0"/>
16+
17+
<class name="l1t::CICADABxCollection"/>
18+
<class name="edm::Wrapper<l1t::CICADABxCollection>"/>
1619
</lcgdict>

EventFilter/L1TRawToDigi/BuildFile.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<use name="DataFormats/RPCDigi"/>
55
<use name="DataFormats/L1DTTrackFinder"/>
66
<use name="DataFormats/L1TMuon"/>
7+
<use name="DataFormats/L1CaloTrigger"/>
78
<use name="EventFilter/RPCRawToDigi"/>
89
<use name="boost_regex"/>
910
<export>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#include "FWCore/MessageLogger/interface/MessageLogger.h"
2+
#include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h"
3+
4+
#include "CICADAUnpacker.h"
5+
6+
#include <cmath>
7+
8+
using namespace edm;
9+
10+
namespace l1t {
11+
namespace stage2 {
12+
bool CICADAUnpacker::unpack(const Block& block, UnpackerCollections* coll) {
13+
LogDebug("L1T") << "Block Size = " << block.header().getSize();
14+
LogDebug("L1T") << "Board ID = " << block.amc().getBoardID();
15+
16+
auto res = static_cast<CaloLayer1Collections*>(coll)->getCICADABxCollection();
17+
// default BX range to trigger standard -2 to 2
18+
// Even though CICADA will never have BX information
19+
// And everything gets put in BX 0
20+
res->setBXRange(-2, 2);
21+
22+
int amc_slot = block.amc().getAMCNumber();
23+
if (not(amc_slot == 7)) {
24+
throw cms::Exception("CICADAUnpacker")
25+
<< "Calo Summary (CICADA) unpacker is unpacking an unexpected AMC. Expected AMC number 7, got AMC number "
26+
<< amc_slot << std::endl;
27+
return false;
28+
} else {
29+
const uint32_t* base = block.payload().data();
30+
//First 4 bits of the first 4 words are CICADA bits
31+
uint32_t word = (caloCrateCicadaBitsPattern & base[0]) >> 16 | (caloCrateCicadaBitsPattern & base[1]) >> 20 |
32+
(caloCrateCicadaBitsPattern & base[2]) >> 24 | (caloCrateCicadaBitsPattern & base[3]) >> 28;
33+
float score = static_cast<float>(word) / 256.f;
34+
res->push_back(0, score);
35+
return true;
36+
}
37+
}
38+
39+
} // namespace stage2
40+
} // namespace l1t
41+
42+
DEFINE_L1T_UNPACKER(l1t::stage2::CICADAUnpacker);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#ifndef EventFilter_L1TRawToDigi_CICADAUnpacker_h
2+
#define EventFilter_L1TRawToDigi_CICADAUnpacker_h
3+
4+
#include "EventFilter/L1TRawToDigi/interface/Unpacker.h"
5+
#include "CaloLayer1Collections.h"
6+
7+
namespace l1t {
8+
namespace stage2 {
9+
class CICADAUnpacker : public Unpacker {
10+
public:
11+
bool unpack(const Block& block, UnpackerCollections* coll) override;
12+
13+
private:
14+
static constexpr unsigned int caloCrateCicadaBitsPattern = 0xF0000000; //first 4 bits of the words are CICADA
15+
};
16+
} // namespace stage2
17+
} // namespace l1t
18+
19+
#endif

EventFilter/L1TRawToDigi/plugins/implementations_stage2/CaloLayer1Collections.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace l1t {
1212
for (int i = 0; i < 5; ++i) {
1313
event_.put(std::move(ecalDigisBx_[i]), "EcalDigisBx" + std::to_string(i + 1));
1414
}
15+
event_.put(std::move(cicadaDigis_), "CICADAScore");
1516
}
1617
} // namespace stage2
1718
} // namespace l1t

EventFilter/L1TRawToDigi/plugins/implementations_stage2/CaloLayer1Collections.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
77
#include "EventFilter/L1TRawToDigi/interface/UnpackerCollections.h"
88
#include "L1TObjectCollections.h"
9+
#include "DataFormats/L1CaloTrigger/interface/CICADA.h"
910

1011
namespace l1t {
1112
namespace stage2 {
@@ -15,7 +16,8 @@ namespace l1t {
1516
: L1TObjectCollections(e),
1617
ecalDigis_(new EcalTrigPrimDigiCollection()),
1718
hcalDigis_(new HcalTrigPrimDigiCollection()),
18-
caloRegions_(new L1CaloRegionCollection()) {
19+
caloRegions_(new L1CaloRegionCollection()),
20+
cicadaDigis_(std::make_unique<CICADABxCollection>()) {
1921
// Pre-allocate:
2022
// 72 iPhi values
2123
// 28 iEta values in Ecal, 28 + 12 iEta values in Hcal + HF
@@ -37,13 +39,15 @@ namespace l1t {
3739
inline EcalTrigPrimDigiCollection* getEcalDigisBx(const unsigned int copy) override {
3840
return ecalDigisBx_[copy].get();
3941
};
42+
inline CICADABxCollection* getCICADABxCollection() { return cicadaDigis_.get(); };
4043

4144
private:
4245
std::unique_ptr<EcalTrigPrimDigiCollection> ecalDigis_;
4346
std::unique_ptr<HcalTrigPrimDigiCollection> hcalDigis_;
4447
std::unique_ptr<L1CaloRegionCollection> caloRegions_;
4548

4649
std::array<std::unique_ptr<EcalTrigPrimDigiCollection>, 5> ecalDigisBx_;
50+
std::unique_ptr<CICADABxCollection> cicadaDigis_;
4751
};
4852
} // namespace stage2
4953
} // namespace l1t

EventFilter/L1TRawToDigi/plugins/implementations_stage2/CaloLayer1Setup.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#include "CaloLayer1Setup.h"
88

9+
#include "DataFormats/L1CaloTrigger/interface/CICADA.h"
10+
911
namespace l1t {
1012
namespace stage2 {
1113
std::unique_ptr<PackerTokens> CaloLayer1Setup::registerConsumes(const edm::ParameterSet& cfg,
@@ -58,6 +60,7 @@ namespace l1t {
5860
for (int i = 0; i < 5; ++i) {
5961
prod.produces<EcalTrigPrimDigiCollection>("EcalDigisBx" + std::to_string(i + 1));
6062
}
63+
prod.produces<CICADABxCollection>("CICADAScore");
6164
}
6265

6366
std::unique_ptr<UnpackerCollections> CaloLayer1Setup::getCollections(edm::Event& e) {
@@ -72,6 +75,9 @@ namespace l1t {
7275
if (board < 18) {
7376
res[0] = UnpackerFactory::get()->make("stage2::CaloLayer1Unpacker");
7477
}
78+
if (fed == 1356 && amc == 7) { //calo summary board
79+
res[0] = UnpackerFactory::get()->make("stage2::CICADAUnpacker");
80+
}
7581
}
7682

7783
return res;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "FWCore/Framework/interface/Event.h"
2+
3+
#include "CaloSummaryCollections.h"
4+
5+
namespace l1t {
6+
namespace stage2 {
7+
CaloSummaryCollections::~CaloSummaryCollections() { event_.put(std::move(cicadaDigis_)); }
8+
} // namespace stage2
9+
} // namespace l1t

0 commit comments

Comments
 (0)