97 {
98
99
100 std::map<std::pair<L1CaloRdoFexTob::TobSource,bool>,SG::WriteHandle<xAOD::eFexEMRoIContainer>> eContainers;
101 std::map<std::pair<L1CaloRdoFexTob::TobSource,bool>,SG::WriteHandle<xAOD::eFexTauRoIContainer>> tContainers;
102
103 bool multislice=false;
104
108 }
110 ATH_CHECK(
StatusCode(addContainer<xAOD::eFexTauRoIContainer, xAOD::eFexTauRoIAuxContainer>(
112 }
116 }
118 ATH_CHECK(
StatusCode(addContainer<xAOD::eFexTauRoIContainer,xAOD::eFexTauRoIAuxContainer>(
120 }
124 multislice=true;
125 }
127 ATH_CHECK(
StatusCode(addContainer<xAOD::eFexTauRoIContainer,xAOD::eFexTauRoIAuxContainer>(
129 multislice=true;
130 }
131
132
133 SG::WriteHandle<xAOD::eFexTowerContainer> eTowers;
136 ATH_CHECK( eTowers.
record(std::make_unique<xAOD::eFexTowerContainer>(),std::make_unique<xAOD::eFexTowerAuxContainer>()) );
137 }
138
139 std::list<L1CaloRdoRodInfo> rodInfos;
140 std::list<L1CaloRdoEfexTob> efexTobs;
141 std::list<L1CaloRdoEfexTower> efexTowers;
143 std::map<std::tuple<int,int,int,int,int>,size_t> towerMap;
144 for (
const ROBF* rob : vrobf) {
145
146 ATH_MSG_DEBUG(
"Decoding " << rob->rod_ndata() <<
" ROD words from ROB 0x" << std::hex << rob->rob_source_id() << std::dec);
148
149 if(rob->rod_ndata()==0) continue;
150
152 auto lastRod = rodInfos.end(); lastRod--;
153
154 if ( (rob->rob_source_id() >> 16) == eformat::TDAQ_CALO_FEAT_EXTRACT_DAQ && !
m_eTowerWriteKey.empty() ) {
155
156
157
158 efexTowers.clear();
159 decoder.decodeEfexData(
data.begin(),
data.end(), efexTowers, lastRod );
160 for(auto& t : efexTowers) {
161 if (
t.getLayer() != 0)
continue;
162 towerMap[std::make_tuple(
t.getCrate(),
t.getModule(),
t.getFpgaNumber(),
t.getRegion().getEtaIndex(),
t.getRegion().getPhiIndex())] = eTowers->size();
163 eTowers->push_back( std::make_unique<xAOD::eFexTower>() );
164
166 counts[0] =
t.getSupercells().at(4);
167 for(
size_t idx = 0;
idx<4;
idx++) {
170 }
171 counts[9] =
t.getSupercells().at(9);
172
173 eTowers->back()->initialize(
t.getRegion().getEtaIndex()*0.1 + 0.05,2.*ROOT::Math::Pi()*(0.5 +
t.getRegion().getPhiIndex() - 64*(
t.getRegion().getPhiIndex()>=32))/64,
174 counts,
175 t.getModule() +
t.getCrate()*12,
178 }
179
180 for(auto& t : efexTowers) {
181 if (
t.getLayer() == 0)
continue;
182 size_t idx = eTowers->size();
183 if(auto itr = towerMap.find({t.getCrate(), t.getModule(), t.getFpgaNumber(),t.getRegion().getEtaIndex(),t.getRegion().getPhiIndex()}); itr != towerMap.end()) {
185 } else {
186
187 towerMap[std::make_tuple(
t.getCrate(),
t.getModule(),
t.getFpgaNumber(),
t.getRegion().getEtaIndex(),
t.getRegion().getPhiIndex())] = eTowers->size();
188 eTowers->push_back( std::make_unique<xAOD::eFexTower>() );
189 eTowers->back()->initialize(
t.getRegion().getEtaIndex()*0.1 + 0.05,2.*ROOT::Math::Pi()*(0.5 +
t.getRegion().getPhiIndex() - 64*(
t.getRegion().getPhiIndex()>=32))/64,
191 t.getModule() +
t.getCrate()*12,
t.getFpgaNumber(),0,
t.getFlag());
192 }
193 auto tower = eTowers->at(idx);
194 tower->setHad_status(
t.getFlag());
195 auto et_count = tower->et_count();
196 et_count.at(10) =
t.getValue();
197 tower->setEt_count(et_count);
198 }
199
200
201
202 } else if ( (rob->rob_source_id() >> 16) == eformat::TDAQ_CALO_FEAT_EXTRACT_ROI ) {
203
204 efexTobs.clear();
206
207 for (const L1CaloRdoEfexTob &tob: efexTobs) {
208
209 for (
size_t slice = 0;
slice < tob.numSlices();
slice++) {
210 if (!multislice && int(slice) != tob.getL1aPos())
211 continue;
212 if (tob.getWord0(slice) == 0) continue;
214 auto cont = eContainers.find({tob.getTobSource(),
int(slice) != tob.getL1aPos()});
215 if (cont == eContainers.end()) continue;
216 cont->second->push_back(std::make_unique<xAOD::eFexEMRoI>());
218 cont->second->back()->initialize(tob.getModule(), tob.getCrate(), tob.getWord0(slice));
219 } else {
220 cont->second->back()->initialize(tob.getWord0(slice), tob.getWord1(slice));
221 }
223 auto cont = tContainers.find({tob.getTobSource(),
int(slice) != tob.getL1aPos()});
224 if (cont == tContainers.end()) continue;
225 cont->second->push_back(std::make_unique<xAOD::eFexTauRoI>());
227 cont->second->back()->initialize(tob.getModule(), tob.getCrate(), tob.getWord0(slice));
228 } else {
229 cont->second->back()->initialize(tob.getWord0(slice), tob.getWord1(slice));
230 }
231 }
232 }
233 }
234 }
235 }
236
237 if(msgLevel(MSG::DEBUG)) {
238 std::stringstream
msg;
239 for (auto&[k, v]: eContainers) {
240 msg <<
v->size() <<
" " << (
k.second ?
"out-of-time " :
"in-time ") <<
"eg" <<
242 }
243 for (auto&[k, v]: tContainers) {
244 msg <<
v->size() <<
" " << (
k.second ?
"out-of-time " :
"in-time ") <<
"tau" <<
246 }
250 }
251 }
252
253
254
255
256
257 return StatusCode::SUCCESS;
258}
#define ATH_CHECK
Evaluate an expression and check for errors.
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment ROBF
char data[hepevt_bytes_allocation_ATLAS]
static void decodeRodInfo(const eformat::ROBFragment< const uint32_t * > *rod, std::list< L1CaloRdoRodInfo > &dat)
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
static const int c_missingCountCode
span(T *ptr, std::size_t sz) -> span< T >
A couple needed deduction guides.
::StatusCode StatusCode
StatusCode definition for legacy code.