Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-09-02 06:14:23

0001 /**
0002  * \class GlobalCondition
0003  *
0004  *
0005  * Description: base class for L1 Global Trigger object templates (condition).
0006  *
0007  * Implementation:
0008  *    <TODO: enter implementation details>
0009  *
0010  * \author: Vladimir Rekovic,   Brian Winer, OSU   Vasile Mihai Ghete - HEPHY Vienna
0011  *          Elisa Fontanesi - extended for three-body correlation conditions
0012  *
0013  * $Date$
0014  * $Revision$
0015  *
0016  */
0017 
0018 // this class header
0019 #include "L1Trigger/L1TGlobal/interface/GlobalCondition.h"
0020 
0021 // system include files
0022 
0023 // user include files
0024 
0025 // forward declarations
0026 
0027 // constructor
0028 //    empty
0029 GlobalCondition::GlobalCondition() {
0030   m_condCategory = l1t::CondNull;
0031   m_condType = l1t::TypeNull;
0032   m_condChipNr = -1;
0033   m_condRelativeBx = 0;
0034 
0035   // the rest of private members are C++ initialized
0036 }
0037 
0038 //    constructor from condition name
0039 GlobalCondition::GlobalCondition(const std::string& cName) {
0040   m_condName = cName;
0041 
0042   m_condCategory = l1t::CondNull;
0043   m_condType = l1t::TypeNull;
0044   m_condChipNr = -1;
0045   m_condRelativeBx = 0;
0046 }
0047 
0048 //   constructor from condition name, category and type
0049 GlobalCondition::GlobalCondition(const std::string& cName,
0050                                  const l1t::GtConditionCategory& cCategory,
0051                                  const l1t::GtConditionType& cType) {
0052   m_condName = cName;
0053   m_condCategory = cCategory;
0054   m_condType = cType;
0055 
0056   m_condChipNr = -1;
0057   m_condRelativeBx = 0;
0058 }
0059 
0060 GlobalCondition::~GlobalCondition() {
0061   // empty
0062 }
0063 
0064 // get number of trigger objects
0065 const int GlobalCondition::nrObjects() const {
0066   switch (m_condType) {
0067     case l1t::TypeNull:
0068     case l1t::TypeExternal: {
0069       return 0;
0070     }
0071 
0072     break;
0073     case l1t::TypeCent0:
0074     case l1t::TypeCent1:
0075     case l1t::TypeCent2:
0076     case l1t::TypeCent3:
0077     case l1t::TypeCent4:
0078     case l1t::TypeCent5:
0079     case l1t::TypeCent6:
0080     case l1t::TypeCent7: {
0081       return 0;
0082     }
0083 
0084     case l1t::Type1s: {
0085       return 1;
0086     }
0087 
0088     break;
0089     case l1t::Type2s:
0090     case l1t::Type2wsc:
0091     case l1t::Type2cor: {
0092       return 2;
0093     }
0094 
0095     break;
0096     case l1t::Type2corWithOverlapRemoval: {
0097       return 3;
0098     }
0099 
0100     break;
0101     case l1t::Type3s: {
0102       return 3;
0103     }
0104 
0105     break;
0106     case l1t::Type4s: {
0107       return 4;
0108     }
0109 
0110     break;
0111     case l1t::TypeETT:
0112     case l1t::TypeETM:
0113     case l1t::TypeHTT:
0114     case l1t::TypeHTM:
0115     case l1t::TypeETMHF:
0116     case l1t::TypeTowerCount:
0117     case l1t::TypeMinBiasHFP0:
0118     case l1t::TypeMinBiasHFM0:
0119     case l1t::TypeMinBiasHFP1:
0120     case l1t::TypeMinBiasHFM1:
0121     case l1t::TypeZDCP:
0122     case l1t::TypeZDCM:
0123     case l1t::TypeAsymEt:
0124     case l1t::TypeAsymHt:
0125     case l1t::TypeAsymEtHF:
0126     case l1t::TypeAsymHtHF: {
0127       return 1;
0128     }
0129 
0130     break;
0131     default: {
0132       // TODO no such type, throw exception?
0133       return 0;
0134     } break;
0135   }
0136 }
0137 
0138 // get logic flag for conditions, same type of trigger objects,
0139 // and with spatial correlations
0140 const bool GlobalCondition::wsc() const {
0141   if (m_condType == l1t::Type2wsc) {
0142     return true;
0143   }
0144 
0145   return false;
0146 }
0147 
0148 // get logic flag for conditions, different type of trigger objects,
0149 // and with spatial correlations
0150 const bool GlobalCondition::corr() const {
0151   if (m_condType == l1t::Type2cor) {
0152     return true;
0153   }
0154 
0155   return false;
0156 }
0157 
0158 // get logic flag for conditions, trigger objects are muons
0159 const bool GlobalCondition::corrThree() const {
0160   if (m_condType == l1t::Type3s) {
0161     return true;
0162   }
0163 
0164   return false;
0165 }
0166 
0167 // print condition
0168 void GlobalCondition::print(std::ostream& myCout) const {
0169   myCout << "\n  Condition name:     " << m_condName << std::endl;
0170 
0171   switch (m_condCategory) {
0172     case l1t::CondNull: {
0173       myCout << "  Condition category: "
0174              << "l1t::CondNull"
0175              << " - it means not defined!" << std::endl;
0176     }
0177 
0178     break;
0179     case l1t::CondMuon: {
0180       myCout << "  Condition category: "
0181              << "l1t::CondMuon" << std::endl;
0182     }
0183 
0184     break;
0185     case l1t::CondMuonShower: {
0186       myCout << "  Condition category: "
0187              << "l1t::CondMuonShower" << std::endl;
0188     }
0189 
0190     break;
0191     case l1t::CondCalo: {
0192       myCout << "  Condition category: "
0193              << "l1t::CondCalo" << std::endl;
0194     }
0195 
0196     break;
0197     case l1t::CondEnergySum: {
0198       myCout << "  Condition category: "
0199              << "CondEnergySum" << std::endl;
0200     }
0201 
0202     break;
0203     case l1t::CondEnergySumZdc: {
0204       myCout << "  Condition category: "
0205              << "CondEnergySumZdc" << std::endl;
0206     }
0207 
0208     break;
0209     case l1t::CondCorrelation: {
0210       myCout << "  Condition category: "
0211              << "CondCorrelation" << std::endl;
0212     }
0213 
0214     break;
0215     case l1t::CondCorrelationThreeBody: {
0216       myCout << "  Condition category: "
0217              << "CondCorrelationThreeBody" << std::endl;
0218     }
0219 
0220     break;
0221     case l1t::CondCorrelationWithOverlapRemoval: {
0222       myCout << "  Condition category: "
0223              << "CondCorrelationWithOverlapRemoval" << std::endl;
0224     }
0225 
0226     break;
0227     case l1t::CondExternal: {
0228       myCout << "  Condition category: "
0229              << "CondExternal" << std::endl;
0230     }
0231 
0232     break;
0233     default: {
0234       myCout << "  Condition category: " << m_condCategory
0235              << "  - no such category defined. Check l1t::GtConditionCategory enum." << std::endl;
0236 
0237     } break;
0238   }
0239 
0240   switch (m_condType) {
0241     case l1t::TypeNull: {
0242       myCout << "  Condition type:     "
0243              << "l1t::TypeNull"
0244              << " - it means not defined!" << std::endl;
0245     }
0246 
0247     break;
0248     case l1t::Type1s: {
0249       myCout << "  Condition type:     "
0250              << "l1t::Type1s" << std::endl;
0251     }
0252 
0253     break;
0254     case l1t::Type2s: {
0255       myCout << "  Condition type:     "
0256              << "l1t::Type2s" << std::endl;
0257     }
0258 
0259     break;
0260     case l1t::Type2corWithOverlapRemoval: {
0261       myCout << "  Condition type:     "
0262              << "l1t::Type2corWithOverlapRemoval" << std::endl;
0263     }
0264 
0265     break;
0266     case l1t::Type2wsc: {
0267       myCout << "  Condition type:     "
0268              << "l1t::Type2wsc" << std::endl;
0269     }
0270 
0271     break;
0272     case l1t::Type2cor: {
0273       myCout << "  Condition type:     "
0274              << "l1t::Type2cor" << std::endl;
0275     }
0276 
0277     break;
0278     case l1t::Type3s: {
0279       myCout << "  Condition type:     "
0280              << "l1t::Type3s" << std::endl;
0281     }
0282 
0283     break;
0284     case l1t::Type4s: {
0285       myCout << "  Condition type:     "
0286              << "l1t::Type4s" << std::endl;
0287     }
0288 
0289     break;
0290     case l1t::TypeETM: {
0291       myCout << "  Condition type:     "
0292              << "TypeETM" << std::endl;
0293     }
0294 
0295     break;
0296     case l1t::TypeETT: {
0297       myCout << "  Condition type:     "
0298              << "TypeETT" << std::endl;
0299     }
0300 
0301     break;
0302     case l1t::TypeHTT: {
0303       myCout << "  Condition type:     "
0304              << "TypeHTT" << std::endl;
0305     }
0306 
0307     break;
0308     case l1t::TypeHTM: {
0309       myCout << "  Condition type:     "
0310              << "TypeHTM" << std::endl;
0311     }
0312 
0313     break;
0314     case l1t::TypeETMHF: {
0315       myCout << "  Condition type:     "
0316              << "TypeETMHF" << std::endl;
0317     }
0318 
0319     break;
0320     case l1t::TypeTowerCount: {
0321       myCout << "  Condition type:     "
0322              << "TypeTowerCount" << std::endl;
0323     }
0324 
0325     break;
0326     case l1t::TypeMinBiasHFP0: {
0327       myCout << "  Condition type:     "
0328              << "TypeMinBiasHFP0" << std::endl;
0329     }
0330 
0331     break;
0332     case l1t::TypeMinBiasHFM0: {
0333       myCout << "  Condition type:     "
0334              << "TypeMinBiasHFM0" << std::endl;
0335     }
0336 
0337     break;
0338     case l1t::TypeMinBiasHFP1: {
0339       myCout << "  Condition type:     "
0340              << "TypeMinBiasHFP1" << std::endl;
0341     }
0342 
0343     break;
0344     case l1t::TypeMinBiasHFM1: {
0345       myCout << "  Condition type:     "
0346              << "TypeMinBiasHFM1" << std::endl;
0347     }
0348 
0349     break;
0350     case l1t::TypeETTem: {
0351       myCout << "  Condition type:     "
0352              << "TypeETTem" << std::endl;
0353     }
0354 
0355     break;
0356     case l1t::TypeAsymEt: {
0357       myCout << "  Condition type:     "
0358              << "TypeAsymEt" << std::endl;
0359     }
0360 
0361     break;
0362     case l1t::TypeAsymHt: {
0363       myCout << "  Condition type:     "
0364              << "TypeAsymHt" << std::endl;
0365     }
0366 
0367     break;
0368     case l1t::TypeAsymEtHF: {
0369       myCout << "  Condition type:     "
0370              << "TypeAsymEtHF" << std::endl;
0371     }
0372 
0373     break;
0374     case l1t::TypeAsymHtHF: {
0375       myCout << "  Condition type:     "
0376              << "TypeAsymHtHF" << std::endl;
0377     }
0378 
0379     break;
0380     case l1t::TypeCent0: {
0381       myCout << "  Condition type:     "
0382              << "TypeCent0" << std::endl;
0383     }
0384 
0385     break;
0386     case l1t::TypeCent1: {
0387       myCout << "  Condition type:     "
0388              << "TypeCent1" << std::endl;
0389     }
0390 
0391     break;
0392     case l1t::TypeCent2: {
0393       myCout << "  Condition type:     "
0394              << "TypeCent2" << std::endl;
0395     }
0396 
0397     break;
0398     case l1t::TypeCent3: {
0399       myCout << "  Condition type:     "
0400              << "TypeCent3" << std::endl;
0401     }
0402 
0403     break;
0404     case l1t::TypeCent4: {
0405       myCout << "  Condition type:     "
0406              << "TypeCent4" << std::endl;
0407     }
0408 
0409     break;
0410     case l1t::TypeCent5: {
0411       myCout << "  Condition type:     "
0412              << "TypeCent5" << std::endl;
0413     }
0414 
0415     break;
0416     case l1t::TypeCent6: {
0417       myCout << "  Condition type:     "
0418              << "TypeCent6" << std::endl;
0419     }
0420 
0421     break;
0422     case l1t::TypeCent7: {
0423       myCout << "  Condition type:     "
0424              << "TypeCent7" << std::endl;
0425     }
0426 
0427     break;
0428     case l1t::TypeExternal: {
0429       myCout << "  Condition type:     "
0430              << "TypeExternal" << std::endl;
0431     }
0432 
0433     break;
0434     default: {
0435       myCout << "  Condition type:     " << m_condType << " - no such type defined. Check l1t::GtConditionType enum."
0436              << std::endl;
0437     } break;
0438   }
0439 
0440   myCout << "  Object types:      ";
0441 
0442   for (unsigned int i = 0; i < m_objectType.size(); ++i) {
0443     switch (m_objectType[i]) {
0444       case l1t::gtMu: {
0445         myCout << " Mu ";
0446       }
0447 
0448       break;
0449       case l1t::gtMuShower: {
0450         myCout << " MuShower ";
0451       }
0452 
0453       break;
0454       case l1t::gtEG: {
0455         myCout << " EG ";
0456       }
0457 
0458       break;
0459 
0460       case l1t::gtJet: {
0461         myCout << " Jet ";
0462       }
0463 
0464       break;
0465 
0466       case l1t::gtTau: {
0467         myCout << " Tau ";
0468       }
0469 
0470       break;
0471       case l1t::gtETM: {
0472         myCout << " ETM ";
0473       }
0474 
0475       break;
0476       case l1t::gtETT: {
0477         myCout << " ETT ";
0478       }
0479 
0480       break;
0481       case l1t::gtHTT: {
0482         myCout << " HTT ";
0483       }
0484 
0485       break;
0486       case l1t::gtHTM: {
0487         myCout << " HTM ";
0488       }
0489 
0490       break;
0491 
0492       case l1t::gtETMHF: {
0493         myCout << " ETMHF ";
0494       }
0495 
0496       break;
0497       case l1t::gtTowerCount: {
0498         myCout << " TowerCount ";
0499       }
0500 
0501       break;
0502       case l1t::gtMinBiasHFP0: {
0503         myCout << " MinBiasHFP0 ";
0504       }
0505 
0506       break;
0507       case l1t::gtMinBiasHFM0: {
0508         myCout << " MinBiasHFM0 ";
0509       }
0510 
0511       break;
0512       case l1t::gtMinBiasHFP1: {
0513         myCout << " MinBiasHFP1 ";
0514       }
0515 
0516       break;
0517       case l1t::gtMinBiasHFM1: {
0518         myCout << " MinBiasHFM1 ";
0519       }
0520 
0521       break;
0522       case l1t::gtETTem: {
0523         myCout << " ETTem ";
0524       }
0525 
0526       break;
0527       case l1t::gtAsymmetryEt: {
0528         myCout << " AsymmetryEt ";
0529       }
0530 
0531       break;
0532       case l1t::gtAsymmetryHt: {
0533         myCout << " AsymmetryHt ";
0534       }
0535 
0536       break;
0537       case l1t::gtAsymmetryEtHF: {
0538         myCout << " AsymmetryEtHF ";
0539       }
0540 
0541       break;
0542       case l1t::gtAsymmetryHtHF: {
0543         myCout << " AsymmetryHtHF ";
0544       }
0545 
0546       break;
0547       case l1t::gtCentrality0: {
0548         myCout << " Centrality0 ";
0549       }
0550 
0551       break;
0552       case l1t::gtCentrality1: {
0553         myCout << " Centrality1 ";
0554       }
0555 
0556       break;
0557       case l1t::gtCentrality2: {
0558         myCout << " Centrality2 ";
0559       }
0560 
0561       break;
0562       case l1t::gtCentrality3: {
0563         myCout << " Centrality3 ";
0564       }
0565 
0566       break;
0567       case l1t::gtCentrality4: {
0568         myCout << " Centrality4 ";
0569       }
0570 
0571       break;
0572       case l1t::gtCentrality5: {
0573         myCout << " Centrality5 ";
0574       }
0575 
0576       break;
0577       case l1t::gtCentrality6: {
0578         myCout << " Centrality6 ";
0579       }
0580 
0581       break;
0582       case l1t::gtCentrality7: {
0583         myCout << " Centrality7 ";
0584       }
0585 
0586       break;
0587 
0588       case l1t::gtExternal: {
0589         myCout << " External ";
0590       }
0591 
0592       break;
0593       default: {
0594         myCout << " Unknown type " << m_objectType[i];
0595       } break;
0596     }
0597   }
0598 
0599   myCout << std::endl;
0600 
0601   myCout << "  \" >= \" flag:        " << m_condGEq << std::endl;
0602 
0603   myCout << "  Condition chip:     " << m_condChipNr;
0604 
0605   if (m_condChipNr < 0) {
0606     myCout << "   - not properly initialized! ";
0607   }
0608 
0609   myCout << std::endl;
0610 
0611   myCout << "  Relative BX:     " << m_condRelativeBx << std::endl;
0612 }
0613 
0614 // output stream operator
0615 std::ostream& operator<<(std::ostream& os, const GlobalCondition& result) {
0616   result.print(os);
0617   return os;
0618 }