From aeba37442d1d9653285fd9b20ee79ed3bbfbd5eb Mon Sep 17 00:00:00 2001 From: nicolas <nicolas@nptool> Date: Thu, 17 Jan 2013 17:23:35 +0000 Subject: [PATCH] * Remove warnings at compilation time from Simulation * Add #ifdef statements in NPSimulation - DetectorConstruction however, if a subset of detectors is selected with ./configure from NPLib, it breaks NPSimulation compilation since all projets are compiled by default in NPSimulation --- NPLib/VDetector/DetectorManager.cxx | 2 +- NPLib/VDetector/Makefile | 2 +- NPLib/configure | 3 ++- NPSimulation/Simulation.cc | 9 ++++---- NPSimulation/src/DetectorConstruction.cc | 26 ++++++++++++++++++++++++ NPSimulation/vis.mac | 24 +++++++++++----------- 6 files changed, 47 insertions(+), 19 deletions(-) diff --git a/NPLib/VDetector/DetectorManager.cxx b/NPLib/VDetector/DetectorManager.cxx index 9acc69ec2..f6c8d9003 100644 --- a/NPLib/VDetector/DetectorManager.cxx +++ b/NPLib/VDetector/DetectorManager.cxx @@ -6,7 +6,7 @@ #include <cstdlib> // Detector -#include "DetectorList.inc" +#include "../DetectorList.inc" #include "TExogamPhysics.h" #include "TMust2Physics.h" #include "TCATSPhysics.h" diff --git a/NPLib/VDetector/Makefile b/NPLib/VDetector/Makefile index 7da1a4703..a2df20fee 100644 --- a/NPLib/VDetector/Makefile +++ b/NPLib/VDetector/Makefile @@ -17,7 +17,7 @@ libDetectorManager.so: DetectorManager.o # dependances VDetector.o: VDetector.cxx VDetector.h -DetectorManager.o: DetectorManager.cxx DetectorManager.h DetectorList.inc +DetectorManager.o: DetectorManager.cxx DetectorManager.h ../DetectorList.inc ####################################### ############# Clean and More ########## diff --git a/NPLib/configure b/NPLib/configure index 12209c9ec..ef30bc00a 100755 --- a/NPLib/configure +++ b/NPLib/configure @@ -133,7 +133,8 @@ done # only the detectors given in arguments # ########################################################################## # output file -outfile="VDetector/DetectorList.inc" +outfile="DetectorList.inc" +# outfile="VDetector/DetectorList.inc" echo " + Creating $outfile file....." # if output file exists delete it diff --git a/NPSimulation/Simulation.cc b/NPSimulation/Simulation.cc index 16361ce2f..6306d9fe9 100644 --- a/NPSimulation/Simulation.cc +++ b/NPSimulation/Simulation.cc @@ -87,7 +87,7 @@ int main(int argc, char** argv) /////////////////////////////////////////////////////////////// /////// Get the pointer to the User Interface manager //////// /////////////////////////////////////////////////////////////// - G4UImanager* UI = G4UImanager::GetUIpointer(); +// G4UImanager* UI = G4UImanager::GetUIpointer(); /////////////////////////////////////////////////////////////// /////////// Define UI terminal for interactive mode /////////// @@ -97,9 +97,9 @@ int main(int argc, char** argv) visManager->Initialize(); #endif - G4UIsession* session = 0; +/* G4UIsession* session = 0; -/*#ifdef G4UI_USE_TCSH +#ifdef G4UI_USE_TCSH session = new G4UIterminal(new G4UItcsh); #else session = new G4UIterminal(); @@ -109,7 +109,7 @@ int main(int argc, char** argv) session->SessionStart(); delete session; */ - + // interactive mode : define UI session // Get the pointer to the User Interface manager G4UImanager* UImanager = G4UImanager::GetUIpointer(); @@ -123,6 +123,7 @@ int main(int argc, char** argv) ui->SessionStart(); delete ui; #endif + #ifdef G4VIS_USE delete visManager; #endif diff --git a/NPSimulation/src/DetectorConstruction.cc b/NPSimulation/src/DetectorConstruction.cc index 331b29115..2fcca39bf 100644 --- a/NPSimulation/src/DetectorConstruction.cc +++ b/NPSimulation/src/DetectorConstruction.cc @@ -40,6 +40,7 @@ #include "G4RotationMatrix.hh" // Detector class +#include "../../NPLib/DetectorList.inc" #include "AnnularS1.hh" #include "Chamber.hh" #include "ComptonTelescope.hh" @@ -224,6 +225,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) //////////// Search for ComptonTelescope //////////// ///////////////////////////////////////////////////// else if (LineBuffer.compare(0, 16, "ComptonTelescope") == 0 && cComptonTelescope == false) { +#ifdef INC_COMPTONTELESCOPE cComptonTelescope = true; G4cout << "//////// ComptonTelescope ////////" << G4endl; @@ -237,6 +239,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector(myDetector); +#endif } @@ -244,6 +247,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) //////////// Search for Eurogam //////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 7, "Eurogam") == 0 && cEurogam == false) { +#ifdef INC_EUROGAM cEurogam = true; G4cout << "//////// Eurogam ////////" << G4endl; @@ -257,6 +261,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector(myDetector); +#endif } @@ -264,6 +269,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) //////////// Search for Gaspard //////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 14, "GaspardTracker") == 0 && cGPDTracker == false) { +#ifdef INC_GASPARD cGPDTracker = true ; G4cout << G4endl << "//////// Gaspard Tracker ////////" << G4endl ; @@ -277,6 +283,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector(myDetector) ; +#endif } @@ -284,6 +291,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) //////////// Search for Hyde //////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 11, "HydeTracker") == 0 && cHYDTracker == false) { +#ifdef INC_HYDE cHYDTracker = true ; G4cout << G4endl << "//////// Hyde Tracker ////////" << G4endl ; @@ -297,6 +305,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector(myDetector) ; +#endif } @@ -304,6 +313,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) //////////// Search for paris //////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 5, "Paris") == 0 && cParis == false) { +#ifdef INC_PARIS cParis = true ; G4cout << G4endl << "//////// Paris ////////" << G4endl ; @@ -317,12 +327,14 @@ void DetectorConstruction::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector(myDetector) ; +#endif } //////////////////////////////////////////// //////////// Search for paris shield //////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 6, "Shield") == 0 && cShield == false) { +#ifdef INC_SHIELD cShield = true ; G4cout << G4endl << "//////// Shield ////////" << G4endl ; @@ -336,12 +348,14 @@ void DetectorConstruction::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector(myDetector) ; +#endif } //////////////////////////////////////////// ///// Search for S1 Annular detector ////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 9, "AnnularS1") == 0 && cS1 == false) { +#ifdef INC_ANNULARSi1 cS1 = true ; G4cout << G4endl << "//////// S1 Annular detector ////////" << G4endl << G4endl ; @@ -355,12 +369,14 @@ void DetectorConstruction::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector(myDetector) ; +#endif } //////////////////////////////////////////// ///// Search for S1 Annular detector ////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 2, "W1") == 0 && cW1 == false) { +#ifdef INC_W1 cW1 = true ; G4cout << G4endl << "//////// W1 Square detector ////////" << G4endl << G4endl; @@ -374,12 +390,14 @@ void DetectorConstruction::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector(myDetector); +#endif } //////////////////////////////////////////// //////// Search for MUST2 Array //////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 10, "MUST2Array") == 0 && cMUST2 == false) { +#ifdef INC_MUST2 cMUST2 = true ; G4cout << G4endl << "//////// MUST2 Array ////////" << G4endl << G4endl ; @@ -393,12 +411,14 @@ void DetectorConstruction::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector(myDetector) ; +#endif } //////////////////////////////////////////// ////////// Search for ThinSi /////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 9, "SSSDArray") == 0 && cAddThinSi == false) { +#ifdef INC_SSSD cAddThinSi = true ; G4cout << G4endl << "//////// SSSD ////////" << G4endl << G4endl ; @@ -412,12 +432,14 @@ void DetectorConstruction::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector(myDetector) ; +#endif } //////////////////////////////////////////// ////////// Search for Sharc /////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 5, "Sharc") == 0 && cSharc == false) { +#ifdef INC_SHARC cSharc = true ; G4cout << G4endl << "//////// Sharc ////////" << G4endl << G4endl ; @@ -431,12 +453,14 @@ void DetectorConstruction::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector(myDetector); +#endif } //////////////////////////////////////////// ////////// Search for Plastic /////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 19, "ScintillatorPlastic") == 0 && cPlastic == false) { +#ifdef INC_PLASTIC cPlastic = true ; G4cout << G4endl << "//////// Plastic ////////" << G4endl << G4endl ; @@ -450,6 +474,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector(myDetector) ; +#endif } //////////////////////////////////////////// @@ -474,6 +499,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) // Add target to the VDetector Vector AddDetector(myDetector); } + //////////////////////////////////////////// //////////// Search for Chamber ///////////// //////////////////////////////////////////// diff --git a/NPSimulation/vis.mac b/NPSimulation/vis.mac index ee5a20ded..59a1a3269 100644 --- a/NPSimulation/vis.mac +++ b/NPSimulation/vis.mac @@ -28,26 +28,26 @@ #/vis/verbose errors # # Draw geometry: -/vis/drawVolume +#/vis/drawVolume # # Specify view angle: -/vis/viewer/set/viewpointThetaPhi 0. 90. +#/vis/viewer/set/viewpointThetaPhi 0. 90. # # Specify zoom value: #/vis/viewer/zoom 2. # # Specify style (surface or wireframe): -/vis/viewer/set/style surface +#/vis/viewer/set/style surface # # Draw coordinate axes: -/vis/scene/add/axes 0 0 0 20 cm +#/vis/scene/add/axes 0 0 0 20 cm # # Draw smooth trajectories at end of event, showing trajectory points # as markers 2 pixels wide: -/vis/scene/add/trajectories smooth -/vis/modeling/trajectories/create/drawByCharge -/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true -/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 1 +#/vis/scene/add/trajectories smooth +#/vis/modeling/trajectories/create/drawByCharge +#/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true +#/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 1 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) # # Draw hits at end of event: @@ -67,11 +67,11 @@ #/vis/modeling/trajectories/drawByParticleID-0/set e- blue # # To superimpose all of the events from a given run: -/vis/scene/endOfEventAction accumulate +#/vis/scene/endOfEventAction accumulate # # Re-establish auto refreshing and verbosity: -/vis/viewer/set/autoRefresh true -/vis/verbose 0 +#/vis/viewer/set/autoRefresh true +#/vis/verbose 0 # # For file-based drivers, use this to create an empty detector view: -/vis/viewer/flush +#/vis/viewer/flush -- GitLab