This repository has been archived by the owner on May 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from LDMX-Software/iss40-toa
First pass at double-ended reconstruction for test beam MC and data
- Loading branch information
Showing
14 changed files
with
390 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import argparse, sys, os, pathlib | ||
|
||
""" | ||
Takes raw data file after reformat (with run number) | ||
and runs single ended reconstruction | ||
""" | ||
|
||
parser = argparse.ArgumentParser(f'ldmx fire {sys.argv[0]}') | ||
parser.add_argument('input_file') | ||
parser.add_argument('--pause',action='store_true') | ||
grp = parser.add_mutually_exclusive_group() | ||
parser.add_argument('--output_dir',default='.',type=pathlib.Path) | ||
#parser.add_argument('--max_events',default=-1,type=int) | ||
arg = parser.parse_args() | ||
|
||
from LDMX.Framework import ldmxcfg | ||
p = ldmxcfg.Process('') | ||
#p.maxEvents = arg.max_events | ||
p.termLogLevel = 0 | ||
p.logFrequency = 1000 | ||
|
||
print(arg.output_dir) | ||
|
||
import LDMX.Hcal.HcalGeometry | ||
import LDMX.Hcal.hcal_testbeam0422_conditions | ||
import LDMX.Hcal.digi as hcal_digi | ||
import LDMX.Hcal.hgcrocFormat as hcal_format | ||
|
||
base_name = os.path.basename(arg.input_file).replace('.root','') | ||
dir_name = os.path.dirname(arg.output_dir) | ||
|
||
p.inputFiles = [arg.input_file] | ||
p.outputFiles = [f'{dir_name}/reco_{base_name}_pass1.root'] | ||
|
||
# sequence | ||
tbl = f'{os.environ["LDMX_BASE"]}/ldmx-sw/Hcal/data/testbeam_connections.csv' | ||
p.sequence = [ | ||
hcal_digi.HcalSingleEndRecProducer( | ||
coll_name = 'HcalRawDigis', | ||
rec_coll_name = 'HcalSingleEndRecHits', | ||
rec_pass_name = '', | ||
), | ||
hcal_digi.HcalDoubleEndRecProducer( | ||
pass_name = '', | ||
coll_name = 'HcalSingleEndRecHits', | ||
rec_coll_name = 'HcalDoubleEndRecHits', | ||
rec_pass_name = '' | ||
) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import argparse, sys, os, pathlib | ||
from LDMX.Framework import ldmxcfg | ||
|
||
""" | ||
Simulation of particles through TB prototype | ||
""" | ||
|
||
parser = argparse.ArgumentParser(f'ldmx fire {sys.argv[0]}') | ||
parser.add_argument('--nevents',default=100,type=int) | ||
parser.add_argument('--particle',default='neutron') # other options, mu-,e-,pi-,proton | ||
parser.add_argument('--energy',default=2.0,type=float) | ||
parser.add_argument('--runnumber',default=1,type=int) | ||
parser.add_argument('--output_dir',default='.',type=pathlib.Path) | ||
arg = parser.parse_args() | ||
|
||
p = ldmxcfg.Process('sim') | ||
p.maxEvents = arg.nevents | ||
p.termLogLevel = 0 | ||
p.logFrequency = 10 | ||
p.run = arg.runnumber | ||
|
||
detector = 'ldmx-hcal-prototype-v2.0' # TODO: CHANGE TO FEFIX version | ||
|
||
base_name = os.path.basename(arg.particle+"Sim_%.2fGeV_"%arg.energy+str(p.maxEvents)+"_%s"%detector+"_pass1_%i"%arg.runnumber) | ||
dir_name = os.path.dirname(arg.output_dir) | ||
|
||
p.outputFiles = [f'{dir_name}/{base_name}.root'] | ||
|
||
from LDMX.SimCore import simulator | ||
import LDMX.Ecal.EcalGeometry # geometry required by sim | ||
|
||
mySim = simulator.simulator('mySim') | ||
mySim.setDetector(detector) | ||
|
||
# Get a pre-written generator | ||
from LDMX.SimCore import generators as gen | ||
myGun = gen.gun('myGun') | ||
myGun.particle = arg.particle | ||
myGun.position = [ 0., 0., -600. ] # mm | ||
myGun.direction = [ 0., 0., 1] # forward in z | ||
myGun.energy = arg.energy # GeV | ||
mySim.generators = [ myGun ] | ||
p.sequence.append( mySim ) | ||
# mySim.verbosity = 1 | ||
|
||
# import chip/geometry (hardcoded) conditions | ||
import LDMX.Hcal.HcalGeometry | ||
import LDMX.Hcal.hcal_testbeamsim_conditions | ||
import LDMX.Hcal.digi as hcal_digi | ||
|
||
# add them to the sequence | ||
p.sequence.extend( | ||
[ | ||
hcal_digi.HcalDigiProducer(), | ||
hcal_digi.HcalRecProducer(), | ||
hcal_digi.HcalSingleEndRecProducer( | ||
pass_name = 'sim', coll_name = 'HcalDigis', | ||
rec_coll_name = 'HcalSingleEndRecHits', | ||
), | ||
hcal_digi.HcalDoubleEndRecProducer( | ||
pass_name = '', | ||
coll_name = 'HcalSingleEndRecHits', | ||
rec_coll_name = 'HcalDoubleEndRecHits', | ||
rec_pass_name = '' | ||
) | ||
] | ||
) | ||
\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.