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

move TS modules upstream of tagger tracker #1087

Closed awhitbeck closed 2 years ago

awhitbeck commented 2 years ago

For upcoming MC campaign, we would like to move the "down" TS module upstream of the tagger tracker.

We will pull the TS modules out of the tagger volume and put them into a separate volume.

Currently, we have a new description of the geometry in the V14 detector folder on TS_geom_edits branch of LDMX-SW and the SimCore module.

awhitbeck commented 2 years ago

@bryngemark I have made a dedicated issue to moving the TS modules. I pushed all of my code. Thanks to help from @tomeichlersmith and @omar-moreno the new GDML is properly getting loaded by LDMX-SW and I can run simulations. However, I don't see any sim hits in the output root file.

Some caveats to where we are currently:

tomeichlersmith commented 2 years ago

can your visualization code accommodate tracks from a simple particle gun?

I have no idea, I haven't tried.

I don't see any sim hits in the output root file.

Remember: The SDs are attached via python configuration now rather than in the GDML. This relies on the configuration using the correct names. https://github.com/LDMX-Software/SimCore/blob/0656170b61f39dd972c6b8fd01fd9707391001d5/python/sensitive_detectors.py#L105-L142

bryngemark commented 2 years ago

hi @tomeichlersmith, i've been trying to get the simhits in place by adjusting the SD info. i think i can conclude that this is indeed the issue since i don't see any TS SDs being loaded when i run:

---- LDMXSW: Configuration load complete  --------
---- LDMXSW: Starting event processing --------
[ DetectorConstruction ] : Attaching Tagger_TrackerSD to LDMXTaggerModuleVolume_component0Sensor0
[ DetectorConstruction ] : Attaching Recoil_TrackerSD to LDMXRecoilL14ModuleVolume_component0Sensor0
[ DetectorConstruction ] : Attaching Recoil_TrackerSD to LDMXRecoilL56ModuleVolume_component0Sensor0
[ DetectorConstruction ] : Attaching hcal_sd to back_hcal_ScintBox_volume
[ DetectorConstruction ] : Attaching hcal_sd to sideTB_hcal_ScintBox_volume
[ DetectorConstruction ] : Attaching hcal_sd to sideLR_hcal_ScintBox_volume
[ DetectorConstruction ] : Attaching ecal_sd to Si_volume
 [ Process ] 1 : RunHeader { run: 1, detectorName: ldmx-det-v12, description: Upstream 4 GeV 1-electron beam

-- i think the "v12" in the runheader description is just hardwired from somewhere; i'm using v14 (and i know it bcs i commented the target as andrew recommended, and it's not showing up either)

here's what i do to tweak it

from LDMX.SimCore.sensitive_detectors import TrigScintSD

tsTagA=TrigScintSD(1, "TaggerA", "trigger_pad_taggerA_bar_volume")
tsTagB=TrigScintSD(3, "TaggerB", "trigger_pad_taggerB_bar_volume")

and i think this matches the SDs @awhitbeck has been setting up here

any thoughts? let me know if you want a config to try it out.

awhitbeck commented 2 years ago

right, if you change these lines in SimCore/python/sensitive_detectors.py you can see the the SDs get attached.

tomeichlersmith commented 2 years ago

After creating the sensitive detectors, you need to give them to the simulator so that they are used.

sim.sensitive_detectors = [ ... ]

The default connection is done in simulator.setDetector and uses the helper functions in sensitive_detectors.py.

BTW, the detector name in the run header description is parsed from GDML and the v14 detector just hasn't been updated on your branch yet.

awhitbeck commented 2 years ago

thanks, @tomeichlersmith. I think these function calls don't need to b changed. I didn't change the name of these functions in my edits to SimCore here. I'll try to double check though.

awhitbeck commented 2 years ago

ah, one more thing, is the detector name important within ldmx-sw? Could the name being 'v12' cause issues?

tomeichlersmith commented 2 years ago

yes, many geometry conditions rely on the detector name to know which geometry to load

tomeichlersmith commented 2 years ago

in your case, since you are based on a GDML which is using v12 hcal and v12 ecal, it might be best to leave it as v12

awhitbeck commented 2 years ago

I just checked that the TS SDs are in the list, but then I thought, maybe the name of these things might be important! If I change the first string in these TrigScintSD call, I get sim hit collections! So, now i am trying to understand what these magic lines do! Where are these functions ('TrigScinSD()`) I am calling in 'sensitive_detectors.py' defined? It seems like if I want to change the name of these things, I also need to change something else.

tomeichlersmith commented 2 years ago

The function TrigScintSD(...) is the class constructor which calls the __init__ method.

https://github.com/LDMX-Software/SimCore/blob/0656170b61f39dd972c6b8fd01fd9707391001d5/python/sensitive_detectors.py#L121-L142

awhitbeck commented 2 years ago

well, I think I lied, I still don't see any hits, but I'll dig more and follow up with more information, hopefully.

awhitbeck commented 2 years ago

okay, I got the sim hits. The name discussion above was a red herring. Now, the upstream modules are in places and working properly. I still need to check things with something more complicated than a pencil beam and fix the target area module...

bryngemark commented 2 years ago

ok. i will mention here for the record that the scoring planes haven't been updated yet either. not the first priority but something to keep on the list