diff --git a/.github/validation_samples/ecal_pn/config.py b/.github/validation_samples/ecal_pn/config.py index d69df1dae..7721ecabf 100644 --- a/.github/validation_samples/ecal_pn/config.py +++ b/.github/validation_samples/ecal_pn/config.py @@ -24,11 +24,6 @@ p.histogramFile = f'hist.root' p.outputFiles = [f'events.root'] -# The Tracking modules produce a lot of helpful messages -# but (at the debug level) is too much for commiting the gold log -# into the git working tree on GitHub -p.termLogLevel = 1 - # Load the tracking module from LDMX.Tracking import tracking from LDMX.Tracking import geo @@ -199,6 +194,22 @@ ecalVeto = ecal_vetos.EcalVetoProcessor() ecalVeto.recoil_from_tracking = True +# The Tracking modules produce a lot of helpful messages +# but (at the debug level) is too much for commiting the gold log +# into the git working tree on GitHub +p.termLogLevel = 0 +p.logger.custom(truth_tracking, level = 2) +p.logger.custom(digi_tagger, level = 2) +p.logger.custom(digi_recoil, level = 2) +p.logger.custom(seeder_tagger, level = 2) +p.logger.custom(seeder_recoil, level = 2) +p.logger.custom(tracking_tagger, level = 0) +p.logger.custom(tracking_recoil, level = 0) +p.logger.custom(seed_tagger_dqm, level = 2) +p.logger.custom(seed_recoil_dqm, level = 2) +p.logger.custom(tagger_dqm, level = 2) +p.logger.custom(recoil_dqm, level = 2) + p.sequence.extend([ digi_tagger, digi_recoil, @@ -223,5 +234,7 @@ tagger_dqm, seed_recoil_dqm, recoil_dqm, - ] + dqm.all_dqm) + ]) + +p.sequence.extend(dqm.all_dqm) diff --git a/.github/validation_samples/inclusive/config.py b/.github/validation_samples/inclusive/config.py index 029042756..169361f04 100644 --- a/.github/validation_samples/inclusive/config.py +++ b/.github/validation_samples/inclusive/config.py @@ -23,7 +23,113 @@ p.histogramFile = 'hist.root' p.outputFiles = ['events.root'] + +# Load the tracking module +from LDMX.Tracking import tracking +from LDMX.Tracking import geo + +from LDMX.Tracking.geo import TrackersTrackingGeometryProvider as trackgeo +trackgeo.get_instance().setDetector('ldmx-det-v14-8gev') + +# Truth seeder +# Runs truth tracking producing tracks from target scoring plane hits for Recoil +# and generated electros for Tagger. +# Truth tracks can be used for assessing tracking performance or using as seeds +truth_tracking = tracking.TruthSeedProcessor() +truth_tracking.debug = True +truth_tracking.trk_coll_name = "RecoilTruthSeeds" +truth_tracking.pdgIDs = [11] +truth_tracking.scoring_hits = "TargetScoringPlaneHits" +truth_tracking.z_min = 0. +truth_tracking.track_id = -1 +truth_tracking.p_cut = 0.05 # In MeV +truth_tracking.pz_cut = 0.03 +truth_tracking.p_cutEcal = 0. # In MeV + +# The Tracking modules produce a lot of helpful messages +# but (at the debug level) is too much for commiting the gold log +# into the git working tree on GitHub p.termLogLevel = 0 +p.logger.custom(truth_tracking, level = 2) + +# These smearing quantities are default. We expect around 6um hit resolution in bending plane +# v-smearing is actually not used as 1D measurements are used for tracking. These smearing parameters +# are fed to the digitization producer. +uSmearing = 0.006 #mm +vSmearing = 0.000001 #mm + +# Smearing Processor - Tagger +# Runs G4 hit smearing producing measurements in the Tagger tracker. +# Hits that belong to the same sensor with the same trackID are merged together to reduce combinatorics +digi_tagger = tracking.DigitizationProcessor("DigitizationProcessor") +digi_tagger.hit_collection = "TaggerSimHits" +digi_tagger.out_collection = "DigiTaggerSimHits" +digi_tagger.merge_hits = True +digi_tagger.sigma_u = uSmearing +digi_tagger.sigma_v = vSmearing + +# Smearing Processor - Recoil +digi_recoil = tracking.DigitizationProcessor("DigitizationProcessorRecoil") +digi_recoil.hit_collection = "RecoilSimHits" +digi_recoil.out_collection = "DigiRecoilSimHits" +digi_recoil.merge_hits = True +digi_recoil.sigma_u = uSmearing +digi_recoil.sigma_v = vSmearing + +# Seed Finder Tagger +# This runs the track seed finder looking for 5 hits in consecutive sensors and fitting them with a +# parabola+linear fit. Compatibility with expected particles is checked by looking at the track +# parameters and the impact parameters at the target or generation point. For the tagger one should look +# for compatibility with the beam orbit / beam spot +seeder_tagger = tracking.SeedFinderProcessor("SeedTagger") +seeder_tagger.input_hits_collection = digi_tagger.out_collection +seeder_tagger.out_seed_collection = "TaggerRecoSeeds" +seeder_tagger.pmin = 0.1 +seeder_tagger.pmax = 10.0 +seeder_tagger.d0min = -45. +seeder_tagger.d0max = 45. +seeder_tagger.z0max = 60. + +#Seed finder processor - Recoil +seeder_recoil = tracking.SeedFinderProcessor("SeedRecoil") +seeder_recoil.perigee_location = [0.,0.,0.] +seeder_recoil.input_hits_collection = digi_recoil.out_collection +seeder_recoil.out_seed_collection = "RecoilRecoSeeds" +seeder_recoil.bfield = 1.5 +seeder_recoil.pmin = 0.1 +seeder_recoil.pmax = 10.0 +seeder_recoil.d0min = -40.0 +seeder_recoil.d0max = 40.0 +seeder_recoil.z0max = 50. + +# Producer for running the CKF track finding starting from the found seeds. +tracking_tagger = tracking.CKFProcessor("Tagger_TrackFinder") +tracking_tagger.dumpobj = False +tracking_tagger.debug = True +tracking_tagger.propagator_step_size = 1000. #mm +tracking_tagger.bfield = -1.5 #in T #From looking at the BField map +tracking_tagger.const_b_field = False +tracking_tagger.seed_coll_name = seeder_tagger.out_seed_collection +tracking_tagger.out_trk_collection = "TaggerTracks" +tracking_tagger.trackID = -1 #1 +tracking_tagger.pdgID = -9999 #11 +tracking_tagger.measurement_collection = digi_tagger.out_collection +tracking_tagger.min_hits = 6 + +#CKF Options +tracking_recoil = tracking.CKFProcessor("Recoil_TrackFinder") +tracking_recoil.dumpobj = False +tracking_recoil.debug = True +tracking_recoil.propagator_step_size = 1000. #mm +tracking_recoil.bfield = -1.5 #in T #From looking at the BField map +tracking_recoil.const_b_field = False +tracking_recoil.taggerTracking=False +tracking_recoil.seed_coll_name = "RecoilTruthSeeds" +tracking_recoil.out_trk_collection = "RecoilTracks" +tracking_recoil.trackID = -1 #1 +tracking_recoil.pdgID = -9999 #11 +tracking_recoil.measurement_collection = digi_recoil.out_collection +tracking_recoil.min_hits = 6 import LDMX.Ecal.EcalGeometry import LDMX.Ecal.ecal_hardcoded_conditions @@ -45,6 +151,40 @@ d.randomSeed = 1 from LDMX.DQM import dqm +from LDMX.Tracking import dqm as tkdqm + +seed_tagger_dqm = tkdqm.TrackingRecoDQM("SeedTaggerDQM") +seed_tagger_dqm.track_collection = seeder_tagger.out_seed_collection +seed_tagger_dqm.truth_collection = "TaggerTruthTracks" +seed_tagger_dqm.title = "" +seed_tagger_dqm.buildHistograms() + +tagger_dqm = tkdqm.TrackingRecoDQM("TaggerDQM") +tagger_dqm.track_collection = tracking_tagger.out_trk_collection +tagger_dqm.truth_collection = "TaggerTruthTracks" +tagger_dqm.trackStates = ["target"] +tagger_dqm.title = "" +tagger_dqm.measurement_collection=digi_tagger.out_collection +tagger_dqm.truth_hit_collection="TaggerSimHits" +tagger_dqm.buildHistograms() + + +seed_recoil_dqm = tkdqm.TrackingRecoDQM("SeedRecoilDQM") +seed_recoil_dqm.track_collection = seeder_recoil.out_seed_collection +seed_recoil_dqm.truth_collection = "RecoilTruthTracks" +seed_recoil_dqm.title = "" +seed_recoil_dqm.buildHistograms() + + +recoil_dqm = tkdqm.TrackingRecoDQM("RecoilDQM") +recoil_dqm.track_collection = tracking_recoil.out_trk_collection +recoil_dqm.truth_collection = "RecoilTruthTracks" +recoil_dqm.trackStates = ["ecal","target"] +recoil_dqm.title = "" +recoil_dqm.measurement_collection=digi_recoil.out_collection +recoil_dqm.truth_hit_collection="RecoilSimHits" +recoil_dqm.buildHistograms() + from LDMX.Recon.electronCounter import ElectronCounter from LDMX.Recon.simpleTrigger import TriggerProcessor @@ -52,10 +192,37 @@ count = ElectronCounter(1,'ElectronCounter') count.input_pass_name = '' +# Load ecal veto and use tracking in it +ecalVeto = ecal_vetos.EcalVetoProcessor() +ecalVeto.recoil_from_tracking = False + +# The Tracking modules produce a lot of helpful messages +# but (at the debug level) is too much for commiting the gold log +# into the git working tree on GitHub +p.termLogLevel = 0 +p.logger.custom(truth_tracking, level = 2) +p.logger.custom(digi_tagger, level = 2) +p.logger.custom(digi_recoil, level = 2) +p.logger.custom(seeder_tagger, level = 2) +p.logger.custom(seeder_recoil, level = 2) +p.logger.custom(tracking_tagger, level = 0) +p.logger.custom(tracking_recoil, level = 0) +p.logger.custom(seed_tagger_dqm, level = 2) +p.logger.custom(seed_recoil_dqm, level = 2) +p.logger.custom(tagger_dqm, level = 2) +p.logger.custom(recoil_dqm, level = 2) + p.sequence.extend([ + digi_tagger, + digi_recoil, + truth_tracking, + seeder_tagger, + seeder_recoil, + tracking_tagger, + tracking_recoil, ecal_digi.EcalDigiProducer(), ecal_digi.EcalRecProducer(), - ecal_vetos.EcalVetoProcessor(), + ecalVeto, hcal_digi.HcalDigiProducer(), hcal_digi.HcalRecProducer(), *ts_digis, @@ -65,4 +232,10 @@ trigScintTrack, count, TriggerProcessor('trigger', 8000.), dqm.PhotoNuclearDQM(verbose=False), - ] + dqm.all_dqm) + seed_tagger_dqm, + tagger_dqm, + seed_recoil_dqm, + recoil_dqm, + ]) + +p.sequence.extend(dqm.all_dqm) \ No newline at end of file diff --git a/.github/validation_samples/it_pileup/config.py b/.github/validation_samples/it_pileup/config.py index 7332b8ddc..032184b07 100644 --- a/.github/validation_samples/it_pileup/config.py +++ b/.github/validation_samples/it_pileup/config.py @@ -15,7 +15,107 @@ det = 'ldmx-det-v14-8gev' p.run = int(os.environ['LDMX_RUN_NUMBER']) p.maxEvents = int(os.environ['LDMX_NUM_EVENTS']) -p.termLogLevel = 0 + +# Load the tracking module +from LDMX.Tracking import tracking +from LDMX.Tracking import geo + +from LDMX.Tracking.geo import TrackersTrackingGeometryProvider as trackgeo +trackgeo.get_instance().setDetector('ldmx-det-v14-8gev') + +# Truth seeder +# Runs truth tracking producing tracks from target scoring plane hits for Recoil +# and generated electros for Tagger. +# Truth tracks can be used for assessing tracking performance or using as seeds +truth_tracking = tracking.TruthSeedProcessor() +truth_tracking.debug = True +truth_tracking.trk_coll_name = "RecoilTruthSeeds" +truth_tracking.pdgIDs = [11] +truth_tracking.scoring_hits = "TargetScoringPlaneHits" +truth_tracking.z_min = 0. +truth_tracking.track_id = -1 +truth_tracking.p_cut = 0.05 # In MeV +truth_tracking.pz_cut = 0.03 +truth_tracking.p_cutEcal = 0. # In MeV + +# These smearing quantities are default. We expect around 6um hit resolution in bending plane +# v-smearing is actually not used as 1D measurements are used for tracking. These smearing parameters +# are fed to the digitization producer. +uSmearing = 0.006 #mm +vSmearing = 0.000001 #mm + +# Smearing Processor - Tagger +# Runs G4 hit smearing producing measurements in the Tagger tracker. +# Hits that belong to the same sensor with the same trackID are merged together to reduce combinatorics +digi_tagger = tracking.DigitizationProcessor("DigitizationProcessor") +digi_tagger.hit_collection = "TaggerSimHits" +digi_tagger.out_collection = "DigiTaggerSimHits" +digi_tagger.merge_hits = True +digi_tagger.sigma_u = uSmearing +digi_tagger.sigma_v = vSmearing + +# Smearing Processor - Recoil +digi_recoil = tracking.DigitizationProcessor("DigitizationProcessorRecoil") +digi_recoil.hit_collection = "RecoilSimHits" +digi_recoil.out_collection = "DigiRecoilSimHits" +digi_recoil.merge_hits = True +digi_recoil.sigma_u = uSmearing +digi_recoil.sigma_v = vSmearing + +# Seed Finder Tagger +# This runs the track seed finder looking for 5 hits in consecutive sensors and fitting them with a +# parabola+linear fit. Compatibility with expected particles is checked by looking at the track +# parameters and the impact parameters at the target or generation point. For the tagger one should look +# for compatibility with the beam orbit / beam spot +seeder_tagger = tracking.SeedFinderProcessor("SeedTagger") +seeder_tagger.input_hits_collection = digi_tagger.out_collection +seeder_tagger.out_seed_collection = "TaggerRecoSeeds" +seeder_tagger.pmin = 0.1 +seeder_tagger.pmax = 10.0 +seeder_tagger.d0min = -45. +seeder_tagger.d0max = 45. +seeder_tagger.z0max = 60. + +#Seed finder processor - Recoil +seeder_recoil = tracking.SeedFinderProcessor("SeedRecoil") +seeder_recoil.perigee_location = [0.,0.,0.] +seeder_recoil.input_hits_collection = digi_recoil.out_collection +seeder_recoil.out_seed_collection = "RecoilRecoSeeds" +seeder_recoil.bfield = 1.5 +seeder_recoil.pmin = 0.1 +seeder_recoil.pmax = 10.0 +seeder_recoil.d0min = -40.0 +seeder_recoil.d0max = 40.0 +seeder_recoil.z0max = 50. + +# Producer for running the CKF track finding starting from the found seeds. +tracking_tagger = tracking.CKFProcessor("Tagger_TrackFinder") +tracking_tagger.dumpobj = False +tracking_tagger.debug = True +tracking_tagger.propagator_step_size = 1000. #mm +tracking_tagger.bfield = -1.5 #in T #From looking at the BField map +tracking_tagger.const_b_field = False +tracking_tagger.seed_coll_name = seeder_tagger.out_seed_collection +tracking_tagger.out_trk_collection = "TaggerTracks" +tracking_tagger.trackID = -1 #1 +tracking_tagger.pdgID = -9999 #11 +tracking_tagger.measurement_collection = digi_tagger.out_collection +tracking_tagger.min_hits = 6 + +#CKF Options +tracking_recoil = tracking.CKFProcessor("Recoil_TrackFinder") +tracking_recoil.dumpobj = False +tracking_recoil.debug = True +tracking_recoil.propagator_step_size = 1000. #mm +tracking_recoil.bfield = -1.5 #in T #From looking at the BField map +tracking_recoil.const_b_field = False +tracking_recoil.taggerTracking=False +tracking_recoil.seed_coll_name = "RecoilTruthSeeds" +tracking_recoil.out_trk_collection = "RecoilTracks" +tracking_recoil.trackID = -1 #1 +tracking_recoil.pdgID = -9999 #11 +tracking_recoil.measurement_collection = digi_recoil.out_collection +tracking_recoil.min_hits = 6 from LDMX.Recon.overlay import OverlayProducer overlay=OverlayProducer('pileup.root') @@ -66,6 +166,7 @@ ecalDigi =eDigi.EcalDigiProducer('ecalDigis') ecalReco =eDigi.EcalRecProducer('ecalRecon') ecalVeto =vetos.EcalVetoProcessor('ecalVetoBDT') +ecalVeto.recoil_from_tracking = False ecalDigi.inputCollName = ecalDigi.inputCollName+overlayStr ecalReco.simHitCollName = ecalReco.simHitCollName+overlayStr @@ -78,6 +179,40 @@ hcalReco.digiPassName = thisPassName from LDMX.DQM import dqm +from LDMX.Tracking import dqm as tkdqm + +seed_tagger_dqm = tkdqm.TrackingRecoDQM("SeedTaggerDQM") +seed_tagger_dqm.track_collection = seeder_tagger.out_seed_collection +seed_tagger_dqm.truth_collection = "TaggerTruthTracks" +seed_tagger_dqm.title = "" +seed_tagger_dqm.buildHistograms() + +tagger_dqm = tkdqm.TrackingRecoDQM("TaggerDQM") +tagger_dqm.track_collection = tracking_tagger.out_trk_collection +tagger_dqm.truth_collection = "TaggerTruthTracks" +tagger_dqm.trackStates = ["target"] +tagger_dqm.title = "" +tagger_dqm.measurement_collection=digi_tagger.out_collection +tagger_dqm.truth_hit_collection="TaggerSimHits" +tagger_dqm.buildHistograms() + + +seed_recoil_dqm = tkdqm.TrackingRecoDQM("SeedRecoilDQM") +seed_recoil_dqm.track_collection = seeder_recoil.out_seed_collection +seed_recoil_dqm.truth_collection = "RecoilTruthTracks" +seed_recoil_dqm.title = "" +seed_recoil_dqm.buildHistograms() + + +recoil_dqm = tkdqm.TrackingRecoDQM("RecoilDQM") +recoil_dqm.track_collection = tracking_recoil.out_trk_collection +recoil_dqm.truth_collection = "RecoilTruthTracks" +recoil_dqm.trackStates = ["ecal","target"] +recoil_dqm.title = "" +recoil_dqm.measurement_collection=digi_recoil.out_collection +recoil_dqm.truth_hit_collection="RecoilSimHits" +recoil_dqm.buildHistograms() + ecalDigiVerify = dqm.EcalDigiVerify() ecalDigiVerify.ecalSimHitColl = ecalDigiVerify.ecalSimHitColl+overlayStr @@ -87,7 +222,30 @@ count = ElectronCounter(1,'ElectronCounter') count.input_pass_name = '' +# The Tracking modules produce a lot of helpful messages +# but (at the debug level) is too much for commiting the gold log +# into the git working tree on GitHub +p.termLogLevel = 0 +p.logger.custom(truth_tracking, level = 2) +p.logger.custom(digi_tagger, level = 2) +p.logger.custom(digi_recoil, level = 2) +p.logger.custom(seeder_tagger, level = 2) +p.logger.custom(seeder_recoil, level = 2) +p.logger.custom(tracking_tagger, level = 0) +p.logger.custom(tracking_recoil, level = 0) +p.logger.custom(seed_tagger_dqm, level = 2) +p.logger.custom(seed_recoil_dqm, level = 2) +p.logger.custom(tagger_dqm, level = 2) +p.logger.custom(recoil_dqm, level = 2) + p.sequence.extend([ + digi_tagger, + digi_recoil, + truth_tracking, + seeder_tagger, + seeder_recoil, + tracking_tagger, + tracking_recoil, ecalDigi, ecalReco, ecalVeto, hcalDigi, hcalReco, *ts_digis, @@ -96,12 +254,14 @@ TrigScintClusterProducer.pad3(), trigScintTrack, count, TriggerProcessor('trigger', 8000.), - dqm.SimObjects(sim_pass=thisPassName), - ecalDigiVerify,dqm.EcalShowerFeatures(), - dqm.PhotoNuclearDQM(verbose=False), - dqm.HCalDQM(), + dqm.PhotoNuclearDQM(verbose=False), + seed_tagger_dqm, + tagger_dqm, + seed_recoil_dqm, + recoil_dqm, +]) -]+dqm.recoil_dqm+dqm.trigger_dqm) +p.sequence.extend(dqm.all_dqm) p.inputFiles = ['ecal_pn.root'] p.outputFiles= ['events.root'] diff --git a/.github/validation_samples/it_pileup/gen_main.py b/.github/validation_samples/it_pileup/gen_main.py index c24823ab1..885d32a55 100644 --- a/.github/validation_samples/it_pileup/gen_main.py +++ b/.github/validation_samples/it_pileup/gen_main.py @@ -9,7 +9,7 @@ from LDMX.Biasing import ecal from LDMX.SimCore import generators as gen -mySim = ecal.photo_nuclear('ldmx-det-v14',gen.single_4gev_e_upstream_tagger()) +mySim = ecal.photo_nuclear('ldmx-det-v14-8gev',gen.single_8gev_e_upstream_tagger()) mySim.beamSpotSmear = [20.,80.,0.] mySim.description = 'ECal PN Test Simulation' diff --git a/.github/validation_samples/it_pileup/gen_pileup.py b/.github/validation_samples/it_pileup/gen_pileup.py index 1896cde0f..cdd884627 100644 --- a/.github/validation_samples/it_pileup/gen_pileup.py +++ b/.github/validation_samples/it_pileup/gen_pileup.py @@ -8,9 +8,9 @@ from LDMX.SimCore import simulator as sim mySim = sim.simulator( "mySim" ) -mySim.setDetector( 'ldmx-det-v14' ) +mySim.setDetector( 'ldmx-det-v14-8gev' ) from LDMX.SimCore import generators as gen -mySim.generators.append( gen.single_4gev_e_upstream_tagger() ) +mySim.generators.append( gen.single_8gev_e_upstream_tagger() ) mySim.beamSpotSmear = [20.,80.,0.] mySim.description = 'Basic test Simulation' diff --git a/.github/validation_samples/kaon_enhanced/config.py b/.github/validation_samples/kaon_enhanced/config.py index 354baeb4b..42b0c2bf4 100644 --- a/.github/validation_samples/kaon_enhanced/config.py +++ b/.github/validation_samples/kaon_enhanced/config.py @@ -6,7 +6,6 @@ thisPassName = 'test' p=ldmxcfg.Process(thisPassName) -p.termLogLevel = 0 # This need to be set but has no meaning given p.totalEvents p.maxEvents = 1 # kaon-focused sample takes about twice as long as normal PN, @@ -72,6 +71,107 @@ myFilter = particle_filter.PhotoNuclearProductsFilter.kaon() mySim.actions.extend([myFilter]) +# Load the tracking module +from LDMX.Tracking import tracking +from LDMX.Tracking import geo + +from LDMX.Tracking.geo import TrackersTrackingGeometryProvider as trackgeo +trackgeo.get_instance().setDetector('ldmx-det-v14-8gev') + +# Truth seeder +# Runs truth tracking producing tracks from target scoring plane hits for Recoil +# and generated electros for Tagger. +# Truth tracks can be used for assessing tracking performance or using as seeds +truth_tracking = tracking.TruthSeedProcessor() +truth_tracking.debug = True +truth_tracking.trk_coll_name = "RecoilTruthSeeds" +truth_tracking.pdgIDs = [11] +truth_tracking.scoring_hits = "TargetScoringPlaneHits" +truth_tracking.z_min = 0. +truth_tracking.track_id = -1 +truth_tracking.p_cut = 0.05 # In MeV +truth_tracking.pz_cut = 0.03 +truth_tracking.p_cutEcal = 0. # In MeV + +# These smearing quantities are default. We expect around 6um hit resolution in bending plane +# v-smearing is actually not used as 1D measurements are used for tracking. These smearing parameters +# are fed to the digitization producer. +uSmearing = 0.006 #mm +vSmearing = 0.000001 #mm + +# Smearing Processor - Tagger +# Runs G4 hit smearing producing measurements in the Tagger tracker. +# Hits that belong to the same sensor with the same trackID are merged together to reduce combinatorics +digi_tagger = tracking.DigitizationProcessor("DigitizationProcessor") +digi_tagger.hit_collection = "TaggerSimHits" +digi_tagger.out_collection = "DigiTaggerSimHits" +digi_tagger.merge_hits = True +digi_tagger.sigma_u = uSmearing +digi_tagger.sigma_v = vSmearing + +# Smearing Processor - Recoil +digi_recoil = tracking.DigitizationProcessor("DigitizationProcessorRecoil") +digi_recoil.hit_collection = "RecoilSimHits" +digi_recoil.out_collection = "DigiRecoilSimHits" +digi_recoil.merge_hits = True +digi_recoil.sigma_u = uSmearing +digi_recoil.sigma_v = vSmearing + +# Seed Finder Tagger +# This runs the track seed finder looking for 5 hits in consecutive sensors and fitting them with a +# parabola+linear fit. Compatibility with expected particles is checked by looking at the track +# parameters and the impact parameters at the target or generation point. For the tagger one should look +# for compatibility with the beam orbit / beam spot +seeder_tagger = tracking.SeedFinderProcessor("SeedTagger") +seeder_tagger.input_hits_collection = digi_tagger.out_collection +seeder_tagger.out_seed_collection = "TaggerRecoSeeds" +seeder_tagger.pmin = 0.1 +seeder_tagger.pmax = 10.0 +seeder_tagger.d0min = -45. +seeder_tagger.d0max = 45. +seeder_tagger.z0max = 60. + +#Seed finder processor - Recoil +seeder_recoil = tracking.SeedFinderProcessor("SeedRecoil") +seeder_recoil.perigee_location = [0.,0.,0.] +seeder_recoil.input_hits_collection = digi_recoil.out_collection +seeder_recoil.out_seed_collection = "RecoilRecoSeeds" +seeder_recoil.bfield = 1.5 +seeder_recoil.pmin = 0.1 +seeder_recoil.pmax = 10.0 +seeder_recoil.d0min = -40.0 +seeder_recoil.d0max = 40.0 +seeder_recoil.z0max = 50. + +# Producer for running the CKF track finding starting from the found seeds. +tracking_tagger = tracking.CKFProcessor("Tagger_TrackFinder") +tracking_tagger.dumpobj = False +tracking_tagger.debug = True +tracking_tagger.propagator_step_size = 1000. #mm +tracking_tagger.bfield = -1.5 #in T #From looking at the BField map +tracking_tagger.const_b_field = False +tracking_tagger.seed_coll_name = seeder_tagger.out_seed_collection +tracking_tagger.out_trk_collection = "TaggerTracks" +tracking_tagger.trackID = -1 #1 +tracking_tagger.pdgID = -9999 #11 +tracking_tagger.measurement_collection = digi_tagger.out_collection +tracking_tagger.min_hits = 6 + +#CKF Options +tracking_recoil = tracking.CKFProcessor("Recoil_TrackFinder") +tracking_recoil.dumpobj = False +tracking_recoil.debug = True +tracking_recoil.propagator_step_size = 1000. #mm +tracking_recoil.bfield = -1.5 #in T #From looking at the BField map +tracking_recoil.const_b_field = False +tracking_recoil.taggerTracking=False +tracking_recoil.seed_coll_name = "RecoilTruthSeeds" +tracking_recoil.out_trk_collection = "RecoilTracks" +tracking_recoil.trackID = -1 #1 +tracking_recoil.pdgID = -9999 #11 +tracking_recoil.measurement_collection = digi_recoil.out_collection +tracking_recoil.min_hits = 6 + # Loading calorimeter and TS processors import LDMX.Ecal.EcalGeometry import LDMX.Ecal.ecal_hardcoded_conditions @@ -118,6 +218,7 @@ ecalReco =eDigi.EcalRecProducer() ecalDigi = eDigi.EcalDigiProducer() ecalVeto =vetos.EcalVetoProcessor() +ecalVeto.recoil_from_tracking = False # HCAL part hcalDigi =hDigi.HcalDigiProducer() @@ -133,9 +234,65 @@ # Load DQM from LDMX.DQM import dqm +from LDMX.Tracking import dqm as tkdqm + +seed_tagger_dqm = tkdqm.TrackingRecoDQM("SeedTaggerDQM") +seed_tagger_dqm.track_collection = seeder_tagger.out_seed_collection +seed_tagger_dqm.truth_collection = "TaggerTruthTracks" +seed_tagger_dqm.title = "" +seed_tagger_dqm.buildHistograms() + +tagger_dqm = tkdqm.TrackingRecoDQM("TaggerDQM") +tagger_dqm.track_collection = tracking_tagger.out_trk_collection +tagger_dqm.truth_collection = "TaggerTruthTracks" +tagger_dqm.trackStates = ["target"] +tagger_dqm.title = "" +tagger_dqm.measurement_collection=digi_tagger.out_collection +tagger_dqm.truth_hit_collection="TaggerSimHits" +tagger_dqm.buildHistograms() + + +seed_recoil_dqm = tkdqm.TrackingRecoDQM("SeedRecoilDQM") +seed_recoil_dqm.track_collection = seeder_recoil.out_seed_collection +seed_recoil_dqm.truth_collection = "RecoilTruthTracks" +seed_recoil_dqm.title = "" +seed_recoil_dqm.buildHistograms() + + +recoil_dqm = tkdqm.TrackingRecoDQM("RecoilDQM") +recoil_dqm.track_collection = tracking_recoil.out_trk_collection +recoil_dqm.truth_collection = "RecoilTruthTracks" +recoil_dqm.trackStates = ["ecal","target"] +recoil_dqm.title = "" +recoil_dqm.measurement_collection=digi_recoil.out_collection +recoil_dqm.truth_hit_collection="RecoilSimHits" +recoil_dqm.buildHistograms() + +# The Tracking modules produce a lot of helpful messages +# but (at the debug level) is too much for commiting the gold log +# into the git working tree on GitHub +p.termLogLevel = 0 +p.logger.custom(truth_tracking, level = 2) +p.logger.custom(digi_tagger, level = 2) +p.logger.custom(digi_recoil, level = 2) +p.logger.custom(seeder_tagger, level = 2) +p.logger.custom(seeder_recoil, level = 2) +p.logger.custom(tracking_tagger, level = 0) +p.logger.custom(tracking_recoil, level = 0) +p.logger.custom(seed_tagger_dqm, level = 2) +p.logger.custom(seed_recoil_dqm, level = 2) +p.logger.custom(tagger_dqm, level = 2) +p.logger.custom(recoil_dqm, level = 2) p.sequence=[ mySim, + digi_tagger, + digi_recoil, + truth_tracking, + seeder_tagger, + seeder_recoil, + tracking_tagger, + tracking_recoil, ecalDigi, ecalReco, ecalVeto, @@ -149,7 +306,11 @@ hcalDigi, hcalReco, hcalVeto, - dqm.PhotoNuclearDQM(verbose=False) + dqm.PhotoNuclearDQM(verbose=False), + seed_tagger_dqm, + tagger_dqm, + seed_recoil_dqm, + recoil_dqm, ] p.sequence.extend(dqm.all_dqm) diff --git a/.github/validation_samples/reduced_ldmx/config.py b/.github/validation_samples/reduced_ldmx/config.py index 67bc460d8..c8c96e200 100644 --- a/.github/validation_samples/reduced_ldmx/config.py +++ b/.github/validation_samples/reduced_ldmx/config.py @@ -16,7 +16,7 @@ myGun.enablePoisson = False #True mySim = sim.simulator( "mySim" ) # Build simulator object -det = 'ldmx-reduced-v1' +det = 'ldmx-reduced-v2' mySim.setDetector(det, True ) mySim.beamSpotSmear = [20.,80.,0.] mySim.description = 'Reduced ECal Electron Gun Test Simulation' @@ -43,6 +43,7 @@ ecalVeto = ecal_vetos.EcalVetoProcessor() ecalVeto.num_ecal_layers = 6 ecalVeto.beam_energy = 4000. +ecalVeto.recoil_from_tracking = False from LDMX.TrigScint.trigScint import TrigScintDigiProducer from LDMX.TrigScint.trigScint import TrigScintClusterProducer @@ -75,4 +76,6 @@ TrigScintClusterProducer.pad3(), trigScintTrack, count, TriggerProcessor('trigger', 4000.), - ] + dqm.ecal_dqm) + ]) + +p.sequence.extend(dqm.all_dqm) diff --git a/.github/validation_samples/signal/config.py b/.github/validation_samples/signal/config.py index 3ccbb128f..019a98ed1 100644 --- a/.github/validation_samples/signal/config.py +++ b/.github/validation_samples/signal/config.py @@ -28,7 +28,107 @@ p.histogramFile = f'hist.root' p.outputFiles = [f'events.root'] -p.termLogLevel = 0 + +# Load the tracking module +from LDMX.Tracking import tracking +from LDMX.Tracking import geo + +from LDMX.Tracking.geo import TrackersTrackingGeometryProvider as trackgeo +trackgeo.get_instance().setDetector('ldmx-det-v14-8gev') + +# Truth seeder +# Runs truth tracking producing tracks from target scoring plane hits for Recoil +# and generated electros for Tagger. +# Truth tracks can be used for assessing tracking performance or using as seeds +truth_tracking = tracking.TruthSeedProcessor() +truth_tracking.debug = True +truth_tracking.trk_coll_name = "RecoilTruthSeeds" +truth_tracking.pdgIDs = [11] +truth_tracking.scoring_hits = "TargetScoringPlaneHits" +truth_tracking.z_min = 0. +truth_tracking.track_id = -1 +truth_tracking.p_cut = 0.05 # In MeV +truth_tracking.pz_cut = 0.03 +truth_tracking.p_cutEcal = 0. # In MeV + +# These smearing quantities are default. We expect around 6um hit resolution in bending plane +# v-smearing is actually not used as 1D measurements are used for tracking. These smearing parameters +# are fed to the digitization producer. +uSmearing = 0.006 #mm +vSmearing = 0.000001 #mm + +# Smearing Processor - Tagger +# Runs G4 hit smearing producing measurements in the Tagger tracker. +# Hits that belong to the same sensor with the same trackID are merged together to reduce combinatorics +digi_tagger = tracking.DigitizationProcessor("DigitizationProcessor") +digi_tagger.hit_collection = "TaggerSimHits" +digi_tagger.out_collection = "DigiTaggerSimHits" +digi_tagger.merge_hits = True +digi_tagger.sigma_u = uSmearing +digi_tagger.sigma_v = vSmearing + +# Smearing Processor - Recoil +digi_recoil = tracking.DigitizationProcessor("DigitizationProcessorRecoil") +digi_recoil.hit_collection = "RecoilSimHits" +digi_recoil.out_collection = "DigiRecoilSimHits" +digi_recoil.merge_hits = True +digi_recoil.sigma_u = uSmearing +digi_recoil.sigma_v = vSmearing + +# Seed Finder Tagger +# This runs the track seed finder looking for 5 hits in consecutive sensors and fitting them with a +# parabola+linear fit. Compatibility with expected particles is checked by looking at the track +# parameters and the impact parameters at the target or generation point. For the tagger one should look +# for compatibility with the beam orbit / beam spot +seeder_tagger = tracking.SeedFinderProcessor("SeedTagger") +seeder_tagger.input_hits_collection = digi_tagger.out_collection +seeder_tagger.out_seed_collection = "TaggerRecoSeeds" +seeder_tagger.pmin = 0.1 +seeder_tagger.pmax = 10.0 +seeder_tagger.d0min = -45. +seeder_tagger.d0max = 45. +seeder_tagger.z0max = 60. + +#Seed finder processor - Recoil +seeder_recoil = tracking.SeedFinderProcessor("SeedRecoil") +seeder_recoil.perigee_location = [0.,0.,0.] +seeder_recoil.input_hits_collection = digi_recoil.out_collection +seeder_recoil.out_seed_collection = "RecoilRecoSeeds" +seeder_recoil.bfield = 1.5 +seeder_recoil.pmin = 0.1 +seeder_recoil.pmax = 10.0 +seeder_recoil.d0min = -40.0 +seeder_recoil.d0max = 40.0 +seeder_recoil.z0max = 50. + +# Producer for running the CKF track finding starting from the found seeds. +tracking_tagger = tracking.CKFProcessor("Tagger_TrackFinder") +tracking_tagger.dumpobj = False +tracking_tagger.debug = True +tracking_tagger.propagator_step_size = 1000. #mm +tracking_tagger.bfield = -1.5 #in T #From looking at the BField map +tracking_tagger.const_b_field = False +tracking_tagger.seed_coll_name = seeder_tagger.out_seed_collection +tracking_tagger.out_trk_collection = "TaggerTracks" +tracking_tagger.trackID = -1 #1 +tracking_tagger.pdgID = -9999 #11 +tracking_tagger.measurement_collection = digi_tagger.out_collection +tracking_tagger.min_hits = 6 + +#CKF Options +tracking_recoil = tracking.CKFProcessor("Recoil_TrackFinder") +tracking_recoil.dumpobj = False +tracking_recoil.debug = True +tracking_recoil.propagator_step_size = 1000. #mm +tracking_recoil.bfield = -1.5 #in T #From looking at the BField map +tracking_recoil.const_b_field = False +tracking_recoil.taggerTracking=False +tracking_recoil.seed_coll_name = "RecoilTruthSeeds" +tracking_recoil.out_trk_collection = "RecoilTracks" +tracking_recoil.trackID = -1 #1 +tracking_recoil.pdgID = -9999 #11 +tracking_recoil.measurement_collection = digi_recoil.out_collection +tracking_recoil.min_hits = 6 import LDMX.Ecal.EcalGeometry import LDMX.Ecal.ecal_hardcoded_conditions @@ -56,11 +156,71 @@ count.input_pass_name = '' from LDMX.DQM import dqm +from LDMX.Tracking import dqm as tkdqm + +seed_tagger_dqm = tkdqm.TrackingRecoDQM("SeedTaggerDQM") +seed_tagger_dqm.track_collection = seeder_tagger.out_seed_collection +seed_tagger_dqm.truth_collection = "TaggerTruthTracks" +seed_tagger_dqm.title = "" +seed_tagger_dqm.buildHistograms() + +tagger_dqm = tkdqm.TrackingRecoDQM("TaggerDQM") +tagger_dqm.track_collection = tracking_tagger.out_trk_collection +tagger_dqm.truth_collection = "TaggerTruthTracks" +tagger_dqm.trackStates = ["target"] +tagger_dqm.title = "" +tagger_dqm.measurement_collection=digi_tagger.out_collection +tagger_dqm.truth_hit_collection="TaggerSimHits" +tagger_dqm.buildHistograms() + + +seed_recoil_dqm = tkdqm.TrackingRecoDQM("SeedRecoilDQM") +seed_recoil_dqm.track_collection = seeder_recoil.out_seed_collection +seed_recoil_dqm.truth_collection = "RecoilTruthTracks" +seed_recoil_dqm.title = "" +seed_recoil_dqm.buildHistograms() + + +recoil_dqm = tkdqm.TrackingRecoDQM("RecoilDQM") +recoil_dqm.track_collection = tracking_recoil.out_trk_collection +recoil_dqm.truth_collection = "RecoilTruthTracks" +recoil_dqm.trackStates = ["ecal","target"] +recoil_dqm.title = "" +recoil_dqm.measurement_collection=digi_recoil.out_collection +recoil_dqm.truth_hit_collection="RecoilSimHits" +recoil_dqm.buildHistograms() + +# Load ecal veto and use tracking in it +ecalVeto = ecal_vetos.EcalVetoProcessor() +ecalVeto.recoil_from_tracking = False + +# The Tracking modules produce a lot of helpful messages +# but (at the debug level) is too much for commiting the gold log +# into the git working tree on GitHub +p.termLogLevel = 0 +p.logger.custom(truth_tracking, level = 2) +p.logger.custom(digi_tagger, level = 2) +p.logger.custom(digi_recoil, level = 2) +p.logger.custom(seeder_tagger, level = 2) +p.logger.custom(seeder_recoil, level = 2) +p.logger.custom(tracking_tagger, level = 0) +p.logger.custom(tracking_recoil, level = 0) +p.logger.custom(seed_tagger_dqm, level = 2) +p.logger.custom(seed_recoil_dqm, level = 2) +p.logger.custom(tagger_dqm, level = 2) +p.logger.custom(recoil_dqm, level = 2) p.sequence.extend([ + digi_tagger, + digi_recoil, + truth_tracking, + seeder_tagger, + seeder_recoil, + tracking_tagger, + tracking_recoil, ecal_digi.EcalDigiProducer(), ecal_digi.EcalRecProducer(), - ecal_vetos.EcalVetoProcessor(), + ecalVeto, hcal_digi.HcalDigiProducer(), hcal_digi.HcalRecProducer(), *ts_digis, @@ -69,5 +229,11 @@ TrigScintClusterProducer.pad3(), trigScintTrack, count, TriggerProcessor('trigger', 8000.), - dqm.DarkBremInteraction() - ] + dqm.all_dqm) + dqm.DarkBremInteraction(), + seed_tagger_dqm, + tagger_dqm, + seed_recoil_dqm, + recoil_dqm, + ]) + +p.sequence.extend(dqm.all_dqm)