Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:22

0001 /**
0002  * \class L1GtEnergySumTemplate
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 "CondFormats/L1TObjects/interface/L1GtEnergySumTemplate.h"
0019 
0020 // system include files
0021 
0022 #include <iostream>
0023 #include <iomanip>
0024 
0025 // user include files
0026 
0027 //   base class
0028 
0029 #include "CondFormats/L1TObjects/interface/L1GtFwd.h"
0030 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
0031 
0032 // forward declarations
0033 
0034 // constructors
0035 L1GtEnergySumTemplate::L1GtEnergySumTemplate() : L1GtCondition() { m_condCategory = CondEnergySum; }
0036 
0037 L1GtEnergySumTemplate::L1GtEnergySumTemplate(const std::string& cName) : L1GtCondition(cName) {
0038   m_condCategory = CondEnergySum;
0039 }
0040 
0041 L1GtEnergySumTemplate::L1GtEnergySumTemplate(const std::string& cName, const L1GtConditionType& cType)
0042     : L1GtCondition(cName, CondEnergySum, cType) {
0043   m_condCategory = CondEnergySum;
0044 
0045   // should be always 1 - they are global quantities...
0046   int nObjects = nrObjects();
0047 
0048   if (nObjects > 0) {
0049     m_objectParameter.reserve(nObjects);
0050     m_objectType.reserve(nObjects);
0051   }
0052 }
0053 
0054 // copy constructor
0055 L1GtEnergySumTemplate::L1GtEnergySumTemplate(const L1GtEnergySumTemplate& cp) : L1GtCondition(cp.m_condName) {
0056   copy(cp);
0057 }
0058 
0059 // destructor
0060 L1GtEnergySumTemplate::~L1GtEnergySumTemplate() {
0061   // empty now
0062 }
0063 
0064 // assign operator
0065 L1GtEnergySumTemplate& L1GtEnergySumTemplate::operator=(const L1GtEnergySumTemplate& cp) {
0066   copy(cp);
0067   return *this;
0068 }
0069 
0070 // setConditionParameter - set the parameters of the condition
0071 void L1GtEnergySumTemplate::setConditionParameter(const std::vector<ObjectParameter>& objParameter) {
0072   m_objectParameter = objParameter;
0073 }
0074 
0075 void L1GtEnergySumTemplate::print(std::ostream& myCout) const {
0076   myCout << "\n  L1GtEnergySumTemplate print..." << std::endl;
0077 
0078   L1GtCondition::print(myCout);
0079 
0080   int nObjects = nrObjects();
0081 
0082   for (int i = 0; i < nObjects; i++) {
0083     myCout << std::endl;
0084     myCout << "  Template for object " << i << " [ hex ]" << std::endl;
0085     myCout << "    etThreshold       = " << std::hex << m_objectParameter[i].etThreshold << std::endl;
0086     myCout << "    energyOverflow    = " << std::hex << m_objectParameter[0].energyOverflow << std::endl;
0087 
0088     if (m_condType == TypeETM) {
0089       myCout << "    phi               = " << std::hex << m_objectParameter[i].phiRange1Word << std::hex
0090              << m_objectParameter[i].phiRange0Word << std::endl;
0091     } else if (m_condType == TypeHTM) {
0092       myCout << "    phi               = " << std::hex << m_objectParameter[i].phiRange0Word << std::endl;
0093     }
0094   }
0095 
0096   // reset to decimal output
0097   myCout << std::dec << std::endl;
0098 }
0099 
0100 void L1GtEnergySumTemplate::copy(const L1GtEnergySumTemplate& cp) {
0101   m_condName = cp.condName();
0102   m_condCategory = cp.condCategory();
0103   m_condType = cp.condType();
0104   m_objectType = cp.objectType();
0105   m_condGEq = cp.condGEq();
0106   m_condChipNr = cp.condChipNr();
0107 
0108   m_objectParameter = *(cp.objectParameter());
0109 }
0110 
0111 // output stream operator
0112 std::ostream& operator<<(std::ostream& os, const L1GtEnergySumTemplate& result) {
0113   result.print(os);
0114   return os;
0115 }