AIDASoft / DD4hep

Detector Description Toolkit for High Energy Physics
http://dd4hep.cern.ch
GNU Lesser General Public License v3.0
53 stars 100 forks source link

Help for beginners #703

Closed saraheno closed 3 years ago

saraheno commented 4 years ago

Hi all, I am trying to use dd4hep to do some studies on a crystal dual readout calorimeter. I successfully followed the installation instructions at https://dd4hep.web.cern.ch/dd4hep/page/installation/ on my SLC6 machine, thanks to Andre's help. It compiled correctly.

I see that there is a folder called "examples" and in this an example called "SimpleDetector". This sounds great. I think I may have even copied all the examples over to the build area constructed in the previous step and maybe compiled them.

However, I now have no idea what to do. How can I

I guess what I'm missing is exactly how to run this and get useful output. is run_sitracking_SimpleCLIC.xml related to this? If so, how do I use it?

Best Sarah Eno

petricm commented 4 years ago

Dear @saraheno,

display the geometry of the simple detector?

The examples in the examples folder you need to compile to make them work.

cd ../examples/
mkdir build
cd build
cmake -DBoost_NO_BOOST_CMAKE=ON  ..
make install -j4

However if you just want to showcase how things work you don't need to do this, simply take as a guide the DDDetectors folder. Execute:

geoDisplay DDDetectors/compact/SiD.xml

and a event display should open up (if you want good functionality of this you need to do this locally and not over ssh -X ).

run some single particles through this to GEANT

For this best use ddsim

ddsim --compactFile=DDDetectors/compact/SiD.xml --runType=batch -G -N=2 --outputFile=testSid.root --gun.position "0.0 0.0 1.0*cm" --gun.direction "1.0 0.0 1.0" --gun.energy 100*GeV --part.userParticleHandler=''

to see all possible options do ddsim --help

When I run GEANT, I know how to add code in SteppingAction.cc etc to access the information created by GEANT.

If you want a custom stepping you can refer to this examples: https://github.com/iLCSoft/lcgeo/blob/master/plugins/TPCSDAction.cpp and this should be paired with proper configuration file like this one https://github.com/iLCSoft/lcgeo/blob/master/example/steeringFile.py#L19

Do I use similar codes to access the information in this case?

There are several predefined actions in DD4hep to get users going so you don't necessarily need to write your own like

##  set the default tracker action 
SIM.action.tracker = "Geant4TrackerWeightedAction" 

##  set the default calorimeter action 
SIM.action.calo = "Geant4ScintillatorCalorimeterAction"

this should be a good starting point. If you use these you output file should have all the necessary information for further processing in most cases. Inspect the output file from the ddsim examples

Are there specific names that should be used?

not really, or maybe I don't get this question.

As a bottom line, to get started firstly use the examples in DDDetectors and later see how you can build you own geometry by exploring the examples folder.

saraheno commented 4 years ago

Thanks, Unfortunately, I am still having problems with the build.
I first cloned https://github.com/AIDASoft/DD4hep then I cc'd down into DD4hep and I followed the instructions at https://dd4hep.web.cern.ch/dd4hep/page/installation/ mkdir build && cd build/ $ cmake -DDD4HEP_USE_GEANT4=ON -DBoost_NO_BOOST_CMAKE=ON -DDD4HEP_USE_LCIO=ON -DBUILD_TESTING=ON -DGeant4_DIR=$G4INSTALL/lib/Geant4-10.4.0 -DROOT_DIR=$ROOTSYS .. $ make -j4 $ make install

that worked fine. As you can see, in these instructions, you make a "build" area in the DD4hep area. When I cd down into that build area, I see it did not pull over the "examples". So I copy this by hand cp -r ../examples.``

I then try cd'ing down into this new examples area and doing the commands you list, including making a new build subdirectory in this new examples area. The full cmake command is `cmake -DDD4HEP_USE_GEANT4=ON -DBoost_NO_BOOST_CMAKE=ON -DDD4HEP_USE_LCIO=ON -DBUILD_TESTING=ON -DGeant4_DIR=$G4INSTALL/lib/Geant4-10.4.0 -DROOT_DIR=$ROOTSYS .. >haha.txt`

