Example #1
0
from Configurables import SimG4Svc
geantservice = SimG4Svc("SimG4Svc", physicslist='SimG4TestPhysicsList')

from Configurables import SimG4Alg, SimG4SaveCalHits, InspectHitsCollectionsTool
inspecttool = InspectHitsCollectionsTool("inspect", readoutNames=["ECalHits"], OutputLevel = DEBUG)
savecaltool = SimG4SaveCalHits("saveECalHits", readoutNames = ["ECalHits"], OutputLevel = DEBUG)
savecaltool.positionedCaloHits.Path = "positionedCaloHits"
savecaltool.caloHits.Path = "caloHits"
geantsim = SimG4Alg("SimG4Alg", outputs= ["SimG4SaveCalHits/saveECalHits","InspectHitsCollectionsTool/inspect"])

from Configurables import RedoSegmentation
resegment = RedoSegmentation("ReSegmentation",
                             # old bitfield (readout)
                             oldReadoutName = "ECalHits",
                             # specify which fields are going to be deleted
                             oldSegmentationIds = ["x","y","z"],
                             # new bitfield (readout), with new segmentation
                             newReadoutName="ECalHitsReverseOrder",
                             OutputLevel = DEBUG)
# clusters are needed, with deposit position and cellID in bits
resegment.inhits.Path = "positionedCaloHits"
resegment.outhits.Path = "newCaloHits"

from Configurables import FCCDataSvc, PodioOutput
podiosvc = FCCDataSvc("EventDataSvc")
out = PodioOutput("out", filename="testResegmentationXYZ.root")
out.outputCommands = ["keep *"]

