Skip to content

Commit

Permalink
Merge pull request #223 from Archil-AD/main
Browse files Browse the repository at this point in the history
update ALLEGRO_o1_v03/run_digi_reco.py for new HCal segmentation
  • Loading branch information
giovannimarchiori authored Dec 13, 2024
2 parents 7b64740 + ddf412f commit 42a62e0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if ! test -f ./neighbours_map_ecalB_thetamodulemerged_hcalB_thetaphi.root; then
wget https://fccsw.web.cern.ch/fccsw/filesForSimDigiReco/ALLEGRO/ALLEGRO_o1_v03/lgbm_calibration-CaloClusters.onnx
wget https://fccsw.web.cern.ch/fccsw/filesForSimDigiReco/ALLEGRO/ALLEGRO_o1_v03/lgbm_calibration-CaloTopoClusters.onnx
wget https://fccsw.web.cern.ch/fccsw/filesForSimDigiReco/ALLEGRO/ALLEGRO_o1_v03/neighbours_map_ecalB_thetamodulemerged.root
wget https://fccsw.web.cern.ch/fccsw/filesForSimDigiReco/ALLEGRO/ALLEGRO_o1_v03/neighbours_map_ecalB_thetamodulemerged_hcalB_thetaphi.root
wget https://fccsw.web.cern.ch/fccsw/filesForSimDigiReco/ALLEGRO/ALLEGRO_o1_v03/neighbours_map_ecalB_thetamodulemerged_hcalB_hcalEndcap_phitheta.root
fi

# run the RECO step
Expand Down
107 changes: 16 additions & 91 deletions FCCee/FullSim/ALLEGRO/ALLEGRO_o1_v03/run_digi_reco.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,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
Expand Down Expand Up @@ -243,26 +239,13 @@
detectorName="HCalBarrel",
OutputLevel=INFO
)
cellPositionHCalBarrelTool2 = CellPositionsHCalPhiThetaSegTool(
"CellPositionsHCalBarrel2",
readoutName=hcalBarrelReadoutName2,
detectorName="HCalBarrel",
OutputLevel=INFO
)
cellPositionHCalEndcapTool = CellPositionsHCalPhiThetaSegTool(
"CellPositionsHCalEndcap",
readoutName=hcalEndcapReadoutName,
detectorName="HCalThreePartsEndcap",
numLayersHCalThreeParts=[6, 9, 22],
OutputLevel=INFO
)
cellPositionHCalEndcapTool2 = CellPositionsHCalPhiThetaSegTool(
"CellPositionsHCalEndcap2",
readoutName=hcalEndcapReadoutName2,
detectorName="HCalThreePartsEndcap",
numLayersHCalThreeParts=[6, 9, 22],
OutputLevel=INFO
)

# - crosstalk tool
if addCrosstalk:
Expand Down Expand Up @@ -431,39 +414,6 @@
OutputLevel=INFO)
TopAlg += [createHCalBarrelCells]

# Compute new cellID of cells based on new readout - removing row information
# We use a RedoSegmentation. Using a RewriteBitField with removeIds=["row"],
# won't 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")
TopAlg += [rewriteHCalBarrel]

hcalBarrelPositionedCellsName2 = hcalBarrelReadoutName2 + "Positioned"
createHCalBarrelCells2 = CreatePositionedCaloCells("CreatePositionedHCalBarrelCells2",
doCellCalibration=False,
positionsTool=cellPositionHCalBarrelTool2,
addCellNoise=False,
filterCellNoise=False,
OutputLevel=INFO,
hits=rewriteHCalBarrel.outhits.Path,
cells=hcalBarrelPositionedCellsName2)
TopAlg += [createHCalBarrelCells2]

# Create cells in HCal endcap
hcalEndcapPositionedCellsName = hcalEndcapReadoutName + "Positioned"
createHCalEndcapCells = CreatePositionedCaloCells("CreatePositionedHCalEndcapCells",
Expand All @@ -477,39 +427,11 @@
cells=hcalEndcapPositionedCellsName)
TopAlg += [createHCalEndcapCells]

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")
TopAlg += [rewriteHCalEndcap]

