52 const int ifMuEtaNumberBits)
107 const int &ifMuEtaNumberBitsValue) {
114 const int &corrParDeltaPhiNrBins) {
128 int numberObjects = candVec->size();
131 if (numberObjects < nObjInCond) {
135 std::vector<int>
index(numberObjects);
137 for (
int i = 0;
i < numberObjects; ++
i) {
142 int jump =
factorial(numberObjects - nObjInCond);
150 bool condResult =
false;
155 objectsInComb.reserve(nObjInCond);
169 objectsInComb.clear();
171 bool tmpResult =
true;
175 for (
int i = 0;
i < nObjInCond;
i++) {
178 objectsInComb.push_back(index[i]);
196 if ((chargeCorr & 1) == 0) {
198 for (
int i = 0;
i < nObjInCond;
i++) {
200 bool chargeValid = (*candVec)[index[
i]]->charge_valid();
201 tmpResult &= chargeValid;
212 if (nObjInCond == 1) {
215 if (!(((chargeCorr & 4) != 0 && (*candVec)[index[0]]->
charge() > 0) ||
216 ((chargeCorr & 2) != 0 && (*candVec)[index[0]]->
charge() < 0))) {
224 bool equalSigns =
true;
225 for (
int i = 0;
i < nObjInCond - 1;
i++) {
226 if ((*candVec)[index[
i]]->
charge() !=
227 (*candVec)[index[
i + 1]]->
charge()) {
234 if (nObjInCond == 2 || nObjInCond == 3) {
236 if (!(((chargeCorr & 4) != 0 && equalSigns) ||
237 ((chargeCorr & 2) != 0 && !equalSigns))) {
244 if (nObjInCond == 4) {
246 unsigned int posCount = 0;
248 for (
int i = 0;
i < nObjInCond;
i++) {
249 if ((*candVec)[index[
i]]->
charge() > 0) {
255 if (!(((chargeCorr & 4) != 0 && equalSigns) ||
256 ((chargeCorr & 2) != 0 && posCount == 2))) {
269 const int ObjInWscComb = 2;
270 if (nObjInCond != ObjInWscComb) {
274 <<
"number of particles in condition with spatial correlation = " 275 << nObjInCond <<
"\n it must be = " << ObjInWscComb << std::endl;
281 unsigned int candDeltaEta;
282 unsigned int candDeltaPhi;
288 int signedEta[ObjInWscComb];
289 int signBit[ObjInWscComb] = {0, 0};
293 for (
int i = 0;
i < ObjInWscComb; ++
i) {
294 signBit[
i] = ((*candVec)[index[
i]]->etaIndex() & scaleEta) >>
296 signedEta[
i] = ((*candVec)[index[
i]]->etaIndex()) % scaleEta;
298 if (signBit[
i] == 1) {
299 signedEta[
i] = (-1) * signedEta[
i];
305 candDeltaEta =
static_cast<int>(
std::abs(signedEta[1] - signedEta[0])) +
306 static_cast<int>(signBit[1] ^ signBit[0]);
315 if ((*candVec)[index[0]]->phiIndex() > (*candVec)[index[1]]->phiIndex()) {
317 (*candVec)[index[0]]->phiIndex() - (*candVec)[index[1]]->phiIndex();
320 (*candVec)[index[1]]->phiIndex() - (*candVec)[index[0]]->phiIndex();
332 unsigned int candDeltaPhiInitial = candDeltaPhi;
338 <<
" Initial candDeltaPhi = " << candDeltaPhiInitial
340 <<
" ==> candDeltaPhi rescaled to: " << candDeltaPhi
341 <<
" [ loop index " << iLoop <<
"; breaks after " << nMaxLoop
347 if (iLoop > nMaxLoop) {
353 if (candDeltaPhi < 64) {
372 }
while (std::next_permutation(index.begin(), index.end()));
406 if (iCondition >= nObjInCond || iCondition < 0) {
535 myCout <<
" Number of bits for eta of muon objects = " 537 myCout <<
" Maximum number of bins for the delta phi scales = " L1GtMuonCondition & operator=(const L1GtMuonCondition &)
const int nrObjects() const
get number of trigger objects
const CorrelationParameter * correlationParameter() const
const bool checkBit(const Type1 &mask, const unsigned int bitNumber) const
check if a bit with a given number is set in a mask
unsigned int ptHighThreshold
int m_verbosity
verbosity level
unsigned long long etaRange
bool m_condLastResult
the last result of evaluateCondition()
unsigned int phiIndex() const
get phi-code
CombinationsInCond m_combinationsInCond
store all the object combinations evaluated to true in the condition
CombinationsInCond & combinationsInCond() const
get all the object combinations (to fill it...)
void setGtIfMuEtaNumberBits(const int &)
unsigned int m_corrParDeltaPhiNrBins
unsigned int etaIndex() const
get eta-code
void copy(const L1GtMuonCondition &cp)
copy function for copy constructor and operator=
std::vector< int > SingleCombInCond
typedefs
int m_ifMuEtaNumberBits
number of bits for eta of muon objects
int condMaxNumberObjects() const
const L1GtMuonTemplate * m_gtMuonTemplate
pointer to a L1GtMuonTemplate
bool isol() const
get isolation
const int gtIfMuEtaNumberBits() const
get / set the number of bits for eta of muon objects
bool empty() const
is it an empty muon candidate?
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
const bool checkThreshold(const Type1 &threshold, const Type2 &value, const bool condGEqValue) const
const L1MuGMTCand * getCandidate(const int indexCand) const
load muon candidates
const L1GlobalTriggerGTL * gtGTL() const
get / set the pointer to GTL
const bool evaluateCondition() const override
the core function to check if the condition matches
unsigned long long deltaPhiRange0Word
const std::vector< ObjectParameter > * objectParameter() const
Abs< T >::type abs(const T &t)
unsigned int chargeCorrelation
~L1GtMuonCondition() override
const bool checkObjectParameter(const int iCondition, const L1MuGMTCand &cand) const
function to check a single object if it matches a condition
void setGtGTL(const L1GlobalTriggerGTL *)
set the pointer to GTL
unsigned int qualityRange
unsigned int ptLowThreshold
int m_condMaxNumberObjects
const std::vector< const L1MuGMTCand * > * getCandL1Mu() const
return global muon trigger candidate
unsigned int quality() const
get quality
void setGtMuonTemplate(const L1GtMuonTemplate *)
const L1GlobalTriggerGTL * m_gtGTL
pointer to GTL, to be able to get the trigger objects
unsigned long long deltaEtaRange
const L1GtMuonTemplate * gtMuonTemplate() const
get / set the pointer to a L1GtCondition
void setGtCorrParDeltaPhiNrBins(const int &)
int factorial(int n)
factorial function
void print(std::ostream &myCout) const override
print the condition
virtual void print(std::ostream &myCout) const
print condition
const bool condGEq() const
get / set condition GEq flag
unsigned long long deltaPhiRange1Word
unsigned int ptIndex() const
get pt-code
CombinationsInCond const & getCombinationsInCond() const
get all the object combinations evaluated to true in the condition
void print(std::ostream &myCout) const override
print condition
bool condLastResult() const
get the latest result for the condition