# common ECAL specific information
# readout name
ecalReadoutName = "ECalHitsPhiEta"
# active material identifier name
ecalIdentifierName = "active_layer"
# active material volume name
ecalVolumeName = "LAr_sensitive"
# ECAL bitfield names & values
ecalFieldNames = ["system", "ECAL_Cryo", "bath", "EM_barrel"]
ecalFieldValues = [5, 1, 1, 1]

#Configure tools for calo reconstruction
from Configurables import CalibrateCaloHitsTool, NoiseCaloCellsFlatTool, TubeLayerPhiEtaCaloTool

calibcells = CalibrateCaloHitsTool("CalibrateCaloHitsTool",
                                   invSamplingFraction="5.4")
noise = NoiseCaloCellsFlatTool("NoiseCaloCellsFlatTool", cellNoise=0.01)
ecalgeo = TubeLayerPhiEtaCaloTool("EcalGeo",
                                  readoutName=ecalReadoutName,
                                  activeVolumeName=ecalVolumeName,
                                  activeFieldName=ecalIdentifierName,
                                  fieldNames=ecalFieldNames,
                                  fieldValues=ecalFieldValues,
                                  OutputLevel=DEBUG)

from Configurables import CreateCaloCells

createcells = CreateCaloCells("CreateCaloCells",
                              geometryTool=ecalgeo,
                              doCellCalibration=True,
                              calibTool=calibcells,
                                 "SimG4SaveCalHits/saveHCalBarrelHits",
                       ],
                       eventProvider=particle_converter,
                       OutputLevel=INFO)

############## Digitization (Merging hits into cells, EM scale calibration)
# EM scale calibration (sampling fraction)
from Configurables import CalibrateInLayersTool
calibEcalBarrel = CalibrateInLayersTool("CalibrateECalBarrel",
                                   # sampling fraction obtained using SamplingFractionInLayers from DetStudies package
                                   samplingFraction =  [0.24833] * 1 + [0.09482] * 1  +  [0.12242] * 1  +  [0.14182] * 1  +  [0.15667] * 1  +  [0.16923] * 1  +  [0.17980] * 1  +  [0.20085] * 1,
                                   readoutName = ecalBarrelReadoutName,
                                   layerFieldName = "layer")

from Configurables import CalibrateCaloHitsTool
calibHcells = CalibrateCaloHitsTool("CalibrateHCal", invSamplingFraction="41.66")

# Create cells in ECal barrel
# 1. step - merge hits into cells with default Eta segmentation
# 2. step - rewrite the cellId using the Phi-Eta segmentation
from Configurables import CreateCaloCells
createEcalBarrelCellsStep1 = CreateCaloCells("CreateECalBarrelCellsStep1",
                               doCellCalibration=True,
                               calibTool = calibEcalBarrel,
                               addCellNoise=False, filterCellNoise=False,
                               OutputLevel=INFO,
                               hits="ECalBarrelHits",
                               cells="ECalBarrelCellsStep1")

# Use Phi-Eta segmentation in ECal barrel
from Configurables import RedoSegmentation
示例#3
0
        numRadialLayers=8)

    createEcalBarrelCellsNoise = CreateCaloCells(
        "CreateECalBarrelCellsNoise",
        geometryTool=barrelEcalGeometry,
        doCellCalibration=False,
        recalibrateBaseline=False,  # already calibrated
        addCellNoise=True,
        filterCellNoise=False,
        noiseTool=noiseEcalBarrel,
        hits=inputCellCollectionECalBarrel,
        cells="ECalBarrelCellsNoise")

    # re-calibrate HCal Barrel cells to correct EM scale
    calibHcells = CalibrateCaloHitsTool("CalibrateHCal",
                                        invSamplingFraction=str(
                                            hadronSampl_hcal / emSampl_hcal))
    if not calib:
        EMscale = True
    else:
        EMscale = False
    # HCal Barrel noise
    noiseHcal = NoiseCaloCellsFlatTool("HCalNoise", cellNoise=0.01)

    if resegmentHCal:
        createHcalBarrelCellsNoise = CreateCaloCells(
            "CreateHCalBarrelCellsNoise",
            geometryTool=barrelHcalGeometry,
            doCellCalibration=EMscale,
            recalibrateBaseline=False,
            addCellNoise=True,
                    outputs=[
                        "SimG4SaveCalHits/saveECalBarrelHits",
                        "SimG4SaveCalHits/saveECalEndcapHits",
                        "SimG4SaveCalHits/saveECalFwdHits",
                        "SimG4SaveCalHits/saveHCalHits",
                        "SimG4SaveCalHits/saveExtHCalHits",
                        "SimG4SaveCalHits/saveHCalEndcapHits",
                        "SimG4SaveCalHits/saveHCalFwdHits"
                    ],
                    eventProvider=pgun,
                    OutputLevel=INFO)

