Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:57

0001 /**
0002  * \class EnergySumTemplate
0003  *
0004  *
0005  * Description: L1 Global Trigger energy-sum template.
0006  *
0007  * Implementation:
0008  *    <TODO: enter implementation details>
0009  *
0010  * \author: Vasile Mihai Ghete - HEPHY Vienna
0011  *
0012  * $Date$
0013  * $Revision$
0014  *
0015  */
0016 
0017 // this class header
0018 #include "L1Trigger/L1TGlobal/interface/EnergySumTemplate.h"
0019 
0020 // system include files
0021 
0022 #include <iostream>
0023 #include <iomanip>
0024 
0025 // user include files
0026 
0027 //   base class
0028 
0029 // forward declarations
0030 
0031 // constructors
0032 EnergySumTemplate::EnergySumTemplate() : GlobalCondition() { m_condCategory = l1t::CondEnergySum; }
0033 
0034 EnergySumTemplate::EnergySumTemplate(const std::string& cName) : GlobalCondition(cName) {
0035   m_condCategory = l1t::CondEnergySum;
0036 }
0037 
0038 EnergySumTemplate::EnergySumTemplate(const std::string& cName, const l1t::GtConditionType& cType)
0039     : GlobalCondition(cName, l1t::CondEnergySum, cType) {
0040   m_condCategory = l1t::CondEnergySum;
0041 
0042   // should be always 1 - they are global quantities...
0043   int nObjects = nrObjects();
0044 
0045   if (nObjects > 0) {
0046     m_objectParameter.reserve(nObjects);
0047     m_objectType.reserve(nObjects);
0048   }
0049 }
0050 
0051 // copy constructor
0052 EnergySumTemplate::EnergySumTemplate(const EnergySumTemplate& cp) : GlobalCondition(cp.m_condName) { copy(cp); }
0053 
0054 // destructor
0055 EnergySumTemplate::~EnergySumTemplate() {
0056   // empty now
0057 }
0058 
0059 // assign operator
0060 EnergySumTemplate& EnergySumTemplate::operator=(const EnergySumTemplate& cp) {
0061   copy(cp);
0062   return *this;
0063 }
0064 
0065 // setConditionParameter - set the parameters of the condition
0066 void EnergySumTemplate::setConditionParameter(const std::vector<ObjectParameter>& objParameter) {
0067   m_objectParameter = objParameter;
0068 }
0069 
0070 void EnergySumTemplate::print(std::ostream& myCout) const {
0071   myCout << "\n  EnergySumTemplate print..." << std::endl;
0072 
0073   GlobalCondition::print(myCout);
0074 
0075   int nObjects = nrObjects();
0076 
0077   for (int i = 0; i < nObjects; i++) {
0078     myCout << std::endl;
0079     myCout << "  Template for object " << i << " [ hex ]" << std::endl;
0080     myCout << "    etThreshold       = " << std::hex << m_objectParameter[i].etLowThreshold << " - "
0081            << m_objectParameter[i].etHighThreshold << std::endl;
0082     myCout << "    energyOverflow    = " << std::hex << m_objectParameter[0].energyOverflow << std::endl;
0083 
0084     if (m_condType == l1t::TypeETM) {
0085       myCout << "    phi               = " << std::hex << m_objectParameter[i].phiRange1Word << std::hex
0086              << m_objectParameter[i].phiRange0Word << std::endl;
0087     } else if (m_condType == l1t::TypeHTM) {
0088       myCout << "    phi               = " << std::hex << m_objectParameter[i].phiRange0Word << std::endl;
0089     } else if (m_condType == l1t::TypeETMHF) {
0090       myCout << "    phi               = " << std::hex << m_objectParameter[i].phiRange0Word << std::endl;
0091     }
0092   }
0093 
0094   // reset to decimal output
0095   myCout << std::dec << std::endl;
0096 }
0097 
0098 void EnergySumTemplate::copy(const EnergySumTemplate& cp) {
0099   m_condName = cp.condName();
0100   m_condCategory = cp.condCategory();
0101   m_condType = cp.condType();
0102   m_objectType = cp.objectType();
0103   m_condGEq = cp.condGEq();
0104   m_condChipNr = cp.condChipNr();
0105   m_condRelativeBx = cp.condRelativeBx();
0106 
0107   m_objectParameter = *(cp.objectParameter());
0108 }
0109 
0110 // output stream operator
0111 std::ostream& operator<<(std::ostream& os, const EnergySumTemplate& result) {
0112   result.print(os);
0113   return os;
0114 }