CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

L1GtEnergySumCondition Class Reference

#include <L1GtEnergySumCondition.h>

Inheritance diagram for L1GtEnergySumCondition:
L1GtConditionEvaluation

List of all members.

Public Member Functions

const bool evaluateCondition () const
 the core function to check if the condition matches
const L1GtEnergySumTemplategtEnergySumTemplate () const
 get / set the pointer to a L1GtCondition
const L1GlobalTriggerPSBgtPSB () const
 get / set the pointer to PSB
 L1GtEnergySumCondition (const L1GtCondition *, const L1GlobalTriggerPSB *)
 from base template condition (from event setup usually)
 L1GtEnergySumCondition ()
 L1GtEnergySumCondition (const L1GtEnergySumCondition &)
L1GtEnergySumConditionoperator= (const L1GtEnergySumCondition &)
void print (std::ostream &myCout) const
 print condition
void setGtEnergySumTemplate (const L1GtEnergySumTemplate *)
void setGtPSB (const L1GlobalTriggerPSB *)
 set the pointer to PSB
virtual ~L1GtEnergySumCondition ()

Private Member Functions

void copy (const L1GtEnergySumCondition &cp)
 copy function for copy constructor and operator=

Private Attributes

const L1GtEnergySumTemplatem_gtEnergySumTemplate
 pointer to a L1GtEnergySumTemplate
const L1GlobalTriggerPSBm_gtPSB
 pointer to PSB, to be able to get the trigger objects

Detailed Description

Description: evaluation of a CondEnergySum condition.

Implementation: <TODO: enter implementation details>

Author:
: Vasile Mihai Ghete - HEPHY Vienna

$Date$ $Revision$

Definition at line 35 of file L1GtEnergySumCondition.h.


Constructor & Destructor Documentation

L1GtEnergySumCondition::L1GtEnergySumCondition ( )

constructors default

Definition at line 42 of file L1GtEnergySumCondition.cc.

                                               :
    L1GtConditionEvaluation() {

    //empty

}
L1GtEnergySumCondition::L1GtEnergySumCondition ( const L1GtCondition eSumTemplate,
const L1GlobalTriggerPSB ptrPSB 
)

from base template condition (from event setup usually)

Definition at line 50 of file L1GtEnergySumCondition.cc.

References L1GtConditionEvaluation::m_condMaxNumberObjects.

                                      :
    L1GtConditionEvaluation(),
    m_gtEnergySumTemplate(static_cast<const L1GtEnergySumTemplate*>(eSumTemplate)),
    m_gtPSB(ptrPSB)

{

    // maximum number of objects received for the evaluation of the condition
    // energy sums are global quantities - one object per event

    m_condMaxNumberObjects = 1;

}
L1GtEnergySumCondition::L1GtEnergySumCondition ( const L1GtEnergySumCondition cp)

Definition at line 79 of file L1GtEnergySumCondition.cc.

References copy().

L1GtEnergySumCondition::~L1GtEnergySumCondition ( ) [virtual]

Definition at line 87 of file L1GtEnergySumCondition.cc.

                                                {

    // empty

}

Member Function Documentation

void L1GtEnergySumCondition::copy ( const L1GtEnergySumCondition cp) [private]
const bool L1GtEnergySumCondition::evaluateCondition ( ) const [virtual]

the core function to check if the condition matches

Implements L1GtConditionEvaluation.

Definition at line 116 of file L1GtEnergySumCondition.cc.