hcalEndcapPositionedCellsName2 = hcalEndcapReadoutName2 + "Positioned"
createHCalEndcapCells2 = CreatePositionedCaloCells("CreatePositionedHCalEndcapCells2",
doCellCalibration=False,
positionsTool=cellPositionHCalEndcapTool2,
addCellNoise=False,
filterCellNoise=False,
OutputLevel=INFO,
hits=rewriteHCalEndcap.outhits.Path,
cells=hcalEndcapPositionedCellsName2)
TopAlg += [createHCalEndcapCells2]

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
if doSWClustering or doTopoClustering:
Expand Down Expand Up @@ -738,7 +660,7 @@ def setupTopoClusters(inputCells,
# positionsEMFwdTool=inputPositioningTools.get('ecalFwd', None),
positionsHCalBarrelTool=inputPositioningTools.get('hcalBarrel', None),
positionsHCalBarrelNoSegTool=None,
positionsHCalExtBarrelTool=inputPositioningTools.get('hcalExtBarrel', None),
positionsHCalExtBarrelTool=inputPositioningTools.get('hcalEndcap', None),
# positionsHECTool=inputPositioningTools.get('hcalEndcap', None),
# positionsHFwdTool=inputPositioningTools.get('hcalFwd', None),
noSegmentationHCal=False,
Expand Down Expand Up @@ -876,14 +798,14 @@ def setupTopoClusters(inputCells,
CaloClusterInputs = {
"ecalBarrel": ecalBarrelPositionedCellsName,
"ecalEndcap": ecalEndcapPositionedCellsName,
"hcalBarrel": hcalBarrelPositionedCellsName2,
"hcalEndcap": hcalEndcapPositionedCellsName2,
"hcalBarrel": hcalBarrelPositionedCellsName,
"hcalEndcap": hcalEndcapPositionedCellsName,
}
CaloClusterReadouts = {
"ecalBarrel": ecalBarrelReadoutName,
"ecalEndcap": ecalEndcapReadoutName,
"hcalBarrel": hcalBarrelReadoutName2,
"hcalEndcap": hcalEndcapReadoutName2,
"hcalBarrel": hcalBarrelReadoutName,
"hcalEndcap": hcalEndcapReadoutName,
}
setupSWClusters(CaloClusterInputs,
CaloClusterReadouts,
Expand Down Expand Up @@ -932,22 +854,25 @@ def setupTopoClusters(inputCells,
if runHCal:
CaloTopoClusterInputs = {
"ecalBarrel": ecalBarrelPositionedCellsName,
"hcalBarrel": hcalBarrelPositionedCellsName2
"hcalBarrel": hcalBarrelPositionedCellsName,
"hcalEndcap": hcalEndcapPositionedCellsName,
}
CaloTopoClusterReadouts = {
"ecalBarrel": ecalBarrelReadoutName,
"hcalBarrel": hcalBarrelReadoutName2
"hcalBarrel": hcalBarrelReadoutName,
"hcalEndcap": hcalEndcapReadoutName,
}
CaloTopoClusterPositioningTools = {
"ecalBarrel": cellPositionEcalBarrelTool,
"hcalBarrel": cellPositionHCalBarrelTool2,
"hcalBarrel": cellPositionHCalBarrelTool,
"hcalEndcap": cellPositionHCalEndcapTool,
}
setupTopoClusters(CaloTopoClusterInputs,
CaloTopoClusterReadouts,
CaloTopoClusterPositioningTools,
"CaloTopoClusters",
0.0,
dataFolder + "neighbours_map_ecalB_thetamodulemerged_hcalB_thetaphi.root",
dataFolder + "neighbours_map_ecalB_thetamodulemerged_hcalB_hcalEndcap_phitheta.root",
dataFolder + "cellNoise_map_electronicsNoiseLevel_ecalB_thetamodulemerged_hcalB_thetaphi.root",
False,
False,
Expand Down Expand Up @@ -1008,8 +933,8 @@ def setupTopoClusters(inputCells,
if resegmentECalBarrel:
io_svc.outputCommands.append("drop %s" % ecalBarrelPositionedCellsName2)
if runHCal:
io_svc.outputCommands.append("drop %s" % hcalBarrelPositionedCellsName2)
io_svc.outputCommands.append("drop %s" % hcalEndcapPositionedCellsName2)
io_svc.outputCommands.append("drop %s" % hcalBarrelPositionedCellsName)
io_svc.outputCommands.append("drop %s" % hcalEndcapPositionedCellsName)
if not saveClusterCells:
io_svc.outputCommands.append("drop *Calo*Cluster*Cells*")

Expand Down

0 comments on commit 42a62e0

Please sign in to comment.