#Configure tools for calo reconstruction
# EM scale calibration
from Configurables import CalibrateCaloHitsTool
calibHcells = CalibrateCaloHitsTool("CalibrateHCal",
                                    invSamplingFraction="41.66")

from Configurables import CalibrateInLayersTool
calibEcalBarrel = CalibrateInLayersTool(
    "CalibrateECalBarrel",
    # sampling fraction obtained using SamplingFractionInLayers from DetStudies package
    samplingFraction=[0.12125] + [0.14283] + [0.16354] + [0.17662] +
    [0.18867] + [0.19890] + [0.20637] + [0.20802],
    readoutName=ecalBarrelReadoutName,
    layerFieldName="layer")

calibEcalEndcap = CalibrateCaloHitsTool("CalibrateECalEndcap",
                                        invSamplingFraction="13.89")
calibEcalFwd = CalibrateCaloHitsTool("CalibrateECalFwd",
                                     invSamplingFraction="303.03")
#invSamplingFractionHEC is approx. invSamplingFractionEMEC * passiveThickness_HEC / activeThickness_HEC
from Configurables import SimG4Alg
geantsim = SimG4Alg("SimG4Alg")
geantsim.eventProvider = particle_converter
ApplicationMgr().TopAlg += [geantsim]

############## Digitization (Merging hits into cells, EM scale calibration)
# EM scale calibration (sampling fraction)
from Configurables import CalibrateInLayersTool

calibEcalBarrel = CalibrateInLayersTool("CalibrateECalBarrel")
calibEcalBarrel.samplingFraction = [0.36571381189697705] * 1 + [0.09779064189677973] * 1 + [0.12564152224404024] * 1 + [0.14350599973146283] * 1 + [0.1557126972314961] * 1 + [0.16444759076233928] * 1 + [0.17097165096847836] * 1 + [0.17684775359805122] * 1 + [0.18181154293837265] * 1 + [0.18544247938196395] * 1 + [0.18922747431624687] * 1 + [0.21187001375505543] * 1
calibEcalBarrel.readoutName = "ECalBarrelEta"
calibEcalBarrel.layerFieldName = "layer"

from Configurables import CalibrateCaloHitsTool
calibHcells = CalibrateCaloHitsTool("CalibrateHCal")
calibHcells.invSamplingFraction = "41.66"

# Create cells in ECal barrel
# 1. step - merge hits into cells with Eta and module segmentation (phi module is a 'physical' cell i.e. lead + LAr + PCB + LAr +lead)
# 2. step - rewrite the cellId using the Eta-Phi segmentation (merging several modules into one phi readout cell)
from Configurables import CreateCaloCells
createEcalBarrelCellsStep1 = CreateCaloCells("CreateECalBarrelCellsStep1")
createEcalBarrelCellsStep1.doCellCalibration = True
createEcalBarrelCellsStep1.calibTool = calibEcalBarrel
createEcalBarrelCellsStep1.addCellNoise = False
createEcalBarrelCellsStep1.filterCellNoise = False
# todo: add when update on cvmfs
createEcalBarrelCellsStep1.addPosition = True
createEcalBarrelCellsStep1.hits = "ECalBarrelPositionedHits"
createEcalBarrelCellsStep1.cells = "ECalBarrelCellsStep1"