Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:14

0001 #ifndef Geometry_MTDCommonData_MTDTopologyMode_H
0002 #define Geometry_MTDCommonData_MTDTopologyMode_H
0003 
0004 #include "FWCore/Utilities/interface/Exception.h"
0005 #include <map>
0006 #include <string>
0007 #include <algorithm>
0008 
0009 #include "DataFormats/ForwardDetId/interface/BTLDetId.h"
0010 #include "DataFormats/ForwardDetId/interface/ETLDetId.h"
0011 
0012 namespace MTDTopologyMode {
0013 
0014   enum class Mode {
0015     undefined = 0,
0016     tile = 1,
0017     bar = 2,
0018     barzflat = 3,
0019     barphiflat = 4,
0020     btlv1etlv4 = 5,
0021     btlv1etlv5 = 6,
0022     btlv2etlv5 = 7,
0023     btlv3etlv8 = 8
0024   };
0025 
0026   Mode MTDStringToEnumParser(const std::string&);
0027 
0028   /** Returns BTLDetId::CrysLayout as a function of topology mode (to accomodate TDR/post TDR ETL scenarios). **/
0029 
0030   inline BTLDetId::CrysLayout crysLayoutFromTopoMode(const int& topoMode) {
0031     if (topoMode < 0 || topoMode > static_cast<int>(Mode::btlv3etlv8)) {
0032       throw cms::Exception("UnknownMTDtopoMode") << "Unknown MTD topology mode :( " << topoMode;
0033     } else if (topoMode <= static_cast<int>(BTLDetId::CrysLayout::barphiflat)) {
0034       return static_cast<BTLDetId::CrysLayout>(topoMode);
0035     } else if (topoMode < static_cast<int>(Mode::btlv2etlv5)) {
0036       return BTLDetId::CrysLayout::barphiflat;
0037     } else if (topoMode == static_cast<int>(Mode::btlv2etlv5)) {
0038       return BTLDetId::CrysLayout::v2;
0039     } else {
0040       return BTLDetId::CrysLayout::v3;
0041     }
0042   }
0043 
0044   /** Returns ETLDetId::EtlLayout as a function of topology mode **/
0045 
0046   inline ETLDetId::EtlLayout etlLayoutFromTopoMode(const int& topoMode) {
0047     if (topoMode < 0 || topoMode > static_cast<int>(Mode::btlv3etlv8)) {
0048       throw cms::Exception("UnknownMTDtopoMode") << "Unknown MTD topology mode :( " << topoMode;
0049     } else if (topoMode <= static_cast<int>(BTLDetId::CrysLayout::barphiflat)) {
0050       return ETLDetId::EtlLayout::tp;
0051     } else if (topoMode == static_cast<int>(Mode::btlv1etlv4)) {
0052       return ETLDetId::EtlLayout::v4;
0053     } else if (topoMode == static_cast<int>(Mode::btlv1etlv5) or topoMode == static_cast<int>(Mode::btlv2etlv5)) {
0054       return ETLDetId::EtlLayout::v5;
0055     } else {
0056       return ETLDetId::EtlLayout::v8;
0057     }
0058   }
0059 
0060 }  // namespace MTDTopologyMode
0061 
0062 #endif  // Geometry_MTDCommonData_MTDTopologyMode_H