ATLAS Offline Software
L1TriggerTowerToolRun3.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
5 // L1TriggerTowerToolRun3.cxx
8 #include "GaudiKernel/Incident.h"
9 #include "GaudiKernel/IIncidentSvc.h"
10 #include "GaudiKernel/GaudiException.h"
11 
15 
21 
22 #include "StoreGate/ReadHandle.h"
23 #include "GaudiKernel/ThreadLocalContext.h"
24 
25 #include <cstdint>
26 #include <tuple>
27 #include <boost/range/adaptor/reversed.hpp>
28 using namespace boost::adaptors;
29 
30 namespace LVL1
31 {
32 
33 //================ Static Constants ============================================
34 
35 const int L1TriggerTowerToolRun3::s_saturationValue;
36 const int L1TriggerTowerToolRun3::s_maxTowers;
37 
38 //================ Constructor =================================================
39 
40 L1TriggerTowerToolRun3::L1TriggerTowerToolRun3(const std::string& t,
41  const std::string& n,
42  const IInterface* p )
43  :
44  AthAlgTool(t,n,p),
45  m_caloMgr(0),
46  m_lvl1Helper(0),
47  m_l1CaloTTIdTools("LVL1::L1CaloTTIdTools/L1CaloTTIdTools", this),
48  m_ttSvc("CaloTriggerTowerService/CaloTriggerTowerService", this),
49  m_mappingTool("", this),
50  m_correctFir(false),
51  m_dynamicPedestalProvider("", this)
52 {
53  declareInterface<IL1TriggerTowerToolRun3>(this);
54 
55  declareProperty( "BaselineCorrection", m_correctFir );
56  declareProperty( "L1DynamicPedestalProvider", m_dynamicPedestalProvider );
57 }
58 
59 //================ Destructor =================================================
60 
62 
63 //================ Initialisation =================================================
64 
66 {
67 
68  // Reading the Condition Containers Run 3 style
73 
74  ATH_CHECK(m_l1CaloTTIdTools.retrieve());
75 
76  if(!m_ttSvc.retrieve().isSuccess()) {
77  ATH_MSG_WARNING( "Could not retrieve CaloTriggerTowerService Tool" );
78  } else {
79  ATH_MSG_INFO("Retrieved Tool " << m_ttSvc);
80  }
81 
82  StatusCode scID = detStore()->retrieve(m_caloMgr);
83  if (scID.isFailure()) {
84  ATH_MSG_WARNING( "Cannot retrieve m_caloMgr" );
85  } else {
87  }
88 
89  if (!m_mappingTool.empty()) {
90  ATH_CHECK( m_mappingTool.retrieve() );
91  }
92 
93  // Incident Service:
94  SmartIF<IIncidentSvc> incSvc{service("IncidentSvc")};
95  ATH_CHECK( incSvc.isValid() );
96  incSvc->addListener(this, "BeginRun");
97 
98  // Pedestal Correction
99  if (m_correctFir) {
101  ATH_MSG_INFO( "Retrieved L1DynamicPedestalProvider: " << m_dynamicPedestalProvider );
102  }
103 
105 
107 
108 
109 
110 
111  ATH_MSG_INFO( "Initialization completed" );
112 
113  return StatusCode::SUCCESS;
114 }
115 
116 //================ Finalisation =================================================
117 
119 {
120  return StatusCode::SUCCESS;
121 }
122 
123 //================ Reset mapping table at start of run ============================
124 
125 void L1TriggerTowerToolRun3::handle(const Incident& inc)
126 {
127  if (inc.type()=="BeginRun") {
128  ATH_MSG_DEBUG( "Resetting mapping table at start of run" );
129 
130  m_idTable.clear();
131  }
132 }
133 
134 
135 
138 void L1TriggerTowerToolRun3::process(const std::vector<int> &digits, double eta, double phi, int layer,
139  std::vector<int> &et, std::vector<int> &bcidResults,
140  std::vector<int> &bcidDecisions, bool useJepLut /* = true */)
141 {
143  L1CaloCoolChannelId id = channelID(eta, phi, layer);
144 
146  process(digits, id, et, bcidResults, bcidDecisions, useJepLut);
147 }
148 
149 
152 void L1TriggerTowerToolRun3::process(const std::vector<int> &digits, const L1CaloCoolChannelId& channelId,
153  std::vector<int> &et, std::vector<int> &bcidResults,
154  std::vector<int> &bcidDecisions, bool useJepLut /* = true */)
155 {
156 
157  ATH_MSG_DEBUG( "::process: ==== Entered Process ====" );
158  ATH_MSG_DEBUG( "::process: digits: " << digits);
159  ATH_MSG_DEBUG( " channelID: " << MSG::hex << channelId.id() << MSG::dec );
160 
161 
163  et.clear();
164  bcidResults.clear();
165  bcidDecisions.clear();
166 
167  ATH_MSG_DEBUG( "::process: ---- FIR filter ----" );
168 
170  std::vector<int> filter;
171  fir(digits, channelId, filter);
172  std::vector<int> lutInput;
173  dropBits(filter, channelId, lutInput);
174 
175  ATH_MSG_DEBUG( "::process: ---- BCID algorithms ----" );
176 
178  bcid(filter, digits, channelId, bcidResults);
179 
180  ATH_MSG_DEBUG( "::process: ---- BCID decisions ----" );
181 
183  std::vector<int> decisionRange;
184  bcidDecisionRange(lutInput, digits, channelId, decisionRange);
185  bcidDecision(bcidResults, decisionRange, bcidDecisions);
186 
187  ATH_MSG_DEBUG( "::process: ---- LUT ET calculation ----" );
188 
190  std::vector<int> lutOutput;
191  if(useJepLut) jepLut(lutInput, channelId, lutOutput);
192  else cpLut(lutInput, channelId, lutOutput);
193 
194 
195  ATH_MSG_DEBUG( "::process: ---- use ET range ----" );
196 
199  applyEtRange(lutOutput, decisionRange, channelId, et);
200 
201  ATH_MSG_DEBUG( "::process: ==== Leaving Process ====" );
202 }
203 
204 namespace {
205 // helper function to convert vectors of different type
206 template <typename DST, typename SRC>
207 std::vector<DST> convertVectorType(const std::vector<SRC>& s) {
208  std::vector<DST> d(s.size());
210  [](SRC v){return static_cast<DST>(v);});
211  return d;
212 }
213 }
214 
216 void L1TriggerTowerToolRun3::simulateChannel(const xAOD::TriggerTower& tt, std::vector<int>& outCpLut, std::vector<int>& outJepLut, std::vector<int>& bcidResults, std::vector<int>& bcidDecisions) const {
217 
218  //If we have 80 MHz readout, we need to extract the 40 MHz samples. The central 80 MHz sample is always a 40 MHz sample. We use the cool database (runParameters folder) to understand if we are in 80MHz readout
219 
221  unsigned int readoutConfigID = runParameters->runParameters(1)->readoutConfigID();
222  ATH_MSG_DEBUG("RunParameters:: readoutConfigID " << readoutConfigID);
223 
224  std::vector<uint16_t> digits40;
225 
226  if(readoutConfigID == 5 or readoutConfigID == 6){
227 
228 
229  ATH_MSG_DEBUG("::simulateChannel: 80 MHz readout detected, emulating 40 MHz samples");
230 
231  int nSlices = tt.adc().size();
232 
233  if((nSlices%4)==3){
234  for (int i=0 ; i < (nSlices-1)/2 ; i++ ){
235  digits40.push_back(tt.adc().at(2*i+1));
236  }
237  }
238  else if((nSlices%4)==1){
239  for (int i=0 ; i <= (nSlices-1)/2 ; i++){
240  digits40.push_back(tt.adc().at(2*i));
241  }
242  }
243 
244 
245  }else{
246  ATH_MSG_DEBUG("::simulateChannel: 40 MHz readout detected");
247  digits40 = tt.adc();
248  }
249 
250  const auto& digits = convertVectorType<int>(digits40);
251 
252  L1CaloCoolChannelId channelId {tt.coolId()};
253 
254  ATH_MSG_DEBUG( "::simulateChannel: ==== Entered Process ====" );
255  ATH_MSG_DEBUG( "::simulateChannel: digits: " << digits );
256  ATH_MSG_DEBUG( "::simulateChannel: channelID: " << MSG::hex << channelId.id() << MSG::dec );
257 
258 
260  outCpLut.clear();
261  outJepLut.clear();
262  bcidResults.clear();
263  bcidDecisions.clear();
264 
266  ATH_MSG_DEBUG( "::simulateChannel: ---- FIR filter ----" );
267  std::vector<int> filter;
268  fir(digits, channelId, filter);
269 
270 
272  ATH_MSG_DEBUG( "::simulateChannel: ---- pedestalCorrection ----" );
273  // the correction is only available for each LUT slice in the read-out (not ADC/Filter slice)
274  // therefore we can only apply it to the #LUT central filter slices
275  const std::size_t nCorr = tt.correctionEnabled().size();
276  const std::size_t filterOffset = filter.size()/2 - nCorr/2;
277  for(std::size_t iCorr = 0; iCorr < nCorr; ++iCorr) {
278  filter[filterOffset + iCorr] -= tt.correction()[iCorr] * tt.correctionEnabled()[iCorr];
279  }
280 
281  ATH_MSG_DEBUG("::simulateChannel: filter: " << filter);
282 
283 
284  std::vector<int> lutInput;
285  dropBits(filter, channelId, lutInput);
286 
287  ATH_MSG_DEBUG( "::simulateChannel: ---- BCID algorithms ---- ");
288 
290  bcid(filter, digits, channelId, bcidResults);
291 
292 
294  std::vector<int> decisionRange;
295  bcidDecisionRange(lutInput, digits, channelId, decisionRange);
296  bcidDecision(bcidResults, decisionRange, bcidDecisions);
297 
298  ATH_MSG_DEBUG( "::simulateChannel: bcidDecisionRange " << decisionRange);
299  ATH_MSG_DEBUG( "::simulateChannel: bcidDecisions " << bcidDecisions);
300 
301 
302 
303  ATH_MSG_DEBUG( "::simulateChannel: ---- LUT ET calculation ----" );
304 
306  std::vector<int> cpLutOutput, jepLutOutput;
307  cpLut(lutInput, channelId, cpLutOutput);
308  jepLut(lutInput, channelId, jepLutOutput);
309 
310  ATH_MSG_DEBUG( "::simulateChannel: cpLut " << cpLutOutput);
311  ATH_MSG_DEBUG( "::simulateChannel: jepLut " << jepLutOutput);
312 
313  ATH_MSG_DEBUG( "::simulateChannel: ---- use ET range ----" );
314 
317  applyEtRange(cpLutOutput, decisionRange, channelId, outCpLut);
318  applyEtRange(jepLutOutput, decisionRange, channelId, outJepLut);
319 
320  ATH_MSG_DEBUG( "::simulateChannel: cpLut applyETRange " << outCpLut);
321  ATH_MSG_DEBUG( "::simulateChannel: jepLut applyETRange " << outJepLut);
322 
323 
324  ATH_MSG_DEBUG( "::simulateChannel: ==== Leaving Process ====" );
325 }
326 
330 void L1TriggerTowerToolRun3::bcid(const std::vector<int> &filter, const std::vector<int> &digits, const L1CaloCoolChannelId& channelId, std::vector<int> &output) const
331 {
332  // Get decision flags for the 2 BCID algorithms
333  std::vector<int> peak;
334  peakBcid(filter, channelId, peak);
335  std::vector<int> sat;
336  satBcid(digits, channelId, sat);
337 
338  output.clear();
339  output.reserve(sat.size()); // avoid frequent reallocations
340 
341  std::vector<int>::iterator itpeak = peak.begin();
342  std::vector<int>::iterator itsat = sat.begin();
343  for ( ; itpeak!=peak.end() && itsat!=sat.end(); ++itpeak, ++itsat ) {
344  output.push_back( (*itpeak<<2) + (*itsat<<1) );
345  }
346 
347  ATH_MSG_DEBUG( "::bcid: bcidResults: " << output);
348 
349 }
350 
354 void L1TriggerTowerToolRun3::bcid(const std::vector<int> &filter, const std::vector<int> &digits,
355  unsigned int strategy, int satLow, int satHigh, int satLevel, std::vector<int> &output) const
356 {
357  // Get decision flags for the 2 BCID algorithms
358  std::vector<int> peak;
359  peakBcid(filter, strategy, peak);
360  std::vector<int> sat;
361  satBcid(digits, satLow, satHigh, satLevel, sat);
362 
363  output.clear();
364  output.reserve(sat.size()); // avoid frequent reallocations
365 
366  std::vector<int>::iterator itpeak = peak.begin();
367  std::vector<int>::iterator itsat = sat.begin();
368  for ( ; itpeak!=peak.end() && itsat!=sat.end(); ++itpeak, ++itsat ) {
369  output.push_back( (*itpeak<<2) + (*itsat<<1) );
370  }
371 
372  ATH_MSG_DEBUG( "::bcid: bcidResults: " << output);
373 }
374 
378 void L1TriggerTowerToolRun3::bcid(const std::vector<int> &filter, const std::vector<int> &lutInput, const std::vector<int> &digits, int energyLow, int energyHigh, int decisionSource, std::vector<unsigned int> &decisionConditions,
379  unsigned int strategy, int satLow, int satHigh, int satLevel, std::vector<int> &result, std::vector<int> &decision) const
380 {
381  // Get decision flags for the 2 BCID algorithms
382  std::vector<int> peak;
383  peakBcid(filter, strategy, peak);
384  std::vector<int> sat;
385  satBcid(digits, satLow, satHigh, satLevel, sat);
386 
387  result.clear();
388  result.reserve(sat.size()); // avoid frequent reallocations
389  decision.clear();
390 
391  std::vector<int>::iterator itpeak = peak.begin();
392  std::vector<int>::iterator itsat = sat.begin();
393  for ( ; itpeak!=peak.end() && itsat!=sat.end(); ++itpeak, ++itsat ) {
394  result.push_back( (*itpeak<<2) + (*itsat<<1) );
395  }
396 
397  ATH_MSG_DEBUG( "::bcid: bcidResults: " << result);
398 
399 
400 
402  std::vector<int> decisionRange;
403  if (!(decisionSource&0x1)) etRange(digits, energyLow, energyHigh, decisionRange);
404  else etRange(lutInput, energyLow, energyHigh, decisionRange);
405  bcidDecision(result, decisionRange, decisionConditions, decision);
406  ATH_MSG_DEBUG( "::bcid: bcidDecisions: " << decision);
407 
408 }
409 
410 namespace { // helper function
411  template<class T>
412  const std::vector<short int>* getFirCoefficients(unsigned int coolId, SG::ReadCondHandle<L1CaloPprConditionsContainerRun2> pprConditionsRun2) {
413  auto settings = pprConditionsRun2->pprConditions(coolId);
414  if(!settings) return nullptr;
415  return &(settings->firCoefficients());
416  }
417 } // anonymous namespace
418 
422 void L1TriggerTowerToolRun3::fir(const std::vector<int> &digits, const L1CaloCoolChannelId& channelId, std::vector<int> &output) const
423 {
424 
426 
428  std::vector<int> firCoeffs;
430  const std::vector<short int>* hwCoeffs;
431  hwCoeffs = getFirCoefficients<L1CaloPprConditionsContainerRun2>(channelId.id(), pprConditionsRun2);
432  if(hwCoeffs) {
436  firCoeffs.reserve(hwCoeffs->size()); // avoid frequent reallocations
437  for (auto &i : reverse(*hwCoeffs)) {
438  firCoeffs.push_back(i);
439  }
440  } else ATH_MSG_WARNING( "::fir: No L1CaloPprConditions found" );
441  } else ATH_MSG_WARNING( "::fir: No Conditions Container retrieved" );
442 
443  ATH_MSG_DEBUG( "::fir: FIR coefficients: " << firCoeffs);
444 
445 
446  fir(digits, firCoeffs, output);
447 }
448 
453 void L1TriggerTowerToolRun3::fir(const std::vector<int> &digits, const std::vector<int> &firCoeffs, std::vector<int> &output) const
454 {
455  output.clear();
456  output.reserve(digits.size()); // avoid frequent reallocations
459  int firstFIR = -1;
460  int lastFIR = 0;
461  for (unsigned int i = 0; i < firCoeffs.size(); ++i) {
462  if (firstFIR < 0 && firCoeffs[i] != 0) firstFIR = i;
463  if (firCoeffs[i] != 0) lastFIR = i;
464  }
465  if (firstFIR < 0) firstFIR = lastFIR + 1;
466 
467  for (int i = 0; i < (int)digits.size(); i++) {
468  int sum = 0;
470  if (i >= 2-firstFIR && i < (int)digits.size()+2-lastFIR) {
471  for (int j = firstFIR; j <= lastFIR; ++j) {
472  sum += digits[i+j-2]*firCoeffs[j];
473  }
474  }
475  if (sum < 0) sum = 0;
476  output.push_back(sum);
477  }
478 
479  ATH_MSG_DEBUG( "::fir: output: " << output);
480 
481 }
482 
483 namespace {
484  template<typename T>
485  unsigned int getStrategy( SG::ReadCondHandle<L1CaloPprConditionsContainerRun2> pprConditionsRun2) {
486  return pprConditionsRun2->peakFinderCond();
487  }
488 }
489 
491 void L1TriggerTowerToolRun3::peakBcid(const std::vector<int> &fir, const L1CaloCoolChannelId& /*channelId*/, std::vector<int> &output) const
492 {
493  unsigned int strategy = 0;
495 
496 
498  strategy = getStrategy<L1CaloPprConditionsContainerRun2>( pprConditionsRun2);
499  } else ATH_MSG_WARNING( "::peakBcid: No Conditions Container retrieved" );
500 
501  ATH_MSG_DEBUG( "::peakBcid: peak-finder strategy: " << strategy );
502 
504 }
505 
507 void L1TriggerTowerToolRun3::peakBcid(const std::vector<int> &fir, unsigned int strategy, std::vector<int> &output) const
508 {
509  output.clear();
510  output.reserve(fir.size()); // avoid frequent reallocations
511 
512  for (unsigned int i = 0; i < fir.size(); i++) {
513  int result = 0;
515  if (i > 0 && i < fir.size()-1) {
517  if (strategy&0x1) {
518  if ( (fir[i-1]<fir[i]) && (fir[i+1]<fir[i]) ) result = 1;
519  } else {
520  if ( (fir[i-1]<fir[i]) && (fir[i+1]<=fir[i]) ) result = 1;
521  }
522  }
523  output.push_back(result);
524  }
525 
526  ATH_MSG_DEBUG( "::peakBcid: output: " << output);
527 
528 
529 }
530 
531 namespace { // helper function
532  template<class T>
533  std::tuple<bool, int, int, int> getSaturation(unsigned int coolId, SG::ReadCondHandle<L1CaloPprConditionsContainerRun2> pprConditionsRun2) {
534  auto settings = pprConditionsRun2->pprConditions(coolId);
535  if(!settings) return std::make_tuple(false, 0, 0, 0);
536  return std::make_tuple(true, settings->satBcidLevel(), settings->satBcidThreshLow(),
537  settings->satBcidThreshHigh());
538  }
539 } // anonymous namespace
540 
542 void L1TriggerTowerToolRun3::satBcid(const std::vector<int> &digits, const L1CaloCoolChannelId& channelId, std::vector<int> &output) const
543 {
544  int satLevel = 0;
545  int satLow = 0;
546  int satHigh = 0;
548 
550  bool available = false;
551  std::tie(available, satLevel, satLow, satHigh) = getSaturation<L1CaloPprConditionsContainerRun2>(channelId.id(), pprConditionsRun2);
552  if(!available) ATH_MSG_WARNING( "::satBcid: No L1CaloPprConditions found" );
553  } else ATH_MSG_WARNING( "::satBcid: No Conditions Container retrieved" );
554 
555  ATH_MSG_DEBUG( "::satBcid: satLevel: " << satLevel
556  << " satLow: " << satLow
557  << " satHigh: " << satHigh );
558 
559  satBcid(digits, satLow, satHigh, satLevel, output);
560 }
561 
564 void L1TriggerTowerToolRun3::satBcid(const std::vector<int> &digits, int satLow, int satHigh, int satLevel, std::vector<int> &output) const
565 {
566  output.clear();
567  output.reserve(digits.size()); // avoid frequent reallocations
568 
569  bool enabled = true;
570  int flag[2] = {0,0};
571 
572  for (unsigned int i = 0; i<digits.size(); i++) {
573  // Algorithm can set flag for following sample. So here we
574  // propagate such flags into the current sample.
575  flag[0] = flag[1];
576  flag[1] = 0;
577 
578  if (digits[i]>=satLevel) { // do we have saturation?
579  if (enabled && i>1) { // is algorithm active?
580  bool low = (digits[i-2]>satLow);
581  bool high = (digits[i-1]>satHigh);
582  if (high) { // flag current or next sample?
583  if (low) {
584  flag[0] = 1;
585  }
586  else {
587  flag[1] = 1;
588  }
589  }
590  else {
591  flag[1] = 1;
592  }
593  }
594  enabled = false; // after first saturation, disable algorithm
595  }
596  else {
597  enabled = true; // unsaturated sample reenables algorithm
598  }
599  output.push_back(flag[0]);
600  }
601 
602  ATH_MSG_DEBUG( "::satBcid: output: " << output);
603 
604 }
605 
607 namespace {
608  template<typename T>
609  unsigned int getDecisionSource( SG::ReadCondHandle<L1CaloPprConditionsContainerRun2> pprConditionsRun2) {
610  return pprConditionsRun2->decisionSource();
611  }
612 }
613 
614 void L1TriggerTowerToolRun3::bcidDecisionRange(const std::vector<int>& lutInput, const std::vector<int>& digits, const L1CaloCoolChannelId& channelId, std::vector<int> &output) const
615 {
616  int decisionSource = 0;
618 
620  decisionSource = getDecisionSource<L1CaloPprConditionsContainerRun2>(pprConditionsRun2);
621 
622  } else ATH_MSG_WARNING( "::bcidDecisionRange: No Conditions Container retrieved" );
623 
624  if (!(decisionSource&0x1)) etRange(digits, channelId, output);
625  else etRange(lutInput, channelId, output);
626 
627  ATH_MSG_DEBUG( "::bcidDecisionRange: decisionSource: " << decisionSource);
628  ATH_MSG_DEBUG( "::bcidDecisionRange: output: " << output);
629 
630 
631 }
632 
634 namespace { // helper function
635  template<class T>
636  std::tuple<unsigned int, unsigned int, unsigned int> getBcidDecision( SG::ReadCondHandle<L1CaloPprConditionsContainerRun2> pprConditionsRun2) {
637  return std::make_tuple(pprConditionsRun2->bcidDecision1(), pprConditionsRun2->bcidDecision2(), pprConditionsRun2->bcidDecision3());
638  }
639 } // anonymous namespace
640 void L1TriggerTowerToolRun3::bcidDecision(const std::vector<int> &bcidResults, const std::vector<int> &range , std::vector<int> &output) const
641 {
642  unsigned int decision1 = 0;
643  unsigned int decision2 = 0;
644  unsigned int decision3 = 0;
646 
648  std::tie(decision1, decision2, decision3) = getBcidDecision<L1CaloPprConditionsContainerRun2>(pprConditionsRun2);
649  } else ATH_MSG_WARNING( "::bcidDecision: No Conditions Container retrieved" );
650 
651  // Reverse the order! (see elog 97082 9/06/10)
652  std::vector<unsigned int> mask = { decision3, decision2, decision1 };
653 
654  ATH_MSG_DEBUG( "::bcidDecision: masks: " << MSG::hex
655  << decision3 << " " << decision2 << " " << decision1 << MSG::dec );
656 
657  bcidDecision(bcidResults, range, mask, output);
658 }
659 
662 void L1TriggerTowerToolRun3::bcidDecision(const std::vector<int> &bcidResults, const std::vector<int> &range, const std::vector<unsigned int> &mask, std::vector<int> &output) const
663 {
664  output.clear();
665  output.reserve(bcidResults.size()); // avoid frequent reallocations
666 
667  std::vector<int>::const_iterator itBcid = bcidResults.begin();
668  std::vector<int>::const_iterator itRange = range.begin();
669  int nRange = mask.size();
670 
671  for ( ; itBcid != bcidResults.end() && itRange != range.end(); ++itBcid, ++itRange) {
672  if ((*itRange) < nRange && (mask[*itRange]&(0x1<<*itBcid))) output.push_back(1);
673  else output.push_back(0);
674  }
675 
676  ATH_MSG_DEBUG( "::bcidDecision: output: " << output);
677 
678 
679 }
680 
681 // TODO implement scale
682 void L1TriggerTowerToolRun3::cpLut(const std::vector<int> &fir, const L1CaloCoolChannelId& channelId, std::vector<int> &output) const
683 {
684  int startBit = 0;
685  int strategy = 0;
686  int offset = 0;
687  int slope = 0;
688  int cut = 0;
689  unsigned short scale_menu = 0;
690  double pedMean = 0;
691  int hwCoeffSum = 0;
692  const std::vector<short int>* hwCoeffs;
693 
694 
696  const EventContext& ctx = Gaudi::Hive::currentContext();
697 
699  auto settings = pprConditionsRun2->pprConditions(channelId.id());
700  if (settings) {
701  startBit = settings->firStartBit();
702  strategy = settings->lutCpStrategy();
703  slope = settings->lutCpSlope();
704  cut = settings->lutCpNoiseCut();
705  pedMean = settings->pedMean();
706 
707  hwCoeffs = getFirCoefficients<L1CaloPprConditionsContainerRun2>(channelId.id(), pprConditionsRun2);
708 
709  auto l1Menu = getL1Menu(ctx);
710  scale_menu = l1Menu->thrExtraInfo().EM().emScale(); // Retrieve scale param from menu
711 
712  for( auto &coeffs : *hwCoeffs) {
713  hwCoeffSum += coeffs;
714  }
715 
716  offset = this->getLutOffset(pedMean, startBit, *hwCoeffs, slope, strategy);
717 
718  } else ATH_MSG_WARNING( "::cpLut: No L1CaloPprConditions found" );
719  } else ATH_MSG_WARNING( "::cpLut: No Conditions Container retrieved" );
720 
721  ATH_MSG_DEBUG( "::cpLut: strategy/scale/offset/slope/cut/pedMean/firCoeffSum/startBit: "
722  << strategy << "/" << scale_menu << "/" << offset << "/" << slope << "/" << cut << "/" << pedMean << "/" << hwCoeffSum << "/" << startBit );
723 
724  unsigned int noiseCut = 0;
725  bool disabled = disabledChannel(channelId, noiseCut);
726  if (noiseCut > 0) cut = noiseCut;
727  if(strategy == 2) {
728  // take the global scale into account - translate strategy to 1 for Run-1 compatible treatment
729  lut(fir, scale_menu*slope, scale_menu*offset, scale_menu*cut, 1, disabled, output);
730  } else if(strategy == 1 || strategy == 0){
731  lut(fir, slope, offset, cut, strategy, disabled, output);
732  } else if (strategy == 4) {
733  // Run-3 FCAL LUT filling scheme (strategy 4) which is identical to
734  // Run-2 strategy 2, but contains an additional fixed factor of 2.
735  lut(fir, scale_menu*slope, scale_menu*offset, scale_menu*cut, 4, disabled, output);
736 
737  }
738 
739  else {
740  ATH_MSG_WARNING(" ::cpLut: Unknown stragegy: " << strategy);
741  output.push_back(0); //avoid crashing with Unknown stragegy
742  }
743 }
744 
745 void L1TriggerTowerToolRun3::jepLut(const std::vector<int> &fir, const L1CaloCoolChannelId& channelId, std::vector<int> &output) const
746 {
747  int startBit = 0;
748  int strategy = 0;
749  int offset = 0;
750  int slope = 0;
751  int cut = 0;
752  unsigned short scale_db = 0;
753  unsigned short scale_menu = 0;
754  double pedMean = 0;
755  int hwCoeffSum = 0;
756  const std::vector<short int>* hwCoeffs;
757  short par1 = 0;
758  short par2 = 0;
759  short par3 = 0;
760  short par4 = 0;
761 
762  if(!isRun2()) {
763  // assert instead ?!
764  ATH_MSG_WARNING("::jepLut: Run-1 data - behaviour undefined!");
765  }
766 
767 
769  const EventContext& ctx = Gaudi::Hive::currentContext();
770 
772  const auto settings = pprConditionsRun2->pprConditions(channelId.id());
773  if (settings) {
774  startBit = settings->firStartBit();
775  strategy = settings->lutJepStrategy();
776  slope = settings->lutJepSlope();
777  cut = settings->lutJepNoiseCut();
778  pedMean = settings->pedMean();
779  scale_db = settings->lutJepScale();
780 
781  auto l1Menu = getL1Menu(ctx);
782  scale_menu = l1Menu->thrExtraInfo().JET().jetScale(); // Retrieve scale param from menu
783 
784  if (strategy == 3) {
785  par1 = settings->lutJepPar1();
786  par2 = settings->lutJepPar2();
787  par3 = settings->lutJepPar3();
788  par4 = settings->lutJepPar4();
789  }
790 
791  hwCoeffs = getFirCoefficients<L1CaloPprConditionsContainerRun2>(channelId.id(), pprConditionsRun2);
792 
793  for( auto &coeffs : *hwCoeffs) {
794  hwCoeffSum += coeffs;
795  }
796 
797  offset = this->getLutOffset(pedMean, startBit, *hwCoeffs, slope, strategy);
798 
799  } else ATH_MSG_WARNING( "::jepLut: No L1CaloPprConditions found" );
800  } else ATH_MSG_WARNING( "::jepLut: No Conditions Container retrieved" );
801 
802  ATH_MSG_DEBUG( "::jepLut: strategy/scale/offset/slope/cut/pedMean/firCoeffSum/startBit: "
803  << strategy << "/" << scale_menu << "/" << offset << "/" << slope << "/" << cut << "/" << pedMean << "/" << hwCoeffSum << "/" << startBit );
804 
805  unsigned int noiseCut = 0;
806  bool disabled = disabledChannel(channelId, noiseCut);
807  if (noiseCut > 0) cut = noiseCut;
808 
809  if(strategy == 3) {
810  nonLinearLut(fir, slope, offset, cut, scale_db, par1, par2, par3, par4, disabled, output);
811  }
812  else if(strategy == 2) {
813  // take the global scale into account - translate strategy to 1 for Run-1 compatible treatment
814  lut(fir, scale_menu*slope, scale_menu*offset, scale_menu*cut, 1, disabled, output);
815 
816  }else if(strategy == 1 || strategy == 0) {
817  lut(fir, slope, offset, cut, strategy, disabled, output);
818  }
819  else if (strategy == 4) {
820  // Run-3 FCAL LUT filling scheme (strategy 4) which is identical to
821  // Run-2 strategy 2, but contains an additional fixed factor of 2.
822  lut(fir, scale_menu*slope, scale_menu*offset, scale_menu*cut, 4, disabled, output);
823 
824  }
825 
826  else {
827  ATH_MSG_WARNING(" ::jepLut: Unknown stragegy: " << strategy);
828  output.push_back(0);//avoid crashing with Unknown stragegy
829  }
830 
831 
832 }
833 
835 void L1TriggerTowerToolRun3::lut(const std::vector<int> &fir, int slope, int offset, int cut, int strategy, bool disabled, std::vector<int> &output) const
836 {
837  output.clear();
838  output.reserve(fir.size()); // avoid frequent reallocations
839 
840  const int reScale = 2;
841  for( auto it : fir) {
842  int out = 0;
843  if (!disabled) {
844  if (strategy == 0 && it >= offset+cut) { // Original scheme
845  out = ((it-offset)*slope + 2048)>>12;
846  }
847  else if (strategy == 1 && it*slope >= offset+cut) { // New scheme
848  out = (it*slope - offset + 2048)>>12;
849  }
850  // Note: for strategy 2, the code is called with strategy=1
851  else if (strategy == 4 && it*slope >= offset+ cut/reScale) { // FCAL
852  out = (it*slope*reScale - offset*reScale + 2048)>>12;
853  }
854  if (out < 0) out = 0;
856  }
857  output.push_back(out);
858  }
859 
860  ATH_MSG_DEBUG( "::lut: output: " << output);
861 
862 }
863 
864 void L1TriggerTowerToolRun3::nonLinearLut(const std::vector<int> &fir, int slope, int offset, int cut, int scale, short par1, short par2, short par3, short par4, bool disabled, std::vector<int> &output) const
865 {
866  output.clear();
867  output.reserve(fir.size()); // avoid frequent reallocations
868 
869 
870  for( auto it : fir) {
871  int out = 0;
872  if (!disabled) {
873  // turn shorts into double
874  double nll_slope = 0.001 * scale;
875  double nll_offset = 0.001 * par1;
876  double nll_ampl = 0.001 * par2;
877  double nll_expo = 0.;
878  if(par3) {
879  nll_expo = -1. / (4096 * 0.001*par3);
880  } else {
881  nll_ampl = 0.;
882  }
883  double nll_noise = 0.001 * par4;
884 
885  // noise cut
886  if (it * slope < offset + nll_noise * cut) {
887  output.push_back(0);
888  continue;
889  }
890  // actual calculation
891  out = int((((int)(2048 + nll_slope * (it * slope - offset)))>>12) + nll_offset + nll_ampl * std::exp(nll_expo * (it * slope - offset)));
892 
894  if(out < 0) out = 0;
895  }
896  output.push_back(out);
897  }
898  ATH_MSG_DEBUG( "::nonLinearLut: output: " << output);
899 
900 }
904 void L1TriggerTowerToolRun3::applyEtRange(const std::vector<int>& lut, const std::vector<int>& range, const L1CaloCoolChannelId& channelId, std::vector<int> &output) const
905 {
907  std::vector<int>::const_iterator itlut = lut.begin();
908  std::vector<int>::const_iterator itrange = range.begin();
909  while ( itlut != lut.end() && itrange != range.end() ) {
910  if (!disabled && satOverride((*itrange))) output.push_back(s_saturationValue);
911  else output.push_back(*itlut);
912  ++itlut;
913  ++itrange;
914  }
915 
916  ATH_MSG_DEBUG( "::applyEtRange: output: " << output);
917 
918 }
919 
921 namespace { // helper function
922  template<class T>
923  std::tuple<bool, int, int> getBcidEnergyRange(unsigned int coolId, SG::ReadCondHandle<L1CaloPprConditionsContainerRun2> pprConditionsRun2) {
924  auto settings = pprConditionsRun2->pprConditions(coolId);
925  if(!settings) return std::make_tuple(false, 0, 0);
926  return std::make_tuple(true, settings->bcidEnergyRangeLow(), settings->bcidEnergyRangeHigh());
927  }
928 }
929 
930 // anonymous namespace
931 
932 void L1TriggerTowerToolRun3::etRange(const std::vector<int> &et, const L1CaloCoolChannelId& channelId, std::vector<int> &output) const
933 {
934  int energyLow = 0;
935  int energyHigh = 0;
937 
939  bool available = false;
940  std::tie(available, energyLow, energyHigh) = getBcidEnergyRange<L1CaloPprConditionsContainerRun2>(channelId.id(), pprConditionsRun2);
941  if(!available) ATH_MSG_WARNING("::etRange: No L1CaloPprConditions found");
942  } else ATH_MSG_WARNING("::etRange: No Conditions Container retrieved");
943 
944  ATH_MSG_VERBOSE( "::etRange: energyLow: " << energyLow
945  << " energyHigh: " << energyHigh);
946 
947  etRange(et, energyLow, energyHigh, output);
948 }
949 
952 void L1TriggerTowerToolRun3::etRange(const std::vector<int> &et, int energyLow, int energyHigh, std::vector<int> &output) const
953 {
954  output.clear();
955  output.reserve(et.size()); // avoid frequent reallocations
956  for( auto it : et) {
957  if (it <= energyLow) output.push_back(0);
958  else if (it <= energyHigh) output.push_back(1);
959  else output.push_back(2);
960  }
961 
962  ATH_MSG_DEBUG( "::etRange: output: " << output);
963 
964 
965 }
966 
968 namespace { // helper function
969  template<class T>
970  std::tuple<bool, int> getFirStartBit(unsigned int coolId, SG::ReadCondHandle<L1CaloPprConditionsContainerRun2> pprConditionsRun2) {
971  auto settings = pprConditionsRun2->pprConditions(coolId);
972  if(!settings) return std::make_tuple(false, 0);
973  return std::make_tuple(true, settings->firStartBit());
974  }
975 } // anonymous namespace
976 
977 void L1TriggerTowerToolRun3::dropBits(const std::vector<int> &fir, const L1CaloCoolChannelId& channelId, std::vector<int> &output) const
978 {
979  unsigned int start = 0;
981 
983  bool available = false;
984  std::tie(available, start) = getFirStartBit<L1CaloPprConditionsContainerRun2>(channelId.id(), pprConditionsRun2);
985  if(!available)ATH_MSG_WARNING( "::dropBits: No L1CaloPprConditions found" );
986  } else ATH_MSG_WARNING( "::dropBits: No Conditions Container retrieved" );
987 
988  ATH_MSG_DEBUG( "::dropBits: firStartBit: " << start );
989 
991 }
992 
995 void L1TriggerTowerToolRun3::dropBits(const std::vector<int> &fir, unsigned int start, std::vector<int> &output) const
996 {
997  output.clear();
998  output.reserve(fir.size()); // avoid frequent reallocations
999 
1001  unsigned int mask = (0x3ff<<start);
1002 
1004  int max = 1<<(10+start);
1005 
1006  for( auto it : fir) {
1007  if (it>=max) output.push_back(0x3ff);
1008  else output.push_back((it&mask)>>start);
1009  }
1010 
1011  ATH_MSG_DEBUG( "::dropBits: output: " << output);
1012 }
1013 
1015 void L1TriggerTowerToolRun3::firParams(const L1CaloCoolChannelId& channelId, std::vector<int> &firCoeffs) const
1016 {
1018  firCoeffs.clear();
1021  const std::vector<short int>* hwCoeffs = nullptr;
1022  hwCoeffs = getFirCoefficients<L1CaloPprConditionsContainerRun2>(channelId.id(), pprConditionsRun2 );
1023 
1024  if(hwCoeffs) {
1028  firCoeffs.reserve(hwCoeffs->size()); // avoid frequent reallocations
1029  for (int i = hwCoeffs->size()-1; i >= 0; --i) firCoeffs.push_back((*hwCoeffs)[i]);
1030 
1031  } else ATH_MSG_WARNING( "::firParams: No L1CaloPprConditions found" );
1032  } else ATH_MSG_WARNING( "::firParams: No Conditions Container retrieved" );
1033 
1034 
1035  ATH_MSG_DEBUG( "::fir: FIR coefficients: " << firCoeffs);
1036 
1037 }
1038 
1040 void L1TriggerTowerToolRun3::bcidParams(const L1CaloCoolChannelId& channelId, int &energyLow, int &energyHigh, int &decisionSource, std::vector<unsigned int> &decisionConditions,
1041  unsigned int &peakFinderStrategy, int &satLow, int &satHigh, int &satLevel) const
1042 {
1043  energyLow = 0;
1044  energyHigh = 0;
1045  decisionSource = 0;
1046  decisionConditions.clear();
1047  peakFinderStrategy = 0;
1048  satLevel = 0;
1049  satLow = 0;
1050  satHigh = 0;
1051 
1053 
1055  using std::get;
1056  std::tuple<unsigned int, unsigned int, unsigned int> bcidDecision;
1057  std::tuple<bool, int, int> bcidEnergyRange;
1058  std::tuple<bool, int, int, int> saturation;
1059 
1060  using Cont = L1CaloPprConditionsContainerRun2;
1061  bcidDecision = getBcidDecision<Cont>(pprConditionsRun2);
1062  peakFinderStrategy = getStrategy<Cont>(pprConditionsRun2);
1063  decisionSource = getDecisionSource<Cont>(pprConditionsRun2);
1064  bcidEnergyRange = getBcidEnergyRange<Cont>(channelId.id(), pprConditionsRun2);
1065  saturation = getSaturation<Cont>(channelId.id(), pprConditionsRun2);
1066 
1067 
1068  decisionConditions = { get<2>(bcidDecision),
1069  get<1>(bcidDecision),
1070  get<0>(bcidDecision) }; // reverse order
1071  if(get<0>(bcidEnergyRange)) {
1072  std::tie(std::ignore, energyLow, energyHigh) = bcidEnergyRange;
1073  } else ATH_MSG_WARNING( "::bcidParams: No BcidEnergyRange found" );
1074 
1075  if(get<0>(saturation)) {
1076  std::tie(std::ignore, satLevel, satLow, satHigh) = saturation;
1077  } else ATH_MSG_WARNING( "::bcidParams: No Saturation found" );
1078  } else ATH_MSG_WARNING( "::bcid:Params No Conditions Container retrieved" );
1079 
1080  ATH_MSG_DEBUG( "::bcidParams: satLevel: " << satLevel
1081  << " satLow: " << satLow << " satHigh: " << satHigh << endmsg
1082  << " energyLow: " << energyLow << " energyHigh: " << energyHigh << endmsg
1083  << " decisionSource: " << decisionSource << " peakFinderStrategy: "
1084  << peakFinderStrategy );
1085 
1086 }
1087 
1088 void L1TriggerTowerToolRun3::cpLutParams(const L1CaloCoolChannelId& channelId, int& startBit, int& slope, int& offset, int& cut, int& pedValue, float& pedMean, int& strategy, bool& disabled)
1089 {
1090  startBit = 0;
1091  strategy = 0;
1092  offset = 0;
1093  slope = 0;
1094  cut = 0;
1095  pedValue = 0;
1096  pedMean = 0.;
1097  disabled = true;
1098  int hwCoeffSum = 0;
1099  const std::vector<short int>* hwCoeffs;
1100 
1101 
1102  if(!isRun2()) {
1103  // assert instead ?!
1104  ATH_MSG_WARNING("::cpLutParams: Run-1 data - behaviour undefined!");
1105  }
1106 
1108 
1110  const auto settings = pprConditionsRun2->pprConditions(channelId.id());
1111  if(settings) {
1112  startBit = settings->firStartBit();
1113  strategy = settings->lutCpStrategy();
1114  slope = settings->lutCpSlope();
1115  cut = settings->lutCpNoiseCut();
1116  pedValue = settings->pedValue();
1117  pedMean = settings->pedMean();
1118 
1119  hwCoeffs = getFirCoefficients<L1CaloPprConditionsContainerRun2>(channelId.id(), pprConditionsRun2);
1120 
1121  for( auto &coeffs : *hwCoeffs) {
1122  hwCoeffSum += coeffs;
1123  }
1124 
1125  offset = this->getLutOffset(pedMean, startBit, *hwCoeffs, slope, strategy);
1126 
1127  ATH_MSG_VERBOSE( "::jepLutParams: Offset: offset/strategy/pedMean/firCoeffSum/startBit/slope: "
1128  << offset << " " << strategy << " " << " " << pedMean << " " << hwCoeffSum << " " << startBit << " " << slope );
1129 
1130  } else ATH_MSG_WARNING( "::cpLutParams: No L1CaloPprConditions found" );
1131  } else ATH_MSG_WARNING( "::cpLutParams: No Conditions Container retrieved" );
1132 
1133  ATH_MSG_VERBOSE( "::cpLutParams: LUT startBit/strategy/offset/slope/cut/pedValue/pedMean: "
1134  << startBit << " " << strategy << " " << offset << " " << slope << " " << cut << " " << pedValue << " " << pedMean );
1135  unsigned int noiseCut = 0;
1136  disabled = disabledChannel(channelId, noiseCut);
1137  if (noiseCut > 0) cut = noiseCut;
1138 }
1139 
1140 void L1TriggerTowerToolRun3::jepLutParams(const L1CaloCoolChannelId& channelId, int& startBit, int& slope, int& offset, int& cut, int& pedValue, float& pedMean, int& strategy, bool& disabled)
1141 {
1142  startBit = 0;
1143  strategy = 0;
1144  offset = 0;
1145  slope = 0;
1146  cut = 0;
1147  pedValue = 0;
1148  pedMean = 0.;
1149  disabled = true;
1150  int hwCoeffSum = 0;
1151  const std::vector<short int>* hwCoeffs;
1152 
1153  if(!isRun2()) {
1154  // assert instead ?!
1155  ATH_MSG_WARNING("::jepLutParams: Run-1 data - behaviour undefined!");
1156  }
1157 
1160  const auto settings = pprConditionsRun2->pprConditions(channelId.id());
1161  if(settings) {
1162  startBit = settings->firStartBit();
1163  strategy = settings->lutJepStrategy();
1164  slope = settings->lutJepSlope();
1165  cut = settings->lutJepNoiseCut();
1166  pedValue = settings->pedValue();
1167  pedMean = settings->pedMean();
1168 
1169  hwCoeffs = getFirCoefficients<L1CaloPprConditionsContainerRun2>(channelId.id(),pprConditionsRun2);
1170 
1171  for( auto &coeffs : *hwCoeffs) {
1172  hwCoeffSum += coeffs;
1173  }
1174 
1175  offset = this->getLutOffset(pedMean, startBit, *hwCoeffs, slope, strategy);
1176 
1177  ATH_MSG_VERBOSE( "::jepLutParams: Offset: offset/strategy/pedMean/firCoeffSum/startBit/slope: "
1178  << offset << " " << strategy << " " << " " << pedMean << " " << hwCoeffSum << " " << startBit << " " << slope );
1179 
1180  } else ATH_MSG_WARNING( "::jepLutParams: No L1CaloPprConditions found" );
1181  } else ATH_MSG_WARNING( "::jepLutParams: No Conditions Container retrieved" );
1182 
1183  ATH_MSG_VERBOSE( "::jepLutParams: LUT startBit/strategy/offset/slope/cut/pedValue/pedMean: "
1184  << startBit << " " << strategy << " " << offset << " " << slope << " " << cut << " " << pedValue << " " << pedMean );
1185  unsigned int noiseCut = 0;
1186  disabled = disabledChannel(channelId, noiseCut);
1187  if (noiseCut > 0) cut = noiseCut;
1188 }
1189 
1193 {
1194  Identifier id(0);
1196  int pos_neg_z = m_l1CaloTTIdTools->pos_neg_z(eta);
1197  int region = m_l1CaloTTIdTools->regionIndex(eta);
1198  int ieta = m_l1CaloTTIdTools->etaIndex(eta);
1199  int iphi = m_l1CaloTTIdTools->phiIndex(eta, phi);
1200 
1201  id = m_lvl1Helper->tower_id(pos_neg_z, layer, region, ieta, iphi);
1202  }
1203  return id;
1204 }
1205 
1209 {
1210  HWIdentifier hwId(0);
1211  if (m_ttSvc) {
1212  try { hwId = m_ttSvc->createTTChannelID(id, false); }
1213  catch (const CaloID_Exception&) { hwId = HWIdentifier(0); }
1214  }
1215  return hwId;
1216 }
1217 
1220 HWIdentifier L1TriggerTowerToolRun3::hwIdentifier(double eta, double phi, int layer)
1221 {
1222  Identifier id = identifier(eta, phi, layer);
1223  return hwIdentifier(id);
1224 }
1225 
1229 {
1230  // Use direct lookup table if possible
1231  const double absEta = std::abs(eta);
1232  int index = 0;
1233  if (absEta < 2.5) {
1234  const int etaBin = 10.*absEta;
1235  const int phiBin = phi*(32/M_PI);
1236  index = (etaBin<<6) + phiBin;
1237  } else if (absEta < 3.2) {
1238  const int etaBin = 5.*(absEta - 2.5);
1239  const int phiBin = phi*(16./M_PI);
1240  index = 1600 + (etaBin<<5) + phiBin;
1241  } else {
1242  const int etaBin = (absEta - 3.2)*(1./0.425);
1243  const int phiBin = phi*(8./M_PI);
1244  index = 1728 + (etaBin<<4) + phiBin;
1245  }
1246  if (eta < 0.) index += 1792;
1247  if (layer > 0) index += 3584;
1248  if (index >= s_maxTowers) return L1CaloCoolChannelId(0);
1249  if (m_idTable.empty()) {
1250  m_idTable.reserve(s_maxTowers);
1251  m_idTable.assign(s_maxTowers, 0);
1252  }
1253  if (m_idTable[index] == 0) {
1254  Identifier id = identifier(eta, phi, layer);
1255  L1CaloCoolChannelId coolID = channelID(id);
1256  m_idTable[index] = coolID.id();
1257  }
1259 }
1260 
1264 {
1265  L1CaloCoolChannelId coolId(0);
1266  if (m_ttSvc) {
1267  try {
1268  HWIdentifier hwId = hwIdentifier(id);
1269  coolId = m_ttSvc->createL1CoolChannelId(hwId);
1270  }
1271  catch (const CaloID_Exception&) { coolId = L1CaloCoolChannelId(0); }
1272  }
1273  return coolId;
1274 }
1275 
1277 namespace { // helper function
1278  template<class T>
1279  std::tuple<bool, bool, bool> getSatOverride(SG::ReadCondHandle<L1CaloPprConditionsContainerRun2> pprConditionsRun2) {
1280  return std::make_tuple(pprConditionsRun2->satOverride1(), pprConditionsRun2->satOverride2(), pprConditionsRun2->satOverride3());
1281  }
1282 } // anonymous namespace
1283 
1285 {
1286 
1288 
1289  bool override = false;
1291  std::tuple<bool, bool, bool> satOverride;
1292  satOverride = getSatOverride<L1CaloPprConditionsContainerRun2>(pprConditionsRun2);
1293  // NB Reverse order as for bcidDecision1/2/3
1294  if (range == 0) override = std::get<2>(satOverride);
1295  else if (range == 1) override = std::get<1>(satOverride);
1296  else if (range == 2) override = std::get<0>(satOverride);
1297  } else ATH_MSG_WARNING( "::satOverride: No Conditions Container retrieved" );
1298 
1299  ATH_MSG_VERBOSE( "::satOverride: range " << range
1300  << " has saturation override flag " << override );
1301 
1302  return override;
1303 }
1304 
1308 {
1309  unsigned int noiseCut = 0;
1310  return disabledChannel(channelId, noiseCut);
1311 }
1312 
1314 bool L1TriggerTowerToolRun3::disabledChannel(const L1CaloCoolChannelId& channelId, unsigned int& noiseCut) const
1315 {
1316 
1318  bool isDisabled = false;
1319  noiseCut = 0;
1321 
1322  const auto disabledChan = pprDisabledChannel->pprDisabledChannel(channelId.id());
1323 
1324  if (disabledChan) {
1325  if (!disabledChan->disabledBits()) {
1326  ChanCalibErrorCode calibError(disabledChan->calibErrorCode());
1327  if (calibError.chanValid()) {
1328  ChanDeadErrorCode deadError(disabledChan->deadErrorCode());
1329  if (deadError.chanValid()) noiseCut = disabledChan->noiseCut();
1330  //else isDisabled = true;
1331  } //else isDisabled = true;
1332  } else isDisabled = true;
1333 
1334  ATH_MSG_DEBUG( MSG::hex
1335  << "::disabledChannel: calibErrorCode: " << (disabledChan->calibErrorCode()).errorCode()
1336  << " deadErrorCode: " << (disabledChan->deadErrorCode()).errorCode()
1337  << " noiseCut: " << disabledChan->noiseCut()
1338  << " disabledBits: " << disabledChan->disabledBits()
1339  << MSG::dec );
1340 
1341  } else {
1342  ATH_MSG_DEBUG( "::disabledChannel: No L1CaloPprDisabledChannel found" );
1343  }
1344  } else {
1345  ATH_MSG_WARNING( "::disabledChannel: No DisabledChannel Container retrieved" );
1346  }
1347  if (isDisabled) ATH_MSG_DEBUG( "::disabledChannel: Channel is disabled" );
1348 
1349  return isDisabled;
1350 }
1351 
1352 
1356 double L1TriggerTowerToolRun3::FCalTTeta(double nominalEta, double /*phi*/, int layer)
1357 {
1358  double eta = nominalEta;
1359  float abseta = std::abs(eta);
1360  if (abseta<3.2) return eta; // If called for non-FCAL TT return input value
1361  if (layer == 0) {
1362  int sign = ((eta > 0) ? 1 : -1);
1363  if (abseta < 3.6) eta = 3.15 * sign;
1364  else if (abseta < 4.0) eta = 3.33 * sign;
1365  else if (abseta < 4.5) eta = 3.72 * sign;
1366  else eta = 4.41 * sign;
1367  }
1368  else if (eta > 0) {
1369  if (abseta < 3.6) eta = 3.36;
1370  else if (abseta < 4.0) eta = 3.45;
1371  else if (abseta < 4.5) eta = 4.17;
1372  else eta = 4.19;
1373  }
1374  else {
1375  if (abseta < 3.6) eta = -3.45;
1376  else if (abseta < 4.0) eta = -3.36;
1377  else if (abseta < 4.5) eta = -4.19;
1378  else eta = -4.17;
1379  }
1380  return eta;
1381 }
1382 
1388 {
1389  if ( !m_mappingTool.isValid() ) {
1390  throw GaudiException("No mapping tool configured",
1391  "L1TriggerTowerToolRun3::FCalTTeta", StatusCode::FAILURE);
1392  }
1393 
1395  unsigned int crate = channelId.crate();
1396  unsigned int module = channelId.module();
1397  unsigned int mcm = channelId.subModule();
1398  unsigned int pin = channelId.channel();
1399  int channel = pin*16 + mcm;
1400 
1402  double eta;
1403  double phi;
1404  int layer;
1405  if(!m_mappingTool->mapping(crate, module, channel, eta, phi, layer)) {
1406  ATH_MSG_WARNING("::FCalTTeta: could not map 0x" << std::hex << channelId.id() << std::dec);
1407  }
1408 
1410  return FCalTTeta(eta, phi, layer);
1411 }
1412 
1413 
1414 
1416 {
1417  //method returning the fine time reference and calibration value
1418  //the fineTimeReference folder has to be loaded first using the method L1TriggerTowerToolRun3::loadFTRefs
1419  double reference = 0;
1420  double calib = 0;
1422 
1424  const L1CaloPpmFineTimeRefs* ftref = ppmFineTimeRefs->ppmFineTimeRefs(channelId.id());
1425  if (ftref) {
1426  FineTimeErrorCode errorCode(ftref->errorCode());
1427 // if (errorCode.chanValid()) { //this should be changed at some point, at the moment the error code is ignored
1428  reference = ftref->refValue();
1429  calib = ftref->calibValue();
1430 // }
1431 
1432  ATH_MSG_VERBOSE( MSG::hex
1433  << "::refValues: errorCode: " << (ftref->errorCode()).errorCode()
1434  << MSG::dec << " reference: " << ftref->refValue() << " calib: " << ftref->calibValue() );
1435 
1436  } else {
1437  ATH_MSG_VERBOSE( "::refValue: No FineTimeRefsTowers found" );
1438  }
1439  } else {
1440  ATH_MSG_VERBOSE( "::refValue: No FineTimeRefs Container retrieved" );
1441  }
1442 
1443  return std::make_pair(reference, calib);
1444 }
1445 
1446 void L1TriggerTowerToolRun3::pedestalCorrection(std::vector<int>& firInOut, int firPed, int iElement, int layer, int bcid, float mu, std::vector<int_least16_t>& correctionOut) {
1447  unsigned nFIR = firInOut.size();
1448  correctionOut.assign(nFIR, 0u);
1449 
1450  if(!m_correctFir) return;
1451 
1452  // apply the pedestal correction
1453  for(unsigned i = 0; i != nFIR; ++i) {
1454  correctionOut[i] = (m_dynamicPedestalProvider->dynamicPedestal(iElement, layer, firPed, bcid + i - nFIR/2, mu) - firPed);
1455  firInOut[i] -= correctionOut[i];
1456 
1457  if(firInOut[i] < 0) firInOut[i] = 0;
1458  }
1459 
1460  ATH_MSG_DEBUG( "::pedestalCorrection(BCID=" << bcid << ", mu = " << mu << "): " << correctionOut);
1461 
1462 }
1463 
1465 {
1466  const EventContext& ctx = Gaudi::Hive::currentContext();
1467  if (ctx.eventID().run_number() >= 253377) return true;
1468 
1470  if (eventInfo->eventType (xAOD::EventInfo::IS_SIMULATION)) return true;
1471  return false;
1472 }
1473 
1474 unsigned int L1TriggerTowerToolRun3::getLutOffset(const double &pedMean, const unsigned int &firStartBit, const std::vector<short int> &firCoeff, const unsigned int &lutSlope, const unsigned int &lutStrategy) const
1475 {
1476  unsigned int lutOffset = 0;
1477  // essential to save in long long to avoid rounding errors
1478  long long int lutOffsetLong = 0;
1479  long long int lutSlopeLong = lutSlope;
1480  long long int firStartBitLong = firStartBit;
1481  long long int pedMeanLong = std::lround(pedMean * 10000.);
1482  long long int firCoeffSum = 0;
1483 
1484  for (unsigned int i=0; i<firCoeff.size(); i++) {
1485  firCoeffSum += firCoeff.at(i);
1486  }
1487 
1488  if ( lutStrategy == 0 ) {
1489  lutOffsetLong = ((pedMeanLong*firCoeffSum) >> firStartBitLong);
1490  }
1491  else {
1492  lutOffsetLong = ((pedMeanLong*firCoeffSum*lutSlopeLong) >> firStartBitLong) - ((lutSlopeLong * 10000) >> 1);
1493  }
1494 
1495  lutOffsetLong = (lutOffsetLong + (10000-1))/10000;
1496  lutOffset = static_cast<unsigned int>( lutOffsetLong < 0 ? 0 : lutOffsetLong );
1497  return lutOffset;
1498 }
1499 
1500 const TrigConf::L1Menu* L1TriggerTowerToolRun3::getL1Menu(const EventContext& ctx) const {
1501  const TrigConf::L1Menu* menu = nullptr;
1502 
1503  StatusCode sc = m_configSvc.retrieve();
1504  if (sc.isFailure()) {
1505  ATH_MSG_WARNING( "Cannot retrieve trigger configuration service" );
1506  }
1507 
1508  if (detStore()->contains<TrigConf::L1Menu>(m_L1MenuKey.key())) {
1510  if( l1MenuHandle.isValid() ){
1511  menu=l1MenuHandle.cptr();
1512  }
1513  } else {
1514  menu = &(m_configSvc->l1Menu(ctx));
1515  }
1516 
1517  return menu;
1518 }
1519 
1520 
1521 
1522 } // end of namespace
1523 
1524 
1525 
1526 
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
xAOD::strategy
strategy
Definition: L2CombinedMuon_v1.cxx:107
L1CaloPprConditionsContainerRun2::satOverride3
int satOverride3() const
Definition: L1CaloPprConditionsContainerRun2.h:64
L1CaloPprConditionsContainerRun2
Container of L1CaloPprConditions objects, inherit from the abstract base class AbstractL1CaloConditio...
Definition: L1CaloPprConditionsContainerRun2.h:32
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
LVL1::L1TriggerTowerToolRun3::nonLinearLut
virtual void nonLinearLut(const std::vector< int > &fir, int slope, int offset, int cut, int scale, short par1, short par2, short par3, short par4, bool disabled, std::vector< int > &output) const
Definition: L1TriggerTowerToolRun3.cxx:864
LVL1::L1TriggerTowerToolRun3::m_ttSvc
ToolHandle< CaloTriggerTowerService > m_ttSvc
Definition: L1TriggerTowerToolRun3.h:138
IL1CaloTTIdTools.h
LVL1::L1TriggerTowerToolRun3::disabledChannel
virtual bool disabledChannel(const L1CaloCoolChannelId &channelId) const override
Check for disabled channel.
Definition: L1TriggerTowerToolRun3.cxx:1307
LVL1::L1TriggerTowerToolRun3::m_L1MenuKey
SG::ReadHandleKey< TrigConf::L1Menu > m_L1MenuKey
Definition: L1TriggerTowerToolRun3.h:158
et
Extra patterns decribing particle interation process.
LVL1::L1TriggerTowerToolRun3::bcidDecisionRange
virtual void bcidDecisionRange(const std::vector< int > &lutInput, const std::vector< int > &digits, const L1CaloCoolChannelId &channelId, std::vector< int > &output) const override
Definition: L1TriggerTowerToolRun3.cxx:614
LVL1::L1TriggerTowerToolRun3::cpLutParams
virtual void cpLutParams(const L1CaloCoolChannelId &channelId, int &startBit, int &slope, int &offset, int &cut, int &pedValue, float &pedMean, int &strategy, bool &disabled) override
Definition: L1TriggerTowerToolRun3.cxx:1088
FineTimeErrorCode
FineTimeErrorCode class for L1Calo error codes.
Definition: FineTimeErrorCode.h:19
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
LVL1::L1TriggerTowerToolRun3::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition: L1TriggerTowerToolRun3.cxx:65
get_generator_info.result
result
Definition: get_generator_info.py:21
L1CaloPprConditionsRun2::firStartBit
unsigned short firStartBit() const
Definition: L1CaloPprConditionsRun2.h:74
L1CaloPpmFineTimeRefsContainer::ppmFineTimeRefs
const L1CaloPpmFineTimeRefs * ppmFineTimeRefs(unsigned int channelId) const
Definition: L1CaloPpmFineTimeRefsContainer.cxx:119
LVL1::L1TriggerTowerToolRun3::m_pprDisabledChannelContainer
SG::ReadCondHandleKey< L1CaloPprDisabledChannelContainerRun2 > m_pprDisabledChannelContainer
Definition: L1TriggerTowerToolRun3.h:145
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
L1CaloPprConditionsContainerRun2::peakFinderCond
int peakFinderCond() const
Definition: L1CaloPprConditionsContainerRun2.h:65
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CaloID_Exception
Exception class for Calo Identifiers.
Definition: CaloID_Exception.h:20
LVL1::L1TriggerTowerToolRun3::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition: L1TriggerTowerToolRun3.h:157
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
index
Definition: index.py:1
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
hist_file_dump.d
d
Definition: hist_file_dump.py:137
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
LVL1::L1TriggerTowerToolRun3::identifier
virtual Identifier identifier(double eta, double phi, int layer) override
Return offline identifier for given tower coordinates.
Definition: L1TriggerTowerToolRun3.cxx:1192
LVL1::L1TriggerTowerToolRun3::isRun2
bool isRun2() const
Definition: L1TriggerTowerToolRun3.cxx:1464
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
LVL1::L1TriggerTowerToolRun3::m_caloMgr
const CaloIdManager * m_caloMgr
Id managers.
Definition: L1TriggerTowerToolRun3.h:133
python.TriggerConfig.menu
menu
Definition: TriggerConfig.py:842
LVL1::L1TriggerTowerToolRun3::m_runParametersContainer
SG::ReadCondHandleKey< L1CaloRunParametersContainer > m_runParametersContainer
Definition: L1TriggerTowerToolRun3.h:147
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
LVL1::L1TriggerTowerToolRun3::satOverride
virtual bool satOverride(int range) const override
Definition: L1TriggerTowerToolRun3.cxx:1284
IL1DynamicPedestalProvider.h
skel.it
it
Definition: skel.GENtoEVGEN.py:396
LVL1::L1TriggerTowerToolRun3::refValues
virtual std::pair< double, double > refValues(const L1CaloCoolChannelId &channelId) override
Definition: L1TriggerTowerToolRun3.cxx:1415
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
M_PI
#define M_PI
Definition: ActiveFraction.h:11
LVL1::L1TriggerTowerToolRun3::satBcid
virtual void satBcid(const std::vector< int > &digits, const L1CaloCoolChannelId &channelId, std::vector< int > &output) const override
Saturated pulse BCID.
Definition: L1TriggerTowerToolRun3.cxx:542
LVL1::L1TriggerTowerToolRun3::simulateChannel
virtual void simulateChannel(const xAOD::TriggerTower &tt, std::vector< int > &outCpLut, std::vector< int > &outJepLut, std::vector< int > &bcidResults, std::vector< int > &bcidDecisions) const override
All-in-one routine - give it the TT identifier, and it returns the results.
Definition: L1TriggerTowerToolRun3.cxx:216
LVL1::L1TriggerTowerToolRun3::etRange
virtual void etRange(const std::vector< int > &et, const L1CaloCoolChannelId &channelId, std::vector< int > &output) const override
Definition: L1TriggerTowerToolRun3.cxx:932
ChanCalibErrorCode::chanValid
bool chanValid() const
Checks if channel is valid, ie.
Definition: ChanCalibErrorCode.cxx:46
LVL1::L1TriggerTowerToolRun3::cpLut
virtual void cpLut(const std::vector< int > &fir, const L1CaloCoolChannelId &channelId, std::vector< int > &output) const override
Definition: L1TriggerTowerToolRun3.cxx:682
ChanCalibErrorCode
ChanCalibErrorCode class for L1Calo error codes Adapted from /LVL1/l1calo/coolL1Calo/coolL1Calo/ChanE...
Definition: ChanCalibErrorCode.h:20
LVL1::L1TriggerTowerToolRun3::process
virtual void process(const std::vector< int > &digits, double eta, double phi, int layer, std::vector< int > &et, std::vector< int > &bcidResults, std::vector< int > &bcidDecisions, bool useJepLut=true) override
Take in vector of ADC digits, return PPrASIC results.
Definition: L1TriggerTowerToolRun3.cxx:138
TrigConf::L1Menu
L1 menu configuration.
Definition: L1Menu.h:28
reference
Definition: hcg.cxx:437
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
LVL1::L1TriggerTowerToolRun3::pedestalCorrection
virtual void pedestalCorrection(std::vector< int > &firInOut, int firPed, int iElement, int layer, int bcid, float mu, std::vector< int_least16_t > &correctionOut) override
Definition: L1TriggerTowerToolRun3.cxx:1446
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
LVL1::L1TriggerTowerToolRun3::jepLutParams
virtual void jepLutParams(const L1CaloCoolChannelId &channelId, int &startBit, int &slope, int &offset, int &cut, int &pedValue, float &pedMean, int &strategy, bool &disabled) override
Definition: L1TriggerTowerToolRun3.cxx:1140
LVL1::L1TriggerTowerToolRun3::m_configSvc
ServiceHandle< TrigConf::ITrigConfigSvc > m_configSvc
Definition: L1TriggerTowerToolRun3.h:161
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
xAOD::EventInfo_v1::IS_SIMULATION
@ IS_SIMULATION
true: simulation, false: data
Definition: EventInfo_v1.h:151
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::L1TriggerTowerToolRun3::finalize
virtual StatusCode finalize() override
standard Athena-Algorithm method
Definition: L1TriggerTowerToolRun3.cxx:118
LVL1::L1TriggerTowerToolRun3::handle
virtual void handle(const Incident &) override
catch begRun
Definition: L1TriggerTowerToolRun3.cxx:125
L1CaloPprConditionsContainerRun2::bcidDecision1
int bcidDecision1() const
Definition: L1CaloPprConditionsContainerRun2.h:59
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
ITkPixEncoding::lut
constexpr auto lut(Generator &&f)
Definition: ITkPixQCoreEncodingLUT.h:19
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
LVL1::L1TriggerTowerToolRun3::hwIdentifier
virtual HWIdentifier hwIdentifier(const Identifier &id) override
Return online identifier for given offline identifier.
Definition: L1TriggerTowerToolRun3.cxx:1208
LVL1::L1TriggerTowerToolRun3::FCalTTeta
virtual double FCalTTeta(const L1CaloCoolChannelId &channelId) override
Return median eta of trigger tower from L1CaloCoolChannelId.
Definition: L1TriggerTowerToolRun3.cxx:1387
LVL1::L1TriggerTowerToolRun3::fir
virtual void fir(const std::vector< int > &digits, const L1CaloCoolChannelId &channelId, std::vector< int > &output) const override
This FIR simulation produces a vector of same length as digit vector, with peak positions correspondi...
Definition: L1TriggerTowerToolRun3.cxx:422
L1CaloPprConditionsContainerRun2::bcidDecision3
int bcidDecision3() const
Definition: L1CaloPprConditionsContainerRun2.h:63
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
DeMoUpdate.reverse
reverse
Definition: DeMoUpdate.py:563
covarianceTool.filter
filter
Definition: covarianceTool.py:514
ChanDeadErrorCode
ChanDeadErrorCode class for L1Calo error codes Adapted from /LVL1/l1calo/coolL1Calo/coolL1Calo/ChanDe...
Definition: ChanDeadErrorCode.h:20
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
python.PyAthena.module
module
Definition: PyAthena.py:131
perfmonmt-refit.coeffs
coeffs
Definition: perfmonmt-refit.py:105
DiTauMassTools::ignore
void ignore(T &&)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:58
L1CaloPprDisabledChannelContainerRun2::pprDisabledChannel
const L1CaloPprDisabledChannel * pprDisabledChannel(unsigned int channelId) const
Definition: L1CaloPprDisabledChannelContainer.cxx:224
menu
make the sidebar many part of the config
Definition: hcg.cxx:551
LVL1::L1TriggerTowerToolRun3::bcidDecision
virtual void bcidDecision(const std::vector< int > &bcidResults, const std::vector< int > &range, std::vector< int > &output) const override
Definition: L1TriggerTowerToolRun3.cxx:640
xAOD::etaBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
Definition: L2StandAloneMuon_v1.cxx:148
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
L1CaloPprConditionsContainerRun2::bcidDecision2
int bcidDecision2() const
Definition: L1CaloPprConditionsContainerRun2.h:61
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
L1CaloRunParametersContainer::runParameters
const L1CaloRunParameters * runParameters(unsigned int channelId) const
Definition: L1CaloRunParametersContainer.cxx:93
lumiFormat.i
int i
Definition: lumiFormat.py:85
LVL1::L1TriggerTowerToolRun3::getL1Menu
const TrigConf::L1Menu * getL1Menu(const EventContext &ctx) const
Definition: L1TriggerTowerToolRun3.cxx:1500
beamspotman.n
n
Definition: beamspotman.py:731
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
LVL1::L1TriggerTowerToolRun3::bcid
virtual void bcid(const std::vector< int > &fir, const std::vector< int > &digits, const L1CaloCoolChannelId &channelId, std::vector< int > &output) const override
Evaluate both peak-finder and saturated BCID algorithms and return vector of predicted BCID result wo...
Definition: L1TriggerTowerToolRun3.cxx:330
master.flag
bool flag
Definition: master.py:29
LVL1::L1TriggerTowerToolRun3::s_maxTowers
static const int s_maxTowers
Definition: L1TriggerTowerToolRun3.h:166
L1CaloPprConditionsContainerRun2::satOverride1
int satOverride1() const
Definition: L1CaloPprConditionsContainerRun2.h:60
LVL1::L1TriggerTowerToolRun3::getLutOffset
unsigned int getLutOffset(const double &pedMean, const unsigned int &firStartBit, const std::vector< short int > &firCoeff, const unsigned int &lutSlope, const unsigned int &lutStrategy) const
Definition: L1TriggerTowerToolRun3.cxx:1474
xAOD::TriggerTower_v2
Description of TriggerTower_v2.
Definition: TriggerTower_v2.h:49
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
BindingsTest.cut
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
Definition: BindingsTest.py:13
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
L1CaloCoolChannelId::id
unsigned int id() const
Definition: L1CaloCoolChannelId.h:32
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
CaloIdManager::getLVL1_ID
const CaloLVL1_ID * getLVL1_ID(void) const
Definition: CaloIdManager.cxx:75
L1CaloPprConditionsContainerRun2::decisionSource
int decisionSource() const
Definition: L1CaloPprConditionsContainerRun2.h:66
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Make4DCorrelationMatrix.nominalEta
int nominalEta
Definition: Make4DCorrelationMatrix.py:80
ChanDeadErrorCode::chanValid
bool chanValid() const
Definition: ChanDeadErrorCode.h:62
LVL1::L1TriggerTowerToolRun3::dropBits
virtual void dropBits(const std::vector< int > &fir, const L1CaloCoolChannelId &channelId, std::vector< int > &output) const override
Definition: L1TriggerTowerToolRun3.cxx:977
SCT_Monitoring::disabled
@ disabled
Definition: SCT_MonitoringNumbers.h:60
LVL1::L1TriggerTowerToolRun3::m_idTable
std::vector< unsigned int > m_idTable
Mapping lookup table.
Definition: L1TriggerTowerToolRun3.h:151
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
LVL1::L1TriggerTowerToolRun3::s_saturationValue
static const int s_saturationValue
Parameters.
Definition: L1TriggerTowerToolRun3.h:165
LVL1::L1TriggerTowerToolRun3::bcidParams
virtual void bcidParams(const L1CaloCoolChannelId &channelId, int &energyLow, int &energyHigh, int &decisionSource, std::vector< unsigned int > &decisionConditions, unsigned int &peakFinderStrategy, int &satLow, int &satHigh, int &satLevel) const override
Return BCID parameters for a channel.
Definition: L1TriggerTowerToolRun3.cxx:1040
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
LVL1::L1TriggerTowerToolRun3::m_l1CaloTTIdTools
ToolHandle< LVL1::IL1CaloTTIdTools > m_l1CaloTTIdTools
Definition: L1TriggerTowerToolRun3.h:137
merge.output
output
Definition: merge.py:17
LVL1::L1TriggerTowerToolRun3::lut
virtual void lut(const std::vector< int > &fir, int slope, int offset, int cut, int strategy, bool disabled, std::vector< int > &output) const override
LUT simulation: pedestal subtraction, energy calibration and threshold.
Definition: L1TriggerTowerToolRun3.cxx:835
ChanDeadErrorCode.h
L1CaloPprConditionsContainerRun2::pprConditions
const L1CaloPprConditionsRun2 * pprConditions(unsigned int channelId) const
Definition: L1CaloPprConditionsContainerRun2.cxx:492
LVL1::L1TriggerTowerToolRun3::m_dynamicPedestalProvider
ToolHandle< LVL1::IL1DynamicPedestalProvider > m_dynamicPedestalProvider
Definition: L1TriggerTowerToolRun3.h:155
LVL1::L1TriggerTowerToolRun3::firParams
virtual void firParams(const L1CaloCoolChannelId &channelId, std::vector< int > &firCoeffs) const override
Return FIR filter parameters for a channel.
Definition: L1TriggerTowerToolRun3.cxx:1015
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
LVL1::L1TriggerTowerToolRun3::applyEtRange
virtual void applyEtRange(const std::vector< int > &lut, const std::vector< int > &range, const L1CaloCoolChannelId &channelId, std::vector< int > &output) const override
Use ET range to return appropriate ET value Do not test BCID here, since no guarantee enough ADC samp...
Definition: L1TriggerTowerToolRun3.cxx:904
xAOD::phiBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setPhiMap phiBin
Definition: L2StandAloneMuon_v2.cxx:144
LVL1::L1TriggerTowerToolRun3::m_lvl1Helper
const CaloLVL1_ID * m_lvl1Helper
and tools for computing identifiers
Definition: L1TriggerTowerToolRun3.h:136
IL1CaloMappingTool.h
L1CaloPprConditionsContainerRun2::satOverride2
int satOverride2() const
Definition: L1CaloPprConditionsContainerRun2.h:62
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
L1CaloPpmFineTimeRefs::refValue
double refValue(void) const
Definition: L1CaloPpmFineTimeRefs.h:38
LVL1::L1TriggerTowerToolRun3::m_pprConditionsContainerRun2
SG::ReadCondHandleKey< L1CaloPprConditionsContainerRun2 > m_pprConditionsContainerRun2
Definition: L1TriggerTowerToolRun3.h:144
LVL1::L1TriggerTowerToolRun3::~L1TriggerTowerToolRun3
virtual ~L1TriggerTowerToolRun3()
default destructor
Definition: L1TriggerTowerToolRun3.cxx:61
LVL1::L1TriggerTowerToolRun3::m_correctFir
bool m_correctFir
Baseline correction Tool.
Definition: L1TriggerTowerToolRun3.h:154
PlotSFuncertainty.calib
calib
Definition: PlotSFuncertainty.py:110
python.PyAthena.v
v
Definition: PyAthena.py:154
L1CaloCoolChannelId
Definition: L1CaloCoolChannelId.h:10
DeMoScan.index
string index
Definition: DeMoScan.py:364
CaloLVL1_ID.h
L1TriggerTowerToolRun3.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CaloTriggerTowerService.h
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
TauGNNUtils::Variables::absEta
bool absEta(const xAOD::TauJet &tau, double &out)
Definition: TauGNNUtils.cxx:234
LVL1::L1TriggerTowerToolRun3::channelID
virtual L1CaloCoolChannelId channelID(double eta, double phi, int layer) override
Return Cool channel identifier for given tower coordinates.
Definition: L1TriggerTowerToolRun3.cxx:1228
LVL1::L1TriggerTowerToolRun3::peakBcid
virtual void peakBcid(const std::vector< int > &fir, const L1CaloCoolChannelId &channelId, std::vector< int > &output) const override
Peak finder BCID.
Definition: L1TriggerTowerToolRun3.cxx:491
CaloIdManager.h
ReadHandle.h
Handle class for reading from StoreGate.
AthAlgTool
Definition: AthAlgTool.h:26
CaloLVL1_ID::tower_id
Identifier tower_id(int pos_neg_z, int sampling, int region, int eta, int phi) const
build a tower identifier
Definition: CaloLVL1_ID.h:429
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
L1CaloRunParameters::readoutConfigID
unsigned int readoutConfigID() const
Definition: L1CaloRunParameters.h:29
TileDCSDataPlotter.tt
tt
Definition: TileDCSDataPlotter.py:874
ChanCalibErrorCode.h
LVL1::L1TriggerTowerToolRun3::m_mappingTool
ToolHandle< LVL1::IL1CaloMappingTool > m_mappingTool
and mappings
Definition: L1TriggerTowerToolRun3.h:141
LVL1::L1TriggerTowerToolRun3::jepLut
virtual void jepLut(const std::vector< int > &fir, const L1CaloCoolChannelId &channelId, std::vector< int > &output) const override
Definition: L1TriggerTowerToolRun3.cxx:745
LVL1::L1TriggerTowerToolRun3::m_ppmFineTimeRefsContainer
SG::ReadCondHandleKey< L1CaloPpmFineTimeRefsContainer > m_ppmFineTimeRefsContainer
Definition: L1TriggerTowerToolRun3.h:146
L1CaloPpmFineTimeRefs::errorCode
FineTimeErrorCode errorCode(void) const
Definition: L1CaloPpmFineTimeRefs.h:37
L1CaloPpmFineTimeRefs
Definition: L1CaloPpmFineTimeRefs.h:23
xAOD::EventInfo_v1::eventType
bool eventType(EventType type) const
Check for one particular bitmask value.
L1CaloPpmFineTimeRefs::calibValue
double calibValue(void) const
Definition: L1CaloPpmFineTimeRefs.h:40
Identifier
Definition: IdentifierFieldParser.cxx:14