diff --git a/Configuration/Geometry/README.md b/Configuration/Geometry/README.md index 863a04bab08ef..7514025b53132 100644 --- a/Configuration/Geometry/README.md +++ b/Configuration/Geometry/README.md @@ -141,6 +141,7 @@ Fast Timing system: * I15: Same as I14, addition of notch and revision of envelope * I16: Starting from I15, revised BTL with complete passive material description, it needs Tracker T31 or newer * I17: Same as I16, BTL with one crystal thickness (type) only, ETL with LGAD split into two sensors +* I18: Same as I17, needed for updated BTL numbering scheme and BTLDetId format The script also handles the common and forward elements of the geometry: * O4: detailed cavern description, changes for modified CALO region for endcap part, no overlaps inside the Muon System @@ -182,4 +183,5 @@ Several detector combinations have been generated: * D114 = T39+C19+M11+I17+O9+F8 * D115 = T35+C20+M11+I17+O9+F8 * D116 = T35+C25+M12+I17+O10+F9 +* D117 = T35+C25+M12+I18+O10+F9 diff --git a/Configuration/Geometry/python/GeometryDD4hepExtendedRun4D117Reco_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtendedRun4D117Reco_cff.py new file mode 100644 index 0000000000000..03cfbc29fbfde --- /dev/null +++ b/Configuration/Geometry/python/GeometryDD4hepExtendedRun4D117Reco_cff.py @@ -0,0 +1,61 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generateRun4Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +from Configuration.Geometry.GeometryDD4hepExtendedRun4D117_cff import * + +# tracker +from Geometry.CommonTopologies.globalTrackingGeometry_cfi import * +from RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi import * +from Geometry.TrackerGeometryBuilder.TrackerAdditionalParametersPerDet_cfi import * +from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * +from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * +from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * +trackerGeometry.applyAlignment = True + +# calo +from Geometry.CaloEventSetup.HGCalTopology_cfi import * +from Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi import * +from Geometry.CaloEventSetup.CaloTopology_cfi import * +from Geometry.CaloEventSetup.CaloGeometryBuilder_cfi import * +CaloGeometryBuilder = cms.ESProducer("CaloGeometryBuilder", + SelectedCalos = cms.vstring("HCAL", + "ZDC", + "EcalBarrel", + "TOWER", + "HGCalEESensitive", + "HGCalHESiliconSensitive", + "HGCalHEScintillatorSensitive" + ) +) +from Geometry.EcalAlgo.EcalBarrelGeometry_cfi import * +from Geometry.HcalEventSetup.HcalGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerTopology_cfi import * +from Geometry.HcalCommonData.hcalDDDRecConstants_cfi import * +from Geometry.HcalEventSetup.hcalTopologyIdeal_cfi import * +from Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi import * +from Geometry.EcalMapping.EcalMapping_cfi import * +from Geometry.EcalMapping.EcalMappingRecord_cfi import * + +# muon +from Geometry.MuonNumbering.muonNumberingInitialization_cfi import * +from RecoMuon.DetLayers.muonDetLayerGeometry_cfi import * +from Geometry.GEMGeometryBuilder.gemGeometry_cff import * +from Geometry.CSCGeometryBuilder.idealForDigiCscGeometry_cff import * +from Geometry.DTGeometryBuilder.idealForDigiDtGeometry_cff import * + +# forward +from Geometry.ForwardGeometry.zdcTopologyEP_cfi import * +from Geometry.ForwardGeometry.ZdcGeometry_cfi import * + +# timing +from RecoMTD.DetLayers.mtdDetLayerGeometry_cfi import * +from Geometry.MTDGeometryBuilder.mtdParameters_cff import * +from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import * +from Geometry.MTDNumberingBuilder.mtdTopology_cfi import * +from Geometry.MTDGeometryBuilder.mtdGeometry_cfi import * +from Geometry.MTDGeometryBuilder.idealForDigiMTDGeometry_cff import * +mtdGeometry.applyAlignment = False + diff --git a/Configuration/Geometry/python/GeometryDD4hepExtendedRun4D117_cff.py b/Configuration/Geometry/python/GeometryDD4hepExtendedRun4D117_cff.py new file mode 100644 index 0000000000000..5f534cbff423f --- /dev/null +++ b/Configuration/Geometry/python/GeometryDD4hepExtendedRun4D117_cff.py @@ -0,0 +1,17 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generateRun4Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +from Configuration.Geometry.GeometryDD4hep_cff import * +DDDetectorESProducer.confGeomXMLFiles = cms.FileInPath("Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometryRun4D117.xml") + +from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cff import * +from SLHCUpgradeSimulations.Geometry.fakePhase2OuterTrackerConditions_cff import * +from Geometry.EcalCommonData.ecalSimulationParameters_cff import * +from Geometry.HcalCommonData.hcalDDDSimConstants_cff import * +from Geometry.HGCalCommonData.hgcalParametersInitialization_cfi import * +from Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi import * +from Geometry.MuonNumbering.muonGeometryConstants_cff import * +from Geometry.MuonNumbering.muonOffsetESProducer_cff import * +from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import * diff --git a/Configuration/Geometry/python/GeometryExtendedRun4D117Reco_cff.py b/Configuration/Geometry/python/GeometryExtendedRun4D117Reco_cff.py new file mode 100644 index 0000000000000..6bf2c3fb28ad4 --- /dev/null +++ b/Configuration/Geometry/python/GeometryExtendedRun4D117Reco_cff.py @@ -0,0 +1,61 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generateRun4Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +from Configuration.Geometry.GeometryExtendedRun4D117_cff import * + +# tracker +from Geometry.CommonTopologies.globalTrackingGeometry_cfi import * +from RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi import * +from Geometry.TrackerGeometryBuilder.TrackerAdditionalParametersPerDet_cfi import * +from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * +from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * +from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * +trackerGeometry.applyAlignment = True + +# calo +from Geometry.CaloEventSetup.HGCalTopology_cfi import * +from Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi import * +from Geometry.CaloEventSetup.CaloTopology_cfi import * +from Geometry.CaloEventSetup.CaloGeometryBuilder_cfi import * +CaloGeometryBuilder = cms.ESProducer("CaloGeometryBuilder", + SelectedCalos = cms.vstring("HCAL", + "ZDC", + "EcalBarrel", + "TOWER", + "HGCalEESensitive", + "HGCalHESiliconSensitive", + "HGCalHEScintillatorSensitive" + ) +) +from Geometry.EcalAlgo.EcalBarrelGeometry_cfi import * +from Geometry.HcalEventSetup.HcalGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerTopology_cfi import * +from Geometry.HcalCommonData.hcalDDDRecConstants_cfi import * +from Geometry.HcalEventSetup.hcalTopologyIdeal_cfi import * +from Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi import * +from Geometry.EcalMapping.EcalMapping_cfi import * +from Geometry.EcalMapping.EcalMappingRecord_cfi import * + +# muon +from Geometry.MuonNumbering.muonNumberingInitialization_cfi import * +from RecoMuon.DetLayers.muonDetLayerGeometry_cfi import * +from Geometry.GEMGeometryBuilder.gemGeometry_cff import * +from Geometry.CSCGeometryBuilder.idealForDigiCscGeometry_cff import * +from Geometry.DTGeometryBuilder.idealForDigiDtGeometry_cff import * + +# forward +from Geometry.ForwardGeometry.zdcTopologyEP_cfi import * +from Geometry.ForwardGeometry.ZdcGeometry_cfi import * + +# timing +from RecoMTD.DetLayers.mtdDetLayerGeometry_cfi import * +from Geometry.MTDGeometryBuilder.mtdParameters_cff import * +from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import * +from Geometry.MTDNumberingBuilder.mtdTopology_cfi import * +from Geometry.MTDGeometryBuilder.mtdGeometry_cfi import * +from Geometry.MTDGeometryBuilder.idealForDigiMTDGeometry_cff import * +mtdGeometry.applyAlignment = False + diff --git a/Configuration/Geometry/python/GeometryExtendedRun4D117_cff.py b/Configuration/Geometry/python/GeometryExtendedRun4D117_cff.py new file mode 100644 index 0000000000000..75c6094f37de8 --- /dev/null +++ b/Configuration/Geometry/python/GeometryExtendedRun4D117_cff.py @@ -0,0 +1,15 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generateRun4Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +from Geometry.CMSCommonData.cmsExtendedGeometryRun4D117XML_cfi import * +from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cff import * +from SLHCUpgradeSimulations.Geometry.fakePhase2OuterTrackerConditions_cff import * +from Geometry.EcalCommonData.ecalSimulationParameters_cff import * +from Geometry.HcalCommonData.hcalDDDSimConstants_cff import * +from Geometry.HGCalCommonData.hgcalParametersInitialization_cfi import * +from Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi import * +from Geometry.MuonNumbering.muonGeometryConstants_cff import * +from Geometry.MuonNumbering.muonOffsetESProducer_cff import * +from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import * diff --git a/Configuration/Geometry/python/dictRun4Geometry.py b/Configuration/Geometry/python/dictRun4Geometry.py index 25044d60e38cf..2ce2b0cc21dda 100644 --- a/Configuration/Geometry/python/dictRun4Geometry.py +++ b/Configuration/Geometry/python/dictRun4Geometry.py @@ -1531,6 +1531,34 @@ ], "era" : "phase2_timing, phase2_timing_layer, phase2_etlV4", }, + "I18" : { + 1 : [ + 'Geometry/MTDCommonData/data/mtdMaterial/v3/mtdMaterial.xml', + 'Geometry/MTDCommonData/data/btl/v4/btl.xml', + 'Geometry/MTDCommonData/data/etl/v8/etl.xml', + 'Geometry/MTDCommonData/data/mtdParameters/v6/mtdStructureTopology.xml', + 'Geometry/MTDCommonData/data/mtdParameters/v6/mtdParameters.xml', + ], + 3 : [ + 'Geometry/MTDSimData/data/v5/mtdsens.xml' + ], + 4 : [ + 'Geometry/MTDSimData/data/v5/mtdProdCuts.xml' + ], + "sim" : [ + 'from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import *', + ], + "reco" :[ + 'from RecoMTD.DetLayers.mtdDetLayerGeometry_cfi import *', + 'from Geometry.MTDGeometryBuilder.mtdParameters_cff import *', + 'from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import *', + 'from Geometry.MTDNumberingBuilder.mtdTopology_cfi import *', + 'from Geometry.MTDGeometryBuilder.mtdGeometry_cfi import *', + 'from Geometry.MTDGeometryBuilder.idealForDigiMTDGeometry_cff import *', + 'mtdGeometry.applyAlignment = False' + ], + "era" : "phase2_timing, phase2_timing_layer, phase2_etlV4", + }, } allDicts = [ commonDict, trackerDict, caloDict, muonDict, forwardDict, timingDict ] @@ -1557,6 +1585,7 @@ ("O9","T39","C19","M14","F8","I17") : "D114", ("O9","T35","C20","M14","F8","I17") : "D115", ("O10","T35","C25","M15","F9","I17") : "D116", + ("O10","T35","C25","M15","F9","I18") : "D117", } deprecatedDets = set([ "D1", "D2", "D3", "D5", "D6" , "D7", "D4", "D8" , "D9", "D12", "D13", "D15", "D10", "D11", "D14", "D16", "D17", "D18", "D19", "D20", "D21", "D22", "D23", "D24", "D25", "D26", "D27", "D28", "D29", "D30", "D31", "D32", "D33", "D34", "D36", "D37", "D38", "D39", "D40", "D42", "D35", "D41", "D43", "D44", "D45", "D46", "D48", "D47", "D50", "D51", "D52", "D53", "D54", "D55", "D56", "D57", "D58", "D59", "D61", "D62", "D63", "D64", "D65", "D66", "D67", "D69", "D71", "D72", "D73", "D74", "D75", "D78", "D79", "D87", "D89", "D90", "D49", "D60", "D68", "D70", "D76", "D77", "D80", "D81", "D82", "D83", "D84", "D85","D86","D88","D91","D92","D93","D94","D97"]) diff --git a/Configuration/PyReleaseValidation/python/relval_Run4.py b/Configuration/PyReleaseValidation/python/relval_Run4.py index a4e587868c493..edcc86ebcfc15 100644 --- a/Configuration/PyReleaseValidation/python/relval_Run4.py +++ b/Configuration/PyReleaseValidation/python/relval_Run4.py @@ -36,6 +36,7 @@ numWFIB.extend([31234.0]) #Run4D114 numWFIB.extend([32034.0]) #Run4D115 numWFIB.extend([32434.0]) #Run4D116 +numWFIB.extend([32834.0]) #Run4D117 #Additional sample for short matrix and IB #Default Phase-2 Det NoPU diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index 901abf9083be1..7d53f403b926e 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -95,6 +95,8 @@ 'Run4D115PU', 'Run4D116', 'Run4D116PU', + 'Run4D117', + 'Run4D117PU', ] # pre-generation of WF numbers @@ -3179,6 +3181,13 @@ def condition(self, fragment, stepList, key, hasHarvest): 'Era' : 'Phase2C17I13M9', 'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal', 'ALCAPhase2'], }, + 'Run4D117' : { + 'Geom' : 'ExtendedRun4D117', + 'HLTmenu': '@relvalRun4', + 'GT' : 'auto:phase2_realistic_T33', + 'Era' : 'Phase2C17I13M9', + 'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal', 'ALCAPhase2'], + }, } # standard PU sequences diff --git a/Configuration/StandardSequences/python/GeometryConf.py b/Configuration/StandardSequences/python/GeometryConf.py index afa1ec873fd15..773ec9b8a92fa 100644 --- a/Configuration/StandardSequences/python/GeometryConf.py +++ b/Configuration/StandardSequences/python/GeometryConf.py @@ -130,4 +130,6 @@ 'DD4hepExtendedRun4D115' : 'DD4hepExtendedRun4D115,DD4hepExtendedRun4D115Reco', 'ExtendedRun4D116' : 'ExtendedRun4D116,ExtendedRun4D116Reco', 'DD4hepExtendedRun4D116' : 'DD4hepExtendedRun4D116,DD4hepExtendedRun4D116Reco', + 'ExtendedRun4D117' : 'ExtendedRun4D117,ExtendedRun4D117Reco', + 'DD4hepExtendedRun4D117' : 'DD4hepExtendedRun4D117,DD4hepExtendedRun4D117Reco', } diff --git a/DataFormats/ForwardDetId/interface/BTLDetId.h b/DataFormats/ForwardDetId/interface/BTLDetId.h index 0a1bd7eab1699..db058046b2fb7 100644 --- a/DataFormats/ForwardDetId/interface/BTLDetId.h +++ b/DataFormats/ForwardDetId/interface/BTLDetId.h @@ -2,48 +2,81 @@ #define DataFormats_BTLDetId_BTLDetId_h #include "DataFormats/ForwardDetId/interface/MTDDetId.h" +#include #include #include +#include /** - @class BTLDetId - @brief Detector identifier class for the Barrel Timing Layer. - The crystal count must start from 0, copy number must be scaled by 1 unit. - - bit 15-10: module sequential number - bit 9-8 : crystal type (1 - 3) - bit 7-6 : readout unit sequential number within a type ( 1 - 2 ) - bit 5-0 : crystal sequential number within a module ( 0 - 15 ) + @class BTLDetId + @brief Detector identifier class for the Barrel Timing Layer. + The crystal count must start from 0, copy number must be scaled by 1 unit. + + // Geometry v2,v3 BTLDetID + bit 15-10: module sequential number + bit 9-8 : crystal type (1 - 3) + bit 7-6 : readout unit sequential number within a type ( 1 - 2 ) + bit 5-0 : crystal sequential number within a module ( 0 - 15 ) + + // Geometry v2 new DetID (all type 1 modules) + bit 15: kBTLNewFormat (0 - old BTLDetID, 1 - new BTLDetID) + bit 12-10: Readout unit number ( 1 - 6 ) + bit 9-6 : Detector Module ( 1 - 12 ) + bit 5 : Sensor Module inside DM ( 0 - 1 ) + bit 4-0 : Crystal number in a SM ( 1 - 16 ) */ class BTLDetId : public MTDDetId { public: - static constexpr uint32_t kBTLmoduleOffset = 10; - static constexpr uint32_t kBTLmoduleMask = 0x3F; - static constexpr uint32_t kBTLmodTypeOffset = 8; - static constexpr uint32_t kBTLmodTypeMask = 0x3; - static constexpr uint32_t kBTLRUOffset = 6; - static constexpr uint32_t kBTLRUMask = 0x3; + // old BTLDetID + static constexpr uint32_t kBTLoldModuleOffset = 10; + static constexpr uint32_t kBTLoldModuleMask = 0x3F; + static constexpr uint32_t kBTLoldModTypeOffset = 8; + static constexpr uint32_t kBTLoldModTypeMask = 0x3; + static constexpr uint32_t kBTLoldRUOffset = 6; + static constexpr uint32_t kBTLoldRUMask = 0x3; + static constexpr uint32_t kBTLoldCrystalOffset = 0; + static constexpr uint32_t kBTLoldCrystalMask = 0x3F; + + // New BTLDetID + static constexpr uint32_t kBTLRodOffset = 16; + static constexpr uint32_t kBTLRodMask = 0x3F; + static constexpr uint32_t kBTLRUOffset = 10; + static constexpr uint32_t kBTLRUMask = 0x7; + static constexpr uint32_t kBTLdetectorModOffset = 6; + static constexpr uint32_t kBTLdetectorModMask = 0xF; + static constexpr uint32_t kBTLsensorModOffset = 5; + static constexpr uint32_t kBTLsensorModMask = 0x1; static constexpr uint32_t kBTLCrystalOffset = 0; - static constexpr uint32_t kBTLCrystalMask = 0x3F; + static constexpr uint32_t kBTLCrystalMask = 0x1F; /// range constants, need two sets for the time being (one for tiles and one for bars) static constexpr uint32_t HALF_ROD = 36; - static constexpr uint32_t kModulesPerRODBarPhiFlat = 48; - static constexpr uint32_t kModulePerTypeBarPhiFlat = 48 / 3; static constexpr uint32_t kRUPerTypeV2 = 2; + static constexpr uint32_t kRUPerRod = 6; static constexpr uint32_t kModulesPerRUV2 = 24; + static constexpr uint32_t kDModulesPerRU = 12; + static constexpr uint32_t kSModulesPerDM = 2; + static constexpr uint32_t kDModulesInRUCol = 3; + static constexpr uint32_t kDModulesInRURow = 4; + static constexpr uint32_t kSModulesInDM = 2; static constexpr uint32_t kCrystalsPerModuleV2 = 16; static constexpr uint32_t kModulesPerTrkV2 = 3; static constexpr uint32_t kCrystalTypes = 3; + // conversion + static constexpr uint32_t kBTLoldFieldMask = 0x3FFFFF; + static constexpr uint32_t kBTLNewFormat = 1 << 15; + + // + // Number of crystals in BTL according to TDR design, valid also for barphiflat scenario: // 16 crystals x 24 modules x 2 readout units/type x 3 types x 36 rods/side x 2 sides // static constexpr uint32_t kCrystalsBTL = kCrystalsPerModuleV2 * kModulesPerRUV2 * kRUPerTypeV2 * kCrystalTypes * HALF_ROD * 2; - enum class CrysLayout { tile = 1, bar = 2, barzflat = 3, barphiflat = 4, v2 = 5, v3 = 6 }; + enum class CrysLayout { tile = 1, bar = 2, barzflat = 3, barphiflat = 4, v2 = 5, v3 = 6, v4 = 7 }; // ---------- Constructors, enumerated types ---------- @@ -53,61 +86,135 @@ class BTLDetId : public MTDDetId { } /** Construct from a raw value */ - BTLDetId(const uint32_t& raw_id) : MTDDetId(raw_id) { ; } + BTLDetId(const uint32_t& raw_id) : MTDDetId(raw_id) { id_ = MTDDetId(raw_id).rawId(); } /** Construct from generic DetId */ - BTLDetId(const DetId& det_id) : MTDDetId(det_id.rawId()) { ; } + BTLDetId(const DetId& det_id) : MTDDetId(det_id.rawId()) { id_ = MTDDetId(det_id.rawId()).rawId(); } - /** Construct from complete geometry information, v1 **/ - BTLDetId(uint32_t zside, uint32_t rod, uint32_t module, uint32_t modtyp, uint32_t crystal) + /** Construct from complete geometry information v2, v3 **/ + /** Geometry v1 is obsolete and not supported **/ + BTLDetId(uint32_t zside, uint32_t rod, uint32_t runit, uint32_t module, uint32_t modtyp, uint32_t crystal, bool v2v3) : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { id_ |= (MTDType::BTL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | - (rod & kRodRingMask) << kRodRingOffset | (module & kBTLmoduleMask) << kBTLmoduleOffset | - (modtyp & kBTLmodTypeMask) << kBTLmodTypeOffset | ((crystal - 1) & kBTLCrystalMask) << kBTLCrystalOffset; + (rod & kRodRingMask) << kRodRingOffset | (module & kBTLoldModuleMask) << kBTLoldModuleOffset | + (modtyp & kBTLoldModTypeMask) << kBTLoldModTypeOffset | (runit & kBTLoldRUMask) << kBTLoldRUOffset | + ((crystal - 1) & kBTLoldCrystalMask) << kBTLoldCrystalOffset; } - /** Construct from complete geometry information, v2 **/ - BTLDetId(uint32_t zside, uint32_t rod, uint32_t runit, uint32_t module, uint32_t modtyp, uint32_t crystal) + /** Construct from complete geometry information v4 **/ + BTLDetId(uint32_t zside, uint32_t rod, uint32_t runit, uint32_t dmodule, uint32_t smodule, uint32_t crystal) : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { + //RU, DM, SM & Xtal numbers start from 0 id_ |= (MTDType::BTL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | - (rod & kRodRingMask) << kRodRingOffset | (module & kBTLmoduleMask) << kBTLmoduleOffset | - (modtyp & kBTLmodTypeMask) << kBTLmodTypeOffset | (runit & kBTLRUMask) << kBTLRUOffset | - ((crystal - 1) & kBTLCrystalMask) << kBTLCrystalOffset; + (rod & kRodRingMask) << kRodRingOffset | (runit & kBTLRUMask) << kBTLRUOffset | + (dmodule & kBTLdetectorModMask) << kBTLdetectorModOffset | + (smodule & kBTLsensorModMask) << kBTLsensorModOffset | (crystal & kBTLCrystalMask) << kBTLCrystalOffset; + id_ |= kBTLNewFormat; } // ---------- Common methods ---------- - /** Returns BTL module number. */ - inline int module() const { return (id_ >> kBTLmoduleOffset) & kBTLmoduleMask; } + /** Returns BTL crystal number. */ + inline int crystal() const { + if (id_ & kBTLNewFormat) { + return ((id_ >> kBTLCrystalOffset) & kBTLCrystalMask); + } else { + return ((id_ >> kBTLoldCrystalOffset) & kBTLoldCrystalMask) + 1; + } + } - /** Returns BTL crystal type number. */ - inline int modType() const { return (id_ >> kBTLmodTypeOffset) & kBTLmodTypeMask; } + /** Returns BTL crystal number in construction database. */ + inline int crystalConsDB() const { + if (((id_ >> kBTLCrystalOffset) & kBTLCrystalMask) == kCrystalsPerModuleV2) { + return -1; + } + if (smodule() == 0) { + return kCrystalsPerModuleV2 - 1 - ((id_ >> kBTLCrystalOffset) & kBTLCrystalMask); + } else { + return ((id_ >> kBTLCrystalOffset) & kBTLCrystalMask); + } + } - /** Returns BTL crystal number. */ - inline int crystal() const { return ((id_ >> kBTLCrystalOffset) & kBTLCrystalMask) + 1; } + /** Returns BTL detector module number. */ + inline int dmodule() const { + if (id_ & kBTLNewFormat) { + return ((id_ >> kBTLdetectorModOffset) & kBTLdetectorModMask); + } else { + uint32_t oldModule = (id_ >> kBTLoldModuleOffset) & kBTLoldModuleMask; + uint32_t detModule = + int((oldModule - 1) % (kDModulesInRUCol)) * kDModulesInRURow + + int((oldModule - 1) / (kDModulesInRUCol * kSModulesInDM)); // in old scenario module number starts from 1 + return detModule; + } + } + + /** Returns BTL sensor module number. */ + inline int smodule() const { + if (id_ & kBTLNewFormat) { + return ((id_ >> kBTLsensorModOffset) & kBTLsensorModMask); + } else { + uint32_t oldModule = (id_ >> kBTLoldModuleOffset) & kBTLoldModuleMask; + uint32_t senModule = + int((oldModule - 1) / kDModulesInRUCol) % kSModulesInDM; // in old scenario module number starts from 1 + return senModule; + } + } - /** Returns BTL readout unit number per type. */ - inline int runit() const { return (id_ >> kBTLRUOffset) & kBTLRUMask; } + /** Returns BTL module number [1-24] (OLD BTL NUMBERING). */ + inline int module() const { + if (id_ & kBTLNewFormat) { + return ((dmodule() % kDModulesInRURow) * (kSModulesInDM * kDModulesInRUCol) + int(dmodule() / kDModulesInRURow) + + kDModulesInRUCol * smodule()) + + 1; + } else { + return (id_ >> kBTLoldModuleOffset) & kBTLoldModuleMask; + } + } + + /** Returns BTL crystal type number [1-3] (OLD BTL NUMBERING). */ + inline int modType() const { + if (id_ & kBTLNewFormat) { + return int(runit() / kRUPerTypeV2 + 1); + } else { + return (id_ >> kBTLoldModTypeOffset) & kBTLoldModTypeMask; + } + } /** Returns BTL global readout unit number. */ - inline int globalRunit() const { - if (runit() == 0) { - // pre-V2: build a RU identifier from available information - return (module() - 1) / kModulePerTypeBarPhiFlat / kRUPerTypeV2 + 1; - } else if (runit() > 0 && modType() > 0) { - // V2/V3: build global RU identifier from RU per type and type - return (modType() - 1) * kRUPerTypeV2 + runit(); + inline int runit() const { + if (id_ & kBTLNewFormat) { + return ((id_ >> kBTLRUOffset) & kBTLRUMask); + } else { + return (modType() - 1) * kRUPerTypeV2 + int((id_ >> kBTLoldRUOffset) & kBTLoldRUMask); + } + } + + /** Returns BTL readout unit number per type [1-2], from Global RU number [1-6]. */ + inline int runitByType() const { + if (id_ & kBTLNewFormat) { + return ((runit() % kRUPerTypeV2) + 1); + } else { + return (((runit() - 1) % kRUPerTypeV2) + 1); } - return 0; } /** return the row in GeomDet language **/ inline int row(unsigned nrows = kCrystalsPerModuleV2) const { - return (crystal() - 1) % nrows; // anything else for now + if (id_ & kBTLNewFormat) { + return crystal() % nrows; + } else { + return (crystal() - 1) % nrows; + } } /** return the column in GeomDetLanguage **/ - inline int column(unsigned nrows = kCrystalsPerModuleV2) const { return (crystal() - 1) / nrows; } + inline int column(unsigned nrows = kCrystalsPerModuleV2) const { + if (id_ & kBTLNewFormat) { + return crystal() / nrows; + } else { + return (crystal() - 1) / nrows; + } + } /** create a Geographical DetId for Tracking **/ BTLDetId geographicalId(CrysLayout lay) const; diff --git a/DataFormats/ForwardDetId/interface/ETLDetId.h b/DataFormats/ForwardDetId/interface/ETLDetId.h index 6d71e0f92ba9c..705673fd396ac 100644 --- a/DataFormats/ForwardDetId/interface/ETLDetId.h +++ b/DataFormats/ForwardDetId/interface/ETLDetId.h @@ -51,8 +51,6 @@ class ETLDetId : public MTDDetId { static constexpr uint32_t kSoff = 4; - enum class EtlLayout { tp = 1, v4 = 2, v5 = 3, v8 = 4 }; - // ---------- Constructors, enumerated types ---------- /** Construct a null id */ diff --git a/DataFormats/ForwardDetId/src/BTLDetId.cc b/DataFormats/ForwardDetId/src/BTLDetId.cc index 7a3ab9461fbdc..5dcede7969920 100644 --- a/DataFormats/ForwardDetId/src/BTLDetId.cc +++ b/DataFormats/ForwardDetId/src/BTLDetId.cc @@ -3,15 +3,15 @@ BTLDetId BTLDetId::geographicalId(CrysLayout lay) const { // For tracking geometry navigation - if (lay == CrysLayout::barphiflat) { - // barphiflat: count modules in a rod, combining all types - return BTLDetId(mtdSide(), mtdRR(), module() + kModulePerTypeBarPhiFlat * (modType() - 1), 0, 1); - } else if (lay == CrysLayout::v2 || lay == CrysLayout::v3) { + if (lay == CrysLayout::v2 || lay == CrysLayout::v3) { // v2: set number of crystals to 17 to distinguish from crystal BTLDetId // v3: set number of crystals to 17 to distinguish from crystal BTLDetId, build V2-like type and RU number as in BTLNumberingScheme - return BTLDetId(mtdSide(), mtdRR(), runit(), module(), modType(), kCrystalsPerModuleV2 + 1); + return BTLDetId(mtdSide(), mtdRR(), runitByType(), module(), modType(), kCrystalsPerModuleV2 + 1, true); + } + if (lay == CrysLayout::v4) { + // v4: identical to v3, needed to update BTLDetId format and corresponding numbering scheme + return BTLDetId(mtdSide(), mtdRR(), runit(), dmodule(), smodule(), kCrystalsPerModuleV2); } - return 0; } @@ -24,8 +24,11 @@ std::ostream& operator<<(std::ostream& os, const BTLDetId& id) { << " Rod : " << id.mtdRR() << std::endl << " Crystal type: " << id.modType() << std::endl << " Readout unit: " << id.runit() << std::endl - << " Global RU : " << id.globalRunit() << std::endl + << " Readout unit by type: " << id.runitByType() << std::endl + << " Detector Module: " << id.dmodule() << std::endl + << " Sensor Module: " << id.smodule() << std::endl << " Module : " << id.module() << std::endl - << " Crystal : " << id.crystal() << std::endl; + << " Crystal : " << id.crystal() << std::endl + << " Crystal in DB: " << id.crystalConsDB() << std::endl; return os; } diff --git a/DataFormats/TrackReco/src/HitPattern.cc b/DataFormats/TrackReco/src/HitPattern.cc index cdc722cc29679..17bc4d0eca57e 100644 --- a/DataFormats/TrackReco/src/HitPattern.cc +++ b/DataFormats/TrackReco/src/HitPattern.cc @@ -143,7 +143,7 @@ namespace { MTDDetId mtdid(id); switch (mtdid.mtdSubDetector()) { case MTDDetId::BTL: - layer = BTLDetId(id).globalRunit(); + layer = BTLDetId(id).runit(); break; case MTDDetId::ETL: layer = ETLDetId(id).mtdRR(); diff --git a/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometryRun4D117.xml b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometryRun4D117.xml new file mode 100644 index 0000000000000..77577c9634fbf --- /dev/null +++ b/Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometryRun4D117.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/CMSCommonData/python/cmsExtendedGeometryRun4D117XML_cfi.py b/Geometry/CMSCommonData/python/cmsExtendedGeometryRun4D117XML_cfi.py new file mode 100644 index 0000000000000..77f6a85009930 --- /dev/null +++ b/Geometry/CMSCommonData/python/cmsExtendedGeometryRun4D117XML_cfi.py @@ -0,0 +1,128 @@ +import FWCore.ParameterSet.Config as cms + +# This config was generated automatically using generateRun4Geometry.py +# If you notice a mistake, please update the generating script, not just this config + +XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource", + geomXMLFiles = cms.vstring( + 'Geometry/CMSCommonData/data/materials/2030/v1/materials.xml', + 'Geometry/TrackerCommonData/data/trackermaterial/2021/v2/trackermaterial.xml', + 'Geometry/CMSCommonData/data/rotations.xml', + 'Geometry/CMSCommonData/data/extend/v2/cmsextent.xml', + 'Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml', + 'Geometry/CMSCommonData/data/cms/2030/v5/cms.xml', + 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/eta3/etaMax.xml', + 'Geometry/CMSCommonData/data/cmsTracker.xml', + 'Geometry/CMSCommonData/data/caloBase/2030/v7/caloBase.xml', + 'Geometry/CMSCommonData/data/cmsCalo.xml', + 'Geometry/CMSCommonData/data/muonBase/2030/v5/muonBase.xml', + 'Geometry/CMSCommonData/data/cmsMuon.xml', + 'Geometry/CMSCommonData/data/mgnt.xml', + 'Geometry/CMSCommonData/data/beampipe/2030/v3/beampipe.xml', + 'Geometry/CMSCommonData/data/cmsBeam/2030/v1/cmsBeam.xml', + 'Geometry/CMSCommonData/data/muonMB.xml', + 'Geometry/CMSCommonData/data/muonMagnet.xml', + 'Geometry/CMSCommonData/data/cavern/2021/v1/cavern.xml', + 'Geometry/CMSCommonData/data/cavernFloor/2017/v1/cavernFloor.xml', + 'Geometry/TrackerCommonData/data/PhaseII/trackerParameters.xml', + 'Geometry/TrackerCommonData/data/pixfwdCommon.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/pixfwd.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_OT800_IT615_2022_10/pixbar.xml', + 'Geometry/TrackerCommonData/data/trackermaterial.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_03/tracker.xml', + 'Geometry/TrackerCommonData/data/PhaseII/OuterTracker616_2020_04/otst.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_IT711_2023_05/pixel.xml', + 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/trackerbar.xml', + 'Geometry/TrackerCommonData/data/PhaseII/TiltedTracker404/trackerfwd.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackerStructureTopology.xml', + 'Geometry/TrackerCommonData/data/PhaseII/Tracker_DD4hep_compatible_IT711_2023_05/pixelStructureTopology.xml', + 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackersens.xml', + 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_IT711_2023_05/pixelsens.xml', + 'Geometry/TrackerRecoData/data/PhaseII/Tracker_DD4hep_compatible_IT711_2023_05/trackerRecoMaterial.xml', + 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_2021_02/trackerProdCuts.xml', + 'Geometry/TrackerSimData/data/PhaseII/Tracker_DD4hep_compatible_IT711_2023_05/pixelProdCuts.xml', + 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml', + 'Geometry/EcalCommonData/data/eregalgo/2030/v2/eregalgo.xml', + 'Geometry/EcalCommonData/data/ectkcable/2030/v1/ectkcable.xml', + 'Geometry/EcalCommonData/data/ectkcablemat/2030/v2/ectkcablemat.xml', + 'Geometry/EcalCommonData/data/ebalgo/2021/v1/ebalgo.xml', + 'Geometry/EcalCommonData/data/ebcon/2021/v1/ebcon.xml', + 'Geometry/EcalCommonData/data/ebrot.xml', + 'Geometry/HcalCommonData/data/hcalrotations.xml', + 'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml', + 'Geometry/HcalCommonData/data/hcal/v2/hcalalgo.xml', + 'Geometry/HcalCommonData/data/hcalbarrelalgo.xml', + 'Geometry/HcalCommonData/data/hcalcablealgo/v2/hcalcablealgo.xml', + 'Geometry/HcalCommonData/data/hcalouteralgo/v1/hcalouteralgo.xml', + 'Geometry/HcalCommonData/data/hcalforwardalgo.xml', + 'Geometry/HcalCommonData/data/hcalSimNumbering/NoHE/v1/hcalSimNumbering.xml', + 'Geometry/HcalCommonData/data/hcalRecNumbering/NoHE/v2/hcalRecNumbering.xml', + 'Geometry/HGCalCommonData/data/hgcalMaterial/v2/hgcalMaterial.xml', + 'Geometry/HGCalCommonData/data/hgcal/v17/hgcal.xml', + 'Geometry/HGCalCommonData/data/hgcalcell/v17/hgcalcell.xml', + 'Geometry/HGCalCommonData/data/hgcalwafer/v17/hgcalwafer.xml', + 'Geometry/HGCalCommonData/data/hgcalEE/v17/hgcalEE.xml', + 'Geometry/HGCalCommonData/data/hgcalHEsil/v17/hgcalHEsil.xml', + 'Geometry/HGCalCommonData/data/hgcalHEmix/v17/hgcalHEmix.xml', + 'Geometry/HGCalCommonData/data/hgcalCons/v17/hgcalCons.xml', + 'Geometry/HGCalCommonData/data/hgcalConsData/v17/hgcalConsData.xml', + 'Geometry/MuonCommonData/data/mbCommon/2021/v1/mbCommon.xml', + 'Geometry/MuonCommonData/data/mb1/2015/v2/mb1.xml', + 'Geometry/MuonCommonData/data/mb2/2015/v2/mb2.xml', + 'Geometry/MuonCommonData/data/mb3/2015/v3/mb3.xml', + 'Geometry/MuonCommonData/data/mb4/2015/v2/mb4.xml', + 'Geometry/MuonCommonData/data/mb4Shield/2030/v1/mb4Shield.xml', + 'Geometry/MuonCommonData/data/muonYoke/2030/v4/muonYoke.xml', + 'Geometry/MuonCommonData/data/mf/2030/v8/mf.xml', + 'Geometry/MuonCommonData/data/csc/2021/v2/csc.xml', + 'Geometry/MuonCommonData/data/rpcf/2030/v4/rpcf.xml', + 'Geometry/MuonCommonData/data/gemf/TDR_BaseLine/gemf.xml', + 'Geometry/MuonCommonData/data/gem11/TDR_BaseLine/gem11.xml', + 'Geometry/MuonCommonData/data/gem21/2030/v1/gem21.xml', + 'Geometry/MuonCommonData/data/mfshield/2030/v6/mfshield.xml', + 'Geometry/MuonCommonData/data/ge0/TDR_Dev/v5/ge0.xml', + 'Geometry/MuonCommonData/data/ge0shield/2030/v1/ge0shield.xml', + 'Geometry/ForwardCommonData/data/forwardshield/2030/v5/forwardshield.xml', + 'Geometry/ForwardCommonData/data/zdcmaterials/2021/v1/zdcmaterials.xml', + 'Geometry/ForwardCommonData/data/lumimaterials.xml', + 'Geometry/ForwardCommonData/data/zdcrotations.xml', + 'Geometry/ForwardCommonData/data/lumirotations.xml', + 'Geometry/ForwardCommonData/data/zdc/2030/v1/zdc.xml', + 'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml', + 'Geometry/ForwardCommonData/data/cmszdc.xml', + 'Geometry/MTDCommonData/data/mtdMaterial/v3/mtdMaterial.xml', + 'Geometry/MTDCommonData/data/btl/v4/btl.xml', + 'Geometry/MTDCommonData/data/etl/v8/etl.xml', + 'Geometry/MTDCommonData/data/mtdParameters/v6/mtdStructureTopology.xml', + 'Geometry/MTDCommonData/data/mtdParameters/v6/mtdParameters.xml', + )+ + cms.vstring( + 'Geometry/MuonCommonData/data/muonNumbering/TDR_DeV/v5/muonNumbering.xml', + 'Geometry/EcalSimData/data/PhaseII/ecalsens.xml', + 'Geometry/HcalCommonData/data/hcalsens/NoHE/v1/hcalsenspmf.xml', + 'Geometry/HcalSimData/data/hf.xml', + 'Geometry/HcalSimData/data/hfpmt.xml', + 'Geometry/HcalSimData/data/hffibrebundle.xml', + 'Geometry/HcalSimData/data/CaloUtil/2030/v2c/CaloUtil.xml', + 'Geometry/HGCalSimData/data/hgcsensv15.xml', + 'Geometry/MuonSimData/data/PhaseII/v2/muonSens.xml', + 'Geometry/DTGeometryBuilder/data/dtSpecsFilter/2021/v1/dtSpecsFilter.xml', + 'Geometry/CSCGeometryBuilder/data/cscSpecsFilter.xml', + 'Geometry/CSCGeometryBuilder/data/cscSpecs.xml', + 'Geometry/RPCGeometryBuilder/data/2030/v1/RPCSpecs.xml', + 'Geometry/GEMGeometryBuilder/data/v12/GEMSpecsFilter.xml', + 'Geometry/GEMGeometryBuilder/data/v12/GEMSpecs.xml', + 'Geometry/ForwardSimData/data/zdcsens.xml', + 'Geometry/MTDSimData/data/v5/mtdsens.xml', + 'Geometry/HcalSimData/data/HcalProdCuts/2030/v1/HcalProdCuts.xml', + 'Geometry/EcalSimData/data/EcalProdCuts.xml', + 'Geometry/HGCalSimData/data/hgcProdCutsv15.xml', + 'Geometry/MuonSimData/data/muonProdCuts/2030/v2/muonProdCuts.xml', + 'Geometry/ForwardSimData/data/zdcProdCuts/2021/v2/zdcProdCuts.xml', + 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml', + 'Geometry/MTDSimData/data/v5/mtdProdCuts.xml', + 'Geometry/CMSCommonData/data/FieldParameters.xml', + ), + rootNodeName = cms.string('cms:OCMS') +) diff --git a/Geometry/MTDCommonData/data/btl/v4/btl.xml b/Geometry/MTDCommonData/data/btl/v4/btl.xml new file mode 100644 index 0000000000000..ccbaeaca6488d --- /dev/null +++ b/Geometry/MTDCommonData/data/btl/v4/btl.xml @@ -0,0 +1,1161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, + 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm + + + -24.0*mm, -20.8*mm, -17.6*mm, -14.4*mm, -11.2*mm, -8.0*mm, -4.8*mm, -1.6*mm, + 1.6*mm, 4.8*mm, 8.0*mm, 11.2*mm, 14.4*mm, 17.6*mm, 20.8*mm, 24.0*mm + + + 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, + 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm, 0.0*mm + + + rotations:NULL, rotations:NULL, rotations:NULL, rotations:NULL, + rotations:NULL, rotations:NULL, rotations:NULL, rotations:NULL, + rotations:NULL, rotations:NULL, rotations:NULL, rotations:NULL, + rotations:NULL, rotations:NULL, rotations:NULL, rotations:NULL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -61.0*mm, 0.0*mm, 61.0*mm, + -61.0*mm, 0.0*mm, 61.0*mm, + -61.0*mm, 0.0*mm, 61.0*mm, + -61.0*mm, 0.0*mm, 61.0*mm, + -61.0*mm, 0.0*mm, 61.0*mm, + -61.0*mm, 0.0*mm, 61.0*mm, + -61.0*mm, 0.0*mm, 61.0*mm, + -61.0*mm, 0.0*mm, 61.0*mm + + + 4.225*mm, 4.225*mm, 4.225*mm, + 4.225*mm, 4.225*mm, 4.225*mm, + 4.225*mm, 4.225*mm, 4.225*mm, + 4.225*mm, 4.225*mm, 4.225*mm, + 4.225*mm, 4.225*mm, 4.225*mm, + 4.225*mm, 4.225*mm, 4.225*mm, + 4.225*mm, 4.225*mm, 4.225*mm, + 4.225*mm, 4.225*mm, 4.225*mm + + + -180.6*mm, -180.6*mm, -180.6*mm, + -129.0*mm, -129.0*mm, -129.0*mm, + -77.4*mm, -77.4*mm, -77.4*mm, + -25.8*mm, -25.8*mm, -25.8*mm, + 25.8*mm, 25.8*mm, 25.8*mm, + 77.4*mm, 77.4*mm, 77.4*mm, + 129.0*mm, 129.0*mm, 129.0*mm, + 180.6*mm, 180.6*mm, 180.6*mm + + + btl:X90, btl:X90, btl:X90, btl:X90, + btl:X90, btl:X90, btl:X90, btl:X90, + btl:X90, btl:X90, btl:X90, btl:X90, + btl:X90, btl:X90, btl:X90, btl:X90, + btl:X90, btl:X90, btl:X90, btl:X90, + btl:X90, btl:X90, btl:X90, btl:X90 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/MTDCommonData/data/mtdParameters/v6/mtdParameters.xml b/Geometry/MTDCommonData/data/mtdParameters/v6/mtdParameters.xml new file mode 100644 index 0000000000000..c9517bff4792c --- /dev/null +++ b/Geometry/MTDCommonData/data/mtdParameters/v6/mtdParameters.xml @@ -0,0 +1,16 @@ + + + + + + 4, 4, 4, 24 + + + 0, 0, 0, 0, 0, 10, 40, 80, 1, 16, 1, 1 + + + 0, 0, 0, 0, 12, 24, 6, 12, 16, 16, 1, 1 + + + + diff --git a/Geometry/MTDCommonData/data/mtdParameters/v6/mtdStructureTopology.xml b/Geometry/MTDCommonData/data/mtdParameters/v6/mtdStructureTopology.xml new file mode 100644 index 0000000000000..9b4f0f8d3288a --- /dev/null +++ b/Geometry/MTDCommonData/data/mtdParameters/v6/mtdStructureTopology.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/MTDCommonData/interface/BTLElectronicsMapping.h b/Geometry/MTDCommonData/interface/BTLElectronicsMapping.h new file mode 100644 index 0000000000000..e0f24781b67d1 --- /dev/null +++ b/Geometry/MTDCommonData/interface/BTLElectronicsMapping.h @@ -0,0 +1,86 @@ +#ifndef DATAFORMATS_BTLELECTRONICSMAPPING_H +#define DATAFORMATS_BTLELECTRONICSMAPPING_H 1 + +#include +#include + +#include "DataFormats/ForwardDetId/interface/BTLDetId.h" +#include + +/** \brief BTL TOFHIR channel mapping with crystal BTLDetId + Convention: + SiPMside 0 == Minus Side + SiPMside 1 == Plus Side + */ + +class BTLElectronicsMapping { +public: + struct SiPMChPair { + int Minus; + int Plus; + }; + + struct TOFHIRChPair { + int Minus; + int Plus; + }; + + // Map SiPM Channel to crystal bars for Forward module orientation + static constexpr std::array SiPMChannelMapFW{ + {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}}; + // Map SiPM Channel to crystal bars for Backward module orientation + static constexpr std::array SiPMChannelMapBW{ + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16}}; + + // Map TOFHIR Channel to SiPM Channel + static constexpr std::array THChannelMap{ + {4, 1, 0, 3, 2, 6, 7, 9, 5, 11, 8, 12, 10, 14, 15, 13, + 17, 16, 18, 19, 20, 23, 21, 26, 22, 27, 28, 31, 30, 24, 25, 29}}; + + /** Default constructor -- invalid value */ + BTLElectronicsMapping(const BTLDetId::CrysLayout lay); + + // Get SiPM Channel number from crystal + int SiPMCh(uint32_t smodCopy, uint32_t crystal, uint32_t SiPMSide); + int SiPMCh(BTLDetId det, uint32_t SiPMSide); + int SiPMCh(uint32_t rawID, uint32_t SiPMSide); + + SiPMChPair GetSiPMChPair(uint32_t smodCopy, uint32_t crystal); + SiPMChPair GetSiPMChPair(BTLDetId det); + SiPMChPair GetSiPMChPair(uint32_t rawID); + + // Get TOFHIR Channel number from crystal + int TOFHIRCh(uint32_t smodCopy, uint32_t crystal, uint32_t SiPMSide); + int TOFHIRCh(BTLDetId det, uint32_t SiPMSide); + int TOFHIRCh(uint32_t rawID, uint32_t SiPMSide); + + TOFHIRChPair GetTOFHIRChPair(uint32_t smodCopy, uint32_t crystal); + TOFHIRChPair GetTOFHIRChPair(BTLDetId det); + TOFHIRChPair GetTOFHIRChPair(uint32_t rawID); + + // Get xtal from TOFHIR Channel number + int THChToXtal(uint32_t smodCopy, uint32_t THCh); + BTLDetId THChToBTLDetId( + uint32_t zside, uint32_t rod, uint32_t runit, uint32_t dmodule, uint32_t smodCopy, uint32_t THCh); + + /** Returns TOFHIR ASIC number in construction database. */ + int TOFHIRASIC(uint32_t dmodule, uint32_t smodCopy); + int TOFHIRASIC(BTLDetId det); + int TOFHIRASIC(uint32_t rawID); + + /** Returns FE board number */ + int FEBoardFromDM(uint32_t dmodule); + int FEBoard(BTLDetId det); + int FEBoard(uint32_t rawID); + + /** Returns CC board number */ + int CCBoardFromRU(uint32_t dmodule); + int CCBoard(BTLDetId det); + int CCBoard(uint32_t rawID); + +private: +}; + +#endif diff --git a/Geometry/MTDCommonData/interface/BTLNumberingScheme.h b/Geometry/MTDCommonData/interface/BTLNumberingScheme.h index e19b25a57cf4a..08678568d2de8 100644 --- a/Geometry/MTDCommonData/interface/BTLNumberingScheme.h +++ b/Geometry/MTDCommonData/interface/BTLNumberingScheme.h @@ -1,3 +1,4 @@ + #ifndef BTLNumberingScheme_h #define BTLNumberingScheme_h @@ -23,4 +24,4 @@ class BTLNumberingScheme : public MTDNumberingScheme { uint32_t getUnitID(const MTDBaseNumber& baseNumber) const override; }; -#endif +#endif \ No newline at end of file diff --git a/Geometry/MTDCommonData/interface/MTDTopologyMode.h b/Geometry/MTDCommonData/interface/MTDTopologyMode.h index dcef321fb7ace..704571ad19f21 100644 --- a/Geometry/MTDCommonData/interface/MTDTopologyMode.h +++ b/Geometry/MTDCommonData/interface/MTDTopologyMode.h @@ -7,7 +7,6 @@ #include #include "DataFormats/ForwardDetId/interface/BTLDetId.h" -#include "DataFormats/ForwardDetId/interface/ETLDetId.h" namespace MTDTopologyMode { @@ -20,40 +19,49 @@ namespace MTDTopologyMode { btlv1etlv4 = 5, btlv1etlv5 = 6, btlv2etlv5 = 7, - btlv3etlv8 = 8 + btlv3etlv8 = 8, + btlv4etlv8 = 9 }; + enum class EtlLayout { v5 = 3, v8 = 4 }; + Mode MTDStringToEnumParser(const std::string&); /** Returns BTLDetId::CrysLayout as a function of topology mode (to accomodate TDR/post TDR ETL scenarios). **/ inline BTLDetId::CrysLayout crysLayoutFromTopoMode(const int& topoMode) { - if (topoMode < 0 || topoMode > static_cast(Mode::btlv3etlv8)) { - throw cms::Exception("UnknownMTDtopoMode") << "Unknown MTD topology mode :( " << topoMode; - } else if (topoMode <= static_cast(BTLDetId::CrysLayout::barphiflat)) { - return static_cast(topoMode); - } else if (topoMode < static_cast(Mode::btlv2etlv5)) { - return BTLDetId::CrysLayout::barphiflat; - } else if (topoMode == static_cast(Mode::btlv2etlv5)) { - return BTLDetId::CrysLayout::v2; - } else { - return BTLDetId::CrysLayout::v3; + switch (topoMode) { + case static_cast(Mode::btlv4etlv8): + return BTLDetId::CrysLayout::v4; + break; + case static_cast(Mode::btlv3etlv8): + return BTLDetId::CrysLayout::v3; + break; + case static_cast(Mode::btlv2etlv5): + return BTLDetId::CrysLayout::v2; + break; + default: + throw cms::Exception("UnknownMTDtopoMode") << "Unknown MTD topology mode :( " << topoMode; + break; } } - /** Returns ETLDetId::EtlLayout as a function of topology mode **/ - - inline ETLDetId::EtlLayout etlLayoutFromTopoMode(const int& topoMode) { - if (topoMode < 0 || topoMode > static_cast(Mode::btlv3etlv8)) { - throw cms::Exception("UnknownMTDtopoMode") << "Unknown MTD topology mode :( " << topoMode; - } else if (topoMode <= static_cast(BTLDetId::CrysLayout::barphiflat)) { - return ETLDetId::EtlLayout::tp; - } else if (topoMode == static_cast(Mode::btlv1etlv4)) { - return ETLDetId::EtlLayout::v4; - } else if (topoMode == static_cast(Mode::btlv1etlv5) or topoMode == static_cast(Mode::btlv2etlv5)) { - return ETLDetId::EtlLayout::v5; - } else { - return ETLDetId::EtlLayout::v8; + /** Returns EtlLayout as a function of topology mode **/ + + inline EtlLayout etlLayoutFromTopoMode(const int& topoMode) { + switch (topoMode) { + case static_cast(Mode::btlv4etlv8): + return EtlLayout::v8; + break; + case static_cast(Mode::btlv3etlv8): + return EtlLayout::v8; + break; + case static_cast(Mode::btlv2etlv5): + return EtlLayout::v5; + break; + default: + throw cms::Exception("UnknownMTDtopoMode") << "Unknown MTD topology mode :( " << topoMode; + break; } } diff --git a/Geometry/MTDCommonData/src/BTLElectronicsMapping.cc b/Geometry/MTDCommonData/src/BTLElectronicsMapping.cc new file mode 100644 index 0000000000000..5a487645f1c25 --- /dev/null +++ b/Geometry/MTDCommonData/src/BTLElectronicsMapping.cc @@ -0,0 +1,218 @@ +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "Geometry/MTDCommonData/interface/BTLElectronicsMapping.h" +#include "FWCore/Utilities/interface/Exception.h" +#include + +#include +#include +#include +BTLElectronicsMapping::BTLElectronicsMapping(const BTLDetId::CrysLayout lay) { + if (static_cast(lay) < 7) { + throw cms::Exception("BTLElectronicsMapping") + << "MTD Topology mode with layout " << static_cast(lay) << " is not supported\n" + << "use layout : 7 (v4) or later!" << std::endl; + } +} + +// Get SiPM Channel from crystal ID + +int BTLElectronicsMapping::SiPMCh(uint32_t smodCopy, uint32_t crystal, uint32_t SiPMSide) { + if (0 > int(crystal) || crystal > BTLDetId::kCrystalsPerModuleV2) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::BTLElectronicsMapping(): " + << "****************** Bad crystal number = " << int(crystal); + return 0; + } + + if (0 > int(smodCopy) || smodCopy > BTLDetId::kSModulesPerDM) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad detector module copy = " << int(smodCopy); + return 0; + } + + if (smodCopy == 0) + return BTLElectronicsMapping::SiPMChannelMapFW[crystal + SiPMSide * BTLDetId::kCrystalsPerModuleV2]; + else + return BTLElectronicsMapping::SiPMChannelMapBW[crystal + SiPMSide * BTLDetId::kCrystalsPerModuleV2]; +} + +int BTLElectronicsMapping::SiPMCh(BTLDetId det, uint32_t SiPMSide) { + uint32_t smodCopy = det.smodule(); + uint32_t crystal = det.crystal(); + + return BTLElectronicsMapping::SiPMCh(smodCopy, crystal, SiPMSide); +} + +int BTLElectronicsMapping::SiPMCh(uint32_t rawId, uint32_t SiPMSide) { + BTLDetId theId(rawId); + return BTLElectronicsMapping::SiPMCh(theId, SiPMSide); +} + +BTLElectronicsMapping::SiPMChPair BTLElectronicsMapping::GetSiPMChPair(uint32_t smodCopy, uint32_t crystal) { + BTLElectronicsMapping::SiPMChPair SiPMChs; + SiPMChs.Minus = BTLElectronicsMapping::SiPMCh(smodCopy, crystal, 0); + SiPMChs.Plus = BTLElectronicsMapping::SiPMCh(smodCopy, crystal, 1); + return SiPMChs; +} + +BTLElectronicsMapping::SiPMChPair BTLElectronicsMapping::GetSiPMChPair(BTLDetId det) { + BTLElectronicsMapping::SiPMChPair SiPMChs; + SiPMChs.Minus = BTLElectronicsMapping::SiPMCh(det, 0); + SiPMChs.Plus = BTLElectronicsMapping::SiPMCh(det, 1); + return SiPMChs; +} +BTLElectronicsMapping::SiPMChPair BTLElectronicsMapping::GetSiPMChPair(uint32_t rawID) { + BTLElectronicsMapping::SiPMChPair SiPMChs; + SiPMChs.Minus = BTLElectronicsMapping::SiPMCh(rawID, 0); + SiPMChs.Plus = BTLElectronicsMapping::SiPMCh(rawID, 1); + return SiPMChs; +} + +// Get TOFHIR Channel from crystal ID + +int BTLElectronicsMapping::TOFHIRCh(uint32_t smodCopy, uint32_t crystal, uint32_t SiPMSide) { + int SiPMCh_ = BTLElectronicsMapping::SiPMCh(smodCopy, crystal, SiPMSide); + return BTLElectronicsMapping::THChannelMap[SiPMCh_]; +} + +int BTLElectronicsMapping::TOFHIRCh(BTLDetId det, uint32_t SiPMSide) { + uint32_t smodCopy = det.smodule(); + uint32_t crystal = det.crystal(); + + return BTLElectronicsMapping::TOFHIRCh(smodCopy, crystal, SiPMSide); +} + +int BTLElectronicsMapping::TOFHIRCh(uint32_t rawId, uint32_t SiPMSide) { + BTLDetId theId(rawId); + return BTLElectronicsMapping::TOFHIRCh(theId, SiPMSide); +} + +BTLElectronicsMapping::TOFHIRChPair BTLElectronicsMapping::GetTOFHIRChPair(uint32_t smodCopy, uint32_t crystal) { + BTLElectronicsMapping::TOFHIRChPair TOFHIRChs; + TOFHIRChs.Minus = BTLElectronicsMapping::TOFHIRCh(smodCopy, crystal, 0); + TOFHIRChs.Plus = BTLElectronicsMapping::TOFHIRCh(smodCopy, crystal, 1); + return TOFHIRChs; +} + +BTLElectronicsMapping::TOFHIRChPair BTLElectronicsMapping::GetTOFHIRChPair(BTLDetId det) { + BTLElectronicsMapping::TOFHIRChPair TOFHIRChs; + TOFHIRChs.Minus = BTLElectronicsMapping::TOFHIRCh(det, 0); + TOFHIRChs.Plus = BTLElectronicsMapping::TOFHIRCh(det, 1); + return TOFHIRChs; +} +BTLElectronicsMapping::TOFHIRChPair BTLElectronicsMapping::GetTOFHIRChPair(uint32_t rawID) { + BTLElectronicsMapping::TOFHIRChPair TOFHIRChs; + TOFHIRChs.Minus = BTLElectronicsMapping::TOFHIRCh(rawID, 0); + TOFHIRChs.Plus = BTLElectronicsMapping::TOFHIRCh(rawID, 1); + return TOFHIRChs; +} + +// Get crystal ID from TOFHIR Channel + +int BTLElectronicsMapping::THChToXtal(uint32_t smodCopy, uint32_t THCh) { + if (0 > int(smodCopy) || BTLDetId::kSModulesPerDM < smodCopy) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad detector module copy = " << int(smodCopy); + return 0; + } + + auto THChPos = + std::find(BTLElectronicsMapping::THChannelMap.begin(), BTLElectronicsMapping::THChannelMap.end(), THCh); + int targetSiPMCh = std::distance(BTLElectronicsMapping::THChannelMap.begin(), THChPos); + + std::array SiPMChMap; + if (smodCopy == 0) + SiPMChMap = BTLElectronicsMapping::SiPMChannelMapFW; + else + SiPMChMap = BTLElectronicsMapping::SiPMChannelMapBW; + + auto targetpos = std::find(SiPMChMap.begin(), SiPMChMap.end(), targetSiPMCh); + return std::distance(SiPMChMap.begin(), targetpos) % BTLDetId::kCrystalsPerModuleV2 + 1; +} + +BTLDetId BTLElectronicsMapping::THChToBTLDetId( + uint32_t zside, uint32_t rod, uint32_t runit, uint32_t dmodule, uint32_t smodCopy, uint32_t THCh) { + if (0 > int(THCh) || 31 < THCh) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad TOFHIR channel = " << int(THCh); + return 0; + } + + if (0 > int(smodCopy) || BTLDetId::kSModulesPerDM < smodCopy) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad detector module copy = " << int(smodCopy); + return 0; + } + + if (0 > int(dmodule) || 12 < dmodule) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad module copy = " << int(dmodule); + return 0; + } + + if (1 > rod || 36 < rod) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad rod copy = " << rod; + return 0; + } + + if (1 < zside) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad side = " << zside; + return 0; + } + + int crystal = BTLElectronicsMapping::THChToXtal(smodCopy, THCh); + + return BTLDetId(zside, rod, runit, dmodule, smodCopy, crystal); +} + +// Get TOFHIR asic number +// if dmodule is odd number (DM range [1-12]) +// SM1 --> TOFHIR A0 (simply 0) +// SM2 --> TOFHIR A1 (simply 1) +// else if dmodule is even number the order is inverted +// SM1 --> TOFHIR A1 (simply 1) +// SM2 --> TOFHIR A0 (simply 0) +int BTLElectronicsMapping::TOFHIRASIC(uint32_t dmodule, uint32_t smodCopy) { + if (dmodule % BTLDetId::kSModulesInDM == 0) + return smodCopy; + else + return BTLDetId::kSModulesInDM - smodCopy - 1; +} + +int BTLElectronicsMapping::TOFHIRASIC(BTLDetId det) { + uint32_t dmodule = det.dmodule(); + uint32_t smodCopy = det.smodule(); + return BTLElectronicsMapping::TOFHIRASIC(dmodule, smodCopy); +} + +int BTLElectronicsMapping::TOFHIRASIC(uint32_t rawID) { + BTLDetId theId(rawID); + return BTLElectronicsMapping::TOFHIRASIC(theId); +} + +/** Returns FE board number */ +int BTLElectronicsMapping::FEBoardFromDM(uint32_t dmodule) { return dmodule; } + +int BTLElectronicsMapping::FEBoard(BTLDetId det) { + uint32_t dmodule = det.dmodule(); + return BTLElectronicsMapping::FEBoardFromDM(dmodule); +} + +int BTLElectronicsMapping::FEBoard(uint32_t rawID) { + BTLDetId theId(rawID); + return BTLElectronicsMapping::FEBoard(theId); +} + +/** Returns CC board number */ +int BTLElectronicsMapping::CCBoardFromRU(uint32_t runit) { return runit; } + +int BTLElectronicsMapping::CCBoard(BTLDetId det) { + uint32_t runit = det.runit(); + return BTLElectronicsMapping::CCBoardFromRU(runit); +} + +int BTLElectronicsMapping::CCBoard(uint32_t rawID) { + BTLDetId theId(rawID); + return BTLElectronicsMapping::CCBoard(theId); +} diff --git a/Geometry/MTDCommonData/src/BTLNumberingScheme.cc b/Geometry/MTDCommonData/src/BTLNumberingScheme.cc index bd06ad10c7606..fe5e37f441788 100644 --- a/Geometry/MTDCommonData/src/BTLNumberingScheme.cc +++ b/Geometry/MTDCommonData/src/BTLNumberingScheme.cc @@ -17,7 +17,7 @@ uint32_t BTLNumberingScheme::getUnitID(const MTDBaseNumber& baseNumber) const { LogDebug("MTDGeom") << "BTLNumberingScheme geometry levels = " << nLevels; - uint32_t zside(999), rodCopy(0), runitCopy(0), modCopy(0), modtyp(0), crystal(0); + uint32_t zside(999), rodCopy(0), runitCopy(0), modCopy(0), modType(0), crystal(0), dmodCopy(0), smodCopy(0); bool isDD4hepOK(false); if (nLevels == kBTLcrystalLevel + 1) { @@ -26,10 +26,6 @@ uint32_t BTLNumberingScheme::getUnitID(const MTDBaseNumber& baseNumber) const { } } -#ifdef EDM_ML_DEBUG - LogDebug("MTDGeom") << "BTLNumberingScheme::getUnitID(): isDD4hep " << isDD4hepOK; -#endif - auto bareBaseName = [&](std::string_view name) { size_t ipos = name.rfind('_'); return (isDD4hepOK) ? name.substr(0, ipos) : name; @@ -45,65 +41,89 @@ uint32_t BTLNumberingScheme::getUnitID(const MTDBaseNumber& baseNumber) const { << bareBaseName(baseNumber.getLevelName(6)) << "[" << baseNumber.getCopyNumber(6) << "], " << bareBaseName(baseNumber.getLevelName(7)) << "[" << baseNumber.getCopyNumber(7) << "], " << bareBaseName(baseNumber.getLevelName(8)) << "[" << baseNumber.getCopyNumber(8) << "]"; + // barphiflat (v1) scenario - not supported + if (baseNumber.getLevelName(4).find("Timingactive") != std::string_view::npos) { + edm::LogError("MTDGeom") << "Geometry v1 of BTL not supported, run on a Geometry configuration D95 or latest "; + throw cms::Exception("Configuration") << "Invalid BTL Geometry configuration (v1)"; + } else if (baseNumber.getLevelName(0).find("BTLCrystal") != std::string_view::npos && + baseNumber.getLevelName(4).find("LayerTiming") != std::string_view::npos) { + // v4 scenario + // zside copy number + const std::string_view& rodName(baseNumber.getLevelName(3)); // name of module volume + uint32_t pos = rodName.find("Zpos"); + zside = (pos <= rodName.size() ? 1 : 0); - // barphiflat scenario + // rod (tray) copy number + rodCopy = baseNumber.getCopyNumber(3) - 1; - if (baseNumber.getLevelName(0).find("Timingactive") != std::string_view::npos) { - crystal = baseNumber.getCopyNumber(0); + // RU, global module and crystal copy numbers + // (everything start from 0) + runitCopy = baseNumber.getCopyNumber(2) - 1; - modCopy = baseNumber.getCopyNumber(2); - rodCopy = baseNumber.getCopyNumber(3); + modCopy = int(baseNumber.getCopyNumber(1)) - 1; + crystal = int(baseNumber.getCopyNumber(0)) - 1; - const std::string_view& modName(baseNumber.getLevelName(2)); // name of module volume - uint32_t pos = modName.find("Positive"); + // Detector and sensor module numbers from global module number 0-23 + dmodCopy = int((modCopy / BTLDetId::kDModulesInRUCol) / BTLDetId::kSModulesInDM) + + (modCopy % BTLDetId::kDModulesInRUCol) * BTLDetId::kDModulesInRURow; + smodCopy = int(modCopy / BTLDetId::kDModulesInRUCol) % BTLDetId::kSModulesInDM; - zside = (pos <= modName.size() ? 1 : 0); - std::string_view baseName = modName.substr(modName.find(':') + 1); - - modtyp = ::atoi(&baseName.at(7)); - if (modtyp == 17) { - modtyp = 2; - } else if (modtyp == 33) { - modtyp = 3; + // error checking + if (0 > int(crystal) || BTLDetId::kCrystalsPerModuleV2 - 1 < crystal) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad crystal number = " << int(crystal) + << ", Volume Number (counting from 0)= " << baseNumber.getCopyNumber(0) - 1; + return 0; } - // error checking + if (0 > int(modCopy) || BTLDetId::kModulesPerRUV2 - 1 < modCopy) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad module copy = " << int(modCopy) + << ", Volume Number (counting from 0)= " << baseNumber.getCopyNumber(1) - 1; + return 0; + } - if (1 > crystal || 64 < crystal) { + if (0 > int(smodCopy) || BTLDetId::kSModulesPerDM - 1 < smodCopy) { edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " - << "****************** Bad crystal number = " << crystal - << ", Volume Number = " << baseNumber.getCopyNumber(0); + << "****************** Bad detector module copy = " << int(smodCopy) + << ", Volume Number (counting from 0)= " << baseNumber.getCopyNumber(1) - 1; return 0; } - if (1 > modtyp || 3 < modtyp) { + if (0 > int(dmodCopy) || BTLDetId::kDModulesPerRU - 1 < dmodCopy) { edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " - << "****************** Bad module name = " << modName - << ", Volume Name = " << baseNumber.getLevelName(2); + << "****************** Bad detector module copy = " << int(dmodCopy) + << ", Volume Number (counting from 0)= " << baseNumber.getCopyNumber(1) - 1; return 0; } - if (1 > modCopy || 54 < modCopy) { + if (0 > int(runitCopy) || BTLDetId::kRUPerRod - 1 < runitCopy) { edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " - << "****************** Bad module copy = " << modCopy - << ", Volume Number = " << baseNumber.getCopyNumber(2); + << "****************** Bad readout unit copy = " << int(runitCopy) + << ", Volume Name= " << baseNumber.getLevelName(2) + << ", Volume Number (counting from 0)= " << baseNumber.getCopyNumber(2) - 1; return 0; } - if (1 > rodCopy || 36 < rodCopy) { + if (0 > int(rodCopy) || BTLDetId::HALF_ROD - 1 < rodCopy) { edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " - << "****************** Bad rod copy = " << rodCopy - << ", Volume Number = " << baseNumber.getCopyNumber(4); + << "****************** Bad rod copy = " << int(rodCopy) + << ", Volume Number (counting from 0)= " << baseNumber.getCopyNumber(3); return 0; } if (1 < zside) { edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " << "****************** Bad side = " << zside - << ", Volume Name = " << baseNumber.getLevelName(2); + << ", Volume Name = " << baseNumber.getLevelName(3); return 0; } - } else if (baseNumber.getLevelName(0).find("BTLCrystal") != std::string_view::npos) { + + // all inputs are fine. Go ahead and decode + BTLDetId thisBTLdetid(zside, rodCopy, runitCopy, dmodCopy, smodCopy, crystal); + intindex = thisBTLdetid.rawId(); + } else if (baseNumber.getLevelName(0).find("BTLCrystal") != std::string_view::npos && + baseNumber.getLevelName(4).find("Layer1Timing") != std::string_view::npos) { // v2 or v3 scenario crystal = baseNumber.getCopyNumber(0); @@ -129,10 +149,10 @@ uint32_t BTLNumberingScheme::getUnitID(const MTDBaseNumber& baseNumber) const { if (isV2) { // V2: the type is embedded in crystal name - modtyp = ::atoi(&bareBaseName(baseNumber.getLevelName(2)).back()); + modType = ::atoi(&bareBaseName(baseNumber.getLevelName(2)).back()); } else { // V3: build type and RU number per type from global RU number - modtyp = globalru2type[runitCopy - 1]; + modType = globalru2type[runitCopy - 1]; runitCopy = globalru2ru[runitCopy - 1]; } @@ -145,7 +165,7 @@ uint32_t BTLNumberingScheme::getUnitID(const MTDBaseNumber& baseNumber) const { return 0; } - if (1 > modtyp || 3 < modtyp) { + if (1 > modType || 3 < modType) { edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " << "****************** Bad RU name, Volume Name = " << bareBaseName(baseNumber.getLevelName(2)); @@ -179,15 +199,13 @@ uint32_t BTLNumberingScheme::getUnitID(const MTDBaseNumber& baseNumber) const { << ", Volume Name = " << baseNumber.getLevelName(3); return 0; } - } - - // all inputs are fine. Go ahead and decode - - BTLDetId thisBTLdetid(zside, rodCopy, runitCopy, modCopy, modtyp, crystal); - intindex = thisBTLdetid.rawId(); + // all inputs are fine. Go ahead and decode + BTLDetId thisBTLdetid(zside, rodCopy, runitCopy, modCopy, modType, crystal, isV2); + intindex = thisBTLdetid.rawId(); + } } else if (nLevels == kBTLmoduleLevel && baseNumber.getLevelName(0).find("BTLModule") != std::string_view::npos) { - // v2 scenario, geographicalId per module + // v4 scenario, geographicalId per module // for tracking navigation geometry LogDebug("MTDGeom") << bareBaseName(baseNumber.getLevelName(0)) << "[" << baseNumber.getCopyNumber(0) << "], " << bareBaseName(baseNumber.getLevelName(1)) << "[" << baseNumber.getCopyNumber(1) << "], " @@ -197,78 +215,142 @@ uint32_t BTLNumberingScheme::getUnitID(const MTDBaseNumber& baseNumber) const { << bareBaseName(baseNumber.getLevelName(5)) << "[" << baseNumber.getCopyNumber(5) << "], " << bareBaseName(baseNumber.getLevelName(6)) << "[" << baseNumber.getCopyNumber(6) << "], " << bareBaseName(baseNumber.getLevelName(7)) << "[" << baseNumber.getCopyNumber(7) << "]"; + if (baseNumber.getLevelName(3).find("LayerTiming") != std::string_view::npos) { + const std::string_view& rodName(baseNumber.getLevelName(2)); // name of module volume + uint32_t pos = rodName.find("Zpos"); + zside = (pos <= rodName.size() ? 1 : 0); - modCopy = baseNumber.getCopyNumber(0); - runitCopy = baseNumber.getCopyNumber(1); - rodCopy = baseNumber.getCopyNumber(2); + // rod (tray), RU and module copy numbers + // (everything start from 0) + rodCopy = baseNumber.getCopyNumber(2) - 1; + runitCopy = baseNumber.getCopyNumber(1) - 1; + modCopy = baseNumber.getCopyNumber(0) - 1; - const std::string_view& rodName(baseNumber.getLevelName(2)); // name of module volume - uint32_t pos = rodName.find("Zpos"); - zside = (pos <= rodName.size() ? 1 : 0); + // eval detector and sensor module numbers from global module number 1-24 + dmodCopy = int((modCopy / BTLDetId::kDModulesInRUCol) / BTLDetId::kSModulesInDM) + + (modCopy % BTLDetId::kDModulesInRUCol) * BTLDetId::kDModulesInRURow; + smodCopy = int(modCopy / BTLDetId::kDModulesInRUCol) % BTLDetId::kSModulesInDM; - // for negative side swap module numbers betwee sides of the tray, so as to keep the same number for the same phi angle - // in the existing model. This introduces a misalignemtn between module number and volume copy for the negative side. - if (zside == 0) { - modCopy = negModCopy[modCopy - 1]; - } + if (0 > int(modCopy) || BTLDetId::kModulesPerRUV2 - 1 < modCopy) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad module copy = " << int(modCopy) + << ", Volume Number (counting from 0)= " << baseNumber.getCopyNumber(0) - 1; + return 0; + } - bool isV2(bareBaseName(baseNumber.getLevelName(0)).back() != 'e'); + if (0 > int(smodCopy) || BTLDetId::kSModulesPerDM - 1 < smodCopy) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad detector module copy = " << int(smodCopy) + << ", Volume Number (counting from 0)= " << baseNumber.getCopyNumber(0) - 1; + return 0; + } -#ifdef EDM_ML_DEBUG - LogDebug("MTDGeom") << "BTLNumberingScheme::getUnitID(): isV2 " << isV2; -#endif + if (0 > int(dmodCopy) || BTLDetId::kDModulesPerRU - 1 < dmodCopy) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad detector module copy = " << int(dmodCopy) + << ", Volume Number (counting from 0)= " << baseNumber.getCopyNumber(0) - 1; + return 0; + } - if (isV2) { - // V2: the type is embedded in crystal name - modtyp = ::atoi(&bareBaseName(baseNumber.getLevelName(1)).back()); - } else { - // V3: build type and RU number per type from global RU number - modtyp = globalru2type[runitCopy - 1]; - runitCopy = globalru2ru[runitCopy - 1]; - } + if (0 > int(runitCopy) || BTLDetId::kRUPerRod - 1 < runitCopy) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad readout unit copy = " << int(runitCopy) + << ", Volume Number (counting from 0)= " << baseNumber.getCopyNumber(1) - 1; + return 0; + } - // error checking + if (0 > int(rodCopy) || BTLDetId::HALF_ROD - 1 < rodCopy) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad rod copy = " << int(rodCopy) + << ", Volume Number (counting from 0)= " << baseNumber.getCopyNumber(2); + return 0; + } - if (1 > modtyp || 3 < modtyp) { - edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " - << "****************** Bad RU name, Volume Name = " - << bareBaseName(baseNumber.getLevelName(1)); - return 0; - } + if (1 < zside) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad side = " << zside + << ", Volume Name = " << baseNumber.getLevelName(2); + return 0; + } - if (1 > modCopy || BTLDetId::kModulesPerRUV2 < modCopy) { - edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " - << "****************** Bad module copy = " << modCopy - << ", Volume Number = " << baseNumber.getCopyNumber(0); - return 0; + // all inputs are fine. Go ahead and decode + BTLDetId thisBTLdetid(zside, rodCopy, runitCopy, dmodCopy, smodCopy, 0); + intindex = thisBTLdetid.geographicalId(BTLDetId::CrysLayout::v4).rawId(); } - if (1 > runitCopy || BTLDetId::kRUPerTypeV2 < runitCopy) { - edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " - << "****************** Bad readout unit copy = " << runitCopy - << ", Volume Number = " << baseNumber.getCopyNumber(1); - return 0; - } + else if (baseNumber.getLevelName(3).find("Layer1Timing") != std::string_view::npos) { + // v2 or v3 scenario + // zside copy number + modCopy = baseNumber.getCopyNumber(0); + runitCopy = baseNumber.getCopyNumber(1); + rodCopy = baseNumber.getCopyNumber(2); - if (1 > rodCopy || BTLDetId::HALF_ROD < rodCopy) { - edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " - << "****************** Bad rod copy = " << rodCopy - << ", Volume Number = " << baseNumber.getCopyNumber(2); - return 0; - } + const std::string_view& rodName(baseNumber.getLevelName(2)); // name of module volume + uint32_t pos = rodName.find("Zpos"); + zside = (pos <= rodName.size() ? 1 : 0); - if (1 < zside) { - edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " - << "****************** Bad side = " << zside - << ", Volume Name = " << baseNumber.getLevelName(2); - return 0; - } + // for negative side swap module numbers betwee sides of the tray, so as to keep the same number for the same phi angle + // in the existing model. This introduces a misalignemtn between module number and volume copy for the negative side. + if (zside == 0) { + modCopy = negModCopy[modCopy - 1]; + } - // all inputs are fine. Go ahead and decode + bool isV2(bareBaseName(baseNumber.getLevelName(0)).back() != 'e'); - BTLDetId thisBTLdetid(zside, rodCopy, runitCopy, modCopy, modtyp, 0); - intindex = thisBTLdetid.geographicalId(BTLDetId::CrysLayout::v2).rawId(); +#ifdef EDM_ML_DEBUG + LogDebug("MTDGeom") << "BTLNumberingScheme::getUnitID(): isV2 " << isV2; +#endif + if (isV2) { + // V2: the type is embedded in crystal name + modType = ::atoi(&bareBaseName(baseNumber.getLevelName(1)).back()); + } else { + // V3: build type and RU number per type from global RU number + modType = globalru2type[runitCopy - 1]; + runitCopy = globalru2ru[runitCopy - 1]; + } + + // error checking + + if (1 > modType || 3 < modType) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad RU name, Volume Name = " + << bareBaseName(baseNumber.getLevelName(1)); + return 0; + } + + if (1 > modCopy || BTLDetId::kModulesPerRUV2 < modCopy) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad module copy = " << modCopy + << ", Volume Number = " << baseNumber.getCopyNumber(0); + return 0; + } + + if (1 > runitCopy || BTLDetId::kRUPerTypeV2 < runitCopy) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad readout unit copy = " << runitCopy + << ", Volume Number = " << baseNumber.getCopyNumber(1); + return 0; + } + + if (1 > rodCopy || BTLDetId::HALF_ROD < rodCopy) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad rod copy = " << rodCopy + << ", Volume Number = " << baseNumber.getCopyNumber(2); + return 0; + } + + if (1 < zside) { + edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " + << "****************** Bad side = " << zside + << ", Volume Name = " << baseNumber.getLevelName(2); + return 0; + } + + // all inputs are fine. Go ahead and decode + BTLDetId thisBTLdetid(zside, rodCopy, runitCopy, modCopy, modType, 0, isV2); + intindex = thisBTLdetid.geographicalId(BTLDetId::CrysLayout::v2).rawId(); + } } else { edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): " << "Not enough levels found in MTDBaseNumber ( " << nLevels @@ -277,8 +359,9 @@ uint32_t BTLNumberingScheme::getUnitID(const MTDBaseNumber& baseNumber) const { } LogDebug("MTDGeom") << "BTL Numbering scheme: " - << " zside = " << zside << " rod = " << rodCopy << " modtyp = " << modtyp << " RU = " << runitCopy - << " module = " << modCopy << " crystal = " << crystal << " Raw Id = " << intindex << "\n" + << " Raw Id = " << intindex << " zside = " << zside << " rod = " << rodCopy + << " runit = " << runitCopy << " dmodule = " << dmodCopy << " smodule = " << smodCopy + << " module = " << modCopy + 1 << " crystal = " << crystal << "\n" << BTLDetId(intindex); return intindex; diff --git a/Geometry/MTDCommonData/src/MTDTopologyMode.cc b/Geometry/MTDCommonData/src/MTDTopologyMode.cc index e40b613767829..d2d86e0afa7d2 100644 --- a/Geometry/MTDCommonData/src/MTDTopologyMode.cc +++ b/Geometry/MTDCommonData/src/MTDTopologyMode.cc @@ -7,22 +7,12 @@ namespace MTDTopologyMode { Mode MTDStringToEnumParser(const std::string &value) { std::string prefix("MTDTopologyMode::"); Mode output = Mode::undefined; - if (value == prefix + "tile") { - output = Mode::tile; - } else if (value == prefix + "bar") { - output = Mode::bar; - } else if (value == prefix + "barzflat") { - output = Mode::barzflat; - } else if (value == prefix + "barphiflat") { - output = Mode::barphiflat; - } else if (value == prefix + "btlv1etlv4") { - output = Mode::btlv1etlv4; - } else if (value == prefix + "btlv1etlv5") { - output = Mode::btlv1etlv5; - } else if (value == prefix + "btlv2etlv5") { + if (value == prefix + "btlv2etlv5") { output = Mode::btlv2etlv5; } else if (value == prefix + "btlv3etlv8") { output = Mode::btlv3etlv8; + } else if (value == prefix + "btlv4etlv8") { + output = Mode::btlv4etlv8; } else { throw cms::Exception("MTDTopologyModeError") << "the value " << value << " is not defined."; } diff --git a/Geometry/MTDCommonData/test/BuildFile.xml b/Geometry/MTDCommonData/test/BuildFile.xml index 54e23853ebc13..25ec6655161e5 100644 --- a/Geometry/MTDCommonData/test/BuildFile.xml +++ b/Geometry/MTDCommonData/test/BuildFile.xml @@ -18,6 +18,7 @@ + diff --git a/Geometry/MTDCommonData/test/DD4hep_TestMTDIdealGeometry.cc b/Geometry/MTDCommonData/test/DD4hep_TestMTDIdealGeometry.cc index df5fba9dc6422..6fd60e327c67d 100644 --- a/Geometry/MTDCommonData/test/DD4hep_TestMTDIdealGeometry.cc +++ b/Geometry/MTDCommonData/test/DD4hep_TestMTDIdealGeometry.cc @@ -13,6 +13,7 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/Records/interface/DDSpecParRegistryRcd.h" @@ -25,6 +26,11 @@ #include "Geometry/MTDCommonData/interface/MTDBaseNumber.h" #include "Geometry/MTDCommonData/interface/BTLNumberingScheme.h" #include "Geometry/MTDCommonData/interface/ETLNumberingScheme.h" +#include "Geometry/MTDCommonData/interface/BTLElectronicsMapping.h" +#include "Geometry/MTDCommonData/interface/MTDTopologyMode.h" + +#include "Geometry/MTDGeometryBuilder/interface/MTDTopology.h" +#include "Geometry/Records/interface/MTDTopologyRcd.h" #include "DataFormats/ForwardDetId/interface/BTLDetId.h" #include "DataFormats/ForwardDetId/interface/ETLDetId.h" @@ -54,6 +60,7 @@ class DD4hep_TestMTDIdealGeometry : public edm::one::EDAnalyzer<> { BTLNumberingScheme btlNS_; ETLNumberingScheme etlNS_; + edm::ESGetToken mtdtopoToken_; edm::ESGetToken dddetToken_; edm::ESGetToken dspecToken_; }; @@ -68,6 +75,7 @@ DD4hep_TestMTDIdealGeometry::DD4hep_TestMTDIdealGeometry(const edm::ParameterSet thisN_(), btlNS_(), etlNS_() { + mtdtopoToken_ = esConsumes(); dddetToken_ = esConsumes(tag_); dspecToken_ = esConsumes(tag_); } @@ -77,6 +85,10 @@ void DD4hep_TestMTDIdealGeometry::analyze(const edm::Event& iEvent, const edm::E auto pSP = iSetup.getTransientHandle(dspecToken_); + auto topologyHandle = iSetup.getTransientHandle(mtdtopoToken_); + const MTDTopology* topology = topologyHandle.product(); + auto btlCrysLayout = MTDTopologyMode::crysLayoutFromTopoMode(topology->getMTDTopologyMode()); + if (ddTopNodeName_ != "BarrelTimingLayer" && ddTopNodeName_ != "EndcapTimingLayer") { edm::LogWarning("DD4hep_TestMTDIdealGeometry") << ddTopNodeName_ << "Not valid top MTD volume"; return; @@ -141,6 +153,11 @@ void DD4hep_TestMTDIdealGeometry::analyze(const edm::Event& iEvent, const edm::E if (dd4hep::dd::noNamespace(fv.name()) == "BarrelTimingLayer") { isBarrel = true; edm::LogInfo("DD4hep_TestMTDIdealGeometry") << "isBarrel = " << isBarrel; + if (static_cast(btlCrysLayout) < static_cast(BTLDetId::CrysLayout::v4)) { + edm::LogInfo("DD4hep_TestMTDIdealGeometry") + << "BTL electronics mapping not available for BTL crystal layout " << static_cast(btlCrysLayout) + << ", use layout 7 (v4) or later!" << std::endl; + } } else if (dd4hep::dd::noNamespace(fv.name()) == "EndcapTimingLayer") { isBarrel = false; edm::LogInfo("DD4hep_TestMTDIdealGeometry") << "isBarrel = " << isBarrel; @@ -217,7 +234,17 @@ void DD4hep_TestMTDIdealGeometry::analyze(const edm::Event& iEvent, const edm::E BTLDetId theId(btlNS_.getUnitID(thisN_)); sunitt << theId.rawId(); snum << theId; - snum << "\n"; + + if (static_cast(btlCrysLayout) >= static_cast(BTLDetId::CrysLayout::v4)) { + BTLElectronicsMapping btlEM = BTLElectronicsMapping(btlCrysLayout); + snum << "\n"; + snum << "----------------------------------------------------------------------------" << std::endl; + snum << " CCBoard: " << btlEM.CCBoard(theId) << " FEBoard: " << btlEM.FEBoard(theId) + << " TOFHIRASIC: " << btlEM.TOFHIRASIC(theId) << "\n SiPMCh minus: " << btlEM.SiPMCh(theId, 0) + << " plus: " << btlEM.SiPMCh(theId, 1) << "\n TOFHIRCh minus: " << btlEM.TOFHIRCh(theId, 0) + << " plus: " << btlEM.TOFHIRCh(theId, 1) << "\n"; + snum << "----------------------------------------------------------------------------" << std::endl; + } } else { ETLDetId theId(etlNS_.getUnitID(thisN_)); sunitt << theId.rawId(); diff --git a/Geometry/MTDCommonData/test/testMTDinDD4hep.py b/Geometry/MTDCommonData/test/testMTDinDD4hep.py index 80c92252d09c2..36f838ec53a43 100644 --- a/Geometry/MTDCommonData/test/testMTDinDD4hep.py +++ b/Geometry/MTDCommonData/test/testMTDinDD4hep.py @@ -7,6 +7,7 @@ process = cms.Process("CompareGeometryTest",_PH2_ERA,dd4hep) process.source = cms.Source("EmptySource") + process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) @@ -55,7 +56,9 @@ threshold = cms.untracked.string('INFO') ) -process.load('Configuration.Geometry.GeometryDD4hepExtendedRun4Default_cff') +process.load("Geometry.MTDNumberingBuilder.mtdTopology_cfi") + +process.load('Configuration.Geometry.GeometryDD4hepExtendedRun4DefaultReco_cff') process.testBTL = cms.EDAnalyzer("DD4hep_TestMTDIdealGeometry", DDDetector = cms.ESInputTag('',''), diff --git a/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc b/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc index b4a07b3367468..2f16a2d75099f 100644 --- a/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc +++ b/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc @@ -59,8 +59,8 @@ bool MTDParametersFromDD::build(const DDCompactView* cvp, PMTDParameters& ptp) { throw cms::Exception("MTDParametersFromDD") << "Not found " << attribute.c_str() << " but needed."; } - if (MTDTopologyMode::etlLayoutFromTopoMode(topoMode) == ETLDetId::EtlLayout::v5 || - MTDTopologyMode::etlLayoutFromTopoMode(topoMode) == ETLDetId::EtlLayout::v8) { + if (MTDTopologyMode::etlLayoutFromTopoMode(topoMode) == MTDTopologyMode::EtlLayout::v5 || + MTDTopologyMode::etlLayoutFromTopoMode(topoMode) == MTDTopologyMode::EtlLayout::v8) { std::array etlLayout{{ "StartCopyNo_Front_Left", "StartCopyNo_Front_Right", @@ -134,8 +134,8 @@ bool MTDParametersFromDD::build(const cms::DDCompactView* cvp, PMTDParameters& p throw cms::Exception("MTDParametersFromDD") << "Not found " << attribute.c_str() << " but needed."; } - if (MTDTopologyMode::etlLayoutFromTopoMode(topoMode) == ETLDetId::EtlLayout::v5 || - MTDTopologyMode::etlLayoutFromTopoMode(topoMode) == ETLDetId::EtlLayout::v8) { + if (MTDTopologyMode::etlLayoutFromTopoMode(topoMode) == MTDTopologyMode::EtlLayout::v5 || + MTDTopologyMode::etlLayoutFromTopoMode(topoMode) == MTDTopologyMode::EtlLayout::v8) { std::array etlLayout{{ "StartCopyNo_Front_Left", "StartCopyNo_Front_Right", diff --git a/Geometry/MTDGeometryBuilder/src/MTDTopology.cc b/Geometry/MTDGeometryBuilder/src/MTDTopology.cc index 2994ec2000ef1..a7387b0119c42 100644 --- a/Geometry/MTDGeometryBuilder/src/MTDTopology.cc +++ b/Geometry/MTDGeometryBuilder/src/MTDTopology.cc @@ -128,7 +128,9 @@ size_t MTDTopology::hshiftETL(const uint32_t detid, const int horizontalShift) c int geomDetIndex; // distinguish numbering in prev8 / v8 geometries - if (getMTDTopologyMode() == static_cast(MTDTopologyMode::Mode::btlv3etlv8)) { + auto topoMode = getMTDTopologyMode(); + if (static_cast(MTDTopologyMode::etlLayoutFromTopoMode(topoMode)) >= + static_cast(MTDTopologyMode::EtlLayout::v8)) { geomDetIndex = 2 * (module - 1) + sensor; } else { geomDetIndex = module; @@ -175,7 +177,9 @@ size_t MTDTopology::vshiftETL(const uint32_t detid, const int verticalShift, siz int geomDetIndex; // distinguish numbering in prev8 / v8 geometries - if (getMTDTopologyMode() == static_cast(MTDTopologyMode::Mode::btlv3etlv8)) { + auto topoMode = getMTDTopologyMode(); + if (static_cast(MTDTopologyMode::etlLayoutFromTopoMode(topoMode)) >= + static_cast(MTDTopologyMode::EtlLayout::v8)) { geomDetIndex = 2 * (module - 1) + sensor; } else { geomDetIndex = module; diff --git a/Geometry/MTDGeometryBuilder/test/DD4hep_TestPixelTopology.cc b/Geometry/MTDGeometryBuilder/test/DD4hep_TestPixelTopology.cc index f8720bafec958..64317d821e7b5 100644 --- a/Geometry/MTDGeometryBuilder/test/DD4hep_TestPixelTopology.cc +++ b/Geometry/MTDGeometryBuilder/test/DD4hep_TestPixelTopology.cc @@ -293,10 +293,10 @@ void DD4hep_TestPixelTopology::analyze(const edm::Event& iEvent, const edm::Even if (isBarrel) { edm::LogVerbatim("DD4hep_TestPixelTopology") - << "geoId= " << modIdBTL.rawId() << " side= " << modIdBTL.mtdSide() - << " RU/mod= " << modIdBTL.globalRunit() << " / " << modIdBTL.module(); + << "geoId= " << modIdBTL.rawId() << " side= " << modIdBTL.mtdSide() << " RU/mod= " << modIdBTL.runit() + << " / " << modIdBTL.module(); sunitt_ << "geoId= " << modIdBTL.rawId() << " side= " << modIdBTL.mtdSide() - << " RU/mod= " << modIdBTL.globalRunit() << " / " << modIdBTL.module(); + << " RU/mod= " << modIdBTL.runit() << " / " << modIdBTL.module(); } else { edm::LogVerbatim("DD4hep_TestPixelTopology") << "geoId= " << modIdETL.rawId() << " side= " << modIdETL.mtdSide() @@ -412,14 +412,14 @@ void DD4hep_TestPixelTopology::analyze(const edm::Event& iEvent, const edm::Even if (isBarrel) { edm::LogVerbatim("DD4hep_TestPixelTopology") << "rawId= " << theIdBTL.rawId() << " geoId= " << geoId.rawId() << " side/rod= " << theIdBTL.mtdSide() - << " / " << theIdBTL.mtdRR() << " RU= " << theIdBTL.globalRunit() + << " / " << theIdBTL.mtdRR() << " RU= " << theIdBTL.runit() << " module/geomodule= " << theIdBTL.module() << " / " << static_cast(geoId).module() << " crys= " << theIdBTL.crystal() << " BTLDetId row/col= " << origRow << " / " << origCol << "\n"; sunitt_ << "rawId= " << theIdBTL.rawId() << " geoId= " << geoId.rawId() - << " side/rod= " << theIdBTL.mtdSide() << " / " << theIdBTL.mtdRR() - << " RU= " << theIdBTL.globalRunit() << " module/geomodule= " << theIdBTL.module() << " / " - << static_cast(geoId).module() << " crys= " << theIdBTL.crystal() - << " BTLDetId row/col= " << origRow << " / " << origCol << "\n"; + << " side/rod= " << theIdBTL.mtdSide() << " / " << theIdBTL.mtdRR() << " RU= " << theIdBTL.runit() + << " module/geomodule= " << theIdBTL.module() << " / " << static_cast(geoId).module() + << " crys= " << theIdBTL.crystal() << " BTLDetId row/col= " << origRow << " / " << origCol + << "\n"; } else { edm::LogVerbatim("DD4hep_TestPixelTopology") << "geoId= " << modIdETL.rawId() << " side= " << modIdETL.mtdSide() diff --git a/Geometry/MTDNumberingBuilder/plugins/CmsMTDConstruction.cc b/Geometry/MTDNumberingBuilder/plugins/CmsMTDConstruction.cc index 7d2f1342651b5..f77f2a882549d 100644 --- a/Geometry/MTDNumberingBuilder/plugins/CmsMTDConstruction.cc +++ b/Geometry/MTDNumberingBuilder/plugins/CmsMTDConstruction.cc @@ -9,8 +9,6 @@ #include "DataFormats/ForwardDetId/interface/ETLDetId.h" #include "Geometry/MTDCommonData/interface/MTDBaseNumber.h" -#include "DataFormats/Math/interface/deltaPhi.h" - using angle_units::operators::convertRadToDeg; template @@ -39,14 +37,14 @@ bool CmsMTDConstruction::mtdOrderPhi(const GeometricTimingDet* a, template bool CmsMTDConstruction::btlOrderPhi(const GeometricTimingDet* a, const GeometricTimingDet* b) { - return static_cast(convertRadToDeg(angle0to2pi::make0To2pi(a->phi()))) < - static_cast(convertRadToDeg(angle0to2pi::make0To2pi(b->phi()))); + return static_cast(convertRadToDeg(makempiToppi(a->phi()))) < + static_cast(convertRadToDeg(makempiToppi(b->phi()))); } template bool CmsMTDConstruction::btlOrderZ(const GeometricTimingDet* a, const GeometricTimingDet* b) { - bool order = (static_cast(convertRadToDeg(angle0to2pi::make0To2pi(a->phi()))) == - static_cast(convertRadToDeg(angle0to2pi::make0To2pi(b->phi())))) && + bool order = (static_cast(convertRadToDeg(makempiToppi(a->phi()))) == + static_cast(convertRadToDeg(makempiToppi(b->phi())))) && (a->translation().z() < b->translation().z()); return order; } @@ -150,7 +148,7 @@ GeometricTimingDet* CmsMTDConstruction::buildSubdet(FilteredView& GeometricTimingDet* subdet = new GeometricTimingDet(&fv, thisDet); if (thisDet == GeometricTimingDet::BTL) { - subdet->setGeographicalID(BTLDetId(0, 0, 0, 0, 0)); + subdet->setGeographicalID(BTLDetId(0, 0, 0, 0, 0, 0)); } else if (thisDet == GeometricTimingDet::ETL) { const uint32_t side = subdet->translation().z() > 0 ? 1 : 0; subdet->setGeographicalID(ETLDetId(side, 0, 0, 0, 0)); diff --git a/Geometry/MTDNumberingBuilder/src/CmsMTDStringToEnum.cc b/Geometry/MTDNumberingBuilder/src/CmsMTDStringToEnum.cc index 725a4f85d4512..a704a1225de20 100644 --- a/Geometry/MTDNumberingBuilder/src/CmsMTDStringToEnum.cc +++ b/Geometry/MTDNumberingBuilder/src/CmsMTDStringToEnum.cc @@ -9,6 +9,7 @@ CmsMTDStringToEnum::Impl::Impl() { map_.emplace("BarrelTimingLayer", GeometricTimingDet::BTL); map_.emplace("Layer1", GeometricTimingDet::BTLLayer); map_.emplace("Layer1Timing", GeometricTimingDet::BTLLayer); + map_.emplace("LayerTiming", GeometricTimingDet::BTLLayer); map_.emplace("BModule", GeometricTimingDet::BTLModule); map_.emplace("BTLModu", GeometricTimingDet::BTLModule); // truncate name to have the same length as old versions map_.emplace("EndcapTimingLayer", GeometricTimingDet::ETL); diff --git a/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc b/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc index d207aa6f212b6..8a05fef2ee512 100644 --- a/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc +++ b/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc @@ -21,15 +21,11 @@ pair, vector > ETLDetLayerGeometryBuilder::buildLay vector result[2]; // one for each endcap const int mtdTopologyMode = topo.getMTDTopologyMode(); - ETLDetId::EtlLayout etlL = MTDTopologyMode::etlLayoutFromTopoMode(mtdTopologyMode); + MTDTopologyMode::EtlLayout etlL = MTDTopologyMode::etlLayoutFromTopoMode(mtdTopologyMode); // number of layers is identical for post TDR scenarios, pick v4 // loop on number of sectors per face, two faces per disc (i.e. layer) taken into account in layer building (front/back) unsigned int nSector(1); - if (etlL == ETLDetId::EtlLayout::v4) { - nSector *= ETLDetId::kETLv4maxSector; - } else if (etlL == ETLDetId::EtlLayout::v5) { - nSector *= ETLDetId::kETLv5maxSector; - } else if (etlL == ETLDetId::EtlLayout::v8) { + if (etlL == MTDTopologyMode::EtlLayout::v5 || etlL == MTDTopologyMode::EtlLayout::v8) { nSector *= ETLDetId::kETLv5maxSector; } else { throw cms::Exception("MTDDetLayers") << "Not implemented scenario " << mtdTopologyMode; diff --git a/RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc b/RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc index 5472945566382..66bda88bc4a05 100644 --- a/RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc +++ b/RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc @@ -78,7 +78,7 @@ DetId MTDDetLayerGeometry::makeDetLayerId(const DetLayer* detLayer) const { return ETLDetId(id.mtdSide(), 0, 0, 0, 0); // Constructor of new geometry is compatible with prev8 } else if (detLayer->subDetector() == GeomDetEnumerators::TimingBarrel) { BTLDetId id(detLayer->basicComponents().front()->geographicalId().rawId()); - return BTLDetId(id.mtdSide(), 0, 0, 0, 0); + return BTLDetId(id.mtdSide(), 0, 0, 0, 0, 0); } else throw cms::Exception("InvalidModuleIdentification"); // << detLayer->module(); } @@ -108,7 +108,7 @@ const DetLayer* MTDDetLayerGeometry::idToLayer(const DetId& id) const { idout = ETLDetId(etlId.mtdSide(), 0, 0, 0, 0); } else if (detId.mtdSubDetector() == 1) { // 1 is BTL BTLDetId btlId(detId.rawId()); - idout = BTLDetId(btlId.mtdSide(), 0, 0, 0, 0); + idout = BTLDetId(btlId.mtdSide(), 0, 0, 0, 0, 0); } else throw cms::Exception("InvalidSubdetId") << detId.subdetId(); diff --git a/RecoMTD/DetLayers/test/mtd_cfg.py b/RecoMTD/DetLayers/test/mtd_cfg.py index c384f5897e7b6..c4a36421478b0 100644 --- a/RecoMTD/DetLayers/test/mtd_cfg.py +++ b/RecoMTD/DetLayers/test/mtd_cfg.py @@ -65,5 +65,4 @@ process.prod1 = cms.EDAnalyzer("TestBTLNavigation") process.prod2 = cms.EDAnalyzer("TestETLNavigation") -# process.p1 = cms.Path(cms.wait(process.prod)+cms.wait(process.prod1)+process.prod2) -process.p1 = cms.Path(cms.wait(process.prod)+process.prod2) +process.p1 = cms.Path(cms.wait(process.prod)+cms.wait(process.prod1)+process.prod2)