ApplicationMgr(EvtSel='NONE',
               EvtMax=30,
               TopAlg=[reader, hepmc_converter, geantsim, resegment,
Example #2
0
                                    doCellCalibration=True,
                                    calibTool=calibcellsBarrel,
                                    addCellNoise=False,
                                    filterCellNoise=False,
                                    OutputLevel=DEBUG)
createcellsBarrel.hits.Path = "ECalBarrelHits"
createcellsBarrel.cells.Path = "ECalBarrelCellsNoPhi"
# Retrieve phi positions from centres of cells
from Configurables import CreateVolumeCaloPositions
positionsEcalBarrel = CreateVolumeCaloPositions("positionsEcalBarrel",
                                                OutputLevel=INFO)
positionsEcalBarrel.hits.Path = "ECalBarrelCellsNoPhi"
positionsEcalBarrel.positionedHits.Path = "ECalBarrelPositions"
from Configurables import RedoSegmentation
resegmentEcal = RedoSegmentation("ReSegmentationEcalBarrel",
                                 oldReadoutName='ECalBarrelEta',
                                 oldSegmentationIds=['eta'],
                                 newReadoutName='ECalBarrelPhiEta')
resegmentEcal.inhits.Path = "ECalBarrelPositions"
resegmentEcal.outhits.Path = "ECalBarrelCells"
createcellsEndcap = CreateCaloCells("CreateCaloCellsEndcap",
                                    doCellCalibration=True,
                                    calibTool=calibcellsEndcap,
                                    addCellNoise=False,
                                    filterCellNoise=False,
                                    OutputLevel=DEBUG)
createcellsEndcap.hits.Path = "ECalEndcapHits"
createcellsEndcap.cells.Path = "ECalEndcapCells"

out = PodioOutput("out",
                  filename="output_ecalInclinedWithEndcapDigi_test.root",
                  OutputLevel=DEBUG)
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
resegmentEcalBarrel = RedoSegmentation("ReSegmentationEcal",
                             # old bitfield (readout)
                             oldReadoutName = ecalBarrelReadoutName,
                             # specify which fields are going to be altered (deleted/rewritten)
                             oldSegmentationIds = ["module"],
                             # new bitfield (readout), with new segmentation
                             newReadoutName = ecalBarrelReadoutNamePhiEta,
                             OutputLevel = INFO,
                             inhits = "ECalBarrelPositions",
                             outhits = "ECalBarrelCellsStep2")
createEcalBarrelCells = CreateCaloCells("CreateECalBarrelCells",
                               doCellCalibration=False,
                               addCellNoise=False, filterCellNoise=False,
                               OutputLevel=INFO,
                               hits="ECalBarrelCellsStep2",
                               cells="ECalBarrelCells")

# Create cells in HCal
# 1. step - merge hits into cells with the default readout
createHcalBarrelCells = CreateCaloCells("CreateHCaloCells",
                               doCellCalibration=True,
from Configurables import CreateCaloCells
createcells = CreateCaloCells("CreateCaloCells",
                              doCellCalibration=True,
                              calibTool=calibcells,
                              addCellNoise=False, filterCellNoise=False,
                              OutputLevel=DEBUG)
createcells.hits.Path="ECalBarrelHits"
createcells.cells.Path="ECalBarrelCellsNoPhi"
# Retrieve phi positions from centres of cells
from Configurables import CreateVolumeCaloPositions
positionsEcalBarrel = CreateVolumeCaloPositions("positionsEcalBarrel", OutputLevel = INFO)
positionsEcalBarrel.hits.Path = "ECalBarrelCellsNoPhi"
positionsEcalBarrel.positionedHits.Path = "ECalBarrelPositions"
from Configurables import RedoSegmentation
resegmentEcal = RedoSegmentation("ReSegmentationEcalBarrel",
                             oldReadoutName = 'ECalBarrelEta',
                             oldSegmentationIds = ['eta'],
                             newReadoutName = 'ECalBarrelPhiEta')
resegmentEcal.inhits.Path = "ECalBarrelPositions"
resegmentEcal.outhits.Path = "ECalBarrelCells"


out = PodioOutput("out", filename="output_ecalInclinedDigi_test.root",
                   OutputLevel=DEBUG)
out.outputCommands = ["keep *"]

#CPU information
from Configurables import AuditorSvc, ChronoAuditor
chra = ChronoAuditor()
audsvc = AuditorSvc()
audsvc.Auditors = [chra]
geantsim.AuditExecute = True
ecalEndcapNoisePath = "/eos/project/f/fccsw-web/testsamples/elecNoise_emec_50Ohm_2shieldWidth_6layers.root"
ecalBarrelNoiseHistName = "h_elecNoise_fcc_"
ecalEndcapNoiseHistName = "h_elecNoise_fcc_"

from Configurables import CreateVolumeCaloPositions, RedoSegmentation, NoiseCaloCellsFlatTool
positionsExtHcal = CreateVolumeCaloPositions("positionsExtHcal",
                                             OutputLevel=INFO)
positionsExtHcal.hits.Path = hcalExtBarrelCellsName
positionsExtHcal.positionedHits.Path = "HCalExtBarrelPositions"

resegmentExtHcal = RedoSegmentation(
    "ReSegmentationExtHcal",
    # old bitfield (readout)
    oldReadoutName=hcalExtBarrelReadoutName,
    # specify which fields are going to be altered (deleted/rewritten)
    oldSegmentationIds=["module", "row"],
    # new bitfield (readout), with new segmentation
    newReadoutName=hcalExtBarrelReadoutPhiEtaName,
    debugPrint=10,
    OutputLevel=INFO,
    inhits="HCalExtBarrelPositions",
    outhits="newHCalExtBarrelCells")

##############################################################################################################
#######                                       REWRITE ENDCAP BITFIELD                            #############
##############################################################################################################

from Configurables import RewriteBitfield
rewriteECalEC = RewriteBitfield(
    "RewriteECalEC",
    # old bitfield (readout)
    oldReadoutName="EMECPhiEta",
Example #6
0
from Configurables import CreateVolumeCaloPositions
positions = CreateVolumeCaloPositions("positions", OutputLevel=VERBOSE)
positions.hits.Path = "HCalCells"
positions.positionedHits.Path = "HCalPositions"

positionsExt = CreateVolumeCaloPositions("positionsExt", OutputLevel=VERBOSE)
positionsExt.hits.Path = "ExtHCalCells"
positionsExt.positionedHits.Path = "ExtHCalPositions"

from Configurables import RedoSegmentation
resegment = RedoSegmentation(
    "ReSegmentation",
    # old bitfield (readout)
    oldReadoutName=hcalReadoutName,
    # specify which fields are going to be altered (deleted/rewritten)
    oldSegmentationIds=["eta", "phi"],
    # new bitfield (readout), with new segmentation
    newReadoutName=newHcalReadoutName,
    debugPrint=10,
    OutputLevel=DEBUG,
    inhits="HCalPositions",
    outhits="newHCalCells")
# clusters are needed, with deposit position and cellID in bits
resegmentExt = RedoSegmentation(
    "ReSegmentationExt",
    # old bitfield (readout)
    oldReadoutName=extHcalReadoutName,
    # specify which fields are going to be altered (deleted/rewritten)
    oldSegmentationIds=["eta", "phi"],
    # new bitfield (readout), with new segmentation
    newReadoutName=newExtHcalReadoutName,
    debugPrint=10,
Example #7
0
from Configurables import CreateVolumeCaloPositions,RedoSegmentation,CreateCaloCells,CreateCellPositions
# Create cells in HCal                                           
# 2. step - rewrite the cellId using the Phi-Eta segmentation    
# 3. step - merge new cells corresponding to eta-phi segmentation
# Hcal barrel cell positions                                                                                                                                                                             
posHcalBarrel = CreateCellPositions("posHcalBarrel",
                                    positionsTool=HCalBcellVols,
                                    hits = prefix+"HCalBarrelCells",
                                    positionedHits = "HCalBarrelPositions")

# Use Phi-Eta segmentation in Hcal barrel                       
resegmentHcalBarrel = RedoSegmentation("ReSegmentationHcal",
                                       # old bitfield (readout) 
                                       oldReadoutName = hcalBarrelReadoutName,
                                       # specify which fields are going to be altered (deleted/rewritten)
                                       oldSegmentationIds = ["module","row"],
                                       # new bitfield (readout), with new segmentation                                                                                     
                                       newReadoutName = hcalBarrelReadoutNamePhiEta,
                                       inhits = "HCalBarrelPositions",
                                       outhits = "HCalBarrelCellsStep2")
    
createHcalBarrelCells = CreateCaloCells("CreateHCalBarrelCells",
                                        doCellCalibration=False,recalibrateBaseline =False, 
                                        addCellNoise=False, filterCellNoise=False,
                                        hits="HCalBarrelCellsStep2",
                                        cells="newHCalBarrelCells")
hcalCells = prefix+"HCalBarrelCells"
hcalCellsForTowers = "HCalBarrelCellsStep2"
if resegmentHCal:
    hcalCells = "newHCalBarrelCells"
    hcalCellsForTowers = "newHCalBarrelCells"
                               hits="HCalHits",
                               cells="HCalCells")

# additionally for HCal
from Configurables import CreateVolumeCaloPositions
positions = CreateVolumeCaloPositions("positions", OutputLevel = VERBOSE)
positions.hits.Path = "HCalCells"
positions.positionedHits.Path = "HCalPositions"

from Configurables import RedoSegmentation
resegment = RedoSegmentation("ReSegmentation",
                             # old bitfield (readout)
                             oldReadoutName = hcalReadoutName,
                             # specify which fields are going to be altered (deleted/rewritten)
                             oldSegmentationIds = ["eta","phi"],
                             # new bitfield (readout), with new segmentation
                             newReadoutName = newHcalReadoutName,
                             debugPrint = 10,
                             OutputLevel = DEBUG,
                             inhits = "HCalPositions",
                             outhits = "newHCalCells")
# clusters are needed, with deposit position and cellID in bits

positions2 = CreateVolumeCaloPositions("positions2", OutputLevel = VERBOSE)
positions2.hits.Path = "newHCalCells"
positions2.positionedHits.Path = "newHCalPositions"

# Ecal cell positions
positionsEcal = CreateVolumeCaloPositions("positionsEcal", OutputLevel = VERBOSE)
positionsEcal.hits.Path = "ECalCells"
positionsEcal.positionedHits.Path = "ECalPositions"
Example #9
0
                                             calibTool=calibEcalBarrel,
                                             addCellNoise=False,
                                             filterCellNoise=False)
createEcalBarrelCellsStep1.hits.Path = "ECalBarrelHits"
createEcalBarrelCellsStep1.cells.Path = "ECalBarrelCellsStep1"
# 2. step - rewrite the cellId using the Phi-Eta segmentation (remove 'module')
# 2.1. retrieve phi positions from centres of cells
from Configurables import CreateVolumeCaloPositions
positionsEcalBarrel = CreateVolumeCaloPositions("positionsEcalBarrel")
positionsEcalBarrel.hits.Path = "ECalBarrelCellsStep1"
positionsEcalBarrel.positionedHits.Path = "ECalBarrelPositions"
# 2.2. assign cells into phi bins
from Configurables import RedoSegmentation
resegmentEcalBarrel = RedoSegmentation("ReSegmentationEcalBarrel",
                                       oldReadoutName='ECalBarrelEta',
                                       oldSegmentationIds=['module'],
                                       newReadoutName='ECalBarrelPhiEta',
                                       inhits="ECalBarrelPositions",
                                       outhits="ECalBarrelCellsStep2")
# 3. step - merge cells in the same phi bin
createEcalBarrelCells = CreateCaloCells(
    "CreateECalBarrelCells",
    doCellCalibration=False,  # already calibrated in step 1
    addCellNoise=False,
    filterCellNoise=False,
    hits="ECalBarrelCellsStep2",
    cells="ECalBarrelCells")

# Create Ecal cells in endcaps
# 1. step - merge layer IDs
# 2. step - create cells
from Configurables import MergeLayers
Example #10
0
                                             hits="ECalBarrelHits",
                                             cells="ECalBarrelCellsStep1")
# Ecal barrel cell positions
from Configurables import CreateVolumeCaloPositions
positionsEcalBarrel = CreateVolumeCaloPositions("positionsBarrelEcal",
                                                OutputLevel=INFO)
positionsEcalBarrel.hits.Path = "ECalBarrelCellsStep1"
positionsEcalBarrel.positionedHits.Path = "ECalBarrelPositions"
# Use Phi-Eta segmentation in ECal barrel
from Configurables import RedoSegmentation
resegmentEcalBarrel = RedoSegmentation(
    "ReSegmentationEcal",
    # old bitfield (readout)
    oldReadoutName=ecalBarrelReadoutName,
    # specify which fields are going to be altered (deleted/rewritten)
    oldSegmentationIds=["module"],
    # new bitfield (readout), with new segmentation
    newReadoutName=ecalBarrelReadoutNamePhiEta,
    OutputLevel=INFO,
    inhits="ECalBarrelPositions",
    outhits="ECalBarrelCellsStep2")
createEcalBarrelCells = CreateCaloCells("CreateECalBarrelCells",
                                        doCellCalibration=False,
                                        addCellNoise=False,
                                        filterCellNoise=False,
                                        OutputLevel=INFO,
                                        hits="ECalBarrelCellsStep2",
                                        cells="ECalBarrelCells")

# Create Ecal cells in endcaps
# 1. step - merge layer IDs
                               addCellNoise=False, filterCellNoise=False,
                               OutputLevel=INFO,
                               hits="ECalBarrelHits",
                               cells="ECalBarrelCellsStep1")
