From 22481a38d632e373fd89c6386af5fe2d4140d113 Mon Sep 17 00:00:00 2001 From: Giovanni Marchiori Date: Fri, 13 Sep 2024 15:21:38 +0200 Subject: [PATCH] add noise and noise-filtering to automatic test --- .../tests/options/ALLEGRO_o1_v03_digi_reco.py | 82 ++++++++++++------- 1 file changed, 51 insertions(+), 31 deletions(-) diff --git a/RecFCCeeCalorimeter/tests/options/ALLEGRO_o1_v03_digi_reco.py b/RecFCCeeCalorimeter/tests/options/ALLEGRO_o1_v03_digi_reco.py index 2aa0447..aadac23 100644 --- a/RecFCCeeCalorimeter/tests/options/ALLEGRO_o1_v03_digi_reco.py +++ b/RecFCCeeCalorimeter/tests/options/ALLEGRO_o1_v03_digi_reco.py @@ -53,7 +53,7 @@ # cluster energy corrections # simple parametrisations of up/downstream losses for ECAL-only clusters # not to be applied for ECAL+HCAL clustering -# superseded by MVA calibration, but turned on here for the purpose of testing that the code is not broken +# superseded by MVA calibration, but turned on here for the purpose of testing that the code is not broken - will end up in separate cluster collection applyUpDownstreamCorrections = True # BDT regression from total cluster energy and fraction of energy in each layer (after correction for sampling fraction) @@ -68,6 +68,7 @@ # not run by default in production, but to be turned on here for the purpose of testing that the code is not broken # currently off till we provide the onnx files runPhotonIDTool = False +logEWeightInPhotonID = False # # ALGORITHMS AND SERVICES SETUP @@ -147,6 +148,12 @@ readoutName=ecalBarrelReadoutName, OutputLevel=INFO ) +# the noise tool needs the positioning tool, but if I reuse the previous one the code crashes.. +cellPositionEcalBarrelToolForNoise = CellPositionsECalBarrelModuleThetaSegTool( + "CellPositionsECalBarrelForNoise", + readoutName=ecalBarrelReadoutName, + OutputLevel=INFO +) if resegmentECalBarrel: cellPositionEcalBarrelTool2 = CellPositionsECalBarrelModuleThetaSegTool( "CellPositionsECalBarrel2", @@ -273,50 +280,54 @@ ecalBarrelNoiseRMSHistName = "h_elecNoise_fcc_" from Configurables import NoiseCaloCellsVsThetaFromFileTool noiseBarrel = NoiseCaloCellsVsThetaFromFileTool("NoiseBarrel", - cellPositionsTool=cellPositionEcalBarrelTool, + cellPositionsTool=cellPositionEcalBarrelToolForNoise, readoutName=ecalBarrelReadoutName, noiseFileName=ecalBarrelNoisePath, elecNoiseRMSHistoName=ecalBarrelNoiseRMSHistName, setNoiseOffset=False, activeFieldName="layer", addPileup=False, - filterNoiseThreshold=0, + filterNoiseThreshold=1, numRadialLayers=11, scaleFactor=1 / 1000., # MeV to GeV OutputLevel=INFO) - # needs to be migrated! - # from Configurables import TubeLayerPhiEtaCaloTool - # barrelGeometry = TubeLayerPhiEtaCaloTool("EcalBarrelGeo", - # readoutName=ecalBarrelReadoutNamePhiEta, - # activeVolumeName="LAr_sensitive", - # activeFieldName="layer", - # activeVolumesNumber=12, - # fieldNames=["system"], - # fieldValues=[4]) + from Configurables import TubeLayerModuleThetaCaloTool + barrelGeometry = TubeLayerModuleThetaCaloTool("EcalBarrelGeo", + readoutName=ecalBarrelReadoutName, + activeVolumeName="LAr_sensitive", + activeFieldName="layer", + activeVolumesNumber=11, + fieldNames=["system"], + fieldValues=[4], + OutputLevel=INFO) # cells with noise not filtered - # createEcalBarrelCellsNoise = CreateCaloCells("CreateECalBarrelCellsNoise", - # doCellCalibration=False, - # addCellNoise=True, - # filterCellNoise=False, - # OutputLevel=INFO, - # hits="ECalBarrelCellsStep2", - # noiseTool=noiseBarrel, - # geometryTool=barrelGeometry, - # cells=EcalBarrelCellsName) + createEcalBarrelCellsNoise = CreatePositionedCaloCells("CreatePositionedECalBarrelCellsWithNoise", + doCellCalibration=True, + positionsTool=cellPositionEcalBarrelTool, + calibTool=calibEcalBarrel, + addCellNoise=True, + filterCellNoise=False, + noiseTool=noiseBarrel, + geometryTool=barrelGeometry, + OutputLevel=INFO, + hits=ecalBarrelReadoutName, # uncalibrated & unpositioned cells without noise + cells=ecalBarrelPositionedCellsName + "WithNoise") # cells with noise filtered - # createEcalBarrelCellsNoise = CreateCaloCells("CreateECalBarrelCellsNoise_filtered", - # doCellCalibration=False, - # addCellNoise=True, - # filterCellNoise=True, - # OutputLevel=INFO, - # hits="ECalBarrelCellsStep2", - # noiseTool=noiseBarrel, - # geometryTool=barrelGeometry, - # cells=EcalBarrelCellsName) - + createEcalBarrelCellsNoiseFiltered = CreatePositionedCaloCells("CreateECalBarrelCellsWithNoiseFiltered", + doCellCalibration=True, + calibTool=calibEcalBarrel, + positionsTool=cellPositionEcalBarrelTool, + addCellNoise=True, + filterCellNoise=True, + noiseTool=noiseBarrel, + geometryTool=barrelGeometry, + OutputLevel=INFO, + hits=ecalBarrelReadoutName, # uncalibrated & unpositioned cells without noise + cells=ecalBarrelPositionedCellsName + "WithNoiseFiltered" + ) if runHCal: # Apply calibration and positioning to cells in HCal barrel @@ -526,6 +537,7 @@ layerFieldNames=["layer"], thetaRecalcWeights=[ecalBarrelThetaWeights], do_photon_shapeVar=runPhotonIDTool, + do_widthTheta_logE_weights=logEWeightInPhotonID, OutputLevel=INFO ) @@ -705,6 +717,7 @@ layerFieldNames=["layer"], thetaRecalcWeights=[ecalBarrelThetaWeights], do_photon_shapeVar=runPhotonIDTool, + do_widthTheta_logE_weights=logEWeightInPhotonID, OutputLevel=INFO) if applyMVAClusterEnergyCalibration: @@ -882,6 +895,13 @@ ] createEcalBarrelCells.AuditExecute = True createEcalEndcapCells.AuditExecute = True +if addNoise: + TopAlg += [ + createEcalBarrelCellsNoise, + createEcalBarrelCellsNoiseFiltered + ] + createEcalBarrelCellsNoise.AuditExecute = True + createEcalBarrelCellsNoiseFiltered.AuditExecute = True if resegmentECalBarrel: TopAlg += [