55 (
const std::string&
name, ISvcLocator* pSvcLocator )
72 return StatusCode::SUCCESS;
109 std::vector< std::vector< std::vector<int> > > crateHits;
110 std::vector< std::vector<int> > Hits;
117 for (
int crate = 0; crate < 4; ++crate) {
118 crateHits[crate].resize(2);
119 for (
int cmx = 0; cmx < 2; ++cmx) {
120 crateHits[crate][cmx].resize(16);
128 for (
int crate = 0; crate < 4; ++crate) {
129 for (
int cmx = 0; cmx < 2; ++cmx) {
131 topoData->push_back(link);
136 bool cpmOverflow[2] = {
false,
false};
142 float cpScale = l1Menu->thrExtraInfo().EM().emScale();
143 std::vector<std::shared_ptr<TrigConf::L1Threshold>> allThresholds = l1Menu->thresholds();
144 std::vector<std::shared_ptr<TrigConf::L1Threshold>> thresholds;
145 for (
const auto&
thresh : allThresholds ) {
146 if (
thresh->type() == L1DataDef::emType() ||
thresh->type() == L1DataDef::tauType() )
147 thresholds.push_back(
thresh );
154 for ( ;
it != bpData->end(); ++
it) {
155 int crate = (*it)->crate();
156 int cmx = (*it)->type();
157 std::vector<unsigned int> tobWords = (*it)->TopoTOBs();
160 int index = 2*crate + cmx;
161 bool overflow = (*it)->overflow();
163 (*topoData)[
index]->setOverflow(
true);
164 cpmOverflow[cmx] =
true;
167 for (std::vector<unsigned int>::const_iterator word = tobWords.begin();
168 word != tobWords.end(); ++word) {
171 (*topoData)[
index]->addTOB( (*word) );
175 int ieta = tob.
ieta() - 1;
176 int iphi = tob.
iphi();
177 if (iphi < 0) iphi += 64;
182 for (
const auto&
thresh : thresholds ) {
186 std::optional<uint16_t> isolMask;
187 if (
thresh->className() ==
"L1Threshold_EM") {
191 else if (
thresh->className() ==
"L1Threshold_TAU") {
197 bool isolationPassed =
true;
200 if ( (*isolMask & (1<<bit)) && !(isol & (1<<bit)) ) isolationPassed =
false;
203 int etCut =
thresh->thrValue(ieta)*cpScale;
204 if (
et > etCut && isolationPassed ) {
207 if (crateHits[crate][cmx][
num] < 7) crateHits[crate][cmx][
num]++;
208 if (Hits[cmx][
num] < 7) Hits[cmx][
num]++;
220 for (
int cmx = 0; cmx < 2; ++cmx) {
221 if (cpmOverflow[cmx]) {
222 for (
int i = 0;
i < 16; ++
i) Hits[cmx][
i] = 7;
227 unsigned int cableWord0 = 0;
228 unsigned int cableWord1 = 0;
229 unsigned int cableWord2 = 0;
230 unsigned int cableWord3 = 0;
231 for (
int i = 0;
i < 8; ++
i) {
232 cableWord0 |= ( Hits[0][
i]<<(3*
i) );
233 cableWord1 |= ( Hits[0][
i+8]<<(3*
i) );
234 cableWord2 |= ( Hits[1][
i]<<(3*
i) );
235 cableWord3 |= ( Hits[1][
i+8]<<(3*
i) );
239 ATH_CHECK(emTauCTP.
record(std::make_unique<EmTauCTP>(cableWord0, cableWord1, cableWord2, cableWord3)));
242 std::vector<int> error0;
243 std::vector<int> error1;
246 std::vector<unsigned int> cratehits0;
247 std::vector<unsigned int> cratehits1;
249 const int system_crate = 3;
252 for (
int crate = 0; crate < 4; ++crate) {
253 for (
int cmx = 0; cmx < 2; ++cmx) {
254 cratehits0.assign(1,0);
255 cratehits1.assign(1,0);
256 for (
int i = 0;
i < 8; ++
i) {
257 cratehits0[0] |= ( crateHits[crate][cmx][
i]<<(3*
i) );
258 cratehits1[0] |= ( crateHits[crate][cmx][
i+8]<<(3*
i) );
261 cratehits0, cratehits1, error0, error1, peak);
263 if (crate != system_crate) {
265 cratehits0, cratehits1, error0, error1, peak);
272 cratehits0.assign(1,cableWord0);
273 cratehits1.assign(1,cableWord1);
275 cratehits0, cratehits1, error0, error1, peak);
276 cratehits0.assign(1,cableWord2);
277 cratehits1.assign(1,cableWord3);
279 cratehits0, cratehits1, error0, error1, peak);
284 return StatusCode::SUCCESS ;