Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the implementation of noise for ALLEGRO v3 to the old fccrun script #35

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 26 additions & 25 deletions FCCSW_ecal/run_thetamodulemerged.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,14 @@
# python libraries
import os
from math import cos, sin, tan

#
# SETTINGS
#

# - 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

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -432,7 +432,6 @@
createEcalBarrelPositionedCells2.hits.Path = ecalBarrelCellsName2
createEcalBarrelPositionedCells2.positionedHits.Path = "ECalBarrelPositionedCells2"


# Create cells in ECal endcap
createEcalEndcapCells = CreateCaloCells("CreateEcalEndcapCaloCells",
doCellCalibration=True,
Expand All @@ -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",
Expand Down Expand Up @@ -864,7 +865,7 @@
resegmentEcalBarrel,
createEcalBarrelCells2,
createEcalBarrelPositionedCells2,
createEcalEndcapCells
createEcalEndcapCells,
]

if runHCal:
Expand Down
37 changes: 37 additions & 0 deletions FCCSW_ecal/xtalk_neighbours_theta.py
Original file line number Diff line number Diff line change
@@ -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
)
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.