50 const int ifCaloEtaNumberBits)
54 m_ifCaloEtaNumberBits(ifCaloEtaNumberBits) {
82 m_gtCaloTemplate =
cp.gtCaloTemplate();
83 m_uGtB =
cp.getuGtB();
85 m_ifCaloEtaNumberBits =
cp.gtIfCaloEtaNumberBits();
86 m_corrParDeltaPhiNrBins =
cp.m_corrParDeltaPhiNrBins;
88 m_condMaxNumberObjects =
cp.condMaxNumberObjects();
89 m_condLastResult =
cp.condLastResult();
90 m_combinationsInCond =
cp.getCombinationsInCond();
92 m_verbosity =
cp.m_verbosity;
116 m_ifCaloEtaNumberBits = ifCaloEtaNumberBitsValue;
121 m_corrParDeltaPhiNrBins = corrParDeltaPhiNrBins;
127 int nObjInCond = m_gtCaloTemplate->nrObjects();
139 switch ((m_gtCaloTemplate->objectType())[0]) {
141 candVec = m_uGtB->getCandL1EG();
145 candVec = m_uGtB->getCandL1Jet();
149 candVec = m_uGtB->getCandL1Tau();
158 int useBx = bxEval + m_gtCaloTemplate->condRelativeBx();
161 if ((useBx < candVec->getFirstBX()) || (useBx > candVec->
getLastBX())) {
165 int numberObjects = candVec->
size(useBx);
168 if (numberObjects < nObjInCond) {
172 std::vector<int>
index(numberObjects);
174 for (
int i = 0;
i < numberObjects; ++
i) {
184 bool condResult =
false;
189 objectsInComb.reserve(nObjInCond);
192 combinationsInCond().clear();
195 if (nObjInCond == 1) {
199 for (
int i = 0;
i < numberObjects;
i++) {
201 objectsInComb.clear();
204 bool passCondition = checkObjectParameter(0, *(candVec->
at(useBx,
i)),
index[
i]);
206 objectsInComb.push_back(
i);
209 combinationsInCond().push_back(objectsInComb);
212 }
else if (nObjInCond == 2) {
213 for (
int i = 0;
i < numberObjects;
i++) {
214 bool passCondition0i = checkObjectParameter(0, *(candVec->
at(useBx,
i)),
index[
i]);
215 bool passCondition1i = checkObjectParameter(1, *(candVec->
at(useBx,
i)),
index[
i]);
217 if (!(passCondition0i || passCondition1i))
220 for (
int j = 0;
j < numberObjects;
j++) {
225 bool passCondition0j = checkObjectParameter(0, *(candVec->
at(useBx,
j)),
index[
i]);
226 bool passCondition1j = checkObjectParameter(1, *(candVec->
at(useBx,
j)),
index[
i]);
228 bool pass = ((passCondition0i && passCondition1j) || (passCondition0j && passCondition1i));
231 if (m_gtCaloTemplate->wsc()) {
235 const int ObjInWscComb = 2;
236 if (nObjInCond != ObjInWscComb) {
240 <<
"number of particles in condition with spatial correlation = " << nObjInCond
241 <<
"\n it must be = " << ObjInWscComb << std::endl;
250 if (!checkRangeDeltaEta((candVec->
at(useBx,
i))->
hwEta(),
255 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRangeDeltaEta" << std::endl;
260 if (!checkRangeDeltaPhi((candVec->
at(useBx,
i))->
hwPhi(),
264 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRangeDeltaPhi" << std::endl;
270 objectsInComb.clear();
271 objectsInComb.push_back(
i);
272 objectsInComb.push_back(
j);
275 combinationsInCond().push_back(objectsInComb);
279 }
else if (nObjInCond == 3) {
280 for (
int i = 0;
i < numberObjects;
i++) {
281 bool passCondition0i = checkObjectParameter(0, *(candVec->
at(useBx,
i)),
index[
i]);
282 bool passCondition1i = checkObjectParameter(1, *(candVec->
at(useBx,
i)),
index[
i]);
283 bool passCondition2i = checkObjectParameter(2, *(candVec->
at(useBx,
i)),
index[
i]);
285 if (!(passCondition0i || passCondition1i || passCondition2i))
288 for (
int j = 0;
j < numberObjects;
j++) {
292 bool passCondition0j = checkObjectParameter(0, *(candVec->
at(useBx,
j)),
index[
i]);
293 bool passCondition1j = checkObjectParameter(1, *(candVec->
at(useBx,
j)),
index[
i]);
294 bool passCondition2j = checkObjectParameter(2, *(candVec->
at(useBx,
j)),
index[
i]);
296 if (!(passCondition0j || passCondition1j || passCondition2j))
299 for (
int k = 0;
k < numberObjects;
k++) {
300 if (
k ==
i ||
k ==
j)
304 bool passCondition0k = checkObjectParameter(0, *(candVec->
at(useBx,
k)),
index[
i]);
305 bool passCondition1k = checkObjectParameter(1, *(candVec->
at(useBx,
k)),
index[
i]);
306 bool passCondition2k = checkObjectParameter(2, *(candVec->
at(useBx,
k)),
index[
i]);
308 bool pass = ((passCondition0i && passCondition1j && passCondition2k) ||
309 (passCondition0i && passCondition1k && passCondition2j) ||
310 (passCondition0j && passCondition1k && passCondition2i) ||
311 (passCondition0j && passCondition1i && passCondition2k) ||
312 (passCondition0k && passCondition1i && passCondition2j) ||
313 (passCondition0k && passCondition1j && passCondition2i));
317 objectsInComb.clear();
318 objectsInComb.push_back(
i);
319 objectsInComb.push_back(
j);
320 objectsInComb.push_back(
k);
321 combinationsInCond().push_back(objectsInComb);
327 else if (nObjInCond == 4) {
328 for (
int i = 0;
i < numberObjects;
i++) {
329 bool passCondition0i = checkObjectParameter(0, *(candVec->
at(useBx,
i)),
index[
i]);
330 bool passCondition1i = checkObjectParameter(1, *(candVec->
at(useBx,
i)),
index[
i]);
331 bool passCondition2i = checkObjectParameter(2, *(candVec->
at(useBx,
i)),
index[
i]);
332 bool passCondition3i = checkObjectParameter(3, *(candVec->
at(useBx,
i)),
index[
i]);
334 if (!(passCondition0i || passCondition1i || passCondition2i || passCondition3i))
337 for (
int j = 0;
j < numberObjects;
j++) {
341 bool passCondition0j = checkObjectParameter(0, *(candVec->
at(useBx,
j)),
index[
i]);
342 bool passCondition1j = checkObjectParameter(1, *(candVec->
at(useBx,
j)),
index[
i]);
343 bool passCondition2j = checkObjectParameter(2, *(candVec->
at(useBx,
j)),
index[
i]);
344 bool passCondition3j = checkObjectParameter(3, *(candVec->
at(useBx,
j)),
index[
i]);
346 if (!(passCondition0j || passCondition1j || passCondition2j || passCondition3j))
349 for (
int k = 0;
k < numberObjects;
k++) {
350 if (
k ==
i ||
k ==
j)
353 bool passCondition0k = checkObjectParameter(0, *(candVec->
at(useBx,
k)),
index[
i]);
354 bool passCondition1k = checkObjectParameter(1, *(candVec->
at(useBx,
k)),
index[
i]);
355 bool passCondition2k = checkObjectParameter(2, *(candVec->
at(useBx,
k)),
index[
i]);
356 bool passCondition3k = checkObjectParameter(3, *(candVec->
at(useBx,
k)),
index[
i]);
358 if (!(passCondition0k || passCondition1k || passCondition2k || passCondition3k))
361 for (
int m = 0;
m < numberObjects;
m++) {
362 if (
m ==
i ||
m ==
j ||
m ==
k)
366 bool passCondition0m = checkObjectParameter(0, *(candVec->
at(useBx,
m)),
index[
i]);
367 bool passCondition1m = checkObjectParameter(1, *(candVec->
at(useBx,
m)),
index[
i]);
368 bool passCondition2m = checkObjectParameter(2, *(candVec->
at(useBx,
m)),
index[
i]);
369 bool passCondition3m = checkObjectParameter(3, *(candVec->
at(useBx,
m)),
index[
i]);
371 bool pass = ((passCondition0i && passCondition1j && passCondition2k && passCondition3m) ||
372 (passCondition0i && passCondition1j && passCondition2m && passCondition3k) ||
373 (passCondition0i && passCondition1k && passCondition2j && passCondition3m) ||
374 (passCondition0i && passCondition1k && passCondition2m && passCondition3j) ||
375 (passCondition0i && passCondition1m && passCondition2j && passCondition3k) ||
376 (passCondition0i && passCondition1m && passCondition2k && passCondition3j) ||
377 (passCondition0j && passCondition1i && passCondition2k && passCondition3m) ||
378 (passCondition0j && passCondition1i && passCondition2m && passCondition3k) ||
379 (passCondition0j && passCondition1k && passCondition2i && passCondition3m) ||
380 (passCondition0j && passCondition1k && passCondition2m && passCondition3i) ||
381 (passCondition0j && passCondition1m && passCondition2i && passCondition3k) ||
382 (passCondition0j && passCondition1m && passCondition2k && passCondition3i) ||
383 (passCondition0k && passCondition1i && passCondition2j && passCondition3m) ||
384 (passCondition0k && passCondition1i && passCondition2m && passCondition3j) ||
385 (passCondition0k && passCondition1j && passCondition2i && passCondition3m) ||
386 (passCondition0k && passCondition1j && passCondition2m && passCondition3i) ||
387 (passCondition0k && passCondition1m && passCondition2i && passCondition3j) ||
388 (passCondition0k && passCondition1m && passCondition2j && passCondition3i) ||
389 (passCondition0m && passCondition1i && passCondition2j && passCondition3k) ||
390 (passCondition0m && passCondition1i && passCondition2k && passCondition3j) ||
391 (passCondition0m && passCondition1j && passCondition2i && passCondition3k) ||
392 (passCondition0m && passCondition1j && passCondition2k && passCondition3i) ||
393 (passCondition0m && passCondition1k && passCondition2i && passCondition3j) ||
394 (passCondition0m && passCondition1k && passCondition2j && passCondition3i));
396 objectsInComb.clear();
397 objectsInComb.push_back(
i);
398 objectsInComb.push_back(
j);
399 objectsInComb.push_back(
k);
400 objectsInComb.push_back(
m);
403 combinationsInCond().push_back(objectsInComb);
411 LogTrace(
"L1TGlobal") <<
"\n CaloCondition: total number of permutations found: " << totalLoops
412 <<
"\n CaloCondition: number of permutations passing requirements: " << passLoops <<
"\n" 423 switch ((m_gtCaloTemplate->objectType())[0]) {
425 return (m_uGtB->getCandL1EG())->at(
bx, indexCand);
429 return (m_uGtB->getCandL1Jet())->at(
bx, indexCand);
433 return (m_uGtB->getCandL1Tau())->at(
bx, indexCand);
454 unsigned int index)
const {
456 int nObjInCond = m_gtCaloTemplate->nrObjects();
458 if (iCondition >= nObjInCond || iCondition < 0) {
469 LogDebug(
"L1TGlobal") <<
"\n CaloTemplate: " 470 <<
"\n\t condRelativeBx = " << m_gtCaloTemplate->condRelativeBx() <<
"\n ObjectParameter : " 473 <<
"\n\t etaRange = " << objPar.
etaRange <<
"\n\t phiRange = " << objPar.
phiRange 474 <<
"\n\t isolationLUT= " << objPar.
isolationLUT << std::endl;
476 LogDebug(
"L1TGlobal") <<
"\n l1t::Candidate : " 477 <<
"\n\t hwPt = " <<
cand.hwPt() <<
"\n\t hwEta = " <<
cand.hwEta()
478 <<
"\n\t hwPhi = " <<
cand.hwPhi() << std::endl;
482 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkThreshold" << std::endl;
488 LogDebug(
"L1TGlobal") <<
"\t\t ilt::Candidate Failed checkIndex " << std::endl;
493 if (!checkRangeEta(
cand.hwEta(),
499 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRange(eta)" << std::endl;
508 if (!checkRangePhi(
cand.hwPhi(),
513 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed checkRange(phi)" << std::endl;
519 if (
cand.hwIso() > 4) {
520 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate has out of range hwIso = " <<
cand.hwIso() << std::endl;
525 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed isolation requirement" << std::endl;
532 if (
cand.hwQual() > 7) {
533 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate has out of range hwQual = " <<
cand.hwQual() << std::endl;
537 bool hasDisplacedLUT =
540 if (hasDisplacedLUT &&
542 LogDebug(
"L1TGlobal") <<
"\t\t l1t::Candidate failed displaced requirement" << std::endl;
559 m_gtCaloTemplate->print(myCout);
561 myCout <<
" Number of bits for eta of calorimeter objects = " << m_ifCaloEtaNumberBits << std::endl;
562 myCout <<
" Maximum number of bins for the delta phi scales = " << m_corrParDeltaPhiNrBins <<
"\n " << std::endl;
unsigned int m_corrParDeltaPhiNrBins
void print(std::ostream &myCout) const override
print condition
void setGtCorrParDeltaPhiNrBins(const int &)
unsigned int phiWindow2Upper
void setGtIfCaloEtaNumberBits(const int &)
std::vector< int > SingleCombInCond
typedefs
unsigned int deltaPhiRangeLower
unsigned int phiWindow2Lower
Log< level::Error, false > LogError
unsigned int phiWindow1Upper
unsigned int etLowThreshold
typedef for a single object template
void setGtCaloTemplate(const CaloTemplate *)
unsigned size(int bx) const
unsigned int displacedLUT
const std::vector< l1t::GlobalObject > & objectType() const
get / set the trigger object type(s) in the condition
unsigned int deltaEtaRangeUpper
unsigned int etaWindow1Lower
const T & at(int bx, unsigned i) const
void setuGtB(const GlobalBoard *)
set the pointer to uGT GlobalBoard
~CaloCondition() override
unsigned int phiWindow1Lower
virtual void print(std::ostream &myCout) const
print condition
unsigned int deltaPhiRangeUpper
unsigned int etaWindow2Upper
CaloCondition & operator=(const CaloCondition &)
const l1t::L1Candidate * getCandidate(const int bx, const int indexCand) const
load calo candidates
typedef for correlation parameters
void copy(const CaloCondition &cp)
copy function for copy constructor and operator=
int m_ifCaloEtaNumberBits
number of bits for eta of calorimeter objects
unsigned int etaWindow2Lower
unsigned int etHighThreshold
int m_condMaxNumberObjects
unsigned int isolationLUT
unsigned int etaWindow1Upper
const bool evaluateCondition(const int bxEval) const override
the core function to check if the condition matches
const CaloTemplate * m_gtCaloTemplate
pointer to a CaloTemplate
unsigned int deltaEtaRangeLower
const bool checkObjectParameter(const int iCondition, const l1t::L1Candidate &cand, const unsigned int index) const
function to check a single object if it matches a condition