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 ) {
148 thresholds.push_back(
thresh );
155 for ( ;
it != bpData->end(); ++
it) {
156 int crate = (*it)->crate();
157 int cmx = (*it)->type();
158 std::vector<unsigned int> tobWords = (*it)->TopoTOBs();
161 int index = 2*crate + cmx;
162 bool overflow = (*it)->overflow();
164 (*topoData)[
index]->setOverflow(
true);
165 cpmOverflow[cmx] =
true;
168 for (std::vector<unsigned int>::const_iterator word = tobWords.begin();
169 word != tobWords.end(); ++word) {
172 (*topoData)[
index]->addTOB( (*word) );
176 int ieta = tob.
ieta() - 1;
177 int iphi = tob.
iphi();
178 if (iphi < 0) iphi += 64;
183 for (
const auto&
thresh : thresholds ) {
187 std::optional<uint16_t> isolMask;
188 if (
thresh->className() ==
"L1Threshold_EM") {
192 else if (
thresh->className() ==
"L1Threshold_TAU") {
198 bool isolationPassed =
true;
201 if ( (*isolMask & (1<<bit)) && !(isol & (1<<bit)) ) isolationPassed =
false;
204 int etCut =
thresh->thrValue(ieta)*cpScale;
205 if (
et > etCut && isolationPassed ) {
208 if (crateHits[crate][cmx][
num] < 7) crateHits[crate][cmx][
num]++;
209 if (Hits[cmx][
num] < 7) Hits[cmx][
num]++;
221 for (
int cmx = 0; cmx < 2; ++cmx) {
222 if (cpmOverflow[cmx]) {
223 for (
int i = 0;
i < 16; ++
i) Hits[cmx][
i] = 7;
228 unsigned int cableWord0 = 0;
229 unsigned int cableWord1 = 0;
230 unsigned int cableWord2 = 0;
231 unsigned int cableWord3 = 0;
232 for (
int i = 0;
i < 8; ++
i) {
233 cableWord0 |= ( Hits[0][
i]<<(3*
i) );
234 cableWord1 |= ( Hits[0][
i+8]<<(3*
i) );
235 cableWord2 |= ( Hits[1][
i]<<(3*
i) );
236 cableWord3 |= ( Hits[1][
i+8]<<(3*
i) );
240 ATH_CHECK(emTauCTP.
record(std::make_unique<EmTauCTP>(cableWord0, cableWord1, cableWord2, cableWord3)));
243 std::vector<int> error0;
244 std::vector<int> error1;
247 std::vector<unsigned int> cratehits0;
248 std::vector<unsigned int> cratehits1;
250 const int system_crate = 3;
253 for (
int crate = 0; crate < 4; ++crate) {
254 for (
int cmx = 0; cmx < 2; ++cmx) {
255 cratehits0.assign(1,0);
256 cratehits1.assign(1,0);
257 for (
int i = 0;
i < 8; ++
i) {
258 cratehits0[0] |= ( crateHits[crate][cmx][
i]<<(3*
i) );
259 cratehits1[0] |= ( crateHits[crate][cmx][
i+8]<<(3*
i) );
262 cratehits0, cratehits1, error0, error1, peak);
264 if (crate != system_crate) {
266 cratehits0, cratehits1, error0, error1, peak);
273 cratehits0.assign(1,cableWord0);
274 cratehits1.assign(1,cableWord1);
276 cratehits0, cratehits1, error0, error1, peak);
277 cratehits0.assign(1,cableWord2);
278 cratehits1.assign(1,cableWord3);
280 cratehits0, cratehits1, error0, error1, peak);
285 return StatusCode::SUCCESS ;