22 const std::vector<std::string>& filenames)
24 TChain chain(tree_name.data());
25 for (
const auto&
filename : filenames)
29 chain.SetBranchAddress(
"event", &
event.event);
30 chain.SetBranchAddress(
"chip", &
event.chip);
31 chain.SetBranchAddress(
"half", &
event.half);
32 chain.SetBranchAddress(
"daqdata", &
event.daqdata);
33 chain.SetBranchAddress(
"bxcounter", &
event.bxcounter);
34 chain.SetBranchAddress(
"eventcounter", &
event.eventcounter);
35 chain.SetBranchAddress(
"orbitcounter", &
event.orbitcounter);
36 chain.SetBranchAddress(
"trigtime", &
event.trigtime);
37 chain.SetBranchAddress(
"trigwidth", &
event.trigwidth);
39 for (
long long i = 0;
i < chain.GetEntries(); ++
i) {
43 EventId key{(uint32_t)
event.eventcounter, (uint32_t)
event.bxcounter, (uint32_t)
event.orbitcounter};
48 ERxId_t erxKey{(uint8_t)
event.chip, (uint8_t)
event.half};
53 if (
const auto nwords =
event.daqdata->size(); nwords != 41)
55 <<
"Invalid number of words retrieved for event {" <<
event.eventcounter <<
":" <<
event.bxcounter <<
":" 56 <<
event.orbitcounter <<
"}: should be 41, got " << nwords <<
".";
61 const uint32_t cmword(
event.daqdata->at(1));
62 if (((cmword >> 20) & 0xfff) != 0)
64 <<
"Consistency check failed for common mode word: " << ((cmword >> 20) & 0xfff) <<
" != 0.";
66 data_[
key][erxKey].cm1 = cmword & 0x3ff;
67 data_[
key][erxKey].cm0 = (cmword >> 10) & 0x3ff;
73 data_[
key][erxKey].tctp.push_back(tctp);
81 data_[
key][erxKey].crc32 =
event.daqdata->at(39);
98 throw cms::Exception(
"HGCalModuleTreeReader") <<
"Insufficient number of events were retrieved from input tree to " 99 "proceed with the generation of emulated events.";
std::pair< uint8_t, uint8_t > ERxId_t
chip/half
std::map< ERxId_t, ERxData > ERxInput
eRx data maps
ECONDInputColl::const_iterator it_data_
const unsigned int num_channels_per_erx
Pure virtual base class for a ECON-D event emulator implementation.
ECONDInput next() override
Fetch the next ECON-D event.
const EmulatorParameters params_
std::pair< EventId, ERxInput > ECONDInput
ECON-D inputs for a given event.
Log< level::Info, false > LogInfo
std::tuple< uint32_t, uint32_t, uint32_t > EventId
Event index (L1A/BX/orbit)
wrapper for a 32b data word from a single channel and its detid The format is always the same: |1b|1b...
HGCalModuleTreeReader(const EmulatorParameters &, const std::string &tree_name, const std::vector< std::string > &filenames)