I attach the dump showing the error during the compile below haha.txt

andresailer commented 4 years ago

I think you need to first

source bin/thisdd4hep.sh

before running cmake for the examples. Because at the moment the DD4hep from the LCG installation is found, which is quite a bit older.

-- |++> Check for DD4hep_DDCORE_LIBRARY: /cvmfs/sft.cern.ch/lcg/views/LCG_96b/x86_64-slc6-gcc8-opt/lib/libDDCore.so -- ok

For the examples the idea is to create a build folder in that directory. DD4hep/examples/build (In principle it shouldn't matter where the build folder is created, as long as cmake is pointed to the CMakeLists.txt of examples, but we never really test the out-of-source buildfolder)

You can also build the examples along the rest of DD4hep by enabling in the main DD4hep/build folder

cmake <ALL_THE_OTHER_OPTIONS> -DDD4HEP_BUILD_EXAMPLES=ON <And So On>
saraheno commented 4 years ago

Thanks. It did compile with these commands

git clone https://github.com/AIDASoft/DD4hep.git cd DD4hep COMPILER_VERSION=gcc8 LCG_RELEASE=LCG_96b source .dd4hep-ci.d/init_x86_64.sh source bin/thisdd4hep.sh cd examples mkdir build cd build cmake -DDD4HEP_USE_GEANT4=ON -DBoost_NO_BOOST_CMAKE=ON -DDD4HEP_USE_LCIO=ON -DBUILD_TESTING=ON -DGeant4_DIR=$G4INSTALL/lib/Geant4-10.4.0 -DROOT_DIR=$ROOTSYS .. make make install

But now I'm a bit confused about your example commands. You give two: geoDisplay DDDetectors/compact/SiD.xml ddsim --compactFile=DDDetectors/compact/SiD.xml --runType=batch -G -N=2 --outputFile=testSid.root --gun.position "0.0 0.0 1.0cm" --gun.direction "1.0 0.0 1.0" --gun.energy 100GeV --part.userParticleHandler=

but both of these look like I would run them from the DD4hep directory, not the DD4hep/examples/build area, because DDDetectors is only in DD4hep and not in DD4hep/examples/build. Also, I did look at SiD.xml with geodisplay and it is a pretty fancy detector. I was hoping "SimpleDetector" was something like the B4a example in GEANT? something truly simple? If I cd back into DD4hep/examples then I do see some xml files like ./SimpleDetector/compact/Simple_ILD.xml. But when I try to geodisplay this, it crashes with - No factory with name Create AirTube

Is there a truly simple example I can study?

andresailer commented 4 years ago

For any of the commands it doesn't matter from which directory they are executed, as long as the relative path to the XML file is correct. The executables and libraries all have to be in the PATH or LD_LIBRARY_PATH. For the example there are also this<PackageName>.sh scripts created that have to be sourced , otherwise the required libraries are not in the LD_LIBRARY_PATH

saraheno commented 4 years ago

That's true, Andre. I guess this was a round about way of pointing out that the commands were not for the actual examples. Is there a simple example? If so, what is the corresponding xml file?

saraheno commented 4 years ago

also, when I look at the command to run a few particle gun events, it seems to be truncated? Should

--part.userParticleHandler=

have something after the equals sign?

andresailer commented 4 years ago

Just an empty string --part.userParticleHandler=""

saraheno commented 4 years ago

Thanks Andre. Will somebody else answer my question about the existence of a truly simple example? Not a full ILC detector?

petricm commented 4 years ago

You have two options:

  1. Comments out the lines in this file https://github.com/AIDASoft/DD4hep/blob/master/DDDetectors/compact/SiD.xml#L69-L92 and you can make the the SiD.xml as simple as you wish (Recommended).
  2. you use the SimpleDetector from examples but it to first order the same as commenting out sub-detectors out from the SiD.xml example
saraheno commented 4 years ago

Thanks Mark and Andre. I hate to bother you with these beginning questions, but I cannot seem to find the right documentation.

The geoDisplay is fun, and has lots of fun display options. But for some reason I cannot figure out how to zoom. When I put my mouse on the display screen, it is easy to rotate the detector. But ctrl-+ doesn't work for zooming and I cannot seem to find a zoom on the menu on the left.

petricm commented 4 years ago

mouse scroll should work

saraheno commented 4 years ago

Thanks. This tool seems pretty good. When I do the run command:

 ddsim --compactFile=SiD.xml --runType=batch -G -N=10 --outputFile=testSid.root --gun.position "0.0 0.0 1.0*cm" --gun.direction "1.0 1.0 0.0" --gun.energy "100*GeV" --part.userParticleHandler="" --gun.particle "pi-"

I see hits in the siliconvertex detector when I look at testSid.root, but not in any of the other detector elements. Is this the expected behavior?

saraheno commented 4 years ago

Just wanted to check in again before I try to debug it. Should this example only produce hits (in testSid.root) for the barrel vertex detector? No hits in the barrel tracker and barrel calorimeter? Or am I still doing something wrong?

andresailer commented 4 years ago

The barrel calorimeters and trackers do not seem to work properly. The endcaps do record hits.

MarkusFrankATcernch commented 4 years ago

Just for your information: I ran the standard SiD example:

python <dd4hep-installation>/examples/DDG4/examples/SiDSim.py

for a couple of events and got hits in all subdetectors (endcaps and barrel). This should exclude basic errors in DDG4. Is it possible that with this gun-direction you simply miss the barrels?

andresailer commented 4 years ago

I shoot with uniform distribution. If I comment the tracker (barrel) in the SiD.xml I get hits in the calorimeter barrels (using ddsim).

andresailer commented 4 years ago

Using ddsim and looking at /tracking/verbose 1 in the geant4 shell I see that particles are killed if this line isn't commented

https://github.com/AIDASoft/DD4hep/blob/0b8b89eec2c2e7af8246047678c4e3e92d472654/DDDetectors/src/SiTrackerBarrel_geo.cpp#L161

   52      214     17.3     10.1   1.9e+03    0.107    0.502       215 av_6_impr_1_TheLayer1_pv_0 Transportation
   53      214     17.3     10.1         0  1.9e+03        0       215 TrackerBarrelSupports_layer0_slice2_2 UserSpecialCut

I don't understand why this doesn't affect SidSim.py but only ddsim

andresailer commented 4 years ago

This limit kills the primary particle

https://github.com/AIDASoft/DD4hep/blob/0b8b89eec2c2e7af8246047678c4e3e92d472654/DDDetectors/compact/SiD.xml#L47

Still don't understand why this doesn't affect SidSim.py but only ddsim

andresailer commented 4 years ago

The difference is that in ddsim we activate the step limiters https://github.com/AIDASoft/DD4hep/blob/0b8b89eec2c2e7af8246047678c4e3e92d472654/DDG4/python/DDSim/DD4hepSimulation.py#L478-L481

MarkusFrankATcernch commented 4 years ago

This means that somehow this region definition is incorrect...

andresailer commented 4 years ago

Yes, we should probably drop the track_length_max and time_max

andresailer commented 4 years ago

@saraheno If you remove these lines you should get hits in all the sub-detectors

https://github.com/AIDASoft/DD4hep/blob/0b8b89eec2c2e7af8246047678c4e3e92d472654/DDDetectors/compact/SiD.xml#L47-L48

Are you still looking for a simple detector otherwise, or any other issue?

saraheno commented 4 years ago

Sorry for not responding for some time. It was the first week of in person classes here at U. Maryland, and I was swamped with teaching duties. I'll try it with your suggested fix. My ultimate goal is to code in the geometry from this paper: https://arxiv.org/abs/2008.00338 but obviously since I am teaching faculty and my funding is only for CMS research, so I have to personally do it instead of assigning it to a student or postdoc, this will take many months and sometimes I'll drop it for a week or so as teaching duties intervene.

On Tue, Sep 15, 2020 at 11:51 AM Andre Sailer notifications@github.com wrote:

@saraheno https://github.com/saraheno If you remove these lines you should get hits in all the sub-detectors

https://github.com/AIDASoft/DD4hep/blob/0b8b89eec2c2e7af8246047678c4e3e92d472654/DDDetectors/compact/SiD.xml#L47-L48

Are you still looking for a simple detector otherwise, or any other issue?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AIDASoft/DD4hep/issues/703#issuecomment-692807161, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHZIOETWQXDRIL6SV2LTB3SF6EQ3ANCNFSM4RAM4WTQ .

saraheno commented 4 years ago

So unfortunately I redownloaded DD4sim and now I am having compilation problems. I do the commands given below.

git clone https://github.com/AIDASoft/DD4hep.git
cd DD4hep
COMPILER_VERSION=gcc8 LCG_RELEASE=LCG_96b source .dd4hep-ci.d/init_x86_64.sh
mkdir build
cd build
cmake -DDD4HEP_USE_GEANT4=ON -DBoost_NO_BOOST_CMAKE=ON -DDD4HEP_USE_LCIO=ON -DBUILD_TESTING=ON -DGeant4_DIR=$G4INSTALL/lib/Geant4-10.4.0 -DROOT_DIR=$ROOTSYS -DD4HEP_BUILD_EXAMPLES=ON ..
make 
make install
source bin/thisdd4hep.sh
cd ../examples
mkdir build
cd build

and get the following error

-- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at /home/eno/dd4hep/DD4hep/build/DD4hepConfig.cmake:35 (include): include could not find load file:

/home/eno/dd4hep/DD4hep/build/cmake/DD4hep.cmake

Call Stack (most recent call first): CMakeLists.txt:34 (find_package)

-- Found Boost 1.70.0 at /cvmfs/sft.cern.ch/lcg/views/LCG_96b/x86_64-slc6-gcc8-opt/lib/cmake/Boost-1.70.0 -- Requested configuration: QUIET REQUIRED -- Found boost_headers 1.70.0 at /cvmfs/sft.cern.ch/lcg/views/LCG_96b/x86_64-slc6-gcc8-opt/lib/cmake/boost_headers-1.70.0 -- Boost found. CMake Error at /home/eno/dd4hep/DD4hep/build/DD4hepConfig.cmake:51 (DD4HEP_SETUP_BOOST_TARGETS): Unknown CMake command "DD4HEP_SETUP_BOOST_TARGETS". Call Stack (most recent call first): CMakeLists.txt:34 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/eno/dd4hep/DD4hep/examples/build/CMakeFiles/CMakeOutput.log".

any help would be appreciated. Sarah Eno

andresailer commented 4 years ago

Are you having problems with the cmake for DD4hep or for the examples? For the main DD4hep you are missing one D -DD4HEP_BUILD_EXAMPLES=ON --> -DDD4HEP_BUILD_EXAMPLES=ON If you enable the examples in the main DD4hep you don't have to build them again. The cmake command for the examples isn't included in your post.

saraheno commented 4 years ago

Thanks Andre. changing DD4HEP to DDD4HEP fixed the build. But now when I run it, I get an error

[eno@hepcms-in1 DD4hep]$ ddsim --compactFile=./DDDetectors/compact/SiD.xml --runType=batch -G -N=10 --outputFile=testSid.root --gun.position "0.0 0.0 1.0cm" --gun.direction "1.0 0.0 1.0" --gun.energy "100GeV" --part.userParticleHandler="" --gun.particle "pi-" DEBUG: Importing units into namespace units Traceback (most recent call last): File "/cvmfs/sft.cern.ch/lcg/views/LCG_96b/x86_64-slc6-gcc8-opt/bin/ddsim", line 16, in RUNNER.run() File "/cvmfs/ sft.cern.ch/lcg/views/LCG_96b/x86_64-slc6-gcc8-opt/python/DDSim/DD4hepSimulation.py", line 282, in run import DDG4, dd4hep File "/cvmfs/ sft.cern.ch/lcg/releases/ROOT/6.18.04-67cfa/x86_64-slc6-gcc8-opt/lib/ROOT.py", line 533, in _importhook return _orig_ihook( name, *args, kwds ) File "/cvmfs/ sft.cern.ch/lcg/views/LCG_96b/x86_64-slc6-gcc8-opt/python/DDG4.py", line 12, in from dd4hep_base import File "/cvmfs/ sft.cern.ch/lcg/releases/ROOT/6.18.04-67cfa/x86_64-slc6-gcc8-opt/lib/ROOT.py", line 533, in _importhook return _orig_ihook( name, args, kwds ) File "/cvmfs/ sft.cern.ch/lcg/views/LCG_96b/x86_64-slc6-gcc8-opt/python/dd4hep_base.py", line 304, in import_units(ns=units) File "/cvmfs/ sft.cern.ch/lcg/views/LCG_96b/x86_64-slc6-gcc8-opt/python/dd4hep_base.py", line 297, in import_units import_unit(ns, u) File "/cvmfs/ sft.cern.ch/lcg/views/LCG_96b/x86_64-slc6-gcc8-opt/python/dd4hep_base.py", line 250, in import_unit setattr(ns,nam,getattr(core,nam)) AttributeError: type object 'dd4hep' has no attribute 'STP_Temperature'

On Mon, Sep 21, 2020 at 3:34 AM Andre Sailer notifications@github.com wrote:

Are you having problems with the cmake for DD4hep or for the examples? For the main DD4hep you are missing one D -DD4HEP_BUILD_EXAMPLES=ON --> -DDD4HEP_BUILD_EXAMPLES=ON

If you enable the examples in the main DD4hep you don't have to build them again. The command for the examples isn't included in your post.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AIDASoft/DD4hep/issues/703#issuecomment-695952290, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHZIOHIOLYVIIUW22KAVZLSG36ZVANCNFSM4RAM4WTQ .

andresailer commented 4 years ago

You're picking up the old DD4hep from the LCG installation, did you source bin/thisdd4hep.sh?

saraheno commented 4 years ago

yes, I did that.

[eno@hepcms-in1 DD4hep]$ cd build [eno@hepcms-in1 build]$ source bin/thisdd4hep.sh [eno@hepcms-in1 build]$ cd .. [eno@hepcms-in1 DD4hep]$ ddsim --compactFile=./DDDetectors/compact/SiD.xml --runTy pe=batch -G -N=10 --outputFile=testSid.root --gun.position "0.0 0.0 1.0cm" --gun. direction "1.0 0.0 1.0" --gun.energy "100GeV" --part.userParticleHandler="" --g un.particle "pi-" DEBUG: Importing units into namespace units Traceback (most recent call last): File "/cvmfs/sft.cern.ch/lcg/views/LCG_96b/x86_64-slc6-gcc8-opt/bin/ddsim", line 16, in RUNNER.run() File "/cvmfs/ sft.cern.ch/lcg/views/LCG_96b/x86_64-slc6-gcc8-opt/python/DDSim/DD4 hepSimulation.py", line 282, in run import DDG4, dd4hep File "/cvmfs/ sft.cern.ch/lcg/releases/ROOT/6.18.04-67cfa/x86_64-slc6-gcc8-opt/li b/ROOT.py", line 533, in _importhook return _orig_ihook( name, *args, kwds ) File "/cvmfs/ sft.cern.ch/lcg/views/LCG_96b/x86_64-slc6-gcc8-opt/python/DDG4.py", line 12, in from dd4hep_base import File "/cvmfs/ sft.cern.ch/lcg/releases/ROOT/6.18.04-67cfa/x86_64-slc6-gcc8-opt/li b/ROOT.py", line 533, in _importhook return _orig_ihook( name, args, kwds ) File "/cvmfs/ sft.cern.ch/lcg/views/LCG_96b/x86_64-slc6-gcc8-opt/python/dd4hep_ba se.py", line 304, in import_units(ns=units) File "/cvmfs/ sft.cern.ch/lcg/views/LCG_96b/x86_64-slc6-gcc8-opt/python/dd4hep_ba se.py", line 297, in import_units import_unit(ns, u) File "/cvmfs/ sft.cern.ch/lcg/views/LCG_96b/x86_64-slc6-gcc8-opt/python/dd4hep_ba se.py", line 250, in import_unit setattr(ns,nam,getattr(core,nam)) AttributeError: type object 'dd4hep' has no attribute 'STP_Temperature'

On Mon, Sep 21, 2020 at 8:41 AM Andre Sailer notifications@github.com wrote:

You're picking up the old DD4hep from the LCG installation, did you source bin/thisdd4hep.sh?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AIDASoft/DD4hep/issues/703#issuecomment-696087596, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHZIOCLMVAYOEK7JFP5Z2TSG5CVNANCNFSM4RAM4WTQ .

andresailer commented 4 years ago

It should be the bin/thisdd4hep.sh from the installed location.

saraheno commented 4 years ago

yes, DD4hep/build is where I ran "make install" (is that what you mean?) so I cd'd to DD4hep/build and sourced that.

On Mon, Sep 21, 2020 at 8:52 AM Andre Sailer notifications@github.com wrote:

It should be the bin/thisdd4hep.sh from the installed location.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AIDASoft/DD4hep/issues/703#issuecomment-696093390, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHZIOCLVGJXEV3RHSGJ47TSG5D7RANCNFSM4RAM4WTQ .

andresailer commented 4 years ago

I mean the target folder of make install (CMAKE_INSTALL_PREFIX), probably the dd4hep base folder.

...
make install
cd .. # probably
source bin/thisdd4hep.sh

for example.

saraheno commented 4 years ago

Thanks, that worked. So many different "bin" areas!

On Mon, Sep 21, 2020 at 9:04 AM Andre Sailer notifications@github.com wrote:

I mean the target folder of make install (CMAKE_INSTALL_PREFIX), probably the dd4hep base folder.

... make install cd .. # probably source bin/thisdd4hep.sh

for example.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AIDASoft/DD4hep/issues/703#issuecomment-696099882, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHZIOHDNNZQIVUZ5TMCQR3SG5FMDANCNFSM4RAM4WTQ .

saraheno commented 4 years ago

So now I have a root file with GEANT4 truth hits for all detectors. Do you have an event display routine, that will display the events in testSid.root, to make pretty pictures?

On Mon, Sep 21, 2020 at 9:08 AM Sarah C. Eno eno@umd.edu wrote:

Thanks, that worked. So many different "bin" areas!

On Mon, Sep 21, 2020 at 9:04 AM Andre Sailer notifications@github.com wrote:

I mean the target folder of make install (CMAKE_INSTALL_PREFIX), probably the dd4hep base folder.

... make install cd .. # probably source bin/thisdd4hep.sh

for example.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AIDASoft/DD4hep/issues/703#issuecomment-696099882, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHZIOHDNNZQIVUZ5TMCQR3SG5FMDANCNFSM4RAM4WTQ .

andresailer commented 4 years ago

event display routine, kind of (make sure paths are correct)

ddeve -config path/to/examples/CLICSiD/eve/DDEve.xml -data path/to/testSid.root

pretty pictures, not really

saraheno commented 4 years ago

thanks Andre.

Also, when I run GEANT4 I often use the option "-u Xm" to do some visualizatoin while the events are made. But I cannot figure out how to pass this option to GEANT when doing

ddsim --compactFile=./DDDetectors/compact/SiD.xml --runType=vis -G -N=2 --outputFile=testSid.root --gun.position "0.0 0.0 1.0cm" --gun.direction "1.0 0.0 1.0" --gun.energy "100GeV" --part.userParticleHandler="" --gun.particle "pi-"

On Mon, Sep 21, 2020 at 11:55 AM Andre Sailer notifications@github.com wrote:

event display routine, kind of (make sure paths are correct)

ddeve -config path/to/examples/CLICSiD/eve/DDEve.xml -data path/to/testSid.root

pretty pictures, not really

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AIDASoft/DD4hep/issues/703#issuecomment-696207681, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHZIOHKBIYFYHAFBPB6RDLSG5ZPHANCNFSM4RAM4WTQ .

petricm commented 4 years ago

You can load the geometry and enter the GEANT4 shell by doing

ddsim --runType=vis --compactFile=./DDDetectors/compact/SiD.xml

but then you have to shoot the particles yourself....

MarkusFrankATcernch commented 4 years ago

$> ddeve -config checkout/examples/CLICSiD/eve/DDEve.xml Then go to the dd4hep menu > Show event IO Then open the data file and click on "Next".

saraheno commented 4 years ago

pretty nice! But it does crash if you choose "calorimeter lego" or "calorimeter 2d"from the "views" menu (or really any other view?) Are the other views supposed to work? For my work, the calorimeter views would be much more useful. The default view (screen shot attached) is not very useful. You cannot really see the calorimeter information.

[image: image.png]

On Tue, Sep 22, 2020 at 2:55 AM MarkusFrankATcernch < notifications@github.com> wrote:

$> ddeve -config checkout/examples/CLICSiD/eve/DDEve.xml Then go to the dd4hep menu

Show event IO Then open the data file and click on "Next".

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AIDASoft/DD4hep/issues/703#issuecomment-696543061, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHZIOFOCJLL5GTE4JIHWW3SHBC55ANCNFSM4RAM4WTQ .

saraheno commented 4 years ago

Thanks Marko. The link I have doesn't seem to have the Xm viewer that has worked for me in the past. I have tried some of the viewers that it says it does have, but they do not seem to work. Is it possible to get a link with the Xm viewer? If so, what is the command?

[image: image.png]

for example, OGLSXm gives me a screen that is not useful, shown below [image: image.png]

Also, when I do not see access to the normal /gps commands to shoot them myself

[image: image.png]

I guess it might be /ddg4/GeneratorAction, but the help for that is cryptic

[image: image.png]

So I cannot see if I shoot something I get something sensible in this blank window...

On Mon, Sep 21, 2020 at 12:37 PM Marko Petric notifications@github.com wrote:

You can load the geometry and enter the GEANT4 shell by doing

ddsim --runType=vis --compactFile=./DDDetectors/compact/SiD.xml

but then you have to shoot the particles yourself....

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AIDASoft/DD4hep/issues/703#issuecomment-696231153, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHZIOHMC2EH3YTSJP2SPALSG56LHANCNFSM4RAM4WTQ .

petricm commented 4 years ago

Since you reply to this thread via e-mail the images you attach do not display. If you want to share image you need to add them in the browser.

andresailer commented 4 years ago

Configuring the particle gun and visualisation mode should still work.

 ddsim --compactFile=./DDDetectors/compact/SiD.xml --runType=vis -G -N=2 --outputFile=testSid.root --gun.position "0.0 0.0 1.0*cm" --gun.direction "1.0 0.0 1.0" --gun.energy "100*GeV" --part.userParticleHandler="" --gun.particle "pi-" --runType vis

and then in the geant4 shell

/run/beamOn 1

The DDG4 particle gun is under /ddg4/Gun, that is enabled by -G

If you want to use the generalParticleSource you can enable that with --enableGPS (if I recall correctly, have a look at ddsim --help to check). Using the geant4 sources doesn't provide the same amount of integration with the DDG4 MChistory tools however.

saraheno commented 4 years ago

here is a version of a recent post with the images:

pretty nice! But it does crash if you choose "calorimeter lego" or "calorimeter 2d"from the "views" menu (or really any other view?) Are the other views supposed to work? For my work, the calorimeter views would be much more useful. The default view (screen shot attached) is not very useful. You cannot really see the calorimeter information.

image (3)

saraheno commented 4 years ago

Here is the other one Thanks Marko. The link I have doesn't seem to have the Xm viewer that has worked for me in the past. I have tried some of the viewers that it says it does have, but they do not seem to work. Is it possible to get a link with the Xm viewer? If so, what is the command?

image (4)

for example, OGLSXm gives me a screen that is not useful, shown below

image (5)

Also, when I do not see access to the normal /gps commands to shoot them myself

image (6)

I guess it might be /ddg4/GeneratorAction, but the help for that is cryptic

image (7)

So I cannot see if I shoot something I get something sensible in this blank window...

saraheno commented 4 years ago

Thanks Andre. I was able to run an event in vis mode. However, the OGLSXm viewer is not working. The old Xm viewer used to work fine for me in normal GEANT. I attach here a screenshot with the error. Is it possible to get the Xm viewer enabled?

image

I used the command you suggested

 DD4hep]$ ddsim --compactFile=./DDDetectors/compact/SiD.xml --runType=vis -G -N=2 --outputFile=testSid.root --gun.position "0.0 0.0 1.0*cm" --gun.direction "1.0 0.0 1.0" --gun.energy "100*GeV" --part.userParticleHandler="" --gun.particle "pi-" --runType vis

