LDMX-Software / ldmx-sw

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

Allow user to specify detector with version number #663

Closed tomeichlersmith closed 4 years ago

tomeichlersmith commented 4 years ago

Pretty self explanatory. This would be nice so that users don't have to soft link the detector description if they are using a standard one that is installed with ldmx-sw.

omar-moreno commented 4 years ago

How do you plan to extract the detector versions?

On Thu, Mar 26, 2020, 11:36 AM Tom Eichlersmith notifications@github.com wrote:

Pretty self explanatory. This would be nice so that users don't have to soft link the detector description if they are using a standard one that is installed with ldmx-sw.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/LDMX-Software/ldmx-sw/issues/663, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4JMXHCTUWXAKHSOYUS23LRJOOBVANCNFSM4LUOMNTA .

tomeichlersmith commented 4 years ago

For a first pass, I was planning on hard-coding a map that goes from the version to the detector name (name of the directory). I can have cmake save the install path to Version.h and then use the install path and some hard-coded knowledge of the installation tree to get the gdml file.

omar-moreno commented 4 years ago

Hard coding is something I would like to avoid. This solution is prone to becoming a mess.

If anything, we can use a database to keep track of it. However, this is not something we should plan to do in the short term.

On Thu, Mar 26, 2020, 12:24 PM Tom Eichlersmith notifications@github.com wrote:

For a first pass, I was planning on hard-coding a map that goes from the version to the detector name (name of the directory). I can have cmake save the install path to Version.h and then use the install path and some hard-coded knowledge of the installation tree to get the gdml file.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LDMX-Software/ldmx-sw/issues/663#issuecomment-604635311, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4JMXBL3NNJDFOG55APCQ3RJOTWDANCNFSM4LUOMNTA .

tomeichlersmith commented 4 years ago

Makes sense. Then I will plan on saving the path to the data directory into a python function. Then people at least don't need to soft link the gdml and the dat? They would just call something like:

sim.parameters[ "detector" ] = pathToDataInstall() + 'ldmx-det-full-v12-magnet-fieldmap/detector.gdml'

Or even better:

sim.parameters[ "detector" ] = makeDetectorPath( 'ldmx-det-full-v12-magnet-fieldmap')

where

def makeDetectorPath( detName ) : 
    return '@CMAKE_INSTALL_PREFIX@' + detName + '/detector.gdml'

What do you think?

omar-moreno commented 4 years ago

This is much better. Go for it.

On Thu, Mar 26, 2020, 12:38 PM Tom Eichlersmith notifications@github.com wrote:

Makes sense. Then I will plan on saving the path to the data directory into a python function. Then people at least don't need to soft link the gdml and the dat? They would just call something like:

sim.parameters[ "detector" ] = pathToDataInstall() + 'ldmx-det-full-v12-magnet-fieldmap/detector.gdml'

Or even better:

sim.parameters[ "detector" ] = makeDetectorPath( 'ldmx-det-full-v12-magnet-fieldmap')

where

def makeDetectorPath( detName ) : return '@CMAKE_INSTALL_PREFIX@' + detName + '/detector.gdml'

What do you think?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LDMX-Software/ldmx-sw/issues/663#issuecomment-604643260, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4JMXEOACQ4BPX7EKBUZ6DRJOVMZANCNFSM4LUOMNTA .