Feature #22466

Provide a LArSoft geometry example working with the new larg4

Added by Gianluca Petrillo over 1 year ago. Updated 16 days ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
Spent time:


My attempt to figure out what it takes to use the new LArG4 package has been frustrated at the point where the detector description from the GDML source needs to be updated.

I feel that we will benefit from a real, working LArSoft full example of how to do that step, including up to running GEANT4 in LArSoft.
So I have pushed into LArCoreAlg develop branch a geometry description, larcorealg:source:larcorealg/Geometry/gdml/MinimalLArTPCdetector.gdml and its _nowires companion, which contains the minimal set of GDML instructions that make LArSoft geometry and presumably GEANT4 and larg4::LArG4 module (LArSim) work properly.
I would like that simplified file to be adapted so that the rest of the community can start from there and give a try to the new LArG4.
To be clear: I am aware of the instructions on LArG4 wiki, and while I got a flavour of the required changed, the instructions proved not enough to bootstrap me into updating a LArTPC geometry file.

For reference, that geometry is the same, in LArSoft terms, as larcorealg:source:larcorealg/Geometry/gdml/LArTPCdetector.gdml, which is a MicroBooNE-like detector with TPC (1), PMTs (30), and auxiliary detectors (267). I can provide configuration files using that geometry and running the current LArG4 module (although I failed to fully enable optical simulation so far).

fcl.tgz (24.7 KB) fcl.tgz Hans-Joachim Wenzel, 05/13/2019 05:25 PM
MinimalLArTPCdetector_nowires.gdml (119 KB) MinimalLArTPCdetector_nowires.gdml Hans-Joachim Wenzel, 07/07/2020 10:36 AM
Screenshot from 2020-07-07 09-45-19.png (133 KB) Screenshot from 2020-07-07 09-45-19.png Hans-Joachim Wenzel, 07/07/2020 10:38 AM
Screenshot from 2020-07-08 17-15-36.png (128 KB) Screenshot from 2020-07-08 17-15-36.png Hans-Joachim Wenzel, 07/08/2020 05:20 PM
Screenshot from 2020-07-08 17-16-38.png (150 KB) Screenshot from 2020-07-08 17-16-38.png Hans-Joachim Wenzel, 07/08/2020 05:20 PM
MinimalLArTPCdetector_nowires.gdml (16.9 KB) MinimalLArTPCdetector_nowires.gdml Hans-Joachim Wenzel, 07/08/2020 05:21 PM
MinimalLArTPCdetector_g4_nowires.gdml (92.4 KB) MinimalLArTPCdetector_g4_nowires.gdml Michael Wang, 09/18/2020 03:45 PM
tt.fcl (4.14 KB) tt.fcl Michael Wang, 09/18/2020 03:45 PM
MinimalLArTPCdetector_g4.gdml (1.04 MB) MinimalLArTPCdetector_g4.gdml Michael Wang, 09/18/2020 03:45 PM
tt_v090300.log (24.9 KB) tt_v090300.log Michael Wang, 09/21/2020 12:13 PM


#1 Updated by Lynn Garren over 1 year ago

  • File test_311dp.fcl added
  • File services_dune2.fcl added
  • File dune_refactored.fcl added
  • File 3x1x1dphase_nowires.gdml added

From Hans:

The people working on dual phase TPC's were able to get the full chain running and I think everything can be found in the dune repositories. I have attached the fcl and gdml file they used.

I am in the process of compiling an example that shows how to use the new workflow using a simplified liquid Argon Detector geometry. But I still have to complete some coding which completely splits the electron drift and detector response. That means the larsim:source:larsim/ElectronDrift/ used by the example above will be split into the and another module that produces the simchannels.

Here the DriftElectronstoPlane_module will take the SimEnergyDeposits as input, drift the electrons to a surface and create the SimDriftedElectronClusters which then are the input for a new module that takes the SimDriftedElectronClusters as input and simchannels as output.

#2 Updated by Kyle Knoepfel over 1 year ago

  • Assignee set to Hans-Joachim Wenzel
  • Status changed from New to Assigned

Hans, can you take care of this?

#3 Updated by Kyle Knoepfel over 1 year ago

Hans, what is the status of this issue?

#4 Updated by Hans-Joachim Wenzel over 1 year ago

  • File fcl.tgz added

#5 Updated by Hans-Joachim Wenzel over 1 year ago

  • File dune_refactored2.fcl added

