Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /**
0002  * \class L1GtCorrelationTemplate
0003  *
0004  *
0005  * Description: L1 Global Trigger correlation template.
0006  * Includes spatial correlation for two objects of different type.
0007  *
0008  * Implementation:
0009  *    <TODO: enter implementation details>
0010  *
0011  * \author: Vasile Mihai Ghete - HEPHY Vienna
0012  *
0013  * $Date$
0014  * $Revision$
0015  *
0016  */
0017 
0018 // this class header
0019 #include "CondFormats/L1TObjects/interface/L1GtCorrelationTemplate.h"
0020 
0021 // system include files
0022 
0023 #include <iostream>
0024 #include <iomanip>
0025 
0026 // user include files
0027 //   base class
0028 
0029 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
0030 
0031 // forward declarations
0032 
0033 // constructors
0034 //   default
0035 
0036 L1GtCorrelationTemplate::L1GtCorrelationTemplate() : L1GtCondition() {
0037   m_condCategory = CondCorrelation;
0038   m_condType = Type2cor;
0039   m_condChipNr = -1;
0040 
0041   // there are in fact two objects
0042   int nObjects = nrObjects();
0043 
0044   if (nObjects > 0) {
0045     m_objectType.reserve(nObjects);
0046   }
0047 
0048   m_cond0Category = CondNull;
0049   m_cond1Category = CondNull;
0050   m_cond0Index = -1;
0051   m_cond1Index = -1;
0052 }
0053 
0054 //   from condition name
0055 L1GtCorrelationTemplate::L1GtCorrelationTemplate(const std::string& cName) : L1GtCondition(cName) {
0056   m_condCategory = CondCorrelation;
0057   m_condType = Type2cor;
0058   m_condChipNr = -1;
0059 
0060   // there are in fact two objects
0061   int nObjects = nrObjects();
0062 
0063   if (nObjects > 0) {
0064     m_objectType.reserve(nObjects);
0065   }
0066 
0067   m_cond0Category = CondNull;
0068   m_cond1Category = CondNull;
0069   m_cond0Index = -1;
0070   m_cond1Index = -1;
0071 }
0072 
0073 //   from condition name, the category of first sub-condition, the category of the
0074 //   second sub-condition, the index of first sub-condition in the cor* vector,
0075 //   the index of second sub-condition in the cor* vector
0076 L1GtCorrelationTemplate::L1GtCorrelationTemplate(const std::string& cName,
0077                                                  const L1GtConditionCategory& cond0Cat,
0078                                                  const L1GtConditionCategory& cond1Cat,
0079                                                  const int cond0Index,
0080                                                  const int cond1index)
0081     : L1GtCondition(cName),
0082       m_cond0Category(cond0Cat),
0083       m_cond1Category(cond1Cat),
0084       m_cond0Index(cond0Index),
0085       m_cond1Index(cond1index)
0086 
0087 {
0088   m_condCategory = CondCorrelation;
0089   m_condType = Type2cor;
0090   m_condChipNr = -1;
0091 
0092   // there are in fact two objects
0093   int nObjects = nrObjects();
0094 
0095   if (nObjects > 0) {
0096     m_objectType.resize(nObjects);
0097   }
0098 }
0099 
0100 // copy constructor
0101 L1GtCorrelationTemplate::L1GtCorrelationTemplate(const L1GtCorrelationTemplate& cp) : L1GtCondition(cp.m_condName) {
0102   copy(cp);
0103 }
0104 
0105 // destructor
0106 L1GtCorrelationTemplate::~L1GtCorrelationTemplate() {
0107   // empty now
0108 }
0109 
0110 // assign operator
0111 L1GtCorrelationTemplate& L1GtCorrelationTemplate::operator=(const L1GtCorrelationTemplate& cp) {
0112   copy(cp);
0113   return *this;
0114 }
0115 
0116 // set the category of the two sub-conditions
0117 void L1GtCorrelationTemplate::setCond0Category(const L1GtConditionCategory& condCateg) { m_cond0Category = condCateg; }
0118 
0119 void L1GtCorrelationTemplate::setCond1Category(const L1GtConditionCategory& condCateg) { m_cond1Category = condCateg; }
0120 
0121 // set the index of the two sub-conditions in the cor* vector from menu
0122 void L1GtCorrelationTemplate::setCond0Index(const int& condIndex) { m_cond0Index = condIndex; }
0123 
0124 void L1GtCorrelationTemplate::setCond1Index(const int& condIndex) { m_cond1Index = condIndex; }
0125 
0126 // set the correlation parameters of the condition
0127 void L1GtCorrelationTemplate::setCorrelationParameter(const CorrelationParameter& corrParameter) {
0128   m_correlationParameter = corrParameter;
0129 }
0130 
0131 void L1GtCorrelationTemplate::print(std::ostream& myCout) const {
0132   myCout << "\n  L1GtCorrelationTemplate print..." << std::endl;
0133 
0134   L1GtCondition::print(myCout);
0135 
0136   myCout << "\n  First sub-condition category:  " << m_cond0Category << std::endl;
0137   myCout << "  Second sub-condition category: " << m_cond1Category << std::endl;
0138 
0139   myCout << "\n  First sub-condition index:  " << m_cond0Index << std::endl;
0140   myCout << "  Second sub-condition index: " << m_cond1Index << std::endl;
0141 
0142   myCout << "\n  Correlation parameters "
0143          << "[ hex ]" << std::endl;
0144 
0145   myCout << "    deltaEtaRange      = " << std::hex << m_correlationParameter.deltaEtaRange << std::endl;
0146   myCout << "    deltaPhiRange      = " << std::hex << m_correlationParameter.deltaPhiRange << std::endl;
0147   myCout << "    deltaPhiMaxbits    = " << std::hex << m_correlationParameter.deltaPhiMaxbits << std::endl;
0148 
0149   // reset to decimal output
0150   myCout << std::dec << std::endl;
0151 }
0152 
0153 void L1GtCorrelationTemplate::copy(const L1GtCorrelationTemplate& cp) {
0154   m_condName = cp.condName();
0155   m_condCategory = cp.condCategory();
0156   m_condType = cp.condType();
0157   m_objectType = cp.objectType();
0158   m_condGEq = cp.condGEq();
0159   m_condChipNr = cp.condChipNr();
0160 
0161   m_cond0Category = cp.cond0Category();
0162   m_cond1Category = cp.cond1Category();
0163   m_cond0Index = cp.cond0Index();
0164   m_cond1Index = cp.cond1Index();
0165 
0166   m_correlationParameter = *(cp.correlationParameter());
0167 }
0168 
0169 // output stream operator
0170 std::ostream& operator<<(std::ostream& os, const L1GtCorrelationTemplate& result) {
0171   result.print(os);
0172   return os;
0173 }