Skip to content

Commit

Permalink
remove all use of G4PhysicsVector::SetSpline due to Geant4 API change…
Browse files Browse the repository at this point in the history
…, implicitly assuming the default stays a sensible false
  • Loading branch information
simoncblyth committed Sep 30, 2021
1 parent 48b41f6 commit 73af7ee
Show file tree
Hide file tree
Showing 16 changed files with 181 additions and 279 deletions.
9 changes: 6 additions & 3 deletions cfg4/CMPT.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void CMPT::AddDummyProperty(G4MaterialPropertiesTable* mpt, const char* lkey, un
G4bool createNewKey = keyIdx == -1 ;
G4MaterialPropertyVector* mpv = mpt->AddProperty(lkey, ddom, dval, nval, createNewKey);
#endif
mpv->SetSpline(false);
assert( mpv );

delete [] ddom ;
delete [] dval ;
Expand Down Expand Up @@ -370,10 +370,14 @@ CMPT::addProperty
Adds an Opticks GProperty to a Geant4 MPT doing the
wavelength to energy swap.
Spline argument is requires to be false,
see issue/optical_local_time_goes_backward.rst
**/

void CMPT::addProperty(const char* lkey, GProperty<double>* prop, bool spline)
{
assert( spline == false );
unsigned int nval = prop->getLength();

LOG(debug) << "CMPT::addProperty"
Expand Down Expand Up @@ -401,8 +405,7 @@ void CMPT::addProperty(const char* lkey, GProperty<double>* prop, bool spline)
}

G4MaterialPropertyVector* mpv = m_mpt->AddProperty(lkey, ddom, dval, nval);
mpv->SetSpline(spline);
// see issue/optical_local_time_goes_backward.rst
assert( mpv );

delete [] ddom ;
delete [] dval ;
Expand Down
22 changes: 9 additions & 13 deletions cfg4/CPropLib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -536,19 +536,15 @@ void CPropLib::addProperty(G4MaterialPropertiesTable* mpt, const char* matname,
G4bool createNewKey = keyIdx == -1 ;
G4MaterialPropertyVector* mpv = mpt->AddProperty(lkey, ddom, dval, nval, createNewKey );
#endif

if(abslength)
{
// see issue/optical_local_time_goes_backward.rst
mpv->SetSpline(false);
}
else
{
//mpv->SetSpline(true);
// see issue/geant4_ok_integration/interpol_mismatch.rst
mpv->SetSpline(false);

}
assert( mpv );

// NB spline interpolation is expected to not be used
// formerly explicitly Set_Spline(false) but Geant4 API changes
// make that problematic : so currently assuming
// a sensible default of false for spline interpolation
//
// see notes/issue/optical_local_time_goes_backward.rst
// see notes/issue/geant4_ok_integration/interpol_mismatch.rst

delete [] ddom ;
delete [] dval ;
Expand Down
173 changes: 0 additions & 173 deletions cfg4/DetectorOld.cc

This file was deleted.

3 changes: 0 additions & 3 deletions examples/Geant4/CerenkovMinimal/src/DetectorConstruction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ G4Material* DetectorConstruction::MakeWater()
mat->AddElement(O, 1);

G4MaterialPropertyVector* ri = MakeWaterRI() ;
ri->SetSpline(false);

AddProperty( mat, "RINDEX" , ri );
return mat ;
Expand All @@ -73,7 +72,6 @@ G4Material* DetectorConstruction::MakeAir()
mat->AddElement(O, 30.*CLHEP::perCent);

G4MaterialPropertyVector* ri = MakeAirRI() ;
ri->SetSpline(false);

AddProperty( mat, "RINDEX" , ri );
return mat ;
Expand All @@ -93,7 +91,6 @@ G4Material* DetectorConstruction::MakeGlass()
mat->AddElement(H,8.467*CLHEP::perCent);

G4MaterialPropertyVector* ri = MakeGlassRI() ;
ri->SetSpline(false);

AddProperty( mat, "RINDEX" , ri );
return mat ;
Expand Down
3 changes: 0 additions & 3 deletions examples/Geant4/CerenkovStandalone/L4CerenkovTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,6 @@ G4Material* L4Cerenkov::MakeMaterial(G4MaterialPropertyVector* rindex) // stati
mat->AddElement(H, 2);
mat->AddElement(O, 1);

rindex->SetSpline(false);
//rindex->SetSpline(true);

G4MaterialPropertiesTable* mpt = new G4MaterialPropertiesTable();
mpt->AddProperty("RINDEX", rindex );
mat->SetMaterialPropertiesTable(mpt) ;
Expand Down
3 changes: 0 additions & 3 deletions examples/Geant4/CerenkovStandalone/OpticksUtil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ G4Material* OpticksUtil::MakeMaterial(G4MaterialPropertyVector* rindex) // stat
mat->AddElement(H, 2);
mat->AddElement(O, 1);

rindex->SetSpline(false);
//rindex->SetSpline(true);

G4MaterialPropertiesTable* mpt = new G4MaterialPropertiesTable();
mpt->AddProperty("RINDEX", rindex );
mat->SetMaterialPropertiesTable(mpt) ;
Expand Down
3 changes: 0 additions & 3 deletions examples/Geant4/GDMLMangledLVNames/DetectorConstruction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ G4Material* DetectorConstruction::MakeWater()
mat->AddElement(O, 1);

G4MaterialPropertyVector* ri = MakeWaterRI() ;
ri->SetSpline(false);

AddProperty( mat, "RINDEX" , ri );
return mat ;
Expand All @@ -68,7 +67,6 @@ G4Material* DetectorConstruction::MakeAir()
mat->AddElement(O, 30.*CLHEP::perCent);

G4MaterialPropertyVector* ri = MakeAirRI() ;
ri->SetSpline(false);

AddProperty( mat, "RINDEX" , ri );
return mat ;
Expand All @@ -88,7 +86,6 @@ G4Material* DetectorConstruction::MakeGlass()
mat->AddElement(H,8.467*CLHEP::perCent);

G4MaterialPropertyVector* ri = MakeGlassRI() ;
ri->SetSpline(false);

AddProperty( mat, "RINDEX" , ri );
return mat ;
Expand Down
3 changes: 3 additions & 0 deletions examples/Geant4/GDMLMangledLVNames/GDMLMangledLVNames.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*/

/**
GDMLMangledLVNames.cc
=======================
This failed to reproduce a problem of mangled LV names
seen in the switch to 10.4.2 see:
Expand Down
15 changes: 5 additions & 10 deletions examples/Geant4/OpNovice/src/OpNoviceDetectorConstruction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,10 @@ G4VPhysicalVolume* OpNoviceDetectorConstruction::Construct()

G4MaterialPropertiesTable* myMPT1 = new G4MaterialPropertiesTable();

myMPT1->AddProperty("RINDEX", photonEnergy, refractiveIndex1,nEntries)
->SetSpline(true);
myMPT1->AddProperty("ABSLENGTH", photonEnergy, absorption, nEntries)
->SetSpline(true);
myMPT1->AddProperty("FASTCOMPONENT",photonEnergy, scintilFast, nEntries)
->SetSpline(true);
myMPT1->AddProperty("SLOWCOMPONENT",photonEnergy, scintilSlow, nEntries)
->SetSpline(true);
myMPT1->AddProperty("RINDEX", photonEnergy, refractiveIndex1,nEntries);
myMPT1->AddProperty("ABSLENGTH", photonEnergy, absorption, nEntries);
myMPT1->AddProperty("FASTCOMPONENT",photonEnergy, scintilFast, nEntries);
myMPT1->AddProperty("SLOWCOMPONENT",photonEnergy, scintilSlow, nEntries);

myMPT1->AddConstProperty("SCINTILLATIONYIELD",50./MeV);
myMPT1->AddConstProperty("RESOLUTIONSCALE",1.0);
Expand Down Expand Up @@ -205,8 +201,7 @@ G4VPhysicalVolume* OpNoviceDetectorConstruction::Construct()
// gforward, gbackward, forward backward ratio
G4double mie_water_const[3]={0.99,0.99,0.8};

myMPT1->AddProperty("MIEHG",energy_water,mie_water,numentries_water)
->SetSpline(true);
myMPT1->AddProperty("MIEHG",energy_water,mie_water,numentries_water);
myMPT1->AddConstProperty("MIEHG_FORWARD",mie_water_const[0]);
myMPT1->AddConstProperty("MIEHG_BACKWARD",mie_water_const[1]);
myMPT1->AddConstProperty("MIEHG_FORWARD_RATIO",mie_water_const[2]);
Expand Down
Loading

0 comments on commit 73af7ee

Please sign in to comment.