# Ecal barrel cell positions
from Configurables import CreateVolumeCaloPositions
positionsEcalBarrel = CreateVolumeCaloPositions("positionsBarrelEcal", OutputLevel = INFO)
positionsEcalBarrel.hits.Path = "ECalBarrelCellsStep1"
positionsEcalBarrel.positionedHits.Path = "ECalBarrelPositions"
# Use Phi-Eta segmentation in ECal barrel
from Configurables import RedoSegmentation
resegmentEcalBarrel = RedoSegmentation("ReSegmentationEcal",
                             # old bitfield (readout)
                             oldReadoutName = ecalBarrelReadoutName,
                             # specify which fields are going to be altered (deleted/rewritten)
                             oldSegmentationIds = ["module"],
                             # new bitfield (readout), with new segmentation
                             newReadoutName = ecalBarrelReadoutNamePhiEta,
                             OutputLevel = INFO,
                             inhits = "ECalBarrelPositions",
                             outhits = "ECalBarrelCellsStep2")
createEcalBarrelCells = CreateCaloCells("CreateECalBarrelCells",
                               doCellCalibration=False,
                               addCellNoise=False, filterCellNoise=False,
                               OutputLevel=INFO,
                               hits="ECalBarrelCellsStep2",
                               cells="ECalBarrelCells")


# Create Ecal cells in endcaps
# 1. step - merge layer IDs
# 2. step - create cells
# 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"
ApplicationMgr().TopAlg += [createEcalBarrelCellsStep1]

## Use Phi-Theta segmentation in ECal barrel
from Configurables import RedoSegmentation
resegmentEcalBarrel = RedoSegmentation("ReSegmentationEcal")
# old bitfield (readout)
resegmentEcalBarrel.oldReadoutName = "ECalBarrelEta"
# specify which fields are going to be altered (deleted/rewritten)
resegmentEcalBarrel.oldSegmentationIds = ["module"]
# new bitfield (readout), with new segmentation
resegmentEcalBarrel.newReadoutName = "ECalBarrelPhiEta"
resegmentEcalBarrel.inhits = "ECalBarrelCellsStep1"
resegmentEcalBarrel.outhits = "ECalBarrelCellsStep2"
ApplicationMgr().TopAlg += [resegmentEcalBarrel]

EcalBarrelCellsName = "ECalBarrelCells"
from Configurables import CreateCaloCells
createEcalBarrelCells = CreateCaloCells("CreateECalBarrelCells")
createEcalBarrelCells.doCellCalibration = False
createEcalBarrelCells.addCellNoise = False