followed by (at the Idle> prompt) /vis/open OGLSXm /run/beamOn 1

andresailer commented 4 years ago

As it says in the error message:

/vis/drawVolume

?

saraheno commented 4 years ago

Thanks everybody for their help so far. I have been looking at the routines in DDDetectors/compact/SiD to figure out how to build my calorimeter. Most of these detector elements using polyhedral geometry. I guess this is defined in DDDetectors/src/? Looking in that directory, I suspect I want CylindricalBarrelCalorimeter for my detector.

However, when I look in in routines like DDDetectors/compact/SiD/SiD_EcalBarrel.xml, I realize I don't understand the syntax well enough and especially if I look at DDDetectors/src/CylindricalBarrelCalorimeter_geo.cpp, it is not clear to me what the similar parameters are.

For example, in SiD_EcalBarrel.xml, I see

detector id="EcalBarrel_ID" name="EcalBarrel" type="DD4hep_EcalBarrel" readout="EcalBarrelHits" vis="Ecal\ BarrelVis" calorimeterType="EM_BARREL"

Is the last argument somehow pointing to DDDetectors/src/EcalBarrel_geo.cpp? but I don't know what the other arguments in this command are? I do see "stave" in that cpp file, which is what most of EcalBarrel.xml defines. but where the concept of "stave" is defined is not clear.

