From ebdea6cdf0b505d95d6548ae2eae25c18c41bab2 Mon Sep 17 00:00:00 2001 From: zwu0922 Date: Fri, 5 Apr 2024 17:03:48 +0200 Subject: [PATCH 1/3] cross talk neighbour script --- FCCSW_ecal/xtalk_neighbours_theta.py | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 FCCSW_ecal/xtalk_neighbours_theta.py diff --git a/FCCSW_ecal/xtalk_neighbours_theta.py b/FCCSW_ecal/xtalk_neighbours_theta.py new file mode 100644 index 0000000..3f9d7af --- /dev/null +++ b/FCCSW_ecal/xtalk_neighbours_theta.py @@ -0,0 +1,37 @@ +from Configurables import GeoSvc +from Configurables import ApplicationMgr +from Configurables import CreateFCCeeCaloXTalkNeighbours +import os +from Gaudi.Configuration import INFO, DEBUG + +# Detector geometry +geoservice = GeoSvc("GeoSvc") +# if K4GEO is empty, this should use relative path to working directory +path_to_detector = os.environ.get("K4GEO", "") +print(path_to_detector) +detectors_to_use = [ + 'FCCee/ALLEGRO/compact/ALLEGRO_o1_v02/ALLEGRO_o1_v02.xml' +] + +# prefix all xmls with path_to_detector +geoservice.detectors = [os.path.join(path_to_detector, _det) for _det in detectors_to_use] +geoservice.OutputLevel = INFO + +# create the crosstalk neighbour file for ECAL barrel cells +neighbours = CreateFCCeeCaloXTalkNeighbours("xtalk_neighbours", + outputFileName="xtalk_neighbours_map_ecalB_thetamodulemerged.root", + readoutNames=["ECalBarrelModuleThetaMerged"], + systemNames=["system"], + systemValues=[4], + activeFieldNames=["layer"], + activeVolumesNumbers=[12], + OutputLevel=DEBUG) + +# ApplicationMgr +ApplicationMgr(TopAlg=[], + EvtSel='NONE', + EvtMax=1, + # order is important, as GeoSvc is needed by G4SimSvc + ExtSvc=[geoservice, neighbours], + OutputLevel=INFO + ) From 37f96c490a4c3bbd8a511159d661effc976b04be Mon Sep 17 00:00:00 2001 From: Zhibo Wu <91186438+zwu0922@users.noreply.github.com> Date: Fri, 5 Apr 2024 17:22:08 +0200 Subject: [PATCH 2/3] Add instructions on the crosstalk neighbour script --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 42c0eed..224cef4 100644 --- a/README.md +++ b/README.md @@ -266,3 +266,13 @@ Basically runs all the steps in one go. Comment/uncomment lines as needed. * Calls the `runParallel` scripts for the various steps. * Train the MVA calib (on CaloClusters and CaloTopoClusters) * Then compute the resolutions and responses, and make plots. + +#### Producing neighbours of crosstalk +jobOption to run: +`xtalk_neighbours_theta.py` + +For each cell, generate a list of crosstalk neighbours and their corresponding crosstalk coefficients with respect to the cell under study. The Layer/Module/Theta indices can be added for debug purpose. + +Output: +`xtalk_neighbours_map_ecalB_thetamodulemerged.root` +A list of crosstalk neighbours and corresponding crosstalk coefficients for each cell. From e2fa8d35011a718d252251243c2ac4f68fa80456 Mon Sep 17 00:00:00 2001 From: Zhibo Wu Date: Mon, 19 Aug 2024 12:09:57 +0200 Subject: [PATCH 3/3] fccrun script with noise for ALLEGRO v3 --- FCCSW_ecal/run_thetamodulemerged.py | 51 +++++++++++++++-------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/FCCSW_ecal/run_thetamodulemerged.py b/FCCSW_ecal/run_thetamodulemerged.py index b86aecd..50dada6 100644 --- a/FCCSW_ecal/run_thetamodulemerged.py +++ b/FCCSW_ecal/run_thetamodulemerged.py @@ -55,7 +55,6 @@ # python libraries import os from math import cos, sin, tan - # # SETTINGS # @@ -63,7 +62,7 @@ # - general settings # use_pythia = False # use pythia or particle gun -addNoise = False # add noise or not to the cell energy +addNoise = True # add noise or not to the cell energy dumpGDML = False # create GDML file of detector model runHCal = False # simulate only the ECAL or both ECAL+HCAL @@ -367,7 +366,8 @@ # Step 1: merge hits into cells according to initial segmentation ecalBarrelCellsName = "ECalBarrelCells" -createEcalBarrelCells = CreateCaloCells("CreateECalBarrelCells", +if not addNoise: + createEcalBarrelCells = CreateCaloCells("CreateECalBarrelCells", doCellCalibration=True, calibTool=calibEcalBarrel, addCellNoise=False, @@ -432,7 +432,6 @@ createEcalBarrelPositionedCells2.hits.Path = ecalBarrelCellsName2 createEcalBarrelPositionedCells2.positionedHits.Path = "ECalBarrelPositionedCells2" - # Create cells in ECal endcap createEcalEndcapCells = CreateCaloCells("CreateEcalEndcapCaloCells", doCellCalibration=True, @@ -458,28 +457,30 @@ filterNoiseThreshold=0, numRadialLayers=11, scaleFactor=1 / 1000., # MeV to GeV - OutputLevel=DEBUG) - - # needs to be migrated! - #from Configurables import TubeLayerPhiEtaCaloTool - #barrelGeometry = TubeLayerPhiEtaCaloTool("EcalBarrelGeo", - # readoutName=ecalBarrelReadoutNamePhiEta, - # activeVolumeName="LAr_sensitive", - # activeFieldName="layer", - # activeVolumesNumber=12, - # fieldNames=["system"], - # fieldValues=[4]) + OutputLevel=INFO) + + # barrel geometry tool is migrated to match ALLEGRO v3 segmentation + from Configurables import TubeLayerModuleThetaMergedCaloTool + barrelGeometry = TubeLayerModuleThetaMergedCaloTool("EcalBarrelGeo", + readoutName=ecalBarrelReadoutName, + activeVolumeName="LAr_sensitive", + activeFieldName="layer", + activeVolumesNumber=11, + fieldNames=["system"], + fieldValues=[4]) # cells with noise not filtered - # createEcalBarrelCellsNoise = CreateCaloCells("CreateECalBarrelCellsNoise", - # doCellCalibration=False, - # addCellNoise=True, - # filterCellNoise=False, - # OutputLevel=INFO, - # hits="ECalBarrelCellsStep2", - # noiseTool=noiseBarrel, - # geometryTool=barrelGeometry, - # cells=EcalBarrelCellsName) + createEcalBarrelCells = CreateCaloCells("CreateECalBarrelCellsNoise", + doCellCalibration=True, + calibTool=calibEcalBarrel, + addCellNoise=True, + filterCellNoise=False, + noiseTool=noiseBarrel, + addPosition=True, + geometryTool=barrelGeometry, + OutputLevel=INFO, + hits=ecalBarrelHitsName, + cells=ecalBarrelCellsName) # cells with noise filtered # createEcalBarrelCellsNoise = CreateCaloCells("CreateECalBarrelCellsNoise_filtered", @@ -864,7 +865,7 @@ resegmentEcalBarrel, createEcalBarrelCells2, createEcalBarrelPositionedCells2, - createEcalEndcapCells + createEcalEndcapCells, ] if runHCal: