-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible to dump all available readout elements? #1297
Comments
Hi The following snippet shows how to loop over the detector element map and sensitive detector map: #include "DD4hep/Detector.h"
#include "DD4hep/DD4hepUnits.h"
#include "DD4hep/BitFieldCoder.h"
R__LOAD_LIBRARY(libDDCore)
auto lcdd = &(dd4hep::Detector::getInstance());
lcdd->fromCompact( path_to_main_XML )
// map of detectors, geometry
for( auto & [name, det] : lcdd->detectors() ) std::cout << name.c_str() << std::endl;
// map of sensitive detectors, readout
for( auto & [name, sd] : lcdd->sensitiveDetectors() ) std::cout << name.c_str() << std::endl;
Is this snippet what you were looking for? Best, |
Thanks for the fast response @atolosadelgado ! We’ll try this asap and let you know. |
Hi again @atolosadelgado , I think this is almost what we want. We're interested in dumping a full list of readout elements, not just readouts. In our example, we have:
We're interested in dumping each element of the |
Yes, this is not that straightforward, as it depends on your segmentation. Previous discussion here: #580 , along with a partial solution |
Hi, I think the last line of the snippet now provides what you are looking for :) #include "DD4hep/Detector.h"
#include "DD4hep/DD4hepUnits.h"
#include "DD4hep/BitFieldCoder.h"
R__LOAD_LIBRARY(libDDCore)
auto lcdd = &(dd4hep::Detector::getInstance());
lcdd->fromCompact( path_to_main_XML )
// map of detectors, geometry
for( auto & [name, det] : lcdd->detectors() ) std::cout << name.c_str() << std::endl;
// map of sensitive detectors, readout
for( auto & [name, sd] : lcdd->sensitiveDetectors() ) std::cout << name.c_str() << std::endl;
// map of readouts
for( auto & [name, ro_b] : lcdd->readouts() )
{
dd4hep::Readout r = ro_b;
std::cout << r.segmentation().type()<< std::endl;
}
|
Hi @alexandertuna , It looks indeed that, since the segmentation does not know, a priori, what is the extent of the volume to be segmented there is no magic function to get what you want. I think you have to retrieve the segmentation and the dimension of the volume at the same time to be able to extract extremas. See for instance: https://github.com/key4hep/k4geo/blob/main/detectorCommon/src/DetUtils_k4geo.cpp#L382 .Which is used (for a different segmentation) e.g. here: https://github.com/HEP-FCC/k4RecCalorimeter/blob/main/RecFCChhCalorimeter/src/components/CreateFCChhCaloNeighbours.cpp#L92 Cheers, |
Hi, sorry, I may have misunderstood the original question. If the question is how to get the size of each pixel/segment, please find below an example that shows the case of cartesian XY segmentation of TGeoBBox. i do not know exactly how to extend it in an elegant way because segmentation can be fully custom
The output would look like this:
|
Thanks everyone. I believe @vvolkl and @BrieucF understand my request - it is the same as #580 , if I understand correctly. Thanks for these links, @BrieucF . It seems there is no magic way to list all the readout channels without e.g. calculating |
As you have already noted issue #580 already states that that enumerating all sensitive elements within a sensitive volume in general is impossible. One can enumerate if the volume is of a very concrete shape (such as a box, a cylinder, etc.), but otherwise is very time consuming and not possible in a only half way straight forward way. At the end one would always to sort of scan through an approximation and for each cell check if the edges are "inside" or "outside" the concrete sensitive volume. This is very expensive. If you can come up with a sort of generic strategy, please let me know! I am happy to implement. |
Hi,
@headunderheels and I are simulating an electromagnetic calorimeter with dd4hep and a compact detector description. Thanks for the very nice code! We have a small question: is it possible to dump all readout elements somehow?
For example, if we simulate a particle passing through the ecal, we can get a collection of readout elements where the particle deposited energy. But is it possible to get a list of all readout elements, without simulating a particle? It would be useful for us to have this info.
Thanks for your help, we're new to this!
Our ecal, for example: https://github.com/madbaron/detector-simulation/blob/KITP_10TeV/geometries/MuColl_10TeV_v0A/ECalEndcap_o2_v01_02.xml
The text was updated successfully, but these errors were encountered: