GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » R3BRoot » Simulation Issues » GLAD positioning (Having issues with the GLAD positioning inside the simulator)
Re: GLAD positioning [message #21272 is a reply to message #21263] Thu, 22 June 2017 13:02 Go to previous message
lzanetti is currently offline  lzanetti
Messages: 5
Registered: June 2017
Location: TU Darmstadt
occasional visitor
From: *
Hi Dima,

Dmytro Kresan wrote on Thu, 22 June 2017 07:26

If you do not pass position and angle arguments to the constructor - the values from the geometry file are taken (exception for glad - the values are hard-coded in the call to ctor of the base class).

Not in the case of GLAD, if the "by name" constructor is used. Because GLAD's rotation isn't read from the geometry, but from the variable fGladAngle, which is not initialized in with that particular constructor, as I mentioned above. BTW, I tried the solution I was proposing: it works.

Specifically, GLAD's rotation is created like this:
TGeoRotation* rot_glob = new TGeoRotation();
rot_glob->RotateY(fGladAngle); //<--- look here!

and then applied.
This happens anyhow, and overrides the rotation read from the geometry file by R3BModule::ConstructRootGeomtry(), which is called a few lines above. Thus, if fGladAngle is 0, a rotation with 0 degrees along -Y is applied, discarding the one defined in the macro (and in the geometry file generated by it).
This can also lead to even funnier behaviour if the compiler doesn't bother default-initalizing fGladAngle to 0 when the "just by name constructor" is called --as for now, GCC does bother, but other compilers may not and I'm not really aware of any strong guarantee about GCC continuing to bother, but I didn't look.

Dmytro Kresan wrote on Thu, 22 June 2017 07:26

I recommend usage of "glad_v17_flange.geo.root" geometry file - the closest to real geometry we have in the cave.

Ok, thanks. Question: is that binary generated with the latest macro? I see that regenerating the geometry with "$R3BROOT_HOME/macros/r3b/geo/create_glad_geo.C" GLAD appears with its flange.

Dmytro Kresan wrote on Thu, 22 June 2017 07:26

Here is how the constructor is called in run_sim.C (new simulation macro, was also announced through the mailing list):
And all this works properly in the central dev branch.

Yes, I saw that constructor and yes, that does work, thanks.
But it will not work with code written before commit f3eb7099988ca632cfdd6c83a3aacbb659b4709a, which will call the "just by name" constructor which is, as of now, broken. One solution is to add the initialization of "fGladAngle" to that constructor as well (which, as I said, fixes it. Regardless of the specific geometry file being used), another is to remove the constructor altogether (and maybe declare it as deleted, so code that calls it will give a useful compilation error).

Thanks a lot for your help.
Best regards,

[Updated on: Thu, 22 June 2017 13:04]

Report message to a moderator

Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Detector ID
Next Topic: Dynamic cast fails.
Goto Forum:

Current Time: Fri Jun 25 14:59:53 CEST 2021

Total time taken to generate the page: 0.02292 seconds