Hi, I have the following error compiling with g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3 : --------------- src/G4PhotoElectricAngularGeneratorSauterGavrila.cc:82: error: conversion from ‘G4double’ to non-scalar type ‘G4ThreeVector’ requested make[2]: *** [/home/malemi/geant4.9.3.p01/tmp/Linux-g++/G4emlowenergy/G4PhotoElectricAngularGeneratorSauterGavrila.o] Error 1 ------------------------------- The file seems to return a G4Double actually, and not a Vector. Nonetheless in previous G4 releases had the same code and no error.... ? Can it be a mistake of mine? Mario
The compilation error you get is due to the fact you're using a version of CLHEP which is not the version supported for release 9.3. Please, use CLHEP-2.0.4.5. New versions of CLHEP will be supported in forthcoming releases of Geant4.
*** Problem 1124 has been marked as a duplicate of this problem. ***
Sorry for reopening it. I am using CLHEP 2.0.5.0.b01, it's a brand new installation, everything should be up to date. Regards, Mario
sorry, I got it... one should use the *old* version of CLHEP, not the newest... sorry again
CLHEP-2.0.4.5. just hides this bug allowing conversion G4double to G4ThreeVector. CLHEP-2.1.0.0.bo1 has different CTORs for G4ThreeVector which do not allow such conversion. Here you are a snippet of the problem code G4ThreeVector G4PhotoElectricAngularGeneratorSauterGavrila::GetPhotoElectronDirection(const G4ThreeVector& direction, const G4double eKineticEnergy, const G4ThreeVector&, const G4int) const { ... 73 G4double costeta = 1.; ... 80 if (gamma > 5.) { 81 G4ThreeVector direction (sinteta*cosphi, sinteta*sinphi, costeta); 82 return costeta; 83 } ... } Inside the 'if' block a new local variable 'direction' of correct return type is defined and never used in the block. G4double value is returned at the line 82. I think there is still the bug which does not depend on CLHEP.
couldn't agree more.... it's good practice return a Vector instead of a double, when you declare that your method is going to return a Vector and not a double:)) mario
Installing the current dev version under Fedora 13 with gcc4.4.4-10. Same problem met of course, G4PhotoElectricAngularGeneratorSauterGavrila.cc line 82 returns G4Double. I have edited as follows to correct the error: 80 if (gamma > 5.) { 81 G4ThreeVector direction (sinteta*cosphi, sinteta*sinphi, costeta); 82 // return costeta; 83 // JG 04/09/10 84 return direction; 85 } The bug is to try to return costeta instead of returning direction , as done for the non trivial case gamma < 5. : 102 G4ThreeVector photoelectrondirection (sinteta*cosphi, sinteta*sinphi , costeta); 103 photoelectrondirection.rotateUz(direction); 104 return photoelectrondirection; Line numbers 102-104 are shifted by 2 w.r.t. the original file because I added 82,84.
Thank you so much Jacques. Your fix was added to Geant4 CVS.
*** Problem 1142 has been marked as a duplicate of this problem. ***
*** Problem 1144 has been marked as a duplicate of this problem. ***