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: 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 + ) 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.