CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

L1GtCorrelationCondition Class Reference

#include <L1GtCorrelationCondition.h>

Inheritance diagram for L1GtCorrelationCondition:
L1GtConditionEvaluation

List of all members.

Public Member Functions

const bool evaluateCondition () const
 the core function to check if the condition matches
const L1GtCorrelationTemplategtCorrelationTemplate () const
 get / set the pointer to a L1GtCondition
const L1GlobalTriggerGTLgtGTL () const
 get / set the pointer to GTL
const L1GlobalTriggerPSBgtPSB () const
 get / set the pointer to PSB
 L1GtCorrelationCondition (const L1GtCorrelationCondition &)
 L1GtCorrelationCondition (const L1GtCondition *, const L1GtCondition *, const L1GtCondition *, const int, const int, const int, const int, const L1GlobalTriggerGTL *, const L1GlobalTriggerPSB *, const L1GtEtaPhiConversions *)
 from base template condition (from event setup usually)
 L1GtCorrelationCondition ()
L1GtCorrelationConditionoperator= (const L1GtCorrelationCondition &)
void print (std::ostream &myCout) const
 print condition
void setGtCorrelationTemplate (const L1GtCorrelationTemplate *)
void setGtGTL (const L1GlobalTriggerGTL *)
 set the pointer to GTL
void setGtPSB (const L1GlobalTriggerPSB *)
 set the pointer to PSB
virtual ~L1GtCorrelationCondition ()

Private Member Functions

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

Private Attributes

int m_cond0EtaBits
int m_cond0NrL1Objects
int m_cond1EtaBits
int m_cond1NrL1Objects
const L1GtConditionm_gtCond0
 pointer to first sub-condition
const L1GtConditionm_gtCond1
 pointer to second sub-condition
const L1GtCorrelationTemplatem_gtCorrelationTemplate
 pointer to a L1GtCorrelationTemplate
const L1GtEtaPhiConversionsm_gtEtaPhiConversions
 pointer to eta and phi conversion class
const L1GlobalTriggerGTLm_gtGTL
 pointer to GTL, to be able to get the trigger objects
const L1GlobalTriggerPSBm_gtPSB
 pointer to PSB, to be able to get the trigger objects
bool m_isDebugEnabled

Detailed Description

Description: evaluation of a CondCorrelation condition.

Implementation: <TODO: enter implementation details>

Author:
: Vasile Mihai Ghete - HEPHY Vienna

$Date$ $Revision$

Definition at line 36 of file L1GtCorrelationCondition.h.


Constructor & Destructor Documentation

L1GtCorrelationCondition::L1GtCorrelationCondition ( )

constructors default

Definition at line 60 of file L1GtCorrelationCondition.cc.

L1GtCorrelationCondition::L1GtCorrelationCondition ( const L1GtCondition corrTemplate,
const L1GtCondition cond0Condition,
const L1GtCondition cond1Condition,
const int  cond0NrL1Objects,
const int  cond1NrL1Objects,
const int  cond0EtaBits,
const int  cond1EtaBits,
const L1GlobalTriggerGTL ptrGTL,
const L1GlobalTriggerPSB ptrPSB,
const L1GtEtaPhiConversions etaPhiConversions 
)

from base template condition (from event setup usually)

Definition at line 70 of file L1GtCorrelationCondition.cc.

References L1GtConditionEvaluation::m_condMaxNumberObjects.

                                                        :
            L1GtConditionEvaluation(),
            m_gtCorrelationTemplate(static_cast<const L1GtCorrelationTemplate*>(corrTemplate)),
            m_gtCond0(cond0Condition), m_gtCond1(cond1Condition),
            m_cond0NrL1Objects(cond0NrL1Objects),
            m_cond1NrL1Objects(cond1NrL1Objects), m_cond0EtaBits(cond0EtaBits),
            m_cond1EtaBits(cond1EtaBits), m_gtGTL(ptrGTL), m_gtPSB(ptrPSB),
            m_gtEtaPhiConversions(etaPhiConversions),
            m_isDebugEnabled(edm::isDebugEnabled())
            {

    m_condMaxNumberObjects = 2; // irrelevant for correlation conditions

}
L1GtCorrelationCondition::L1GtCorrelationCondition ( const L1GtCorrelationCondition cp)

