| Summary: | XrayFluoAnalysisManager: use of undeclared identifier 'MeV'; did you mean 'CLHEP::MeV' | ||
|---|---|---|---|
| Product: | Examples/Advanced | Reporter: | Mojca Miklavec <mojca.miklavec.lists> |
| Component: | xray_fluorescence | Assignee: | Luciano Pandola <luciano.pandola> |
| Status: | RESOLVED FIXED | ||
| Severity: | trivial | CC: | kelsey, pandola |
| Priority: | P5 | ||
| Version: | other | ||
| Hardware: | All | ||
| OS: | All | ||
Could you please try adding #include "G4SystemOfUnits.hh" to XrayFluoAnalysisManager.cc? That was removed from globals.hh, in order to reduce external dependences and collisions, after the 9.6 release. The testing and build process should have caught this... I just checked our nightly build logs; the most recent MacOSX 10.7 build, with clang 3.1 does not report the missing namespace problem, nor do our late GCC builds (we have 4.7 and 4.8 for testing). I also see that this example has numerous "good coding rules" violations, which often lead to these sorts of obscure warnings depending on the exact compiler and options used. Yes, thank you, it helps, but I also had to add it to XrayFluoRunAction.cc, else it failed again with the same problem.
Sorry, I was probably wrong about the compiler version. Here's the full confusing string:
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
The remaining warnings are as follows:
/app/geant4.10.00.b01/examples/advanced/xray_fluorescence/src/XrayFluoAnalysisManager.cc:120:76: warning: declaration shadows a field of
'XrayFluoAnalysisManager' [-Wshadow]
void XrayFluoAnalysisManager::CreatePersistency(G4String fileName,G4String persistencyType,
^
/app/geant4.10.00.b01/examples/advanced/xray_fluorescence/include/XrayFluoAnalysisManager.hh:125:12: note: previous declaration is here
G4String persistencyType;
^
/app/geant4.10.00.b01/examples/advanced/xray_fluorescence/src/XrayFluoAnalysisManager.cc:259:12: warning: declaration shadows a field of
'XrayFluoAnalysisManager' [-Wshadow]
G4String persistencyType;
^
/app/geant4.10.00.b01/examples/advanced/xray_fluorescence/include/XrayFluoAnalysisManager.hh:125:12: note: previous declaration is here
G4String persistencyType;
^
/app/geant4.10.00.b01/examples/advanced/xray_fluorescence/include/XrayFluoAnalysisManager.hh:161:20: warning: private field 'beamCloud' is
not used [-Wunused-private-field]
AIDA::ICloud1D* beamCloud;
^
/app/geant4.10.00.b01/examples/advanced/xray_fluorescence/include/XrayFluoAnalysisManager.hh:163:20: warning: private field 'cloud_2' is
not used [-Wunused-private-field]
AIDA::ICloud1D* cloud_2;
^
/app/geant4.10.00.b01/examples/advanced/xray_fluorescence/include/XrayFluoAnalysisManager.hh:164:20: warning: private field 'cloud_3' is
not used [-Wunused-private-field]
AIDA::ICloud1D* cloud_3;
^
5 warnings generated.
Thank you for the followup! As I noted in my previous comment, the X-ray fluorescence example has a number of coding issues. My guess is that it has not been adequately maintained to follow some of the change and improvements applied to the G4 toolkit proper. The warnings you mention (especially the "unused field" ones) are relatively benign, if annoying. The "shadowing" warnings occur when a function parameter or local variable is given the same name as a class data member. So long as the function involved is not _supposed_ to be access the member data, these warnings may be ignored until the code is fixed. Ciao, this problem was unnoticed up to now, because it appears only in the pieces of code that are compiled when AIDA is available (i.e. G4ANALYSIS_USE = 1). In the routine testing, the compilation is performed with no G4ANALYSIS_USE. It has been fixed now. My apologies for the delay. |
In version of Geant4 10.00.b01 the example doesn't build (I'm building on Mac OS X 10.7 with clang 4.2). It fails with /app/geant4-10.0/work/geant4.10.00.b01/examples/advanced/xray_fluorescence/src/XrayFluoAnalysisManager.cc:295:72: error: use of undeclared identifier 'MeV'; did you mean 'CLHEP::MeV'? gunParticleEnergies->push_back(tupleData->getDouble(energyIndex)*MeV); ^~~ CLHEP::MeV /opt/local/include/CLHEP/Units/SystemOfUnits.h:158:23: note: 'CLHEP::MeV' declared here static const double MeV = megaelectronvolt; ^ /app/geant4-10.0/work/geant4.10.00.b01/examples/advanced/xray_fluorescence/src/XrayFluoAnalysisManager.cc:588:39: error: use of undeclared identifier 'keV'; did you mean 'CLHEP::keV'? histo_4->fill(gammaLeavingSample/keV); ^~~ CLHEP::keV /opt/local/include/CLHEP/Units/SystemOfUnits.h:160:23: note: 'CLHEP::keV' declared here static const double keV = kiloelectronvolt; ^ /app/geant4-10.0/work/geant4.10.00.b01/examples/advanced/xray_fluorescence/src/XrayFluoAnalysisManager.cc:620:39: error: use of undeclared identifier 'keV'; did you mean 'CLHEP::keV'? histo_5->fill(eleLeavingSample/keV); ^~~ CLHEP::keV /opt/local/include/CLHEP/Units/SystemOfUnits.h:160:23: note: 'CLHEP::keV' declared here static const double keV = kiloelectronvolt; ^ /opt/local/bin/cmake -E cmake_progress_report /app/geant4-10.0/work/build/CMakeFiles /app/geant4-10.0/work/geant4.10.00.b01/examples/advanced/xray_fluorescence/src/XrayFluoAnalysisManager.cc:628:37: error: use of undeclared identifier 'keV'; did you mean 'CLHEP::keV'? histo_9->fill(protonsLeavSam/keV); ^~~ CLHEP::keV /opt/local/include/CLHEP/Units/SystemOfUnits.h:160:23: note: 'CLHEP::keV' declared here static const double keV = kiloelectronvolt; ^ /app/geant4-10.0/work/geant4.10.00.b01/examples/advanced/xray_fluorescence/src/XrayFluoAnalysisManager.cc:694:40: error: use of undeclared identifier 'keV'; did you mean 'CLHEP::keV'? histo_2->fill(gammaBornInSample/keV); ^~~ CLHEP::keV /opt/local/include/CLHEP/Units/SystemOfUnits.h:160:23: note: 'CLHEP::keV' declared here static const double keV = kiloelectronvolt; ^ /app/geant4-10.0/work/geant4.10.00.b01/examples/advanced/xray_fluorescence/src/XrayFluoAnalysisManager.cc:711:38: error: use of undeclared identifier 'keV'; did you mean 'CLHEP::keV'? histo_3->fill(eleBornInSample/keV); ^~~ CLHEP::keV /opt/local/include/CLHEP/Units/SystemOfUnits.h:160:23: note: 'CLHEP::keV' declared here static const double keV = kiloelectronvolt; ^ /app/geant4-10.0/work/geant4.10.00.b01/examples/advanced/xray_fluorescence/src/XrayFluoAnalysisManager.cc:732:40: error: use of undeclared identifier 'keV'; did you mean 'CLHEP::keV'? histo_6->fill( gammaAtTheDetPre/keV); ^~~ CLHEP::keV /opt/local/include/CLHEP/Units/SystemOfUnits.h:160:23: note: 'CLHEP::keV' declared here static const double keV = kiloelectronvolt; ^ /app/geant4-10.0/work/geant4.10.00.b01/examples/advanced/xray_fluorescence/src/XrayFluoAnalysisManager.cc:741:42: error: use of undeclared identifier 'keV'; did you mean 'CLHEP::keV'? histo_8->fill( protonsAtTheDetPre/keV); ^~~ CLHEP::keV /opt/local/include/CLHEP/Units/SystemOfUnits.h:160:23: note: 'CLHEP::keV' declared here static const double keV = kiloelectronvolt; ^ /app/geant4-10.0/work/geant4.10.00.b01/examples/advanced/xray_fluorescence/src/XrayFluoAnalysisManager.cc:790:27: error: use of undeclared identifier 'keV'; did you mean 'CLHEP::keV'? histo_1->fill(energyDep/keV); ^~~ CLHEP::keV /opt/local/include/CLHEP/Units/SystemOfUnits.h:160:23: note: 'CLHEP::keV' declared here static const double keV = kiloelectronvolt; ^ /app/geant4-10.0/work/geant4.10.00.b01/examples/advanced/xray_fluorescence/src/XrayFluoAnalysisManager.cc:805:26: error: use of undeclared identifier 'keV'; did you mean 'CLHEP::keV'? histo_7->fill(energy/keV); ^~~ CLHEP::keV /opt/local/include/CLHEP/Units/SystemOfUnits.h:160:23: note: 'CLHEP::keV' declared here static const double keV = kiloelectronvolt; ^