Currently an example is available as part of dunetpc. It was developed by the group working on a dual-phase TPC (Jose, Bea and Paul). So to look at the example one needs to setup dunetpc. Below is what I am doing until we find a place for a more generic example.

mkdir example 
cd example
mkdir larsim_dev
cd larsim_dev
source /cvmfs/
setup mrb
export MRB_PROJECT=larsim
mrb newDev -v v08_07_00 -q e17:prof
source localProducts_larsim_v08_07_00_e17_prof/setup
cd srcs
mrb g larsim
mrb b -j 4
unsetup cetpkgsupport
source /cvmfs/
setup dunetpc -qe17:prof v08_20_00 
tar xzvf fcl.tgz
lar -c dune_refactored.fcl

to run the module by Bill seligman which does the simdrift and injects the charge into the simchannels. (Currently this still depends on the LArG4Parameters service but we will remove this dependency)

lar -c dune_refactored2.fcl

#6 Updated by Hans-Joachim Wenzel over 1 year ago

  • File deleted (fcl.tgz)

#7 Updated by Hans-Joachim Wenzel over 1 year ago

  • File deleted (dune_refactored2.fcl)

#8 Updated by Hans-Joachim Wenzel over 1 year ago

#9 Updated by Hans-Joachim Wenzel over 1 year ago

  • File deleted (3x1x1dphase_nowires.gdml)

#10 Updated by Hans-Joachim Wenzel over 1 year ago

  • File deleted (dune_refactored.fcl)

#11 Updated by Hans-Joachim Wenzel over 1 year ago

  • File deleted (services_dune2.fcl)

#12 Updated by Hans-Joachim Wenzel over 1 year ago

  • File deleted (test_311dp.fcl)

#14 Updated by Hans-Joachim Wenzel 3 months ago

Now everything is square as Gianluca intended. The gdml as well as some screenshots are attached. I am not quite done yet but the gdml file should be quite compact and easy to read and modify.

#15 Updated by Michael Wang about 1 month ago

I am testing (with larsoft v08_55_02) the new minimal LArTPC detector example Hans created about 2 months ago for the purpose of illustrating how to use the refactored larg4. However it fails in GeometryCore::BuildGeometry at the following line:

Cryostats() = builder.extractCryostats(path);

with the following error message:
Info in <TGeoManager::Import>: Reading geometry from file: ./MinimalLArTPCdetector_g4.gdml
Info in <TGeoManager::TGeoManager>: Geometry GDMLImport, Geometry imported from GDML created
Info in <TGeoManager::SetTopVolume>: Top volume is volWorld. Master volume is volWorld
Info in <TGeoNavigator::BuildCache>: --- Maximum geometry depth set to 100
Info in <TGeoManager::CheckGeometry>: Fixing runtime shapes...
Info in <TGeoManager::CheckGeometry>: ...Nothing to fix
Info in <TGeoManager::CloseGeometry>: Counting nodes...
Info in <TGeoManager::Voxelize>: Voxelizing...
Info in <TGeoManager::CloseGeometry>: Building cache...
Info in <TGeoManager::CountLevels>: max level = 5, max placements = 2591
Info in <TGeoManager::CloseGeometry>: 3563 nodes/ 12 volume UID's in Geometry imported from GDML
Info in <TGeoManager::CloseGeometry>: ----------------modeler ready----------------

 *** Break *** segmentation violation
    import os

Gianluca, could you please take a look, since this appears to be your code and you understand it better than the rest of us, to help us understand what's wrong so we can get this example working. I am attaching the fcl and the gdml files used by the geometry service. The gdml file used by larg4 is the same one Hans created and uploaded 2 months ago on this page.

#16 Updated by Michael Wang 30 days ago

As suggested by Kyle and Lynn at today's scisoft meeting, I repeated my test using larsoft v09_03_00. I see the same failure. Attached is a text file with the output from running lar showing more details of the failure.

#17 Updated by Michael Wang 16 days ago

The problem I was seeing turned out to be the way things were labeled in Han's gdml file describing the minimal lartpc. GeometryBuilderStandard was expecting "volTPCWire" but the label used in the gdml file was "psenseWire". Replacing the latter with the former seems to fix things and I no longer see the error above.

With the fixed gdml file, I was able to run SimDriftElectrons to drift the ionization electrons resulting from the SimEnergyDeposits to the two wire planes in the sample model to produce SimChannels. I was also able to run SimWire on these results to produce the RawDigits associated with wire signals.

Finally, I also managed to get lareventdisplay to work with the example above to verify it was producing reasonable results.

Also available in: Atom PDF