From 7c0d9134ccbb80230ef2d9b7ea5f1970a93e00dc Mon Sep 17 00:00:00 2001 From: Archil Durglishvili Date: Thu, 5 Dec 2024 16:08:10 +0100 Subject: [PATCH] fixing RecFCCeeCalorimeter tests --- .../tests/options/ALLEGRO_o1_v03.sh | 4 +- .../tests/options/ALLEGRO_o1_v03_digi_reco.py | 117 +++--------------- .../run_thetamodulemerged_SW_benchmarkCorr.py | 62 +--------- 3 files changed, 24 insertions(+), 159 deletions(-) diff --git a/RecFCCeeCalorimeter/tests/options/ALLEGRO_o1_v03.sh b/RecFCCeeCalorimeter/tests/options/ALLEGRO_o1_v03.sh index 91418e4..ce773a7 100755 --- a/RecFCCeeCalorimeter/tests/options/ALLEGRO_o1_v03.sh +++ b/RecFCCeeCalorimeter/tests/options/ALLEGRO_o1_v03.sh @@ -47,7 +47,7 @@ if ! test -f ./neighbours_map_ecalB_thetamodulemerged_hcalB_thetaphi.root; then download_file "https://fccsw.web.cern.ch/fccsw/filesForSimDigiReco/ALLEGRO/ALLEGRO_o1_v03/lgbm_calibration-CaloClusters.onnx" download_file "https://fccsw.web.cern.ch/fccsw/filesForSimDigiReco/ALLEGRO/ALLEGRO_o1_v03/lgbm_calibration-CaloTopoClusters.onnx" download_file "https://fccsw.web.cern.ch/fccsw/filesForSimDigiReco/ALLEGRO/ALLEGRO_o1_v03/neighbours_map_ecalB_thetamodulemerged.root" - download_file "https://fccsw.web.cern.ch/fccsw/filesForSimDigiReco/ALLEGRO/ALLEGRO_o1_v03/neighbours_map_ecalB_thetamodulemerged_hcalB_thetaphi.root" + download_file "https://fccsw.web.cern.ch/fccsw/filesForSimDigiReco/ALLEGRO/ALLEGRO_o1_v03/neighbours_map_ecalB_thetamodulemerged_hcalB_hcalEndcap_phitheta.root" # add here the lines to get the files for the photon ID fi @@ -61,4 +61,4 @@ else k4run $SCRIPT_DIR/ALLEGRO_o1_v03_digi_reco.py --EventDataSvc.input=ALLEGRO_sim_e_endcap.root --out.filename=ALLEGRO_sim_digi_reco_e_endcap.root || exit 1 k4run $SCRIPT_DIR/ALLEGRO_o1_v03_digi_reco.py --EventDataSvc.input=ALLEGRO_sim_pi_barrel.root --out.filename=ALLEGRO_sim_digi_reco_pi_barrel.root || exit 1 k4run $SCRIPT_DIR/ALLEGRO_o1_v03_digi_reco.py --EventDataSvc.input=ALLEGRO_sim_pi_endcap.root --out.filename=ALLEGRO_sim_digi_reco_pi_endcap.root || exit 1 -fi \ No newline at end of file +fi diff --git a/RecFCCeeCalorimeter/tests/options/ALLEGRO_o1_v03_digi_reco.py b/RecFCCeeCalorimeter/tests/options/ALLEGRO_o1_v03_digi_reco.py index aadac23..415ad57 100644 --- a/RecFCCeeCalorimeter/tests/options/ALLEGRO_o1_v03_digi_reco.py +++ b/RecFCCeeCalorimeter/tests/options/ALLEGRO_o1_v03_digi_reco.py @@ -109,15 +109,11 @@ ecalEndcapReadoutName = "ECalEndcapTurbine" # endcap, turbine-like (baseline) # - HCAL readouts if runHCal: - hcalBarrelReadoutName = "HCalBarrelReadout" # barrel, original segmentation (row-phi) - hcalBarrelReadoutName2 = "BarHCal_Readout_phitheta" # barrel, groups together cells of different row within same theta slice - hcalEndcapReadoutName = "HCalEndcapReadout" # endcap, original segmentation - hcalEndcapReadoutName2 = "HCalEndcapReadout_phitheta" # endcap, groups together cells of different row within same theta slice + hcalBarrelReadoutName = "HCalBarrelReadout" # barrel, original segmentation (HCalPhiTheta) + hcalEndcapReadoutName = "HCalEndcapReadout" # endcap, original segmentation (HCalPhiTheta) else: hcalBarrelReadoutName = "" - hcalBarrelReadoutName2 = "" hcalEndcapReadoutName = "" - hcalEndcapReadoutName2 = "" # - EM scale calibration (sampling fraction) from Configurables import CalibrateInLayersTool @@ -176,12 +172,6 @@ detectorName="HCalBarrel", OutputLevel=INFO ) - cellPositionHCalBarrelTool2 = CellPositionsHCalPhiThetaSegTool( - "CellPositionsHCalBarrel2", - readoutName=hcalBarrelReadoutName2, - detectorName="HCalBarrel", - OutputLevel=INFO - ) cellPositionHCalEndcapTool = CellPositionsHCalPhiThetaSegTool( "CellPositionsHCalEndcap", readoutName=hcalEndcapReadoutName, @@ -189,13 +179,6 @@ numLayersHCalThreeParts=[6, 9, 22], OutputLevel=INFO ) - cellPositionHCalEndcapTool2 = CellPositionsHCalPhiThetaSegTool( - "CellPositionsHCalEndcap2", - readoutName=hcalEndcapReadoutName2, - detectorName="HCalThreePartsEndcap", - numLayersHCalThreeParts=[6, 9, 22], - OutputLevel=INFO - ) # - crosstalk tool if addCrosstalk: @@ -342,37 +325,6 @@ cells=hcalBarrelPositionedCellsName, OutputLevel=INFO) - # Compute new cellID of cells based on new readout - removing row information - # We use a RedoSegmentation. Using a RewriteBitField with removeIds=["row"], - # wont work because there are tiles with same layer/theta/phi but different row - # as a consequence there will be multiple cells with same cellID in the output collection - # and this will screw up the SW clustering - - # first we create new hits with the readout without the row information - # and then merge them into new cells, wihotut applying the calibration again - from Configurables import RedoSegmentation - rewriteHCalBarrel = RedoSegmentation("ReSegmentationHCalBarrel", - # old bitfield (readout) - oldReadoutName=hcalBarrelReadoutName, - # specify which fields are going to be altered (deleted/rewritten) - oldSegmentationIds=["row", "theta", "phi"], - # new bitfield (readout), with new segmentation (theta-phi grid) - newReadoutName=hcalBarrelReadoutName2, - OutputLevel=INFO, - debugPrint=200, - inhits=hcalBarrelPositionedCellsName, - outhits="HCalBarrelCellsWithoutRow") - - hcalBarrelPositionedCellsName2 = hcalBarrelReadoutName2 + "Positioned" - createHCalBarrelCells2 = CreatePositionedCaloCells("CreateHCalBarrelCells2", - doCellCalibration=False, - positionsTool=cellPositionHCalBarrelTool2, - addCellNoise=False, - filterCellNoise=False, - OutputLevel=INFO, - hits=rewriteHCalBarrel.outhits.Path, - cells=hcalBarrelPositionedCellsName2) - # Create cells in HCal endcap hcalEndcapPositionedCellsName = hcalEndcapReadoutName + "Positioned" createHCalEndcapCells = CreatePositionedCaloCells("CreateHCalEndcapCells", @@ -385,37 +337,11 @@ hits=hcalEndcapReadoutName, cells=hcalEndcapPositionedCellsName) - rewriteHCalEndcap = RedoSegmentation("ReSegmentationHCalEndcap", - # old bitfield (readout) - oldReadoutName=hcalEndcapReadoutName, - # specify which fields are going to be altered (deleted/rewritten) - oldSegmentationIds=["row", "theta", "phi"], - # new bitfield (readout), with new segmentation (theta-phi grid) - newReadoutName=hcalEndcapReadoutName2, - OutputLevel=INFO, - debugPrint=200, - inhits=hcalEndcapPositionedCellsName, - outhits="HCalEndcapCellsWithoutRow") - - hcalEndcapPositionedCellsName2 = hcalEndcapReadoutName2 + "Positioned" - createHCalEndcapCells2 = CreatePositionedCaloCells("CreateHCalEndcapCells2", - doCellCalibration=False, - positionsTool=cellPositionHCalEndcapTool2, - addCellNoise=False, - filterCellNoise=False, - OutputLevel=INFO, - hits=rewriteHCalEndcap.outhits.Path, - cells=hcalEndcapPositionedCellsName2) - else: hcalBarrelPositionedCellsName = "emptyCaloCells" - hcalBarrelPositionedCellsName2 = "emptyCaloCells" hcalEndcapPositionedCellsName = "emptyCaloCells" - hcalEndcapPositionedCellsName2 = "emptyCaloCells" cellPositionHCalBarrelTool = None - cellPositionHCalBarrelTool2 = None cellPositionHCalEndcapTool = None - cellPositionHCalEndcapTool2 = None # Empty cells for parts of calorimeter not implemented yet from Configurables import CreateEmptyCaloCellsCollection @@ -590,17 +516,17 @@ ecalBarrelReadoutName=ecalBarrelReadoutName, ecalEndcapReadoutName=ecalEndcapReadoutName, ecalFwdReadoutName="", - hcalBarrelReadoutName=hcalBarrelReadoutName2, + hcalBarrelReadoutName=hcalBarrelReadoutName, hcalExtBarrelReadoutName="", - hcalEndcapReadoutName=hcalEndcapReadoutName2, + hcalEndcapReadoutName=hcalEndcapReadoutName, hcalFwdReadoutName="", OutputLevel=INFO) towers.ecalBarrelCells.Path = ecalBarrelPositionedCellsName towers.ecalEndcapCells.Path = ecalEndcapPositionedCellsName towers.ecalFwdCells.Path = "emptyCaloCells" - towers.hcalBarrelCells.Path = hcalBarrelPositionedCellsName2 + towers.hcalBarrelCells.Path = hcalBarrelPositionedCellsName towers.hcalExtBarrelCells.Path = "emptyCaloCells" - towers.hcalEndcapCells.Path = hcalEndcapPositionedCellsName2 + towers.hcalEndcapCells.Path = hcalEndcapPositionedCellsName towers.hcalFwdCells.Path = "emptyCaloCells" createClusters = CreateCaloClustersSlidingWindowFCCee("CreateCaloClusters", @@ -667,9 +593,9 @@ noiseTool=readECalBarrelNoisyCellsMap, # cell positions tools for all sub - systems positionsECalBarrelTool=cellPositionEcalBarrelTool, - # positionsHCalBarrelTool=cellPositionHCalBarrelTool2, + positionsHCalBarrelTool=cellPositionHCalBarrelTool, # positionsHCalBarrelNoSegTool=cellPositionHCalBarrelNoSegTool, - # positionsHCalExtBarrelTool=cellPositionHCalExtBarrelTool, + positionsHCalExtBarrelTool=cellPositionHCalEndcapTool, # positionsHCalExtBarrelTool = HCalExtBcells, # positionsEMECTool = EMECcells, # positionsHECTool = HECcells, @@ -767,24 +693,25 @@ ecalBarrelReadoutName=ecalBarrelReadoutName, ecalEndcapReadoutName="", ecalFwdReadoutName="", - hcalBarrelReadoutName=hcalBarrelReadoutName2, + hcalBarrelReadoutName=hcalBarrelReadoutName, hcalExtBarrelReadoutName="", - hcalEndcapReadoutName="", + hcalEndcapReadoutName=hcalEndcapReadoutName, hcalFwdReadoutName="", OutputLevel=INFO) createTopoInput.ecalBarrelCells.Path = ecalBarrelPositionedCellsName createTopoInput.ecalEndcapCells.Path = "emptyCaloCells" createTopoInput.ecalFwdCells.Path = "emptyCaloCells" - createTopoInput.hcalBarrelCells.Path = hcalBarrelPositionedCellsName2 + createTopoInput.hcalBarrelCells.Path = hcalBarrelPositionedCellsName createTopoInput.hcalExtBarrelCells.Path = "emptyCaloCells" - createTopoInput.hcalEndcapCells.Path = "emptyCaloCells" + createTopoInput.hcalEndcapCells.Path = hcalEndcapPositionedCellsName createTopoInput.hcalFwdCells.Path = "emptyCaloCells" cellPositionHCalBarrelNoSegTool = None cellPositionHCalExtBarrelTool = None - neighboursMap = "neighbours_map_ecalB_thetamodulemerged_hcalB_thetaphi.root" + #neighboursMap = "neighbours_map_ecalB_thetamodulemerged_hcalB_hcalEndcap_phirow.root" + neighboursMap = "neighbours_map_ecalB_thetamodulemerged_hcalB_hcalEndcap_phitheta.root" noiseMap = "cellNoise_map_electronicsNoiseLevel_ecalB_thetamodulemerged_hcalB_thetaphi.root" readNeighboursMap = TopoCaloNeighbours("ReadNeighboursMap", @@ -804,9 +731,9 @@ noiseTool=readNoisyCellsMap, # cell positions tools for all sub - systems positionsECalBarrelTool=cellPositionEcalBarrelTool, - positionsHCalBarrelTool=cellPositionHCalBarrelTool2, + positionsHCalBarrelTool=cellPositionHCalBarrelTool, # positionsHCalBarrelNoSegTool=cellPositionHCalBarrelNoSegTool, - # positionsHCalExtBarrelTool=cellPositionHCalExtBarrelTool, + positionsHCalExtBarrelTool=cellPositionHCalEndcapTool, # positionsHCalExtBarrelTool = HCalExtBcells, # positionsEMECTool = EMECcells, # positionsHECTool = HECcells, @@ -865,8 +792,8 @@ if resegmentECalBarrel: out.outputCommands.append("drop %s" % ecalBarrelPositionedCellsName2) if runHCal: - out.outputCommands.append("drop %s" % hcalBarrelPositionedCellsName2) - out.outputCommands.append("drop %s" % hcalEndcapPositionedCellsName2) + out.outputCommands.append("drop %s" % hcalBarrelPositionedCellsName) + out.outputCommands.append("drop %s" % hcalEndcapPositionedCellsName) if not saveClusterCells: out.outputCommands.append("drop Calo*ClusterCells*") @@ -914,18 +841,10 @@ if runHCal: TopAlg += [ createHCalBarrelCells, - rewriteHCalBarrel, - createHCalBarrelCells2, createHCalEndcapCells, - rewriteHCalEndcap, - createHCalEndcapCells2, ] createHCalBarrelCells.AuditExecute = True - rewriteHCalBarrel.AuditExecute = True - createHCalBarrelCells2.AuditExecute = True createHCalEndcapCells.AuditExecute = True - rewriteHCalEndcap.AuditExecute = True - createHCalEndcapCells2.AuditExecute = True if doSWClustering or doTopoClustering: TopAlg += [createemptycells] diff --git a/RecFCCeeCalorimeter/tests/options/run_thetamodulemerged_SW_benchmarkCorr.py b/RecFCCeeCalorimeter/tests/options/run_thetamodulemerged_SW_benchmarkCorr.py index 1819944..a13974d 100644 --- a/RecFCCeeCalorimeter/tests/options/run_thetamodulemerged_SW_benchmarkCorr.py +++ b/RecFCCeeCalorimeter/tests/options/run_thetamodulemerged_SW_benchmarkCorr.py @@ -224,11 +224,9 @@ # HCAL if runHCal: hcalBarrelReadoutName = "HCalBarrelReadout" - hcalBarrelReadoutName2 = "BarHCal_Readout_phitheta" hcalEndcapReadoutName = "HCalEndcapReadout" else: hcalBarrelReadoutName = "" - hcalBarrelReadoutName2 = "" hcalEndcapReadoutName = "" # Configure saving of calorimeter hits @@ -429,7 +427,7 @@ cells=hcalBarrelCellsName, OutputLevel=INFO) - # 2 - attach positions to the cells (cell positions needed for RedoSegmentation!) + # 2 - attach positions to the cells from Configurables import CellPositionsHCalPhiThetaSegTool cellPositionHcalBarrelTool = CellPositionsHCalPhiThetaSegTool( "CellPositionsHCalBarrel", @@ -445,52 +443,6 @@ createHcalBarrelPositionedCells.hits.Path = hcalBarrelCellsName createHcalBarrelPositionedCells.positionedHits.Path = hcalBarrelPositionedCellsName - # 3 - compute new cellID of cells based on new readout - removing row information - # We use a RedoSegmentation. Using a RewriteBitField with removeIds=["row"], - # wont work because there are tiles with same layer/theta/phi but different row - # as a consequence there will be multiple cells with same cellID in the output collection - # and this will screw up the SW clustering - hcalBarrelCellsName2 = "HCalBarrelCells2" - - # first we create new hits with the readout without the row information - # and then merge them into new cells - rewriteHCalBarrel = RedoSegmentation("ReSegmentationHcal", - # old bitfield (readout) - oldReadoutName=hcalBarrelReadoutName, - # specify which fields are going to be altered (deleted/rewritten) - oldSegmentationIds=["row", "theta", "phi"], - # new bitfield (readout), with new segmentation (merged modules and theta cells) - newReadoutName=hcalBarrelReadoutName2, - OutputLevel=INFO, - debugPrint=200, - inhits=hcalBarrelPositionedCellsName, - outhits="HCalBarrelCellsWithoutRow") - - createHcalBarrelCells2 = CreateCaloCells("CreateHCalBarrelCells2", - doCellCalibration=False, - addCellNoise=False, - filterCellNoise=False, - OutputLevel=INFO, - hits=rewriteHCalBarrel.outhits.Path, - cells=hcalBarrelCellsName2) - - # 4 - attach positions to the new cells - from Configurables import CellPositionsHCalPhiThetaSegTool - hcalBarrelPositionedCellsName2 = "HCalBarrelPositionedCells2" - cellPositionHcalBarrelTool2 = CellPositionsHCalPhiThetaSegTool( - "CellPositionsHCalBarrel2", - readoutName=hcalBarrelReadoutName2, - OutputLevel=INFO - ) - createHcalBarrelPositionedCells2 = CreateCaloCellPositionsFCCee( - "CreateHCalBarrelPositionedCells2", - OutputLevel=INFO - ) - createHcalBarrelPositionedCells2.positionsTool = cellPositionHcalBarrelTool2 - createHcalBarrelPositionedCells2.hits.Path = hcalBarrelCellsName2 - createHcalBarrelPositionedCells2.positionedHits.Path = hcalBarrelPositionedCellsName2 - - # createHcalEndcapCells = CreateCaloCells("CreateHcalEndcapCaloCells", # doCellCalibration=True, # calibTool=calibHcalEndcap, @@ -503,10 +455,7 @@ else: hcalBarrelCellsName = "emptyCaloCells" hcalBarrelPositionedCellsName = "emptyCaloCells" - hcalBarrelCellsName2 = "emptyCaloCells" - hcalBarrelPositionedCellsName2 = "emptyCaloCells" cellPositionHcalBarrelTool = None - cellPositionHcalBarrelTool2 = None # Empty cells for parts of calorimeter not implemented yet createemptycells = CreateEmptyCaloCellsCollection("CreateEmptyCaloCells") @@ -521,7 +470,7 @@ ecalBarrelReadoutName=ecalBarrelReadoutName, ecalEndcapReadoutName=ecalEndcapReadoutName, ecalFwdReadoutName="", - hcalBarrelReadoutName=hcalBarrelReadoutName2, + hcalBarrelReadoutName=hcalBarrelReadoutName, hcalExtBarrelReadoutName="", hcalEndcapReadoutName="", hcalFwdReadoutName="", @@ -530,7 +479,7 @@ towers.ecalEndcapCells.Path = ecalEndcapPositionedCellsName towers.ecalFwdCells.Path = "emptyCaloCells" -towers.hcalBarrelCells.Path = hcalBarrelPositionedCellsName2 +towers.hcalBarrelCells.Path = hcalBarrelPositionedCellsName towers.hcalExtBarrelCells.Path = "emptyCaloCells" towers.hcalEndcapCells.Path = "emptyCaloCells" towers.hcalFwdCells.Path = "emptyCaloCells" @@ -568,7 +517,7 @@ numLayers=[12,13], firstLayerIDs=[0,0], lastLayerIDs=[11,12], - readoutNames=[ecalBarrelReadoutName,hcalBarrelReadoutName2], + readoutNames=[ecalBarrelReadoutName,hcalBarrelReadoutName], # do not split the following line or it will break scripts that update the values of the corrections upstreamParameters = [[0.03900891447361534, -4.322941016402328, -139.1811369546787, 0.498342628339746, -3.3545078429754813, -13.99996971344221],[]], upstreamFormulas=[['[0]+[1]/(x-[2])', '[0]+[1]/(x-[2])'],[]], @@ -644,9 +593,6 @@ TopAlg += [ createHcalBarrelCells, createHcalBarrelPositionedCells, - rewriteHCalBarrel, - createHcalBarrelCells2, - createHcalBarrelPositionedCells2, # createHcalEndcapCells ]