[Gate-users] How to compile a new geometry class?
Andreas Menzel
am at crystal-photonics.com
Fri Jul 7 11:42:18 CEST 2017
Dear Gate community, revered Gatemeisters,
I finally got around to start writing some code to extract volumes or
solids from GDML files.
As of now, I am a bit lost how to put the volumes extracted (currently,
only G4LogicalVolumes work, but the next steps would be
G4VPhysicalVolumes and Solids) into the Gate world, i.e. to make them
visible to the simulation. I use the G4GDMLParser to return a pointer to
the logical volume I want to extract, I get the pointer... and then?
Do I add the volume to some ObjectStore or something? What would be the
best way?
Currently, Gate's main creates a static "GateGDMLGeomReader" singleton
object with a messenger; both of these seem to be created and interact
as intended at this stage. GateGDMLGeomReader is basically a wrapper
around the G4GDMLParser. I am thinking of moving the creation of the
GateGDMLGeomReader singleton to GateDetectorConstruction but haven't
done it yet. I would prefer the GateGDMLGeomReader to be created when
the corresponding command is issued on the UI/mac file, though. How do I
achieve this?
If you need more detailed information to answer this question, please
tell me. I am not very experienced in C++, so perhaps there are some
dumb questions here, sorry.
Thank you for your help!
Andreas
Am 01.06.2017 um 14:44 schrieb Andreas Menzel:
> Dear David Sarrut, der David Boersma,
>
> thanks a lot for your really quick and detailed answers.
> From a programming side, it turns out I had been doing exactly the
> right thing.
> I just setup the necessary git(Hub) infrastructure and, thanks to your
> quick replies, I will see very soon if it works.
>
> Thanks again!
>
> Andreas Menzel
>
>
> Am 01.06.2017 um 10:39 schrieb David Boersma:
>> Hi Andreas,
>>
>> Den 01/06/2017 kl. 09:39, skrev Andreas Menzel:
>>> Dear Gate community,
>>>
>>> probably this has been asked before, but it seems I cannot use the
>>> mailing list's archive.
>>>
>>> So, can someone please tell me where to find instructions on how to
>>> compile a newly added class in Gate? I don't seem to find it in the
>>> online documentation, either.
>>>
>>> To be specific, I am supposed to do a simulation which contains a
>>> rather complex collimator. As the Gate scripting language does not
>>> seem to support what I am trying to do, I decided to use two
>>> different ways and try out which one works better: The first one is
>>> to use Geant4's boolean solids and do subtractions of geometry
>>> primitives. The second would be to load a GDML file containing the
>>> geometry which also can be done in Geant4. I only started the first
>>> one and I wrote a Gate geometry class and a messenger connected to
>>> it as well as the necessary header files.
>>>
>>> Now, is there some template makefile / CMakeLists.txt I could use to
>>> actually compile these and test them? Or do I just put the sources
>>> into the location of the other Gate sources and re-make the whole
>>> thing so that the new files are compiled?
>>
>> I think that is the most straightforward way. Since you are
>> developing something new, you should use the head of the "develop"
>> branch on GitHub. Our official repository is here:
>>
>> https://github.com/OpenGATE/Gate
>>
>> (On the "Git" page of our website we still advertise an outdated git
>> server. I hope we can update/clean that outdated web page soon. For
>> now it's better to get all your git documentation & tutorials from
>> the github website.)
>>
>> (If you just would like to retrieve & build the latest greatest
>> development version of gate then you can just "clone" directly from
>> there. But since you are planning to develop your own thing, it's
>> recommended to get your own (free) github account and make a "fork"
>> first, "clone" your "fork", make a new "branch", then when you are
>> happy with your new feature you "push" that "branch" back to your
>> "fork" on github and then you submit a "pull request" so that your
>> new feature may (or may not) be included into the official Gate
>> development. On the GitHub website you can find extensive help and
>> tutorials for all the "quoted operations". It takes some time to get
>> used to all these git things, but in the medium/long term it's a good
>> system. And GitHub is used by a very large developer community, so
>> it's a very useful skill to learn.)
>>
>> You shouldn't need to edit anything in the CMakeLists.txt file unless
>> you are doing exotic things with external libraries of
>> platform-dependent features. Just add your new geometry classes in
>> the "include" and "src" subdirectories of Gate/source/geometry, then
>> run ccmake and make, etc, as described on our wiki.
>>
>>>
>>> Thanks for your help!
>>
>> Good luck!
>> David B.
>>
>>>
>>> Andreas Menzel
>>>
>> _______________________________________________
>> Gate-users mailing list
>> Gate-users at lists.opengatecollaboration.org
>> http://lists.opengatecollaboration.org/mailman/listinfo/gate-users
>
--
Dr. Andreas Menzel
Crystal Photonics GmbH
Albert Einstein Straße 16
D - 12489 Berlin
Germany
FAX.: +49 (0) 30 34669299
am at crystal-photonics.com
www.crystal-photonics.com
-------------------------
Geschäftsführer: Klaus Schwenkenbecher
Amtsgericht Berlin-Charlottenburg HRB 99822B
Steuer-Nr.: 37/109/21041
VAT-No.: DE 814612031
More information about the Gate-users
mailing list