Is there someplace some documentation that would help with this? I do not see "stave" in https://dd4hep.web.cern.ch/dd4hep/usermanuals/DD4hepManual/DD4hepManualch2.html#x3-110002

When I try to search for EM_BARREL, it also shows up in DDCore/src/plugins/PandoraConverter.cpp. I thought Pandora was a particle flow algorithm? Is this some label that helps pandora later?

**UPDATE: I now think the polyhydra is best. but I still do not understand where I can find documentation on the arguments on these things.

saraheno commented 4 years ago

I would also appreciate if somebody would translate this for me

system:8,barrel:3,module:4,layer:6,slice:5,x:32:-16,y:-16

are there units on the grid size? And what is the "system", "barrel", "module" etc?

petricm commented 4 years ago

Take for instance https://github.com/AIDASoft/DD4hep/blob/master/DDDetectors/compact/SiD/SiD_HcalBarrel.xml there is the line

  <detector id="HcalBarrel_ID" name="HcalBarrel" type="DD4hep_PolyhedraBarrelCalorimeter2" readout="HcalBarrelHits" vis="HcalBarrelVis" calorimeterType="HAD_BARREL" gap="0.*cm" material="Steel235">

Fro further understanding the most important part is type, which associates the xml with the piece of C++ code that interprets this xml, usually called driver. If you search in the repo you will find https://github.com/AIDASoft/DD4hep/blob/master/DDDetectors/src/PolyhedraBarrelCalorimeter2_geo.cpp

