Skip to content

CaloTrackingGeometry, create the known materials at ctor as values. Avoid dyn allocations

We were creating

m_caloMaterial = new Trk::Material;
Trk::Material* mAr = new Trk::Material(140.036, 856.32, 39.948, 18., 0.0014);
Trk::Material* mAl = new Trk::Material(88.93, 388.62, 26.98, 13., 0.0027);
// Trk::Material* mFe = new Trk::Material(17.58, 169.68, 55.85, 26., 0.0079);
Trk::Material* mScint = new Trk::Material(424.35, 707.43, 11.16, 5.61,
                                            0.001);  // from G4 definition
const Trk::Material* crackMaterial = new Trk::Material(
      424.35, 707.43, 11.16, 5.61, 0.001);  // Scintillator/Glue (G4 def.)

And then we seem to delete them either in the finalize or the dtor. In the execute also we had a complicated mechanism.

It seems we can create these material once for the full lifetime of the tool instance.

In principle on could prb even try to have them static const but was not 100% sure if this worths the trouble.

Edited by Christos Anastopoulos

Merge request reports

Loading