diff --git a/Detector/DetCRD/compact/CRD_common_v01/Ecal_Crystal_Barrel_v01_01.xml b/Detector/DetCRD/compact/CRD_common_v01/Ecal_Crystal_Barrel_v01_01.xml index 02e2244c08ba6e60b85c85f087248fb1c8f5fdc4..e439461d9ca5f824e321e0e43b2fc833232f88bd 100644 --- a/Detector/DetCRD/compact/CRD_common_v01/Ecal_Crystal_Barrel_v01_01.xml +++ b/Detector/DetCRD/compact/CRD_common_v01/Ecal_Crystal_Barrel_v01_01.xml @@ -15,7 +15,6 @@ <detectors> <detector id="DetID_ECAL" name="CaloDetector" type="CRDEcalBarrel_v01" readout="EcalBarrelCollection" vis="Invisible" sensitive="true" region="EcalBarrelRegion"> - <sensitive type="scintillator"/> <!-- Use cm as unit if you want to use Pandora for reconstruction --> </detector> </detectors> diff --git a/Detector/DetCRD/compact/CRD_common_v01/Ecal_Rotated_Crystal_v01_01.xml b/Detector/DetCRD/compact/CRD_common_v01/Ecal_Rotated_Crystal_v01_01.xml index 1301bd434ca98656baf082d54b91ff6362ee65e6..eef2ba3cfdbe9e3c0dba6ad0c913ed870a3f41ef 100644 --- a/Detector/DetCRD/compact/CRD_common_v01/Ecal_Rotated_Crystal_v01_01.xml +++ b/Detector/DetCRD/compact/CRD_common_v01/Ecal_Rotated_Crystal_v01_01.xml @@ -22,7 +22,6 @@ <shape type="Tube" rmin="Ecal_barrel_inner_radius" rmax="Ecal_barrel_outer_radius_redef" dz="Ecal_barrel_half_length" material="Air"/> <!--/shape--> </envelope> - <sensitive type="scintillator"/> <dimensions rmin="Ecal_barrel_inner_radius" rmax="Ecal_barrel_outer_radius_redef" zhalf="Ecal_barrel_half_length_correct" alpha="Ecal_crystal_rotate_angle" nphi="1368" nz="numberZ" gap="0"/> <crystal material="G4_BGO" vis="ECALVis"/> </detector> diff --git a/Detector/DetCRD/scripts/Standalone-Sim-RotCrystal.py b/Detector/DetCRD/scripts/Standalone-Sim-RotCrystal.py index a424a1b3af88ed4b9929cf87ade65891277ce763..1386affd7623cda211e7d1d8f983fa749b26b9f3 100644 --- a/Detector/DetCRD/scripts/Standalone-Sim-RotCrystal.py +++ b/Detector/DetCRD/scripts/Standalone-Sim-RotCrystal.py @@ -88,6 +88,10 @@ detsimalg.AnaElems = [ ] detsimalg.RootDetElem = "WorldDetElemTool" +from Configurables import CalorimeterSensDetTool +cal_sensdettool = CalorimeterSensDetTool("CalorimeterSensDetTool") +cal_sensdettool.CalNamesApplyBirks = ["EcalBarrel"] + # output from Configurables import PodioOutput out = PodioOutput("outputalg") diff --git a/Detector/DetCRD/src/Calorimeter/CRDEcal.cpp b/Detector/DetCRD/src/Calorimeter/CRDEcal.cpp index 65602b45772baec41534983a53e505751a671dce..9d1b6b79d8733d0977925bd1c5c429bf9bbe9eb7 100644 --- a/Detector/DetCRD/src/Calorimeter/CRDEcal.cpp +++ b/Detector/DetCRD/src/Calorimeter/CRDEcal.cpp @@ -128,8 +128,7 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector, sd.setPlacement(plv); } - xml_dim_t sd_typ = x_det.child(_U(sensitive)); - sens.setType(sd_typ.typeStr()); + sens.setType("calorimeter"); MYDEBUG("create_detector DONE. "); return ECAL; diff --git a/Detector/DetCRD/src/Calorimeter/CRDEcal_v01.cpp b/Detector/DetCRD/src/Calorimeter/CRDEcal_v01.cpp index a11717c0c63252adca4bace361d919bca203b887..4ba45b249f46c9bd815ac60b21f3a32f385a51cf 100644 --- a/Detector/DetCRD/src/Calorimeter/CRDEcal_v01.cpp +++ b/Detector/DetCRD/src/Calorimeter/CRDEcal_v01.cpp @@ -183,8 +183,7 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector, sd.setPlacement(plv); } - xml_dim_t sd_typ = x_det.child(_U(sensitive)); - sens.setType(sd_typ.typeStr()); + sens.setType("calorimeter"); ECAL.addExtension< LayeredCalorimeterData >( caloData ) ; MYDEBUG("create_detector DONE. "); diff --git a/Detector/DetCRD/src/Calorimeter/RotatedCrystalCalorimeter_v01_geo.cpp b/Detector/DetCRD/src/Calorimeter/RotatedCrystalCalorimeter_v01_geo.cpp index 9de1e8a096edcf3f4d41d6269ef3353a830bcf60..ec6e9fa5c229c348edccc36089d8cb59e24b7c1d 100644 --- a/Detector/DetCRD/src/Calorimeter/RotatedCrystalCalorimeter_v01_geo.cpp +++ b/Detector/DetCRD/src/Calorimeter/RotatedCrystalCalorimeter_v01_geo.cpp @@ -97,13 +97,9 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s Volume crystalVol("crystal_whole", crystalTrap, crystalMat); crystalVol.setVisAttributes(description, crystalVis); - if ( x_det.isSensitive() ) { - xml_dim_t sd_typ = x_det.child(_U(sensitive)); - sens.setType(sd_typ.typeStr()); - crystalVol.setSensitiveDetector(sens); - } + sens.setType("calorimeter"); // TODO: crystal pack - + crystalVol.setSensitiveDetector(sens); for (xml_coll_t xp(x_crystal, _U(slice)); xp; ++xp){ // xml_comp_t x_slice = xp; diff --git a/Simulation/DetSimGeom/src/AnExampleDetElemTool.cpp b/Simulation/DetSimGeom/src/AnExampleDetElemTool.cpp index e7ea439453243102e5260c8d03c1e83dfc0dd86a..ff20af31bc40cd2d24304e83e2c9bbadffc6a171 100644 --- a/Simulation/DetSimGeom/src/AnExampleDetElemTool.cpp +++ b/Simulation/DetSimGeom/src/AnExampleDetElemTool.cpp @@ -101,7 +101,7 @@ AnExampleDetElemTool::ConstructSDandField() { // try to use SD tool to find the SD if (!g4sd) { - if (typ=="calorimeter" || typ=="scintillator") { + if (typ=="calorimeter") { m_calo_sdtool = ToolHandle<ISensDetTool>("CalorimeterSensDetTool"); if (m_calo_sdtool) { info() << "Find the CalorimeterSensDetTool." << endmsg; diff --git a/Simulation/DetSimSD/include/DetSimSD/CaloSensitiveDetector.h b/Simulation/DetSimSD/include/DetSimSD/CaloSensitiveDetector.h index 49581737494d6a2266fa35dfefb43f30b81f0e97..4f2b6182c431cf3249591ae06f435bec7240b38d 100644 --- a/Simulation/DetSimSD/include/DetSimSD/CaloSensitiveDetector.h +++ b/Simulation/DetSimSD/include/DetSimSD/CaloSensitiveDetector.h @@ -32,8 +32,8 @@ protected: HitCollection* m_hc; std::map<unsigned long, CalorimeterHit*> m_hitMap; - bool m_isMergeEnabled; - bool m_applyBirksLaw = false; + bool m_isMergeEnabled = false; + bool m_applyBirksLaw = false; }; diff --git a/Simulation/DetSimSD/src/CalorimeterSensDetTool.cpp b/Simulation/DetSimSD/src/CalorimeterSensDetTool.cpp index 8e405936b96a00ad6a6bf6849211702e776cb76a..c02b59103d74d6ce7298c2ed9ce5cd48144640f9 100644 --- a/Simulation/DetSimSD/src/CalorimeterSensDetTool.cpp +++ b/Simulation/DetSimSD/src/CalorimeterSensDetTool.cpp @@ -45,9 +45,12 @@ CalorimeterSensDetTool::createSD(const std::string& name) { CaloSensitiveDetector* sd = new CaloSensitiveDetector(name, *dd4hep_geo, is_merge_enabled); debug() << name << " set to merge true/false = " << is_merge_enabled << endmsg; - auto sens = dd4hep_geo->sensitiveDetector(name); - std::string typ = sens.type(); - if(typ=="scintillator"&&m_applyBirksLaw) sd->ApplyBirksLaw(); + for(auto cal_name : m_listCalsApplyBirks){ + if(cal_name==name){ + sd->ApplyBirksLaw(); + break; + } + } return sd; } diff --git a/Simulation/DetSimSD/src/CalorimeterSensDetTool.h b/Simulation/DetSimSD/src/CalorimeterSensDetTool.h index 00bdb69c568e20654c35cf3888ca6a00723dd78d..69bab1d4e5a5bde38b087ce14d54c8db1969dd96 100644 --- a/Simulation/DetSimSD/src/CalorimeterSensDetTool.h +++ b/Simulation/DetSimSD/src/CalorimeterSensDetTool.h @@ -30,7 +30,7 @@ private: SmartIF<IGeomSvc> m_geosvc; Gaudi::Property<std::vector<std::string> > m_listCalsMergeDisable{this, "CalNamesMergeDisable", {}}; - Gaudi::Property<bool> m_applyBirksLaw{this, "ApplyBirksLaw", true}; + Gaudi::Property<std::vector<std::string> > m_listCalsApplyBirks{this, "CalNamesApplyBirks", {}}; }; #endif