From 2b1ebf9e3a0a8c1f633386316cd1e8bcb9c921fa Mon Sep 17 00:00:00 2001 From: Adrien Blanchet Date: Mon, 12 Dec 2022 18:39:42 +0100 Subject: [PATCH] - removing non std includes (GNU specific) - adding compatibility with Geant4 v11 - missing #ifdef G4VIS_USE --- WCSim.cc | 16 ++- include/WCSimWCDigi.hh | 25 ++-- include/WCSimWCHit.hh | 37 +---- src/WCSimConstructCylinder.cc | 197 ++++++++++++++++++++------- src/WCSimConstructEggShapedHyperK.cc | 41 ++++++ src/WCSimConstructPMT.cc | 29 +++- src/WCSimDetectorConstruction.cc | 6 +- src/WCSimPhysicsListFactory.cc | 10 +- 8 files changed, 254 insertions(+), 107 deletions(-) diff --git a/WCSim.cc b/WCSim.cc index d788f747e..b6397ee1b 100755 --- a/WCSim.cc +++ b/WCSim.cc @@ -1,8 +1,3 @@ -#include "G4ios.hh" -#include "G4RunManager.hh" -#include "G4UImanager.hh" -#include "G4UIterminal.hh" -#include "G4UItcsh.hh" #include "WCSimDetectorConstruction.hh" #include "WCSimPhysicsListFactory.hh" #include "WCSimPhysicsListFactoryMessenger.hh" @@ -17,6 +12,13 @@ #include "WCSimVisManager.hh" #include "WCSimRandomParameters.hh" +#include "G4ios.hh" +#include "G4RunManager.hh" +#include "G4UImanager.hh" +#include "G4UIterminal.hh" +#include "G4UItcsh.hh" +#include "G4VisManager.hh" + #ifdef G4UI_USE #include "G4UIExecutive.hh" @@ -95,8 +97,10 @@ int main(int argc,char** argv) runManager->SetUserInitialization(physFactory); // Visualization +#ifdef G4VIS_USE G4VisManager* visManager = new WCSimVisManager; visManager->Initialize(); +#endif // Set user action classes WCSimPrimaryGeneratorAction* myGeneratorAction = new @@ -162,7 +166,9 @@ int main(int argc,char** argv) } +#ifdef G4VIS_USE delete visManager; +#endif delete runManager; return 0; diff --git a/include/WCSimWCDigi.hh b/include/WCSimWCDigi.hh index ea4fe0349..5e005fa26 100644 --- a/include/WCSimWCDigi.hh +++ b/include/WCSimWCDigi.hh @@ -17,11 +17,6 @@ //for less_equal, bind2nd,... #include -// compose2 is not part of the C++ standard -#include -using __gnu_cxx::compose2; - - class WCSimWCDigi : public G4VDigi { @@ -229,13 +224,19 @@ public: std::vector::iterator tfirst = time_double.begin(); std::vector::iterator tlast = time_double.end(); - std::vector::iterator found = - std::find_if(tfirst,tlast, - compose2(std::logical_and(), - std::bind2nd(std::greater_equal(),low), - std::bind2nd(std::less_equal(),upevent) - ) - ); +// std::vector::iterator found = +// std::find_if(tfirst,tlast, +// compose2(std::logical_and(), +// std::bind2nd(std::greater_equal(),low), +// std::bind2nd(std::less_equal(),upevent) +// ) +// ); + + std::vector::iterator found = + std::find_if(tfirst,tlast, [&](G4double& element_){ + return element_ >= low and element_ <= upevent; + }); + if ( found != tlast ) { firsttime = *found; // first hit time } diff --git a/include/WCSimWCHit.hh b/include/WCSimWCHit.hh index 2941449cc..3d3c3c225 100644 --- a/include/WCSimWCHit.hh +++ b/include/WCSimWCHit.hh @@ -12,29 +12,6 @@ //for less_equal, bind2nd,... #include -// compose2 is not part of the C++ standard -// use this kludgy technique to use it -#include -using __gnu_cxx::identity_element; -using __gnu_cxx::unary_compose; -using __gnu_cxx::binary_compose; -using __gnu_cxx::compose1; -using __gnu_cxx::compose2; -using __gnu_cxx::identity; -using __gnu_cxx::select1st; -using __gnu_cxx::select2nd; -using __gnu_cxx::project1st; -using __gnu_cxx::project2nd; -using __gnu_cxx::constant_void_fun; -using __gnu_cxx::constant_unary_fun; -using __gnu_cxx::constant_binary_fun; -using __gnu_cxx::constant0; -using __gnu_cxx::constant1; -using __gnu_cxx::constant2; -using __gnu_cxx::subtractive_rng; -using __gnu_cxx::mem_fun1; -using __gnu_cxx::mem_fun1_ref; - class WCSimWCHit : public G4VHit @@ -112,12 +89,7 @@ class WCSimWCHit : public G4VHit std::vector::iterator tlast = time.end(); std::vector::iterator found = - std::find_if(tfirst,tlast, - compose2(std::logical_and(), - std::bind2nd(std::greater_equal(),low), - std::bind2nd(std::less_equal(),upevent) - ) - ); + std::find_if(tfirst,tlast,[&](G4double& t_){ return t_ >= low and t_ <= upevent; }); if ( found != tlast ) { firsttime = *found; // first hit time } @@ -141,12 +113,7 @@ class WCSimWCHit : public G4VHit // return number of hits in the time window... - G4int number = std::count_if(tfirst,tlast, - compose2(std::logical_and(), - std::bind2nd(std::greater_equal(),low), - std::bind2nd(std::less_equal(),mintime) - ) - ); + G4int number = std::count_if(tfirst,tlast, [&](G4double& t_){ return (t_ >= low and t_ <= mintime); }); totalPeInGate = number; // G4cout << "numer = " << number <<"\n"; diff --git a/src/WCSimConstructCylinder.cc b/src/WCSimConstructCylinder.cc index d73bde24b..be2797c79 100644 --- a/src/WCSimConstructCylinder.cc +++ b/src/WCSimConstructCylinder.cc @@ -1,6 +1,7 @@ // -*- mode:c++; tab-width:4; -*- #include "WCSimDetectorConstruction.hh" +#include "G4Version.hh" #include "G4Material.hh" #include "G4Element.hh" #include "G4Box.hh" @@ -154,8 +155,12 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructCylinder() G4VisAttributes* showColor = new G4VisAttributes(G4Colour(0.0,1.0,0.0)); logicWC->SetVisAttributes(showColor); - logicWC->SetVisAttributes(G4VisAttributes::Invisible); //amb79 - +#if G4VERSION_NUMBER >= 1110 + logicWC->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else + logicWC->SetVisAttributes(G4VisAttributes::Invisible); +#endif + //----------------------------------------------------- // everything else is contained in this water tubs //----------------------------------------------------- @@ -184,11 +189,12 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructCylinder() // This volume needs to made invisible to view the blacksheet and PMTs with RayTracer if (Vis_Choice == "RayTracer") - {logicWCBarrel->SetVisAttributes(G4VisAttributes::Invisible);} +// {logicWCBarrel->SetVisAttributes(G4VisAttributes::GetInvisible());} + {logicWCBarrel->SetVisAttributes(G4VisAttributes::GetInvisible());} else {//{if(!debugMode) - //logicWCBarrel->SetVisAttributes(G4VisAttributes::Invisible);} + //logicWCBarrel->SetVisAttributes(G4VisAttributes::GetInvisible());} } //----------------------------------------------------- // Form annular section of barrel to hold PMTs @@ -223,8 +229,13 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructCylinder() false, 0, checkOverlaps); -if(!debugMode) - logicWCBarrelAnnulus->SetVisAttributes(G4VisAttributes::Invisible); //amb79 +if(!debugMode) { +#if G4VERSION_NUMBER >= 1110 + logicWCBarrelAnnulus->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else + logicWCBarrelAnnulus->SetVisAttributes(G4VisAttributes::Invisible); +#endif +} //----------------------------------------------------- // Subdivide the BarrelAnnulus into rings @@ -260,7 +271,11 @@ if(!debugMode) tmpVisAtt->SetForceWireframe(true);// This line is used to give definition to the rings in OGLSX Visualizer logicWCBarrelRing->SetVisAttributes(tmpVisAtt); //If you want the rings on the Annulus to show in OGLSX, then comment out the line below. - logicWCBarrelRing->SetVisAttributes(G4VisAttributes::Invisible); +#if G4VERSION_NUMBER >= 1110 + logicWCBarrelRing->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else + logicWCBarrelRing->SetVisAttributes(G4VisAttributes::Invisible); +#endif } else { G4VisAttributes* tmpVisAtt = new G4VisAttributes(G4Colour(0,0.5,1.)); @@ -302,7 +317,11 @@ else { tmpVisAtt->SetForceSolid(true);// This line is used to give definition to the cells in OGLSX Visualizer logicWCBarrelCell->SetVisAttributes(tmpVisAtt); //If you want the columns on the Annulus to show in OGLSX, then comment out the line below. - logicWCBarrelCell->SetVisAttributes(G4VisAttributes::Invisible); +#if G4VERSION_NUMBER >= 1110 + logicWCBarrelCell->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else + logicWCBarrelCell->SetVisAttributes(G4VisAttributes::Invisible); +#endif } else { G4VisAttributes* tmpVisAtt = new G4VisAttributes(G4Colour(1.,0.5,0.5)); @@ -366,23 +385,33 @@ else { // Change made here to have the if statement contain the !debugmode to be consistent // This code gives the Blacksheet its color. -if (Vis_Choice == "RayTracer"){ - - G4VisAttributes* WCBarrelBlackSheetCellVisAtt - = new G4VisAttributes(G4Colour(0.2,0.9,0.2)); // green color - WCBarrelBlackSheetCellVisAtt->SetForceSolid(true); // force the object to be visualized with a surface - WCBarrelBlackSheetCellVisAtt->SetForceAuxEdgeVisible(true); // force auxiliary edges to be shown - if(!debugMode) - logicWCBarrelCellBlackSheet->SetVisAttributes(WCBarrelBlackSheetCellVisAtt); - else - logicWCBarrelCellBlackSheet->SetVisAttributes(G4VisAttributes::Invisible);} +if (Vis_Choice == "RayTracer") { + G4VisAttributes *WCBarrelBlackSheetCellVisAtt + = new G4VisAttributes(G4Colour(0.2, 0.9, 0.2)); // green color + WCBarrelBlackSheetCellVisAtt->SetForceSolid(true); // force the object to be visualized with a surface + WCBarrelBlackSheetCellVisAtt->SetForceAuxEdgeVisible(true); // force auxiliary edges to be shown + if (!debugMode) + logicWCBarrelCellBlackSheet->SetVisAttributes(WCBarrelBlackSheetCellVisAtt); + else { +#if G4VERSION_NUMBER >= 1110 + logicWCBarrelCellBlackSheet->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else + logicWCBarrelCellBlackSheet->SetVisAttributes(G4VisAttributes::Invisible); +#endif + } +} else { G4VisAttributes* WCBarrelBlackSheetCellVisAtt = new G4VisAttributes(G4Colour(0.2,0.9,0.2)); - if(!debugMode) + if(!debugMode){ +#if G4VERSION_NUMBER >= 1110 + logicWCBarrelCellBlackSheet->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else logicWCBarrelCellBlackSheet->SetVisAttributes(G4VisAttributes::Invisible); +#endif + } else logicWCBarrelCellBlackSheet->SetVisAttributes(WCBarrelBlackSheetCellVisAtt);} @@ -436,9 +465,12 @@ else { 0, checkOverlaps); - +#if G4VERSION_NUMBER >= 1110 + logicWCExtraTower->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else logicWCExtraTower->SetVisAttributes(G4VisAttributes::Invisible); +#endif //------------------------------------------- // subdivide the extra tower into cells //------------------------------------------ @@ -468,7 +500,11 @@ else { G4VisAttributes* tmpVisAtt = new G4VisAttributes(G4Colour(1.,0.5,0.5)); tmpVisAtt->SetForceSolid(true);// This line is used to give definition to the cells in OGLSX Visualizer //logicWCExtraTowerCell->SetVisAttributes(tmpVisAtt); - logicWCExtraTowerCell->SetVisAttributes(G4VisAttributes::Invisible); +#if G4VERSION_NUMBER >= 1110 + logicWCExtraTowerCell->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else + logicWCExtraTowerCell->SetVisAttributes(G4VisAttributes::Invisible); +#endif //TF vis. //--------------------------------------------- @@ -523,8 +559,13 @@ else { G4VisAttributes* WCBarrelBlackSheetCellVisAtt = new G4VisAttributes(G4Colour(0.2,0.9,0.2)); // green color - if(!debugMode) - {logicWCTowerBlackSheet->SetVisAttributes(G4VisAttributes::Invisible);} + if(!debugMode){ +#if G4VERSION_NUMBER >= 1110 + logicWCTowerBlackSheet->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else + logicWCTowerBlackSheet->SetVisAttributes(G4VisAttributes::Invisible); +#endif + } else {logicWCTowerBlackSheet->SetVisAttributes(WCBarrelBlackSheetCellVisAtt);}} @@ -545,8 +586,13 @@ else { G4VisAttributes* WCBarrelBlackSheetCellVisAtt = new G4VisAttributes(G4Colour(0.2,0.9,0.2)); // green color - if(!debugMode) - {logicWCTowerBlackSheet->SetVisAttributes(G4VisAttributes::Invisible);} + if(!debugMode){ +#if G4VERSION_NUMBER >= 1110 + logicWCTowerBlackSheet->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else + logicWCTowerBlackSheet->SetVisAttributes(G4VisAttributes::Invisible); +#endif + } else {logicWCTowerBlackSheet->SetVisAttributes(WCBarrelBlackSheetCellVisAtt);}} @@ -722,7 +768,7 @@ else { /*These lines of code will give color and volume to the PMTs if it hasn't been set in WCSimConstructPMT.cc. I recommend setting them in WCSimConstructPMT.cc. -If used here, uncomment the SetVisAttributes(WClogic) line, and comment out the SetVisAttributes(G4VisAttributes::Invisible) line.*/ +If used here, uncomment the SetVisAttributes(WClogic) line, and comment out the SetVisAttributes(G4VisAttributes::GetInvisible()) line.*/ G4VisAttributes* WClogic = new G4VisAttributes(G4Colour(0.4,0.0,0.8)); @@ -730,7 +776,11 @@ If used here, uncomment the SetVisAttributes(WClogic) line, and comment out the WClogic->SetForceAuxEdgeVisible(true); //logicWCPMT->SetVisAttributes(WClogic); - //logicWCPMT->SetVisAttributes(G4VisAttributes::Invisible); +//#if G4VERSION_NUMBER >= 1110 +// logicWCPMT->SetVisAttributes(G4VisAttributes::GetInvisible()); +//#else +// logicWCPMT->SetVisAttributes(G4VisAttributes::Invisible); +//#endif //jl145------------------------------------------------ // Add top veto PMTs @@ -894,11 +944,21 @@ If used here, uncomment the SetVisAttributes(WClogic) line, and comment out the // These lines make the large cap volume invisible to view the caps blacksheets. Need to make invisible for // RayTracer if (Vis_Choice == "RayTracer"){ - logicBottomCapAssembly->SetVisAttributes(G4VisAttributes::Invisible); - logicTopCapAssembly->SetVisAttributes(G4VisAttributes::Invisible); +#if G4VERSION_NUMBER >= 1110 + logicBottomCapAssembly->SetVisAttributes(G4VisAttributes::GetInvisible()); + logicTopCapAssembly->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else + logicBottomCapAssembly->SetVisAttributes(G4VisAttributes::Invisible); + logicTopCapAssembly->SetVisAttributes(G4VisAttributes::Invisible); +#endif } else { - logicBottomCapAssembly->SetVisAttributes(G4VisAttributes::Invisible); - logicTopCapAssembly->SetVisAttributes(G4VisAttributes::Invisible); +#if G4VERSION_NUMBER >= 1110 + logicBottomCapAssembly->SetVisAttributes(G4VisAttributes::GetInvisible()); + logicTopCapAssembly->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else + logicBottomCapAssembly->SetVisAttributes(G4VisAttributes::Invisible); + logicTopCapAssembly->SetVisAttributes(G4VisAttributes::Invisible); +#endif } G4VPhysicalVolume* physiTopCapAssembly = @@ -979,8 +1039,12 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructCaps(G4int zflip) G4VisAttributes* tmpVisAtt = new G4VisAttributes(G4Colour(1.,0.5,0.5)); tmpVisAtt->SetForceSolid(true);// This line is used to give definition to the cells in OGLSX Visualizer - //logicWCBarrelBorderRing->SetVisAttributes(tmpVisAtt); - logicWCBarrelBorderRing->SetVisAttributes(G4VisAttributes::Invisible); + //logicWCBarrelBorderRing->SetVisAttributes(tmpVisAtt); +#if G4VERSION_NUMBER >= 1110 + logicWCBarrelBorderRing->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else + logicWCBarrelBorderRing->SetVisAttributes(G4VisAttributes::Invisible); +#endif //TF vis. } @@ -1016,16 +1080,27 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructCaps(G4int zflip) // used for RayTracer if (Vis_Choice == "RayTracer"){ - if(!debugMode){ - G4VisAttributes* tmpVisAtt = new G4VisAttributes(G4Colour(1.,0.5,0.5)); - tmpVisAtt->SetForceSolid(true); - logicWCBarrelBorderCell->SetVisAttributes(tmpVisAtt); - logicWCBarrelBorderCell->SetVisAttributes(G4VisAttributes::Invisible);} + if(!debugMode) { + G4VisAttributes *tmpVisAtt = new G4VisAttributes(G4Colour(1., 0.5, 0.5)); + tmpVisAtt->SetForceSolid(true); + logicWCBarrelBorderCell->SetVisAttributes(tmpVisAtt); +#if G4VERSION_NUMBER >= 1110 + logicWCBarrelBorderCell->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else + logicWCBarrelBorderCell->SetVisAttributes(G4VisAttributes::Invisible); +#endif + } else { G4VisAttributes* tmpVisAtt = new G4VisAttributes(G4Colour(1.,0.5,0.5)); tmpVisAtt->SetForceWireframe(true); logicWCBarrelBorderCell->SetVisAttributes(tmpVisAtt); - logicWCBarrelBorderCell->SetVisAttributes(G4VisAttributes::Invisible);}} +#if G4VERSION_NUMBER >= 1110 + logicWCBarrelBorderCell->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else + logicWCBarrelBorderCell->SetVisAttributes(G4VisAttributes::Invisible); +#endif + } + } // used for OGLSX else { @@ -1035,7 +1110,11 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructCaps(G4int zflip) G4VisAttributes* tmpVisAtt = new G4VisAttributes(G4Colour(1.,0.5,0.5)); tmpVisAtt->SetForceSolid(true); logicWCBarrelBorderCell->SetVisAttributes(tmpVisAtt); - logicWCBarrelBorderCell->SetVisAttributes(G4VisAttributes::Invisible); +#if G4VERSION_NUMBER >= 1110 + logicWCBarrelBorderCell->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else + logicWCBarrelBorderCell->SetVisAttributes(G4VisAttributes::Invisible); +#endif } else { G4VisAttributes* tmpVisAtt = new G4VisAttributes(G4Colour(1.,0.5,0.5)); @@ -1111,8 +1190,12 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructCaps(G4int zflip) G4VisAttributes* tmpVisAtt = new G4VisAttributes(G4Colour(1.,0.5,0.5)); tmpVisAtt->SetForceSolid(true);// This line is used to give definition to the cells in OGLSX Visualizer - logicWCExtraBorderCell->SetVisAttributes(tmpVisAtt); - logicWCExtraBorderCell->SetVisAttributes(G4VisAttributes::Invisible); + logicWCExtraBorderCell->SetVisAttributes(tmpVisAtt); +#if G4VERSION_NUMBER >= 1110 + logicWCExtraBorderCell->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else + logicWCExtraBorderCell->SetVisAttributes(G4VisAttributes::Invisible); +#endif //TF vis. @@ -1222,7 +1305,11 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructCaps(G4int zflip) G4VisAttributes* tmpVisAtt2 = new G4VisAttributes(G4Colour(1,0.5,0.5)); tmpVisAtt2->SetForceSolid(true); logicWCCap->SetVisAttributes(tmpVisAtt2); +#if G4VERSION_NUMBER >= 1110 + logicWCCap->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else logicWCCap->SetVisAttributes(G4VisAttributes::Invisible); +#endif } else{ @@ -1236,8 +1323,12 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructCaps(G4int zflip) G4VisAttributes* tmpVisAtt = new G4VisAttributes(G4Colour(1.,0.5,0.5)); tmpVisAtt->SetForceSolid(true);// This line is used to give definition to the cells in OGLSX Visualizer - //logicWCCap->SetVisAttributes(tmpVisAtt); + //logicWCCap->SetVisAttributes(tmpVisAtt); +#if G4VERSION_NUMBER >= 1110 + logicWCCap->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else logicWCCap->SetVisAttributes(G4VisAttributes::Invisible); +#endif //TF vis. } else @@ -1332,8 +1423,13 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructCaps(G4int zflip) G4VisAttributes* WCCapBlackSheetVisAtt = new G4VisAttributes(G4Colour(0.9,0.2,0.2)); - if(!debugMode) - logicWCCapBlackSheet->SetVisAttributes(G4VisAttributes::Invisible); + if(!debugMode){ +#if G4VERSION_NUMBER >= 1110 + logicWCCapBlackSheet->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else + logicWCCapBlackSheet->SetVisAttributes(G4VisAttributes::Invisible); +#endif + } else logicWCCapBlackSheet->SetVisAttributes(WCCapBlackSheetVisAtt);} @@ -1343,9 +1439,14 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructCaps(G4int zflip) G4VisAttributes* WCCapBlackSheetVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0)); - if(!debugMode) - //logicWCCapBlackSheet->SetVisAttributes(G4VisAttributes::Invisible); //Use this line if you want to make the blacksheet on the caps invisible to view through - logicWCCapBlackSheet->SetVisAttributes(WCCapBlackSheetVisAtt); + if(!debugMode){ +//#if G4VERSION_NUMBER >= 1110 +// logicWCCapBlackSheet->SetVisAttributes(G4VisAttributes::GetInvisible()); +//#else +// logicWCCapBlackSheet->SetVisAttributes(G4VisAttributes::Invisible); +//#endif + logicWCCapBlackSheet->SetVisAttributes(WCCapBlackSheetVisAtt); + } else logicWCCapBlackSheet->SetVisAttributes(WCCapBlackSheetVisAtt);} diff --git a/src/WCSimConstructEggShapedHyperK.cc b/src/WCSimConstructEggShapedHyperK.cc index aae8614d3..3e62d9fa7 100644 --- a/src/WCSimConstructEggShapedHyperK.cc +++ b/src/WCSimConstructEggShapedHyperK.cc @@ -1,6 +1,7 @@ // -*- mode:c++; tab-width:4; -*- #include "WCSimDetectorConstruction.hh" +#include "G4Version.hh" #include "G4SystemOfUnits.hh" #include "G4ThreeVector.hh" #include "G4RotationMatrix.hh" @@ -61,7 +62,11 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructEggShapedHyperK() waterTank_Length/2.+blackSheetThickness), FindMaterial("G4_AIR"), "EggShapedHyperK"); +#if G4VERSION_NUMBER >= 1110 + eggShapedHyperKLV->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else eggShapedHyperKLV->SetVisAttributes(G4VisAttributes::Invisible); +#endif new G4LogicalSkinSurface("WaterBSSurface",eggShapedHyperKLV,OpWaterBSSurface); @@ -111,7 +116,11 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructEggShapedHyperK() waterTankLV = new G4LogicalVolume(waterTank_union,FindMaterial("G4_WATER"),"Tank"); +#if G4VERSION_NUMBER >= 1110 + waterTankLV->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else waterTankLV->SetVisAttributes(G4VisAttributes::Invisible); +#endif new G4PVPlacement(0,G4ThreeVector(0,waterTank_Height/4.,0), waterTankLV,"Tank",eggShapedHyperKLV,false,0,checkOverlaps); @@ -407,7 +416,11 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructRadialPMT(G4bool top, -phi/2.,phi), FindMaterial("G4_WATER"), "PMTAnnulus"); +#if G4VERSION_NUMBER >= 1110 + pmtAnnulusLV->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else pmtAnnulusLV->SetVisAttributes(G4VisAttributes::Invisible); +#endif G4LogicalVolume* blackSheetALV = NULL; if (inner) { @@ -429,7 +442,11 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructRadialPMT(G4bool top, -phi/2.,phi), FindMaterial("G4_WATER"), "PMTRings"); +#if G4VERSION_NUMBER >= 1110 + pmtRingLV->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else pmtRingLV->SetVisAttributes(G4VisAttributes::Invisible); +#endif G4LogicalVolume* pmtCellLV = new G4LogicalVolume(new G4Tubs("PMTCell", @@ -438,7 +455,11 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructRadialPMT(G4bool top, -dphi/2.,dphi), FindMaterial("G4_WATER"), "PMTCell"); +#if G4VERSION_NUMBER >= 1110 + pmtCellLV->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else pmtCellLV->SetVisAttributes(G4VisAttributes::Invisible); +#endif //----------------------------------------------------------------- // @@ -517,7 +538,11 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructEndWallPMT() innerPMT_Apitch/2.), FindMaterial("G4_WATER"), "PMTCell"); +#if G4VERSION_NUMBER >= 1110 + pmtCellLV->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else pmtCellLV->SetVisAttributes(G4VisAttributes::Invisible); +#endif G4RotationMatrix* rotm = new G4RotationMatrix(); rotm->rotateY(180.*degree); @@ -578,7 +603,11 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructEndWallPMT() innerPMT_Apitch/2.), FindMaterial("G4_WATER"), "PMTSlab"); +#if G4VERSION_NUMBER >= 1110 + pmtSlabLV->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else pmtSlabLV->SetVisAttributes(G4VisAttributes::Invisible); +#endif new G4PVReplica("PMTCell", pmtCellLV, @@ -637,7 +666,11 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructCeilingPMT(G4bool top, zlength/2.), FindMaterial("G4_WATER"), "PMTSlab"); +#if G4VERSION_NUMBER >= 1110 + pmtSlabLV->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else pmtSlabLV->SetVisAttributes(G4VisAttributes::Invisible); +#endif G4LogicalVolume* blackSheetYLV = NULL; if (inner) { @@ -659,7 +692,11 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructCeilingPMT(G4bool top, pitch/2.), FindMaterial("G4_WATER"), "PMTSlab"); +#if G4VERSION_NUMBER >= 1110 + pmtSliceLV->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else pmtSliceLV->SetVisAttributes(G4VisAttributes::Invisible); +#endif G4LogicalVolume* pmtCellLV = new G4LogicalVolume(new G4Box("PMTCell", @@ -668,7 +705,11 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructCeilingPMT(G4bool top, pitch/2.), FindMaterial("G4_WATER"), "PMTCell"); +#if G4VERSION_NUMBER >= 1110 + pmtCellLV->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else pmtCellLV->SetVisAttributes(G4VisAttributes::Invisible); +#endif G4VPhysicalVolume* pmtSlicePV = new G4PVReplica("PMTSlice", diff --git a/src/WCSimConstructPMT.cc b/src/WCSimConstructPMT.cc index 11bbf9ed6..6dc7aae4c 100755 --- a/src/WCSimConstructPMT.cc +++ b/src/WCSimConstructPMT.cc @@ -1,5 +1,6 @@ #include "WCSimDetectorConstruction.hh" +#include "G4Version.hh" #include "G4Box.hh" #include "G4Sphere.hh" #include "G4SubtractionSolid.hh" @@ -196,7 +197,11 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructPMT(G4String PMTName, G4Str // Makes the volume containg the PMT invisible for normal visualization G4VisAttributes* WCPMTVisAttGrey = new G4VisAttributes(G4Colour(0.2,0.2,0.2)); WCPMTVisAttGrey->SetForceSolid(true); +#if G4VERSION_NUMBER >= 1110 + logicWCPMT->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else logicWCPMT->SetVisAttributes(G4VisAttributes::Invisible); +#endif logicWCPMT->SetVisAttributes(WCPMTVisAttGrey); //TF debug overlaps with this volume } } @@ -255,7 +260,11 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructPMT(G4String PMTName, G4Str logicInteriorWCPMT->SetVisAttributes(WCPMTVisAtt); } else { // Making the inner portion of the detector invisible for OGLSX visualization +#if G4VERSION_NUMBER >= 1110 + logicInteriorWCPMT->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else logicInteriorWCPMT->SetVisAttributes(G4VisAttributes::Invisible); +#endif } ///////////////////////////// @@ -298,7 +307,11 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructPMT(G4String PMTName, G4Str // used in OGLSX visualizer G4VisAttributes* WCPMTVisAtt = new G4VisAttributes(G4Colour(0.2,0.2,0.2)); WCPMTVisAtt->SetForceWireframe(true); - //logicGlassFaceWCPMT->SetVisAttributes(G4VisAttributes::Invisible); +#if G4VERSION_NUMBER >= 1110 +// logicGlassFaceWCPMT->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else +// logicGlassFaceWCPMT->SetVisAttributes(G4VisAttributes::Invisible); +#endif logicGlassFaceWCPMT->SetVisAttributes(WCPMTVisAtt);} if (Vis_Choice == "RayTracer"){ @@ -307,8 +320,12 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructPMT(G4String PMTName, G4Str G4VisAttributes* WCPMTVisAtt = new G4VisAttributes(G4Colour(0.0,0.0,1.0)); WCPMTVisAtt->SetForceSolid(true); // force the object to be visualized with a surface WCPMTVisAtt->SetForceAuxEdgeVisible(true); // force auxiliary edges to be shown - //logicGlassFaceWCPMT->SetVisAttributes(G4VisAttributes::Invisible); - +#if G4VERSION_NUMBER >= 1110 +// logicGlassFaceWCPMT->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else +// logicGlassFaceWCPMT->SetVisAttributes(G4VisAttributes::Invisible); +#endif + logicGlassFaceWCPMT->SetVisAttributes(WCPMTVisAtt); } else { @@ -318,7 +335,11 @@ G4LogicalVolume* WCSimDetectorConstruction::ConstructPMT(G4String PMTName, G4Str //WCPMTVisAtt->SetForceWireframe(true); G4VisAttributes* WCPMTVisAtt = new G4VisAttributes(G4Colour(0.0,1.0,0.0)); //better for seeing geometry WCPMTVisAtt->SetForceSolid(true); - //logicGlassFaceWCPMT->SetVisAttributes(G4VisAttributes::Invisible); +#if G4VERSION_NUMBER >= 1110 +// logicGlassFaceWCPMT->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else +// logicGlassFaceWCPMT->SetVisAttributes(G4VisAttributes::Invisible); +#endif logicGlassFaceWCPMT->SetVisAttributes(WCPMTVisAtt); } diff --git a/src/WCSimDetectorConstruction.cc b/src/WCSimDetectorConstruction.cc index acf116978..e6a149e6d 100644 --- a/src/WCSimDetectorConstruction.cc +++ b/src/WCSimDetectorConstruction.cc @@ -2,6 +2,7 @@ #include "WCSimDetectorMessenger.hh" #include "WCSimTuningParameters.hh" +#include "G4Version.hh" #include "G4Element.hh" #include "G4Box.hh" #include "G4LogicalVolume.hh" @@ -275,8 +276,11 @@ G4VPhysicalVolume* WCSimDetectorConstruction::Construct() // Now set the visualization attributes of the logical volumes. // logicWCBox->SetVisAttributes(G4VisAttributes::Invisible); +#if G4VERSION_NUMBER >= 1110 + logicExpHall->SetVisAttributes(G4VisAttributes::GetInvisible()); +#else logicExpHall->SetVisAttributes(G4VisAttributes::Invisible); - +#endif //----------------------------------------------------- // Create and place the physical Volumes //----------------------------------------------------- diff --git a/src/WCSimPhysicsListFactory.cc b/src/WCSimPhysicsListFactory.cc index 698ebc7b8..55025f425 100644 --- a/src/WCSimPhysicsListFactory.cc +++ b/src/WCSimPhysicsListFactory.cc @@ -1,14 +1,20 @@ +#include "G4Version.hh" #include #include #include #include -#include #include #include #include #include #include "WCSimPhysicsListFactory.hh" +#if G4VERSION_NUMBER >= 1110 +#include +#else +#include +#endif + #include "GdNeutronHPCapture.hh" #include "G4PhysicalConstants.hh" @@ -69,7 +75,7 @@ void WCSimPhysicsListFactory::ConstructProcess() { registry->RemoveMe(registry->FindModel("NeutronHPCapture")); } - G4HadronCaptureProcess *theCaptureProcess = new G4HadronCaptureProcess; + auto *theCaptureProcess = new G4NeutronCaptureProcess; manager->AddDiscreteProcess(theCaptureProcess); G4NeutronCaptureXS *xsNeutronCaptureXS = (G4NeutronCaptureXS *) G4CrossSectionDataSetRegistry::Instance()->GetCrossSectionDataSet(G4NeutronCaptureXS::Default_Name());