From 04cbb83b5d5de68345e5b76c691b2f21c23b74c9 Mon Sep 17 00:00:00 2001 From: Thomas Prokscha Date: Thu, 16 Mar 2006 13:49:31 +0000 Subject: [PATCH] Fixed most of the compiler warnings under gcc 3.2.3. Modified lemuEnv.sh and update.sh. --- geant4/LEMuSR/G4Modified/update.sh | 21 ++++++++++--------- geant4/LEMuSR/LEMuSR.cc | 7 +++---- geant4/LEMuSR/include/LEMuSRCryoField.hh | 6 +++--- geant4/LEMuSR/include/LEMuSRCryoHit.hh | 1 - geant4/LEMuSR/include/LEMuSRRNDMAGField.hh | 2 +- geant4/LEMuSR/lemuEnv.sh | 14 ++++++------- geant4/LEMuSR/src/LEMuSRCryoField.cc | 2 +- geant4/LEMuSR/src/LEMuSRCryoHit.cc | 14 +++++++------ geant4/LEMuSR/src/LEMuSRDetectorMessenger.cc | 5 ++--- geant4/LEMuSR/src/LEMuSRMagneticField.cc | 2 +- geant4/LEMuSR/src/LEMuSRMaterials.cc | 6 +++--- geant4/LEMuSR/src/LEMuSRMcpHit.cc | 6 ++++-- geant4/LEMuSR/src/LEMuSROScintHit.cc | 6 ++++-- .../LEMuSR/src/LEMuSRParticleChangeForSR.cc | 6 +++--- .../LEMuSR/src/LEMuSRParticleGunMessenger.cc | 2 +- .../src/LEMuSRPrimaryGeneratorAction.cc | 4 ++-- geant4/LEMuSR/src/LEMuSRRNDMAGField.cc | 16 +++++++------- geant4/LEMuSR/src/LEMuSRRunAction.cc | 2 +- geant4/LEMuSR/src/LEMuSRScintHit.cc | 6 ++++-- .../src/LEMuSRStackingActionMessenger.cc | 3 ++- geant4/LEMuSR/src/meyer.cc | 14 ++++++------- 21 files changed, 75 insertions(+), 70 deletions(-) diff --git a/geant4/LEMuSR/G4Modified/update.sh b/geant4/LEMuSR/G4Modified/update.sh index a4d4f0a..7d08ae7 100644 --- a/geant4/LEMuSR/G4Modified/update.sh +++ b/geant4/LEMuSR/G4Modified/update.sh @@ -24,18 +24,19 @@ cp G4MuonDecayChannel.cc $G4INSTALL/source/particles/management/src/ cp G4MuonDecayChannel.hh $G4INSTALL/source/particles/management/include/ -cd $G4INSTALL/source/geometry/magneticfield/ -gmake clean +#cd $G4INSTALL/source/geometry/magneticfield/ +#gmake clean +#gmake + + +#cd $G4INSTALL/source/particles/management/ +#gmake clean +#gmake + +cd $G4INSTALL/source gmake - -cd $G4INSTALL/source/particles/management/ -gmake clean -gmake - - - -cd ~/LEMuSR/G4Modified +cd $G4WORKDIR diff --git a/geant4/LEMuSR/LEMuSR.cc b/geant4/LEMuSR/LEMuSR.cc index 102375c..d602d68 100644 --- a/geant4/LEMuSR/LEMuSR.cc +++ b/geant4/LEMuSR/LEMuSR.cc @@ -1,4 +1,4 @@ -//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//* +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//* // LOW ENERGY MUON SPIN RELAXATION, ROTATION, RADIATION Geant4 SIMULATION // ID : LEMuSR.cc , v 1.2 // AUTHOR: Taofiq PARAISO @@ -60,15 +60,14 @@ #endif -int main(int argc,char** argv)//argc:: defines the user interface +int main() //argc:: defines the user interface { - // random numbers time_t myseed; time(&myseed); RanecuEngine *theRanGenerator = new RanecuEngine; theRanGenerator->setSeed(myseed); - HepRandom::setTheEngine(theRanGenerator); + HepRandom::setTheEngine(theRanGenerator); //! 1 The run manager construction diff --git a/geant4/LEMuSR/include/LEMuSRCryoField.hh b/geant4/LEMuSR/include/LEMuSRCryoField.hh index 54c417d..c5f0502 100644 --- a/geant4/LEMuSR/include/LEMuSRCryoField.hh +++ b/geant4/LEMuSR/include/LEMuSRCryoField.hh @@ -21,8 +21,8 @@ //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$// #include "G4ElectricField.hh" -#include"G4ThreeVector.hh" -#include"G4ios.hh" +#include "G4ThreeVector.hh" +#include "G4ios.hh" /*! * This class is defines homogenous electric field in the cryostat region. * It is obsolete since a field map has been introduces for this region. @@ -39,7 +39,7 @@ public: /*! The constructor initializes the field within the boundary cylinder centered in mcpv_z, radius and length= zmax-zmin */ - LEMuSRCryoField(G4ThreeVector FieldVector,G4double radius,G4double zmin, G4double zmax,G4double mcpv_z); + LEMuSRCryoField(G4ThreeVector FieldVector,G4double radius,G4double zmin, G4double zmax); ~LEMuSRCryoField(); G4bool DoesFieldChangeEnergy() const { return true; } diff --git a/geant4/LEMuSR/include/LEMuSRCryoHit.hh b/geant4/LEMuSR/include/LEMuSRCryoHit.hh index ce508df..ea3a736 100644 --- a/geant4/LEMuSR/include/LEMuSRCryoHit.hh +++ b/geant4/LEMuSR/include/LEMuSRCryoHit.hh @@ -119,5 +119,4 @@ inline void LEMuSRCryoHit :: operator delete(void *aHit) LEMuSRCryoHitAllocator.FreeSingle((LEMuSRCryoHit*) aHit); } - #endif diff --git a/geant4/LEMuSR/include/LEMuSRRNDMAGField.hh b/geant4/LEMuSR/include/LEMuSRRNDMAGField.hh index cc80158..5c22197 100644 --- a/geant4/LEMuSR/include/LEMuSRRNDMAGField.hh +++ b/geant4/LEMuSR/include/LEMuSRRNDMAGField.hh @@ -33,7 +33,7 @@ public: ~LEMuSRRNDMAGField(); void GetFieldValue(const G4double pos[4], G4double *field) const; - + G4bool uniform; diff --git a/geant4/LEMuSR/lemuEnv.sh b/geant4/LEMuSR/lemuEnv.sh index d26388b..aeedd50 100755 --- a/geant4/LEMuSR/lemuEnv.sh +++ b/geant4/LEMuSR/lemuEnv.sh @@ -1,12 +1,12 @@ -export G4VRMLFILE_VIEWER=freewrl_sa +export G4VRMLFILE_VIEWER=freewrl_sa export G4UI_USE_TCSH=1 - # ROOT -export ROOTSYS=/usr/local/root +# ROOT, ROOTSYS usually defined in /etc/profile +#export ROOTSYS=/usr/local/root export G4UI_BUILD_ROOT_SESSION=1 -export PATH=$ROOTSYS/bin:$PATH -export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH +#export PATH=$ROOTSYS/bin:$PATH +#export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH @@ -16,7 +16,7 @@ export G4VIS_BUILD_OPENGLX_DRIVER=1 export G4VIS_USE_OPENGLX=1 -export G4VIS_BUILD_DAWN_DRIVER=1 +export G4VIS_BUILD_DAWN_DRIVER=1 export G4VIS_USE_DAWN=1 export DAWN_PS_PREVIEWER='/usr/X11R6/bin/gv' export G4DAWN_NAMED_PIPE=1 @@ -29,6 +29,6 @@ export ASYM_USE_LEMU=1 export LEMuSR_FIELDMAPS_DIR=/scratch/FieldMaps -alias mu=~/geant4/bin/Linux-g++/LEMuSR +alias mu=$G4WORKDIR/bin/Linux-g++/LEMuSR export wlem=~/LEMuSR diff --git a/geant4/LEMuSR/src/LEMuSRCryoField.cc b/geant4/LEMuSR/src/LEMuSRCryoField.cc index 6a14c4d..b5aaf8b 100644 --- a/geant4/LEMuSR/src/LEMuSRCryoField.cc +++ b/geant4/LEMuSR/src/LEMuSRCryoField.cc @@ -34,7 +34,7 @@ LEMuSRCryoField::LEMuSRCryoField(G4ThreeVector FieldVector) LEMuSRCryoField::~LEMuSRCryoField() {;} -LEMuSRCryoField:: LEMuSRCryoField(G4ThreeVector FieldVector,G4double radius,G4double zmin, G4double zmax, G4double mcpv_z) +LEMuSRCryoField:: LEMuSRCryoField(G4ThreeVector FieldVector,G4double radius,G4double zmin, G4double zmax) { // initialize diff --git a/geant4/LEMuSR/src/LEMuSRCryoHit.cc b/geant4/LEMuSR/src/LEMuSRCryoHit.cc index 736f360..f9ce07d 100644 --- a/geant4/LEMuSR/src/LEMuSRCryoHit.cc +++ b/geant4/LEMuSR/src/LEMuSRCryoHit.cc @@ -26,8 +26,8 @@ #include "G4Colour.hh" #include "G4VisAttributes.hh" #include "G4ios.hh" -#include -#include +#include +#include #include "G4UnitsTable.hh" @@ -85,12 +85,14 @@ void LEMuSRCryoHit::Print() void LEMuSRCryoHit::print(G4String name) { + using namespace std; + ofstream TestPrint(name,ios::app); if (!TestPrint.is_open()) exit(8); - TestPrint << "particle name : " << particle_name <<" ;\n " - << "energy_deposition : " << G4BestUnit(energy_deposition,"Energy") <<" ;\n " - << "time_of_flight : " << G4BestUnit(time_of_flight,"Time") <<" ;\n " - << "position : " << position <<" ;\n " + TestPrint << "particle name : " << particle_name <<" ;\n " + << "energy_deposition : " << G4BestUnit(energy_deposition,"Energy") <<" ;\n " + << "time_of_flight : " << G4BestUnit(time_of_flight,"Time") <<" ;\n " + << "position : " << position <<" ;\n " << "momentum : " << momentum <<" ;\n " < +#include LEMuSRMagneticField::LEMuSRMagneticField(const G4ThreeVector FieldVector) diff --git a/geant4/LEMuSR/src/LEMuSRMaterials.cc b/geant4/LEMuSR/src/LEMuSRMaterials.cc index 0a56e3a..6f5fb31 100644 --- a/geant4/LEMuSR/src/LEMuSRMaterials.cc +++ b/geant4/LEMuSR/src/LEMuSRMaterials.cc @@ -1,4 +1,4 @@ -//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//* +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//* // LOW ENERGY MUON SPIN RELAXATION, ROTATION, RADIATION // // ID : LEMuSRDetectorConstruction.cc , v 1.0 @@ -54,7 +54,7 @@ // G4 CLASSES #include "G4ios.hh" -#include +#include // HEADER @@ -89,7 +89,7 @@ void LEMuSRDetectorConstruction :: LoadAttributes() { // visual attributes - G4VisAttributes InBlack = new G4VisAttributes(G4Colour(0.,0.,0.));// for special projection plot. + //G4VisAttributes InBlack = new G4VisAttributes(G4Colour(0.,0.,0.));// for special projection plot. Blue_style = new G4VisAttributes(G4Colour(0.80,0.83,1.));// InBlack Blue_style->SetForceSolid(true); //Blue_style->SetForceWireframe(false); diff --git a/geant4/LEMuSR/src/LEMuSRMcpHit.cc b/geant4/LEMuSR/src/LEMuSRMcpHit.cc index 7d17a27..f19bdc2 100644 --- a/geant4/LEMuSR/src/LEMuSRMcpHit.cc +++ b/geant4/LEMuSR/src/LEMuSRMcpHit.cc @@ -26,8 +26,8 @@ #include "G4Colour.hh" #include "G4VisAttributes.hh" #include "G4ios.hh" -#include -#include +#include +#include #include "G4UnitsTable.hh" @@ -85,6 +85,8 @@ void LEMuSRMcpHit::Print() void LEMuSRMcpHit::print(G4String name) { + using namespace std; + ofstream TestPrint(name,ios::app); if (!TestPrint.is_open()) exit(8); TestPrint << "particle name : " << particle_name <<" ;\n " diff --git a/geant4/LEMuSR/src/LEMuSROScintHit.cc b/geant4/LEMuSR/src/LEMuSROScintHit.cc index aa6f741..9773ee9 100644 --- a/geant4/LEMuSR/src/LEMuSROScintHit.cc +++ b/geant4/LEMuSR/src/LEMuSROScintHit.cc @@ -26,8 +26,8 @@ #include "G4Colour.hh" #include "G4VisAttributes.hh" #include "G4ios.hh" -#include -#include +#include +#include #include "G4UnitsTable.hh" @@ -85,6 +85,8 @@ void LEMuSROScintHit::Print() void LEMuSROScintHit::print(G4String name) { + using namespace std; + ofstream TestPrint(name,ios::app); if (!TestPrint.is_open()) exit(8); TestPrint << "particle name : " << particle_name <<" ;\n " diff --git a/geant4/LEMuSR/src/LEMuSRParticleChangeForSR.cc b/geant4/LEMuSR/src/LEMuSRParticleChangeForSR.cc index 8815d75..f2a3928 100644 --- a/geant4/LEMuSR/src/LEMuSRParticleChangeForSR.cc +++ b/geant4/LEMuSR/src/LEMuSRParticleChangeForSR.cc @@ -28,10 +28,10 @@ G4Step* LEMuSRParticleChangeForSR::UpdateStepForAtRest(G4Step* pStep) { G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint(); G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint(); - G4Track* aTrack = pStep->GetTrack(); - + //G4Track* aTrack = pStep->GetTrack(); + // update polarization - + pPostStepPoint->SetMomentumDirection(theMomentumDirectionChange); pPostStepPoint->SetKineticEnergy(theEnergyChange); pPostStepPoint->AddPolarization( thePolarizationChange diff --git a/geant4/LEMuSR/src/LEMuSRParticleGunMessenger.cc b/geant4/LEMuSR/src/LEMuSRParticleGunMessenger.cc index b2776a3..d2917b4 100644 --- a/geant4/LEMuSR/src/LEMuSRParticleGunMessenger.cc +++ b/geant4/LEMuSR/src/LEMuSRParticleGunMessenger.cc @@ -37,7 +37,7 @@ #include "G4Tokenizer.hh" #include -#include +#include LEMuSRParticleGunMessenger::LEMuSRParticleGunMessenger(LEMuSRParticleGun* fPtclGun) diff --git a/geant4/LEMuSR/src/LEMuSRPrimaryGeneratorAction.cc b/geant4/LEMuSR/src/LEMuSRPrimaryGeneratorAction.cc index 15ff4cd..c39d6ce 100644 --- a/geant4/LEMuSR/src/LEMuSRPrimaryGeneratorAction.cc +++ b/geant4/LEMuSR/src/LEMuSRPrimaryGeneratorAction.cc @@ -1,4 +1,4 @@ -//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//* +//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//* // LOW ENERGY MUON SPIN RELAXATION, ROTATION, RADIATION // // ID : LEMuSRPrimaryGeneratorAction.cc , v 1.3 @@ -44,7 +44,7 @@ #include "G4RunManager.hh" #include "time.h" #include "G4ios.hh" -#include +#include #include "LEMuSRMuoniumParticle.hh" diff --git a/geant4/LEMuSR/src/LEMuSRRNDMAGField.cc b/geant4/LEMuSR/src/LEMuSRRNDMAGField.cc index 9169135..689449d 100644 --- a/geant4/LEMuSR/src/LEMuSRRNDMAGField.cc +++ b/geant4/LEMuSR/src/LEMuSRRNDMAGField.cc @@ -22,7 +22,7 @@ #include "LEMuSRRNDMAGField.hh" #include "G4ios.hh" -#include +#include #include "Randomize.hh" #include "globals.hh" #include "G4Transform3D.hh" @@ -48,17 +48,15 @@ LEMuSRRNDMAGField::LEMuSRRNDMAGField(const G4ThreeVector FieldVector, G4double LEMuSRRNDMAGField::~LEMuSRRNDMAGField() {;} - -void LEMuSRRNDMAGField::GetFieldValue (const G4double pos[4], - G4double *field ) const +void LEMuSRRNDMAGField::GetFieldValue (const G4double pos[4], G4double *field ) const { - - field[0]= 0.0; + G4double x = pos[0]; // dummy usage to avoid compiler warning + field[0]= 0.0 * x; field[1]= 0.0; field[2]= 0.0; - - + + G4double costheta, sintheta, cosphi, sinphi, theta, phi; phi = 2.0*M_PI*G4UniformRand()*rad; @@ -76,7 +74,7 @@ void LEMuSRRNDMAGField::GetFieldValue (const G4double pos[4], G4ThreeVector direction0(px,py,pz); - + field[0]= BField.x()*(1-randomness) + direction0.x()*(randomness) ;//TAO field[1]= BField.y()*(1-randomness) + direction0.y()*(randomness) ; diff --git a/geant4/LEMuSR/src/LEMuSRRunAction.cc b/geant4/LEMuSR/src/LEMuSRRunAction.cc index 9355a4f..04fd943 100644 --- a/geant4/LEMuSR/src/LEMuSRRunAction.cc +++ b/geant4/LEMuSR/src/LEMuSRRunAction.cc @@ -62,7 +62,7 @@ LEMuSRRunAction::~LEMuSRRunAction() */ void LEMuSRRunAction::BeginOfRunAction(const G4Run* aRun) { - G4UImanager* UI = G4UImanager::GetUIpointer(); + // G4UImanager* UI = G4UImanager::GetUIpointer(); /* G4cout<<"WILL REBUILD THE DETECTOR"<ApplyCommand("/Detector/View total"); G4VPhysicalVolume* newDetector = LEMuSRDetectorConstruction::GetInstance()->Construct(); diff --git a/geant4/LEMuSR/src/LEMuSRScintHit.cc b/geant4/LEMuSR/src/LEMuSRScintHit.cc index 2361228..ba37fe7 100644 --- a/geant4/LEMuSR/src/LEMuSRScintHit.cc +++ b/geant4/LEMuSR/src/LEMuSRScintHit.cc @@ -26,8 +26,8 @@ #include "G4Colour.hh" #include "G4VisAttributes.hh" #include "G4ios.hh" -#include -#include +#include +#include #include "G4UnitsTable.hh" @@ -85,6 +85,8 @@ void LEMuSRScintHit::Print() void LEMuSRScintHit::print(G4String name) { + using namespace std; + ofstream TestPrint(name,ios::app); if (!TestPrint.is_open()) exit(8); TestPrint << "particle_name : " << particle_name <<" ;\n" diff --git a/geant4/LEMuSR/src/LEMuSRStackingActionMessenger.cc b/geant4/LEMuSR/src/LEMuSRStackingActionMessenger.cc index eb7916e..1245837 100644 --- a/geant4/LEMuSR/src/LEMuSRStackingActionMessenger.cc +++ b/geant4/LEMuSR/src/LEMuSRStackingActionMessenger.cc @@ -46,6 +46,7 @@ void LEMuSRStackingActionMessenger::SetNewValue(G4UIcommand *,G4String) G4String LEMuSRStackingActionMessenger::GetCurrentValue(G4UIcommand *) { - ; + //to make the compiler satisfied with function declaration + return "LEMuSRStackingActionMessenger::GetCurrentValue undefined"; } diff --git a/geant4/LEMuSR/src/meyer.cc b/geant4/LEMuSR/src/meyer.cc index 1d3a0d8..f6b803d 100644 --- a/geant4/LEMuSR/src/meyer.cc +++ b/geant4/LEMuSR/src/meyer.cc @@ -348,7 +348,7 @@ void meyer:: Get_F_Function_Meyer(double tau, double Ekin, double Z1, double Z2, Mprint << theta<< " "<< fValues[i]/fValues[1]<<" " << fValuesFolded[i]<