Definition at line 120 of file L1GtCorrelationCondition.cc.

References copy().

L1GtCorrelationCondition::~L1GtCorrelationCondition ( ) [virtual]

Definition at line 127 of file L1GtCorrelationCondition.cc.

                                                    {

    // empty

}

Member Function Documentation

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

the core function to check if the condition matches

Implements L1GtConditionEvaluation.

Definition at line 164 of file L1GtCorrelationCondition.cc.

References CenJet, L1GtCorrelationTemplate::cond0Category(), L1GtCorrelationTemplate::cond1Category(), CondCalo, CondEnergySum, L1GtConditionEvaluation::condLastResult(), CondMuon, L1GtConditionEvaluation::evaluateConditionStoreResult(), ForJet, L1GlobalTriggerPSB::getCandL1CenJet(), L1GlobalTriggerPSB::getCandL1ETM(), L1GlobalTriggerPSB::getCandL1ForJet(), L1GlobalTriggerPSB::getCandL1IsoEG(), L1GlobalTriggerGTL::getCandL1Mu(), L1GlobalTriggerPSB::getCandL1NoIsoEG(), L1GlobalTriggerPSB::getCandL1TauJet(), L1GtConditionEvaluation::getCombinationsInCond(), IsoEG, LogTrace, m_cond0EtaBits, m_cond0NrL1Objects, m_cond1EtaBits, m_cond1NrL1Objects, m_gtCond0, m_gtCond1, m_gtCorrelationTemplate, m_gtGTL, m_gtPSB, m_isDebugEnabled, L1GtConditionEvaluation::m_verbosity, NoIsoEG, L1GtCondition::objectType(), L1GctEtMiss::phi(), L1GtCaloCondition::print(), L1GtMuonCondition::print(), L1GtEnergySumCondition::print(), and TauJet.

                                                             {

    bool condResult = false;

    // number of objects in condition (it is 2, no need to retrieve from
    // condition template) and their type
    int nObjInCond = 2;
    std::vector<L1GtObject> cndObjTypeVec(nObjInCond);

    // evaluate first the two sub-conditions (Type1s)

    const L1GtConditionCategory cond0Categ = m_gtCorrelationTemplate->cond0Category();
    const L1GtConditionCategory cond1Categ = m_gtCorrelationTemplate->cond1Category();

    const L1GtMuonTemplate* corrMuon = 0;
    const L1GtCaloTemplate* corrCalo = 0;
    const L1GtEnergySumTemplate* corrEnergySum = 0;

    CombinationsInCond cond0Comb;
    CombinationsInCond cond1Comb;

    switch (cond0Categ) {
        case CondMuon: {
            corrMuon = static_cast<const L1GtMuonTemplate*>(m_gtCond0);
            L1GtMuonCondition muCondition(corrMuon, m_gtGTL,
                    m_cond0NrL1Objects, m_cond0EtaBits);

            muCondition.evaluateConditionStoreResult();
            condResult = muCondition.condLastResult();

            cond0Comb = *(muCondition.getCombinationsInCond());
            cndObjTypeVec[0] = (corrMuon->objectType())[0];

            if (m_verbosity && m_isDebugEnabled ) {
                std::ostringstream myCout;
                muCondition.print(myCout);

                LogTrace("L1GtCorrelationCondition") << myCout.str() << std::endl;
            }
        }
            break;
        case CondCalo: {
            corrCalo = static_cast<const L1GtCaloTemplate*>(m_gtCond0);
            L1GtCaloCondition caloCondition(corrCalo, m_gtPSB,
                    m_cond0NrL1Objects, m_cond0NrL1Objects, m_cond0NrL1Objects,
                    m_cond0NrL1Objects, m_cond0NrL1Objects, m_cond0EtaBits);

            caloCondition.evaluateConditionStoreResult();
            condResult = caloCondition.condLastResult();

            cond0Comb = *(caloCondition.getCombinationsInCond());
            cndObjTypeVec[0] = (corrCalo->objectType())[0];

            if (m_verbosity && m_isDebugEnabled ) {
                std::ostringstream myCout;
                caloCondition.print(myCout);

                LogTrace("L1GtCorrelationCondition") << myCout.str() << std::endl;
            }
        }
            break;
        case CondEnergySum: {
            corrEnergySum = static_cast<const L1GtEnergySumTemplate*>(m_gtCond0);
            L1GtEnergySumCondition eSumCondition(corrEnergySum, m_gtPSB);

            eSumCondition.evaluateConditionStoreResult();
            condResult = eSumCondition.condLastResult();

            cond0Comb = *(eSumCondition.getCombinationsInCond());
            cndObjTypeVec[0] = (corrEnergySum->objectType())[0];

            if (m_verbosity && m_isDebugEnabled ) {
                std::ostringstream myCout;
                eSumCondition.print(myCout);

                LogTrace("L1GtCorrelationCondition") << myCout.str() << std::endl;
            }
        }
            break;
        default: {
            // should not arrive here
            condResult = false;
        }
            break;
    }

    // return if first subcondition is false
    if (!condResult) {
        return false;
    }


    switch (cond1Categ) {
        case CondMuon: {
            corrMuon = static_cast<const L1GtMuonTemplate*>(m_gtCond1);
            L1GtMuonCondition muCondition(corrMuon, m_gtGTL,
                    m_cond1NrL1Objects, m_cond1EtaBits);

            muCondition.evaluateConditionStoreResult();
            condResult = muCondition.condLastResult();

            cond1Comb = *(muCondition.getCombinationsInCond());
            cndObjTypeVec[1] = (corrMuon->objectType())[0];

            if (m_verbosity && m_isDebugEnabled ) {
                std::ostringstream myCout;
                muCondition.print(myCout);

                LogTrace("L1GtCorrelationCondition") << myCout.str() << std::endl;
            }
        }
            break;
        case CondCalo: {
            corrCalo = static_cast<const L1GtCaloTemplate*>(m_gtCond1);
            L1GtCaloCondition caloCondition(corrCalo, m_gtPSB,
                    m_cond1NrL1Objects, m_cond1NrL1Objects, m_cond1NrL1Objects,
                    m_cond1NrL1Objects, m_cond1NrL1Objects, m_cond1EtaBits);

            caloCondition.evaluateConditionStoreResult();
            condResult = caloCondition.condLastResult();

            cond1Comb = *(caloCondition.getCombinationsInCond());
            cndObjTypeVec[1] = (corrCalo->objectType())[0];

            if (m_verbosity && m_isDebugEnabled ) {
                std::ostringstream myCout;
                caloCondition.print(myCout);

                LogTrace("L1GtCorrelationCondition") << myCout.str() << std::endl;
            }
        }
            break;
        case CondEnergySum: {
            corrEnergySum = static_cast<const L1GtEnergySumTemplate*>(m_gtCond1);
            L1GtEnergySumCondition eSumCondition(corrEnergySum, m_gtPSB);
            eSumCondition.evaluateConditionStoreResult();
            condResult = eSumCondition.condLastResult();

            cond1Comb = *(eSumCondition.getCombinationsInCond());
            cndObjTypeVec[1] = (corrEnergySum->objectType())[0];

            if (m_verbosity && m_isDebugEnabled ) {
                std::ostringstream myCout;
                eSumCondition.print(myCout);

                LogTrace("L1GtCorrelationCondition") << myCout.str() << std::endl;
            }
        }
            break;
        default: {
            // should not arrive here
            condResult = false;
        }
            break;
    }

    // return if second subcondition is false
    // if here, the first subcondition was true
    if (!condResult) {
        return false;
    }

    //
    // evaluate the delta_eta and delta_phi correlations
    //

    // store the indices of the calorimeter objects
    // from the combination evaluated in the condition
    SingleCombInCond objectsInComb;
    objectsInComb.reserve(nObjInCond);

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

    // pointers to objects
    const std::vector<const L1MuGMTCand*>* candMuVec = 0;
    const std::vector<const L1GctCand*>* candCaloVec = 0;
    const L1GctEtMiss* candETM = 0; // no other energy sum appears in correlation conditions

    unsigned int phiIndex0 = 0;
    unsigned int phiIndex1 = 0;
    unsigned int etaIndex0 = 0;
    unsigned int etaIndex1 = 0;

    // loop over all combinations which produced individually "true" as Type1s
    for (std::vector<SingleCombInCond>::const_iterator
        it0Comb = cond0Comb.begin(); it0Comb != cond0Comb.end(); it0Comb++) {

        // Type1s: there is 1 object only, no need for a loop (*it0Comb)[0]
        int obj0Index = (*it0Comb)[0];
        switch (cond0Categ) {
            case CondMuon: {
                candMuVec = m_gtGTL->getCandL1Mu();
                phiIndex0 = (*candMuVec)[obj0Index]->phiIndex();
                etaIndex0 = (*candMuVec)[obj0Index]->etaIndex();

            }
                break;
            case CondCalo: {
                switch (cndObjTypeVec[0]) {
                    case NoIsoEG:
                        candCaloVec = m_gtPSB->getCandL1NoIsoEG();
                        break;
                    case IsoEG:
                        candCaloVec = m_gtPSB->getCandL1IsoEG();
                        break;
                    case CenJet:
                        candCaloVec = m_gtPSB->getCandL1CenJet();
                        break;
                    case ForJet:
                        candCaloVec = m_gtPSB->getCandL1ForJet();
                        break;
                    case TauJet:
                        candCaloVec = m_gtPSB->getCandL1TauJet();
                        break;
                    default:
                        // do nothing
                        break;
                }

                phiIndex0 = (*candCaloVec)[obj0Index]->phiIndex();
                etaIndex0 = (*candCaloVec)[obj0Index]->etaIndex();
            }
                break;
            case CondEnergySum: {
                candETM = m_gtPSB->getCandL1ETM();
                phiIndex0 = candETM->phi();
            }
                break;
            default: {
                // should not arrive here
                condResult = false;
            }
                break;
        }

        for (std::vector<SingleCombInCond>::const_iterator
            it1Comb = cond1Comb.begin(); it1Comb != cond1Comb.end(); it1Comb++) {

            // Type1s: there is 1 object only, no need for a loop (*it1Comb)[0]
            int obj1Index = (*it1Comb)[0];
            switch (cond1Categ) {
                case CondMuon: {
                    candMuVec = m_gtGTL->getCandL1Mu();
                    phiIndex1 = (*candMuVec)[obj1Index]->phiIndex();
                    etaIndex1 = (*candMuVec)[obj1Index]->etaIndex();

                }
                    break;
                case CondCalo: {
                    switch (cndObjTypeVec[1]) {
                        case NoIsoEG:
                            candCaloVec = m_gtPSB->getCandL1NoIsoEG();
                            break;
                        case IsoEG:
                            candCaloVec = m_gtPSB->getCandL1IsoEG();
                            break;
                        case CenJet:
                            candCaloVec = m_gtPSB->getCandL1CenJet();
                            break;
                        case ForJet:
                            candCaloVec = m_gtPSB->getCandL1ForJet();
                            break;
                        case TauJet:
                            candCaloVec = m_gtPSB->getCandL1TauJet();
                            break;
                        default:
                            // do nothing
                            break;
                    }

                    phiIndex1 = (*candCaloVec)[obj1Index]->phiIndex();
                    etaIndex1 = (*candCaloVec)[obj1Index]->etaIndex();
                }
                    break;
                case CondEnergySum: {
                    candETM = m_gtPSB->getCandL1ETM();
                    phiIndex1 = candETM->phi();
                }
                    break;
                default: {
                    // should not arrive here
                    condResult = false;
                }
                    break;
            }

            if (m_verbosity && m_isDebugEnabled ) {
                LogTrace("L1GtCorrelationCondition")
                    << "\n First correlation object of type   " << cndObjTypeVec[0]
                    << " with collection index " << obj0Index
                    << ": phiIndex = " << phiIndex0 << " etaIndex = " << etaIndex0
                    << "\n Second correlation object  of type " << cndObjTypeVec[1]
                    << " with collection index " << obj1Index
                    << " phiIndex = " << phiIndex1 << " etaIndex = " << etaIndex1
                    << std::endl;
            }

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

            objectsInComb.push_back(obj0Index);
            objectsInComb.push_back(obj1Index); //...

            // evaluate delta_eta

            // evaluate delta_phi

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

            condResult = true;
            (*m_combinationsInCond).push_back(objectsInComb);

        }

    }

    return condResult;

}
const L1GtCorrelationTemplate* L1GtCorrelationCondition::gtCorrelationTemplate ( ) const [inline]