References L1GtConditionEvaluation::checkBit(), L1GtConditionEvaluation::checkThreshold(), L1GtCondition::condGEq(), L1GctEtTotal::et(), L1GctEtHad::et(), L1GctEtMiss::et(), L1GctHtMiss::et(), ETM, ETT, L1GtEnergySumTemplate::ObjectParameter::etThreshold, L1GlobalTriggerPSB::getCandL1ETM(), L1GlobalTriggerPSB::getCandL1ETT(), L1GlobalTriggerPSB::getCandL1HTM(), L1GlobalTriggerPSB::getCandL1HTT(), HTM, HTT, m_gtEnergySumTemplate, m_gtPSB, L1GtEnergySumTemplate::objectParameter(), L1GtCondition::objectType(), L1GctEtMiss::overFlow(), L1GctHtMiss::overFlow(), L1GctEtHad::overFlow(), L1GctEtTotal::overFlow(), L1GctHtMiss::phi(), L1GctEtMiss::phi(), L1GtEnergySumTemplate::ObjectParameter::phiRange0Word, and L1GtEnergySumTemplate::ObjectParameter::phiRange1Word.

                                                           {

    // number of trigger objects in the condition
    // in fact, there is only one object
    int iCondition = 0;

    // condition result condResult set to true if the energy sum
    // passes all requirements
    bool condResult = false;

    // store the indices of the calorimeter objects
    // from the combination evaluated in the condition
    SingleCombInCond objectsInComb;

    // clear the m_combinationsInCond vector
    (*m_combinationsInCond).clear();

    // clear the indices in the combination
    objectsInComb.clear();

    // get energy, phi (ETM and HTM) and overflow for the trigger object

    unsigned int candEt = 0;
    unsigned int candPhi = 0;
    bool candOverflow = false;

    switch ((m_gtEnergySumTemplate->objectType())[0]) {
        case ETT: {
            const L1GctEtTotal* cand1 = m_gtPSB->getCandL1ETT();

            if (cand1 == 0) {
                return false;
            }

            candEt = cand1->et();
            candOverflow = cand1->overFlow();

            break;
        }
        case ETM: {
            const L1GctEtMiss* cand2 = m_gtPSB->getCandL1ETM();

            if (cand2 == 0) {
                return false;
            }

            candEt = cand2->et();
            candPhi = cand2->phi();
            candOverflow = cand2->overFlow();

            break;
        }
        case HTT: {
            const L1GctEtHad* cand3 = m_gtPSB->getCandL1HTT();

            if (cand3 == 0) {
                return false;
            }

            candEt = cand3->et();
            candOverflow = cand3->overFlow();

            break;
        }
        case HTM: {
            const L1GctHtMiss* cand4 = m_gtPSB->getCandL1HTM();

            if (cand4 == 0) {
                return false;
            }

            candEt = cand4->et();
            candPhi = cand4->phi();
            candOverflow = cand4->overFlow();

            break;
        }
        default: {
            // should not arrive here
            return false;

            break;
        }
    }

    const L1GtEnergySumTemplate::ObjectParameter objPar =
        ( *(m_gtEnergySumTemplate->objectParameter()) )[iCondition];

    // check energy threshold and overflow
    // overflow evaluation:
    //     for condGEq >=
    //         candidate overflow true -> condition true
    //         candidate overflow false -> evaluate threshold
    //     for condGEq =
    //         candidate overflow true -> condition false
    //         candidate overflow false -> evaluate threshold
    //

    bool condGEqVal = m_gtEnergySumTemplate->condGEq();

    if (condGEqVal) {
        if (!candOverflow) {
            if (!checkThreshold(objPar.etThreshold, candEt, condGEqVal)) {
                return false;
            }
        }
    } else {
        if (candOverflow) {
            return false;
        } else {
            if (!checkThreshold(objPar.etThreshold, candEt, condGEqVal)) {
                return false;
            }
        }

    }

    // for ETM and HTM check phi also
    // for overflow, the phi requirements are ignored

    if (!candOverflow) {
        if ( ( m_gtEnergySumTemplate->objectType() )[0] == ETM) {

            // phi bitmask is saved in two uint64_t (see parser)
            if (candPhi < 64) {
                if (!checkBit(objPar.phiRange0Word, candPhi)) {

                    return false;
                }
            } else {
                if (!checkBit(objPar.phiRange1Word, candPhi - 64)) {

                    return false;
                }
            }

        } else if ( ( m_gtEnergySumTemplate->objectType() )[0] == HTM) {

            // phi bitmask is in the first word for HTM
            if (candPhi < 64) {
                if (!checkBit(objPar.phiRange0Word, candPhi)) {

                    return false;
                }
            } else {
                if (!checkBit(objPar.phiRange1Word, candPhi - 64)) {

                    return false;
                }
            }
        }
    }


    // index is always zero, as they are global quantities (there is only one object)
    int indexObj = 0;

    objectsInComb.push_back(indexObj);
    (*m_combinationsInCond).push_back(objectsInComb);

    // if we get here all checks were successfull for this combination
    // set the general result for evaluateCondition to "true"

    condResult = true;
    return condResult;

}
const L1GtEnergySumTemplate* L1GtEnergySumCondition::gtEnergySumTemplate ( ) const [inline]

get / set the pointer to a L1GtCondition

Definition at line 67 of file L1GtEnergySumCondition.h.

References m_gtEnergySumTemplate.

Referenced by copy().

                                                                    {
        return m_gtEnergySumTemplate;
    }
const L1GlobalTriggerPSB* L1GtEnergySumCondition::gtPSB ( ) const [inline]

get / set the pointer to PSB

Definition at line 74 of file L1GtEnergySumCondition.h.

References m_gtPSB.

Referenced by copy().

                                                   {
        return m_gtPSB;
    }
L1GtEnergySumCondition & L1GtEnergySumCondition::operator= ( const L1GtEnergySumCondition cp)

Definition at line 94 of file L1GtEnergySumCondition.cc.

References copy().

{
    copy(cp);
    return *this;
}
void L1GtEnergySumCondition::print ( std::ostream &  myCout) const [virtual]
void L1GtEnergySumCondition::setGtEnergySumTemplate ( const L1GtEnergySumTemplate eSumTempl)

Definition at line 101 of file L1GtEnergySumCondition.cc.

References m_gtEnergySumTemplate.

                                            {

    m_gtEnergySumTemplate = eSumTempl;

}
void L1GtEnergySumCondition::setGtPSB ( const L1GlobalTriggerPSB ptrPSB)

set the pointer to PSB

Definition at line 109 of file L1GtEnergySumCondition.cc.

References m_gtPSB.

                                                                      {

    m_gtPSB = ptrPSB;

}

Member Data Documentation

pointer to PSB, to be able to get the trigger objects

Definition at line 91 of file L1GtEnergySumCondition.h.

Referenced by copy(), evaluateCondition(), gtPSB(), and setGtPSB().