LDMX-Software / ldmx-sw

The Light Dark Matter eXperiment simulation and reconstruction framework.
https://ldmx-software.github.io
GNU General Public License v3.0
22 stars 20 forks source link

Bring back the old simple reconstruction chain #1351

Open EinarElen opened 7 months ago

EinarElen commented 7 months ago

When developing, debugging, or trying to understand reconstructed quantities people often have to work with simulation level hits which are quite different from their reconstructed counterparts. This means that people have to re-create an entire (often worse) reco-chain in their analysis.

Having the old reconstruction tool available as an alternative would solve this problem. It should of course be clearly marked as simplified & not the default use.

EinarElen commented 7 months ago

I made a quick implementation of the old producer here https://github.com/LDMX-Software/Hcal/commit/a6a4dab991af7f9decc7247dc6d5236983260f33

I'll update Some quick DQM results from 10k 4 GeV Ecal PN with the following config

#!/usr/bin/env python3
from LDMX.Framework import ldmxcfg
p = ldmxcfg.Process('test')

p.maxTriesPerEvent = 10000

from LDMX.Biasing import ecal, util
from LDMX.SimCore import generators as gen
mySim = ecal.photo_nuclear('ldmx-det-v14',gen.single_4gev_e_upstream_tagger())
mySim.beamSpotSmear = [20.,80.,0.]
mySim.description = 'ECal PN Test Simulation'
# step = util.StepPrinter(process_name='CoulombScat', track_id=-1)
# step.depth=3
# mySim.actions.extend([step])

p.sequence = [ mySim ]

##################################################################
# Below should be the same for all sim scenarios

import os
import sys

if 'LDMX_NUM_EVENTS' in os.environ:
    p.maxEvents = int(os.environ['LDMX_NUM_EVENTS'])
else:
    p.maxEvents = int(sys.argv[1])
if 'LDMX_RUN_NUMBER' in os.environ:
    p.run = int(os.environ['LDMX_RUN_NUMBER'])
else:
    p.run = 1

rectype = sys.argv[2]

output_base = f'swan/data/type_ecalpn_N_{p.maxEvents}_rectype_{rectype}'
output_base = f'data/type_hcalrectest_N_{p.maxEvents}_rectype_{rectype}'

p.histogramFile = f'{output_base}_kind_hist.root'
p.outputFiles = [f'{output_base}_kind_events.root']

import LDMX.Ecal.EcalGeometry
import LDMX.Ecal.ecal_hardcoded_conditions
import LDMX.Hcal.HcalGeometry
import LDMX.Hcal.hcal_hardcoded_conditions
import LDMX.Hcal.digi as digi

from LDMX.DQM import dqm

if rectype == 'simple':
    p.sequence.extend([digi.HcalSimpleDigiAndRecProducer()])
else:
    p.sequence.extend([
        digi.HcalDigiProducer(),
        digi.HcalRecProducer(),
    ])
p.sequence.extend(
                   dqm.hcal_dqm
                  )
![hcal_dqm_back_along_x](https://github.com/LDMX-Software/Hcal/assets/14233914/9f8d189f-1986-46f4-8543-2f797adf9517)

PE hcal_dqm_back_pe hcal_dqm_back_total_pe

Positions along bars hcal_dqm_back_along_y

Vetoable hits hcal_dqm_back_vetoable_hit_multiplicity

tomeichlersmith commented 6 months ago

Draft solution in submodule: https://github.com/LDMX-Software/Hcal/pull/75

cmantill commented 4 months ago

hi @EinarElen, thinking about using this for clustering plots in the DR and I want to make sure that the position reconstruction is understood.

Could you provide from your file above, a plot comparing the position reconstruction but split x- and y-oriented layers so that the coordinate is given by the layer/bar measurement only? If you are swamped, I could make that plot too if you point me to the output file.