get / set the pointer to a L1GtCondition

Definition at line 71 of file L1GtCorrelationCondition.h.

References m_gtCorrelationTemplate.

const L1GlobalTriggerGTL* L1GtCorrelationCondition::gtGTL ( ) const [inline]

get / set the pointer to GTL

Definition at line 78 of file L1GtCorrelationCondition.h.

References m_gtGTL.

                                                   {
        return m_gtGTL;
    }
const L1GlobalTriggerPSB* L1GtCorrelationCondition::gtPSB ( ) const [inline]

get / set the pointer to PSB

Definition at line 85 of file L1GtCorrelationCondition.h.

References m_gtPSB.

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

Definition at line 134 of file L1GtCorrelationCondition.cc.

References copy().

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

print condition

Reimplemented from L1GtConditionEvaluation.

Definition at line 488 of file L1GtCorrelationCondition.cc.

References m_gtCorrelationTemplate, and L1GtCorrelationTemplate::print().

Referenced by L1GlobalTriggerGTL::run().

void L1GtCorrelationCondition::setGtCorrelationTemplate ( const L1GtCorrelationTemplate corrTempl)

Definition at line 142 of file L1GtCorrelationCondition.cc.

References m_gtCorrelationTemplate.

                                                  {

    m_gtCorrelationTemplate = corrTempl;

}
void L1GtCorrelationCondition::setGtGTL ( const L1GlobalTriggerGTL ptrGTL)

set the pointer to GTL

Definition at line 150 of file L1GtCorrelationCondition.cc.

References m_gtGTL.

                                                                        {

    m_gtGTL = ptrGTL;

}
void L1GtCorrelationCondition::setGtPSB ( const L1GlobalTriggerPSB ptrPSB)

set the pointer to PSB

Definition at line 157 of file L1GtCorrelationCondition.cc.

References m_gtPSB.

                                                                        {

    m_gtPSB = ptrPSB;

}

Member Data Documentation

Definition at line 110 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

Definition at line 108 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

Definition at line 111 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

Definition at line 109 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

pointer to first sub-condition

Definition at line 102 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

pointer to second sub-condition

Definition at line 105 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

pointer to eta and phi conversion class

Definition at line 120 of file L1GtCorrelationCondition.h.

Referenced by copy().

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

Definition at line 114 of file L1GtCorrelationCondition.h.

Referenced by copy(), evaluateCondition(), gtGTL(), and setGtGTL().

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

Definition at line 117 of file L1GtCorrelationCondition.h.

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

Definition at line 124 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().