CMS 3D CMS Logo

L1GtHfRingEtSumsCondition.cc

Go to the documentation of this file.
00001 
00017 // this class header
00018 #include "L1Trigger/GlobalTrigger/interface/L1GtHfRingEtSumsCondition.h"
00019 
00020 // system include files
00021 #include <iostream>
00022 #include <iomanip>
00023 
00024 #include <vector>
00025 
00026 // user include files
00027 //   base class
00028 #include "L1Trigger/GlobalTrigger/interface/L1GtConditionEvaluation.h"
00029 
00030 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
00031 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctHFRingEtSums.h"
00032 
00033 #include "CondFormats/L1TObjects/interface/L1GtHfRingEtSumsTemplate.h"
00034 
00035 #include "L1Trigger/GlobalTrigger/interface/L1GlobalTriggerPSB.h"
00036 
00037 // constructors
00038 //     default
00039 L1GtHfRingEtSumsCondition::L1GtHfRingEtSumsCondition() :
00040     L1GtConditionEvaluation() {
00041 
00042     //empty
00043 
00044 }
00045 
00046 //     from base template condition (from event setup usually)
00047 L1GtHfRingEtSumsCondition::L1GtHfRingEtSumsCondition(
00048         const L1GtCondition* etTemplate, const L1GlobalTriggerPSB* ptrPSB) :
00049     L1GtConditionEvaluation(), m_gtHfRingEtSumsTemplate(
00050             static_cast<const L1GtHfRingEtSumsTemplate*> (etTemplate)), m_gtPSB(
00051             ptrPSB)
00052 {
00053 
00054     // maximum number of objects received for the evaluation of the condition
00055     // no objects, in fact, just a number
00056     m_condMaxNumberObjects = 1;
00057 
00058 }
00059 
00060 // copy constructor
00061 void L1GtHfRingEtSumsCondition::copy(const L1GtHfRingEtSumsCondition &cp) {
00062 
00063     m_gtHfRingEtSumsTemplate = cp.gtHfRingEtSumsTemplate();
00064     m_gtPSB = cp.gtPSB();
00065 
00066     m_condMaxNumberObjects = cp.condMaxNumberObjects();
00067     m_condLastResult = cp.condLastResult();
00068     m_combinationsInCond = cp.getCombinationsInCond();
00069 
00070 }
00071 
00072 L1GtHfRingEtSumsCondition::L1GtHfRingEtSumsCondition(const L1GtHfRingEtSumsCondition& cp) :
00073     L1GtConditionEvaluation() {
00074 
00075     copy(cp);
00076 
00077 }
00078 
00079 // destructor
00080 L1GtHfRingEtSumsCondition::~L1GtHfRingEtSumsCondition() {
00081 
00082     // empty
00083 
00084 }
00085 
00086 // equal operator
00087 L1GtHfRingEtSumsCondition& L1GtHfRingEtSumsCondition::operator= (const L1GtHfRingEtSumsCondition& cp)
00088 {
00089     copy(cp);
00090     return *this;
00091 }
00092 
00093 // methods
00094 void L1GtHfRingEtSumsCondition::setGtHfRingEtSumsTemplate(const L1GtHfRingEtSumsTemplate* etTemplate) {
00095 
00096     m_gtHfRingEtSumsTemplate = etTemplate;
00097 
00098 }
00099 
00101 void L1GtHfRingEtSumsCondition::setGtPSB(const L1GlobalTriggerPSB* ptrPSB) {
00102 
00103     m_gtPSB = ptrPSB;
00104 
00105 }
00106 
00107 // try all object permutations and check spatial correlations, if required
00108 const bool L1GtHfRingEtSumsCondition::evaluateCondition() const {
00109 
00110     // number of trigger objects in the condition
00111     // no objects, in fact, just a number
00112     int iCondition = 0;
00113 
00114     // condition result condResult will be set to true if the HF Ring Et sums
00115     // passes the requirement
00116     bool condResult = false;
00117 
00118     // store the index of the HfRingEtSums object
00119     // from the combination evaluated in the condition
00120     SingleCombInCond objectsInComb;
00121 
00122     // clear the m_combinationsInCond vector
00123     (*m_combinationsInCond).clear();
00124 
00125     // get the HF Ring Et sums (event / condition)
00126     const L1GctHFRingEtSums* etSumCand = m_gtPSB->getCandL1HfRingEtSums();
00127 
00128     // protection against missing HF Ring Et sums collection
00129     if (etSumCand == 0) {
00130         return false;
00131     }
00132 
00133     const L1GtHfRingEtSumsTemplate::ObjectParameter objPar =
00134         ( *(m_gtHfRingEtSumsTemplate->objectParameter()) )[iCondition];
00135 
00136     // FIXME ask GCT to provide a method to retrieve it
00137     const unsigned int numberL1HfRingEtSums = 4;
00138 
00139     const unsigned int cIndex = objPar.etSumIndex;
00140     if (cIndex >= numberL1HfRingEtSums) {
00141 
00142         edm::LogError("L1GtHfRingEtSumsCondition") << "\nL1GtHfRingEtSumsCondition error: etSumIndex "
00143             << cIndex << "greater than GCT maximum index = " << numberL1HfRingEtSums
00144             << "\n  ==> condResult = false " << std::endl;
00145         return false;
00146 
00147     }
00148 
00149     const unsigned int etSumValue = etSumCand->etSum(cIndex);
00150 
00151     // check countThreshold
00152     if ( !checkThreshold(objPar.etSumThreshold, etSumValue, m_gtHfRingEtSumsTemplate->condGEq()) ) {
00153 
00154         return false;
00155     }
00156 
00157     // index is always zero - the object is in fact a count
00158     int indexObj = 0;
00159 
00160     objectsInComb.push_back(indexObj);
00161     (*m_combinationsInCond).push_back(objectsInComb);
00162 
00163     // if we get here all checks were successful for this combination
00164     // set the general result for evaluateCondition to "true"
00165 
00166     condResult = true;
00167     return condResult;
00168 
00169 }
00170 
00171 void L1GtHfRingEtSumsCondition::print(std::ostream& myCout) const {
00172 
00173     m_gtHfRingEtSumsTemplate->print(myCout);
00174     L1GtConditionEvaluation::print(myCout);
00175 
00176 }
00177 

Generated on Tue Jun 9 17:40:14 2009 for CMSSW by  doxygen 1.5.4