diff --git a/DDG4/lcio/Geant4Output2LCIO.cpp b/DDG4/lcio/Geant4Output2LCIO.cpp index d5adee47045faa3436e6f9da5fed22c26c08bc4c..2aa8ff6ded5a733769886ecf6bd34aab50425f84 100644 --- a/DDG4/lcio/Geant4Output2LCIO.cpp +++ b/DDG4/lcio/Geant4Output2LCIO.cpp @@ -183,17 +183,17 @@ lcio::LCCollectionVec* Geant4Output2LCIO::saveParticles(Geant4ParticleMap* parti MCParticleImpl* q = new lcio::MCParticleImpl(); q->setPDG(p->pdgID); - float ps_fa[3] = {float(p->psx/GeV),float(p->psy/GeV),float(p->psz/GeV)}; + float ps_fa[3] = {float(p->psx/CLHEP::GeV),float(p->psy/CLHEP::GeV),float(p->psz/CLHEP::GeV)}; q->setMomentum( ps_fa ); - double vs_fa[3] = { p->vsx/mm, p->vsy/mm, p->vsz/mm } ; + double vs_fa[3] = { p->vsx/CLHEP::mm, p->vsy/CLHEP::mm, p->vsz/CLHEP::mm } ; q->setVertex( vs_fa ); - double ve_fa[3] = { p->vex/mm, p->vey/mm, p->vez/mm } ; + double ve_fa[3] = { p->vex/CLHEP::mm, p->vey/CLHEP::mm, p->vez/CLHEP::mm } ; q->setEndpoint( ve_fa ); - q->setTime(p->time/ns); - q->setMass(p->mass/GeV); + q->setTime(p->time/CLHEP::ns); + q->setMass(p->mass/CLHEP::GeV); q->setCharge(def ? def->GetPDGCharge() : 0); // Charge(e+) = 1 ! // Set generator status diff --git a/DDG4/lcio/LCIOConversions.cpp b/DDG4/lcio/LCIOConversions.cpp index 77edb08762c90cd4dc2b200c5bd48fc3a51a7178..be31bed962e390a1852ca533b807c6fc907b9e8b 100644 --- a/DDG4/lcio/LCIOConversions.cpp +++ b/DDG4/lcio/LCIOConversions.cpp @@ -30,6 +30,8 @@ #include "UTIL/Operators.h" #include "UTIL/ILDConf.h" +#include <G4SystemOfUnits.hh> + using namespace std; //================================================================================== @@ -119,16 +121,16 @@ namespace DD4hep { const Geant4Tracker::Hit::Contribution& t = hit->truth; int trackID = pm->particleID(t.trackID); EVENT::MCParticle* lc_mcp = (EVENT::MCParticle*)lc_part->getElementAt(trackID); - double pos[3] = {hit->position.x()/mm, hit->position.y()/mm, hit->position.z()/mm}; + double pos[3] = {hit->position.x()/CLHEP::mm, hit->position.y()/CLHEP::mm, hit->position.z()/CLHEP::mm}; lcio::SimTrackerHitImpl* lc_hit = new lcio::SimTrackerHitImpl; lc_hit->setCellID0((hit->cellID >> 0 ) & 0xFFFFFFFF); lc_hit->setCellID1((hit->cellID >> sizeof(int)) & 0xFFFFFFFF); - lc_hit->setEDep(hit->energyDeposit/GeV); - lc_hit->setPathLength(hit->length/mm); - lc_hit->setTime(hit->truth.time/ns); + lc_hit->setEDep(hit->energyDeposit/CLHEP::GeV); + lc_hit->setPathLength(hit->length/CLHEP::mm); + lc_hit->setTime(hit->truth.time/CLHEP::ns); lc_hit->setMCParticle(lc_mcp); lc_hit->setPosition(pos); - lc_hit->setMomentum(hit->momentum.x()/GeV,hit->momentum.y()/GeV,hit->momentum.z()/GeV); + lc_hit->setMomentum(hit->momentum.x()/CLHEP::GeV,hit->momentum.y()/CLHEP::GeV,hit->momentum.z()/CLHEP::GeV); lc_coll->addElement(lc_hit); } return lc_coll; diff --git a/DDG4/lcio/LCIOEventReader.cpp b/DDG4/lcio/LCIOEventReader.cpp index 1a0cf097b1c039882db48f84ee4adfe3748972b0..5bda98d11ec22d5971a62b790a5c48d1d6b7da57 100644 --- a/DDG4/lcio/LCIOEventReader.cpp +++ b/DDG4/lcio/LCIOEventReader.cpp @@ -95,24 +95,24 @@ LCIOEventReader::readParticles(int event_number, vector<Particle*>& particles) PropertyMask status(p->status); p->pdgID = pdg; p->charge = int(mcp->getCharge()*3.0); - p->psx = mom[0]*GeV; - p->psy = mom[1]*GeV; - p->psz = mom[2]*GeV; - p->time = mcp->getTime()*ns; - p->properTime = mcp->getTime()*ns; - p->vsx = vsx[0]*mm; - p->vsy = vsx[1]*mm; - p->vsz = vsx[2]*mm; - p->vex = vex[0]*mm; - p->vey = vex[1]*mm; - p->vez = vex[2]*mm; + p->psx = mom[0]*CLHEP::GeV; + p->psy = mom[1]*CLHEP::GeV; + p->psz = mom[2]*CLHEP::GeV; + p->time = mcp->getTime()*CLHEP::ns; + p->properTime = mcp->getTime()*CLHEP::ns; + p->vsx = vsx[0]*CLHEP::mm; + p->vsy = vsx[1]*CLHEP::mm; + p->vsz = vsx[2]*CLHEP::mm; + p->vex = vex[0]*CLHEP::mm; + p->vey = vex[1]*CLHEP::mm; + p->vez = vex[2]*CLHEP::mm; p->process = 0; p->spin[0] = spin[0]; p->spin[1] = spin[1]; p->spin[2] = spin[2]; p->colorFlow[0] = color[0]; p->colorFlow[0] = color[1]; - p->mass = mcp->getMass()*GeV; + p->mass = mcp->getMass()*CLHEP::GeV; const EVENT::MCParticleVec &par = mcp->getParents(), &dau=mcp->getDaughters(); for(int num=dau.size(),k=0; k<num; ++k) p->daughters.insert(GET_ENTRY(mcparts,dau[k])); diff --git a/DDG4/plugins/Geant4FieldTrackingSetup.cpp b/DDG4/plugins/Geant4FieldTrackingSetup.cpp index a373565cb665a3a06dc4c3563d099563b47e73b7..6d89b84fedca72a8ab768ff3a474e82c3777ae06 100644 --- a/DDG4/plugins/Geant4FieldTrackingSetup.cpp +++ b/DDG4/plugins/Geant4FieldTrackingSetup.cpp @@ -141,7 +141,7 @@ namespace { Geant4FieldTrackingSetup::Geant4FieldTrackingSetup() : eq_typ(), stepper_typ() { eps_min = -1.0; eps_max = -1.0; - min_chord_step = 1.0e-2 *mm; + min_chord_step = 1.0e-2 *CLHEP::mm; delta_chord = -1.0; delta_one_step = -1.0; delta_intersection = -1.0; diff --git a/DDG4/plugins/Geant4Particles.cpp b/DDG4/plugins/Geant4Particles.cpp index 4f5c9cb402f671c814e416a7eb7c4721813474bb..bc3a0b31570a64205da0a910b9b5695cfc21f756 100644 --- a/DDG4/plugins/Geant4Particles.cpp +++ b/DDG4/plugins/Geant4Particles.cpp @@ -7,6 +7,8 @@ // //==================================================================== +#include <G4Version.hh> + // Framework include files #include "DDG4/Factories.h" @@ -203,8 +205,15 @@ DECLARE_GEANT4_PARTICLE(G4BMesonZero) DECLARE_GEANT4_PARTICLE(G4AntiKaonZero) #include "G4EtaPrime.hh" DECLARE_GEANT4_PARTICLE(G4EtaPrime) + +#if G4VERSION_NUMBER >= 1000 +#include "G4Upsilon.hh" +DECLARE_GEANT4_PARTICLE(G4Upsilon) +#else #include "G4Upsiron.hh" DECLARE_GEANT4_PARTICLE(G4Upsiron) +#endif + #include "G4AntiBMesonZero.hh" DECLARE_GEANT4_PARTICLE(G4AntiBMesonZero) #include "G4JPsi.hh" diff --git a/DDG4/plugins/Geant4PhysicsConstructors.cpp b/DDG4/plugins/Geant4PhysicsConstructors.cpp index 1905201ce262e2a348006fd6faaffffab159da7d..033d654ab4f9a695ead9df6d4fe440fe434b3e71 100644 --- a/DDG4/plugins/Geant4PhysicsConstructors.cpp +++ b/DDG4/plugins/Geant4PhysicsConstructors.cpp @@ -53,41 +53,28 @@ DECLARE_GEANT4_PHYSICS(G4IonBinaryCascadePhysics) #ifdef GEANT4_9_6 #include "G4IonINCLXXPhysics.hh" DECLARE_GEANT4_PHYSICS(G4IonINCLXXPhysics) + +#if G4VERSION_NUMBER < 1000 #include "G4IonLHEPPhysics.hh" DECLARE_GEANT4_PHYSICS(G4IonLHEPPhysics) #endif +#endif + #include "G4IonPhysics.hh" DECLARE_GEANT4_PHYSICS(G4IonPhysics) #include "G4IonQMDPhysics.hh" DECLARE_GEANT4_PHYSICS(G4IonQMDPhysics) + +#if G4VERSION_NUMBER < 1000 #include "G4LHEPStoppingPhysics.hh" DECLARE_GEANT4_PHYSICS(G4LHEPStoppingPhysics) #include "G4QStoppingPhysics.hh" DECLARE_GEANT4_PHYSICS(G4QStoppingPhysics) -#include "G4HadronElasticPhysics.hh" -DECLARE_GEANT4_PHYSICS(G4HadronElasticPhysics) -#include "G4HadronDElasticPhysics.hh" -DECLARE_GEANT4_PHYSICS(G4HadronDElasticPhysics) -#include "G4HadronElasticPhysicsHP.hh" -DECLARE_GEANT4_PHYSICS(G4HadronElasticPhysicsHP) -#include "G4HadronElasticPhysicsLEND.hh" -DECLARE_GEANT4_PHYSICS(G4HadronElasticPhysicsLEND) #include "G4HadronElasticPhysicsLHEP.hh" DECLARE_GEANT4_PHYSICS(G4HadronElasticPhysicsLHEP) -#include "G4HadronElasticPhysicsXS.hh" -DECLARE_GEANT4_PHYSICS(G4HadronElasticPhysicsXS) -#include "G4HadronHElasticPhysics.hh" -DECLARE_GEANT4_PHYSICS(G4HadronHElasticPhysics) #include "G4HadronQElasticPhysics.hh" DECLARE_GEANT4_PHYSICS(G4HadronQElasticPhysics) -#include "G4NeutronTrackingCut.hh" -DECLARE_GEANT4_PHYSICS(G4NeutronTrackingCut) - -// Optical physics -#include "G4OpticalPhysics.hh" -DECLARE_GEANT4_PHYSICS(G4OpticalPhysics) - #include "G4QAtomicPhysics.hh" DECLARE_GEANT4_PHYSICS(G4QAtomicPhysics) #include "G4QCaptureAtRestPhysics.hh" @@ -102,9 +89,6 @@ DECLARE_GEANT4_PHYSICS(G4QNeutrinoPhysics) DECLARE_GEANT4_PHYSICS(G4QStoppingPhysics) #include "G4QIonPhysics.hh" DECLARE_GEANT4_PHYSICS(G4QIonPhysics) -#include "G4RadioactiveDecayPhysics.hh" -DECLARE_GEANT4_PHYSICS(G4RadioactiveDecayPhysics) - // LHEP hadrons #include "HadronPhysicsLHEP.hh" DECLARE_GEANT4_PHYSICS(HadronPhysicsLHEP) @@ -125,7 +109,35 @@ DECLARE_GEANT4_PHYSICS(HadronPhysicsQGSP_FTFP_BERT) #include "HadronPhysicsFTFP_BERT.hh" DECLARE_GEANT4_PHYSICS(HadronPhysicsFTFP_BERT) +#endif + +#include "G4HadronElasticPhysics.hh" +DECLARE_GEANT4_PHYSICS(G4HadronElasticPhysics) +#include "G4HadronDElasticPhysics.hh" +DECLARE_GEANT4_PHYSICS(G4HadronDElasticPhysics) +#include "G4HadronElasticPhysicsHP.hh" +DECLARE_GEANT4_PHYSICS(G4HadronElasticPhysicsHP) +#include "G4HadronElasticPhysicsLEND.hh" +DECLARE_GEANT4_PHYSICS(G4HadronElasticPhysicsLEND) +#include "G4HadronElasticPhysicsXS.hh" +DECLARE_GEANT4_PHYSICS(G4HadronElasticPhysicsXS) +#include "G4HadronHElasticPhysics.hh" +DECLARE_GEANT4_PHYSICS(G4HadronHElasticPhysics) +#include "G4NeutronTrackingCut.hh" +DECLARE_GEANT4_PHYSICS(G4NeutronTrackingCut) + +// Optical physics +#include "G4OpticalPhysics.hh" +DECLARE_GEANT4_PHYSICS(G4OpticalPhysics) + +#include "G4RadioactiveDecayPhysics.hh" +DECLARE_GEANT4_PHYSICS(G4RadioactiveDecayPhysics) + + + #ifdef GEANT4_9_6 + +#if G4VERSION_NUMBER < 1000 #include "HadronPhysicsQGSP_INCLXX.hh" DECLARE_GEANT4_PHYSICS(HadronPhysicsQGSP_INCLXX) #include "HadronPhysicsFTFP_BERT.hh" @@ -138,6 +150,10 @@ DECLARE_GEANT4_PHYSICS(HadronPhysicsQGSP_BERT_95) DECLARE_GEANT4_PHYSICS(HadronPhysicsQGSP_FTFP_BERT_95) #endif +#endif + +#if G4VERSION_NUMBER < 1000 + #include "HadronPhysicsCHIPS.hh" DECLARE_GEANT4_PHYSICS(HadronPhysicsCHIPS) #include "HadronPhysicsFTF_BIC.hh" @@ -172,6 +188,7 @@ DECLARE_GEANT4_PHYSICS(HadronPhysicsQGSP_BIC_HP) DECLARE_GEANT4_PHYSICS(HadronPhysicsQGSP_FTFP_BERT) #include "HadronPhysicsQGSP.hh" DECLARE_GEANT4_PHYSICS(HadronPhysicsQGSP) +#endif #if 0 #include ".hh" diff --git a/DDG4/plugins/Geant4PhysicsLists.cpp b/DDG4/plugins/Geant4PhysicsLists.cpp index 4d04f3263edeca6bc708c037bbdc3e9100ff1411..f502287559511aa7229f50f7352e018593fbf3f5 100644 --- a/DDG4/plugins/Geant4PhysicsLists.cpp +++ b/DDG4/plugins/Geant4PhysicsLists.cpp @@ -41,20 +41,26 @@ namespace { DECLARE_GEANT4_PHYSICS_LIST(EmptyPhysics) // Physics constructors from source/physics_lists +#if G4VERSION_NUMBER < 1000 #include "CHIPS.hh" DECLARE_GEANT4_PHYSICS_LIST(CHIPS) +#endif #ifdef GEANT4_9_6 + +#if G4VERSION_NUMBER < 1000 #include "CHIPS_HP.hh" DECLARE_GEANT4_PHYSICS_LIST(CHIPS_HP) -#include "FTFP_BERT.hh" - DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT) -#include "FTFP_BERT_HP.hh" - DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_HP) #include "QGSP_BERT_95.hh" DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_95) #include "QGSP_BERT_95XS.hh" DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_95XS) +#endif + +#include "FTFP_BERT.hh" + DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT) +#include "FTFP_BERT_HP.hh" + DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_HP) #include "QGSP_INCLXX.hh" DECLARE_GEANT4_PHYSICS_LIST(QGSP_INCLXX) @@ -62,53 +68,66 @@ DECLARE_GEANT4_PHYSICS_LIST(CHIPS) #include "FTF_BIC.hh" DECLARE_GEANT4_PHYSICS_LIST(FTF_BIC) + +#if G4VERSION_NUMBER < 1000 + +// extra EM physics lists only via physicsListFactory #include "FTFP_BERT_EMV.hh" DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_EMV) #include "FTFP_BERT_EMX.hh" DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_EMX) -#include "FTFP_BERT.hh" - DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT) -#include "FTFP_BERT_TRV.hh" - DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_TRV) -#include "LBE.hh" -//DECLARE_GEANT4_PHYSICS_LIST(LBE) takes no verbosity arg! #include "LHEP_EMV.hh" DECLARE_GEANT4_PHYSICS_LIST(LHEP_EMV) +#include "QGSP_BERT_EMV.hh" + DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_EMV) +#include "QGSP_BERT_EMX.hh" + DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_EMX) + + +#include "QGSP_BIC_EMY.hh" + DECLARE_GEANT4_PHYSICS_LIST(QGSP_BIC_EMY) + + #include "LHEP.hh" DECLARE_GEANT4_PHYSICS_LIST(LHEP) -#include "QBBC.hh" - DECLARE_GEANT4_PHYSICS_LIST(QBBC) -#include "QGS_BIC.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGS_BIC) #include "QGSC_BERT.hh" DECLARE_GEANT4_PHYSICS_LIST(QGSC_BERT) #include "QGSC_CHIPS.hh" DECLARE_GEANT4_PHYSICS_LIST(QGSC_CHIPS) #include "QGSP_BERT_CHIPS.hh" DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_CHIPS) -#include "QGSP_BERT_EMV.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_EMV) -#include "QGSP_BERT_EMX.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_EMX) -#include "QGSP_BERT.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT) #include "QGSP_BERT_NOLEP.hh" DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_NOLEP) #include "QGSP_BERT_TRV.hh" DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_TRV) -#include "QGSP_BIC_EMY.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BIC_EMY) +#include "QGSP.hh" + DECLARE_GEANT4_PHYSICS_LIST(QGSP) +#include "QGSP_QEL.hh" + DECLARE_GEANT4_PHYSICS_LIST(QGSP_QEL) + +#include "HadronPhysicsCHIPS.hh" + + +#endif + +#include "FTFP_BERT.hh" + DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT) +#include "FTFP_BERT_TRV.hh" + DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_TRV) +#include "LBE.hh" +//DECLARE_GEANT4_PHYSICS_LIST(LBE) takes no verbosity arg! +#include "QBBC.hh" + DECLARE_GEANT4_PHYSICS_LIST(QBBC) +#include "QGS_BIC.hh" + DECLARE_GEANT4_PHYSICS_LIST(QGS_BIC) +#include "QGSP_BERT.hh" + DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT) #include "QGSP_BIC_HP.hh" DECLARE_GEANT4_PHYSICS_LIST(QGSP_BIC_HP) #include "QGSP_BIC.hh" DECLARE_GEANT4_PHYSICS_LIST(QGSP_BIC) #include "QGSP_FTFP_BERT.hh" DECLARE_GEANT4_PHYSICS_LIST(QGSP_FTFP_BERT) -#include "QGSP.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP) -#include "QGSP_QEL.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_QEL) -#include "HadronPhysicsCHIPS.hh" #if 0 #include ".hh" diff --git a/DDG4/plugins/Geant4Processes.cpp b/DDG4/plugins/Geant4Processes.cpp index 5938bea205f205768c2f52c2602480c500fe28db..0441f3f0a5855a134afa691ade82db50c555bd27 100644 --- a/DDG4/plugins/Geant4Processes.cpp +++ b/DDG4/plugins/Geant4Processes.cpp @@ -122,8 +122,12 @@ DECLARE_GEANT4_PROCESS(G4BraggIonGasModel) DECLARE_GEANT4_PROCESS(G4BetheBlochIonGasModel) #include "G4WentzelVIModel.hh" DECLARE_GEANT4_PROCESS(G4WentzelVIModel) + +#if G4VERSION_NUMBER < 1000 #include "G4UrbanMscModel93.hh" DECLARE_GEANT4_PROCESS(G4UrbanMscModel93) +#endif + #include "G4hImpactIonisation.hh" DECLARE_GEANT4_PROCESS(G4hImpactIonisation) diff --git a/DDG4/plugins/Geant4SDActions.cpp b/DDG4/plugins/Geant4SDActions.cpp index f309cb56689a7509ebb6cc7a933e52a17415ca24..5b66094fa9d3e3d9b2c20fe8f138d30f50d5e62a 100644 --- a/DDG4/plugins/Geant4SDActions.cpp +++ b/DDG4/plugins/Geant4SDActions.cpp @@ -248,8 +248,8 @@ namespace DD4hep { collection->add(hit); sensitive->printM2("+++ TrackID:%6d [%s] CREATE hit combination with %2d deposit(s):" " %e MeV Pos:%8.2f %8.2f %8.2f", - pre.truth.trackID,sensitive->c_name(),combined,pre.truth.deposit/MeV, - pos.X()/mm,pos.Y()/mm,pos.Z()/mm); + pre.truth.trackID,sensitive->c_name(),combined,pre.truth.deposit/CLHEP::MeV, + pos.X()/CLHEP::mm,pos.Y()/CLHEP::mm,pos.Z()/CLHEP::mm); clear(); } @@ -265,7 +265,7 @@ namespace DD4hep { extractHit(coll); } /// There must be something in. - if ( h.deposit()/keV <= 0 ) { + if ( h.deposit()/CLHEP::keV <= 0 ) { return false; } /// Initialize the deposits of the next hit. diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp index ba905b05920a7f713341e6ffb9f7b266ec99fa17..bd834e28da3dd2ff9c2b97f5bcb1a235445cafa5 100644 --- a/DDG4/src/Geant4Converter.cpp +++ b/DDG4/src/Geant4Converter.cpp @@ -294,7 +294,7 @@ void* Geant4Converter::handleElement(const string& name, const Atom element) con } } else { - g4e = new G4Element(element->GetTitle(), name, element->Z(), element->A() * (g / mole)); + g4e = new G4Element(element->GetTitle(), name, element->Z(), element->A() * (CLHEP::g / CLHEP::mole)); } stringstream str; str << (*g4e); @@ -313,7 +313,7 @@ void* Geant4Converter::handleMaterial(const string& name, Material medium) const if (!mat) { TGeoMaterial* m = medium->GetMaterial(); G4State state = kStateUndefined; - double density = m->GetDensity() * (gram / cm3); + double density = m->GetDensity() * (CLHEP::gram / CLHEP::cm3); if (density < 1e-25) density = 1e-25; switch (m->GetState()) { diff --git a/DDG4/src/Geant4Exec.cpp b/DDG4/src/Geant4Exec.cpp index 217bd3f1800426459d5bcc4744bc3fe5d2d9d320..6729076f47dec56488e0b1701da6363d94f85993 100644 --- a/DDG4/src/Geant4Exec.cpp +++ b/DDG4/src/Geant4Exec.cpp @@ -6,6 +6,9 @@ // Author : M.Frank // //==================================================================== + +#include <G4Version.hh> + #include "DD4hep/Printout.h" #include "DD4hep/Primitives.h" #include "DD4hep/InstanceCount.h" @@ -15,7 +18,9 @@ #include "G4UserTrackingAction.hh" #include "G4UserStackingAction.hh" #include "G4UserSteppingAction.hh" +#if G4VERSION_NUMBER < 1000 #include "G4UserReactionAction.hh" +#endif #include "G4VUserPhysicsList.hh" #include "G4VModularPhysicsList.hh" #include "G4VUserPrimaryGeneratorAction.hh" diff --git a/DDG4/src/Geant4HierarchyDump.cpp b/DDG4/src/Geant4HierarchyDump.cpp index 2e6b463f96246271141d838e56aa5a88f4749dcb..a2ed19f7b21bcb086a2c0d4238859c7492585267 100644 --- a/DDG4/src/Geant4HierarchyDump.cpp +++ b/DDG4/src/Geant4HierarchyDump.cpp @@ -7,6 +7,8 @@ // //==================================================================== +#include <G4Version.hh> + #include "DD4hep/LCDD.h" #include "DD4hep/Volumes.h" #include "DD4hep/Printout.h" @@ -20,7 +22,9 @@ // Geant4 include files #include "G4Element.hh" #include "G4SDManager.hh" +#if G4VERSION_NUMBER < 1000 #include "G4Assembly.hh" +#endif #include "G4AssemblyVolume.hh" #include "G4Box.hh" #include "G4Trd.hh" diff --git a/DDG4/src/Geant4InputHandling.cpp b/DDG4/src/Geant4InputHandling.cpp index fb34c11eeecea1a15c368e22e19aa8ffbeffbb09..2adb54e2222aef555ee72086d8da60ffb14bd64b 100644 --- a/DDG4/src/Geant4InputHandling.cpp +++ b/DDG4/src/Geant4InputHandling.cpp @@ -156,8 +156,8 @@ int DD4hep::Simulation::boostInteraction(const Geant4Action* /* caller */, // Now move begin and end-vertex of all primary vertices accordingly for(iv=inter->vertices.begin(); iv != inter->vertices.end(); ++iv) { Geant4Vertex* v = (*iv).second; - double t = gamma * v->time + betagamma * v->x / c_light; - double x = gamma * v->x + betagamma * c_light * v->time; + double t = gamma * v->time + betagamma * v->x / CLHEP::c_light; + double x = gamma * v->x + betagamma * CLHEP::c_light * v->time; double y = v->y; double z = v->z; v->x = x; @@ -169,8 +169,8 @@ int DD4hep::Simulation::boostInteraction(const Geant4Action* /* caller */, // Now move begin and end-vertex of all primary and generator particles accordingly for(ip=inter->particles.begin(); ip != inter->particles.end(); ++ip) { Geant4ParticleHandle p = (*ip).second; - double t = gamma * p->time + betagamma * p->vsx / c_light; - double x = gamma * p->vsx + betagamma * c_light * p->time; + double t = gamma * p->time + betagamma * p->vsx / CLHEP::c_light; + double x = gamma * p->vsx + betagamma * CLHEP::c_light * p->time; double y = p->vsx; double z = p->vsz; @@ -318,7 +318,7 @@ int DD4hep::Simulation::generatePrimaries(const Geant4Action* caller, G4PrimaryVertex* v4 = new G4PrimaryVertex(v->x,v->y,v->z,v->time); event->AddPrimaryVertex(v4); caller->print("+++++ G4PrimaryVertex at (%+.2e,%+.2e,%+.2e) [mm] %+.2e [ns]", - v->x/mm,v->y/mm,v->z/mm,v->time/ns); + v->x/CLHEP::mm,v->y/CLHEP::mm,v->z/CLHEP::mm,v->time/CLHEP::ns); for(Geant4Vertex::Particles::const_iterator ip=v->out.begin(); ip!=v->out.end(); ++ip) { Geant4ParticleHandle p = pm[*ip]; if ( p->daughters.size() > 0 ) { diff --git a/DDG4/src/Geant4IsotropeGenerator.cpp b/DDG4/src/Geant4IsotropeGenerator.cpp index b0b83b06e7866c77920766ae83857c5b8bfd07b0..c0ea420f382d1c628e603617f845c66f57db028c 100644 --- a/DDG4/src/Geant4IsotropeGenerator.cpp +++ b/DDG4/src/Geant4IsotropeGenerator.cpp @@ -33,7 +33,7 @@ Geant4IsotropeGenerator::Geant4IsotropeGenerator(Geant4Context* context, const s InstanceCount::increment(this); m_needsControl = true; declareProperty("Particle", m_particleName = "e-"); - declareProperty("Energy", m_energy = 50 * MeV); + declareProperty("Energy", m_energy = 50 * CLHEP::MeV); declareProperty("Multiplicity", m_multiplicity = 1); declareProperty("Mask", m_mask = 0); declareProperty("Position", m_position); @@ -94,7 +94,7 @@ void Geant4IsotropeGenerator::operator()(G4Event*) { inter->particles.insert(make_pair(p->id,p)); vtx->out.insert(p->id); printout(INFO,name(),"Particle [%d] %s %.3f GeV direction:(%6.3f %6.3f %6.3f)", - p->id, m_particleName.c_str(), momentum/GeV, x1, x2, x3); + p->id, m_particleName.c_str(), momentum/CLHEP::GeV, x1, x2, x3); } } diff --git a/DDG4/src/Geant4Particle.cpp b/DDG4/src/Geant4Particle.cpp index b9c7a7dda7dbcd469c6fbf082f7d26a27383ba00..581333e7ec636dbb22afc9c18d58d66bf7fb2f64 100644 --- a/DDG4/src/Geant4Particle.cpp +++ b/DDG4/src/Geant4Particle.cpp @@ -283,7 +283,7 @@ void Geant4ParticleHandle::dumpWithVertex(int level, const std::string& src, con "+++ %s ID:%3d %-12s status:%08X PDG:%6d Vtx:(%+.2e,%+.2e,%+.2e)[mm] " "time: %+.2e [ns] #Dau:%3d #Par:%1d%-6s", tag,p->id,p.particleName().c_str(),p->status,p->pdgID, - p->vsx/mm,p->vsy/mm,p->vsz/mm,p->time/ns, + p->vsx/CLHEP::mm,p->vsy/CLHEP::mm,p->vsz/CLHEP::mm,p->time/CLHEP::ns, p->daughters.size(), p->parents.size(), text); @@ -306,7 +306,7 @@ void Geant4ParticleHandle::dumpWithMomentum(int level, const std::string& src, c "+++%s ID:%3d %-12s stat:%08X PDG:%6d Mom:(%+.2e,%+.2e,%+.2e)[MeV] " "time: %+.2e [ns] #Dau:%3d #Par:%1d%-6s", tag,p->id,p.particleName().c_str(),p->status,p->pdgID, - p->psx/MeV,p->psy/MeV,p->psz/MeV,p->time/ns, + p->psx/CLHEP::MeV,p->psy/CLHEP::MeV,p->psz/CLHEP::MeV,p->time/CLHEP::ns, int(p->daughters.size()), int(p->parents.size()), text); @@ -328,8 +328,8 @@ void Geant4ParticleHandle::dumpWithMomentumAndVertex(int level, const std::strin "+++%s %3d %-12s stat:%08X PDG:%6d Mom:(%+.2e,%+.2e,%+.2e)[MeV] " "Vtx:(%+.2e,%+.2e,%+.2e)[mm] #Dau:%3d #Par:%1d%-6s", tag,p->id,p.particleName().c_str(),p->status,p->pdgID, - p->psx/MeV,p->psy/MeV,p->psz/MeV, - p->vsx/mm,p->vsy/mm,p->vsz/mm, + p->psx/CLHEP::MeV,p->psy/CLHEP::MeV,p->psz/CLHEP::MeV, + p->vsx/CLHEP::mm,p->vsy/CLHEP::mm,p->vsz/CLHEP::mm, int(p->daughters.size()), int(p->parents.size()), text); diff --git a/DDG4/src/Geant4ParticleGun.cpp b/DDG4/src/Geant4ParticleGun.cpp index 7a0705a5f669f84069ef8213c058002f8114e401..8b873c69bc4e7848f5152c92673f917fe6a3a383 100644 --- a/DDG4/src/Geant4ParticleGun.cpp +++ b/DDG4/src/Geant4ParticleGun.cpp @@ -36,7 +36,7 @@ Geant4ParticleGun::Geant4ParticleGun(Geant4Context* context, const string& name) InstanceCount::increment(this); m_needsControl = true; declareProperty("particle", m_particleName = "e-"); - declareProperty("energy", m_energy = 50 * MeV); + declareProperty("energy", m_energy = 50 * CLHEP::MeV); declareProperty("multiplicity", m_multiplicity = 1); declareProperty("position", m_position); declareProperty("direction", m_direction); @@ -82,7 +82,7 @@ void Geant4ParticleGun::operator()(G4Event* event) { } } print("Shoot [%d] %.3f GeV %s pos:(%.3f %.3f %.3f)[mm] dir:(%6.3f %6.3f %6.3f)", - m_shotNo, m_energy/GeV, m_particleName.c_str(), + m_shotNo, m_energy/CLHEP::GeV, m_particleName.c_str(), m_position.X(), m_position.Y(), m_position.Z(), m_direction.X(),m_direction.Y(), m_direction.Z()); diff --git a/DDG4/src/Geant4ParticleHandler.cpp b/DDG4/src/Geant4ParticleHandler.cpp index 050a546f821c1658323ed65f74e15683d8d1cd5d..cc538c2babc95cc11ae183f2e91c846de31b3fc1 100644 --- a/DDG4/src/Geant4ParticleHandler.cpp +++ b/DDG4/src/Geant4ParticleHandler.cpp @@ -70,7 +70,7 @@ Geant4ParticleHandler::Geant4ParticleHandler(Geant4Context* context, const strin declareProperty("PrintStartTracking", m_printStartTracking = false); declareProperty("KeepAllParticles", m_keepAll = false); declareProperty("SaveProcesses", m_processNames); - declareProperty("MinimalKineticEnergy",m_kinEnergyCut = 100e0*MeV); + declareProperty("MinimalKineticEnergy",m_kinEnergyCut = 100e0*CLHEP::MeV); m_needsControl = true; }