And the important line/macro that makes the connection between the code and the xml is the line before last

DECLARE_DETELEMENT(DD4hep_PolyhedraBarrelCalorimeter2, create_detector)

If you now inspect the C++ code you find the find mentioned system, barrel, module etc... from your second question, usually in the context

pv.addPhysVolID("module", module);

This associated to a given placement of a physical volume an ID so that you can associate a hit to a given placement of a volume. The string system:8,barrel:3,module:4,layer:6,slice:5 is the allocation in bits of how much space you assign to a given variable, so in this case you can assign to system values from 0 to 255 (2^8). And the last part of the string is how much space you assign to variables from the segmentation that you apply to this sensitive detector.

saraheno commented 4 years ago

Thanks Marko. Let me ask you this, then.

at https://github.com/AIDASoft/DD4hep/blob/d805ea11d2d3bf130906f3ec61ccf6cf0bed475d/DDDetectors/src/PolyhedraBarrelCalorimeter2_geo.cpp#L48

is xml_h e a pointer to SiD_HcalBarrel.xml ?

In SiD_HcalBarrel.xml, there is "HcalBarrelHits" which is defined in SiD_Hcal.xml, and this is "CartesianGridXY"

does information from CartesianGridXY end up being used in PlyhedraBarrelCalorimeter2_geo.cpp? If so, where? I would have thought that there would have to be a separate volume for each readout?