Skip to content

Commit

Permalink
try to fix static analyzer warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
civanch committed Jan 19, 2016
1 parent 7fb8d7f commit de54ac8
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 32 deletions.
65 changes: 43 additions & 22 deletions SimG4Core/PhysicsLists/src/CMSEmStandardPhysics.cc
Expand Up @@ -136,25 +136,21 @@ void CMSEmStandardPhysics::ConstructProcess() {
G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();

// muon & hadron bremsstrahlung and pair production
G4MuBremsstrahlung* mub = new G4MuBremsstrahlung();
G4MuPairProduction* mup = new G4MuPairProduction();
G4hBremsstrahlung* pib = new G4hBremsstrahlung();
G4hPairProduction* pip = new G4hPairProduction();
G4hBremsstrahlung* kb = new G4hBremsstrahlung();
G4hPairProduction* kp = new G4hPairProduction();
G4hBremsstrahlung* pb = new G4hBremsstrahlung();
G4hPairProduction* pp = new G4hPairProduction();
G4MuBremsstrahlung* mub = nullptr;
G4MuPairProduction* mup = nullptr;
G4hBremsstrahlung* pib = nullptr;
G4hPairProduction* pip = nullptr;
G4hBremsstrahlung* kb = nullptr;
G4hPairProduction* kp = nullptr;
G4hBremsstrahlung* pb = nullptr;
G4hPairProduction* pp = nullptr;

// muon & hadron multiple scattering
G4MuMultipleScattering* mumsc = new G4MuMultipleScattering();
mumsc->AddEmModel(0, new G4WentzelVIModel());
G4MuMultipleScattering* pimsc = new G4MuMultipleScattering();
pimsc->AddEmModel(0, new G4WentzelVIModel());
G4MuMultipleScattering* kmsc = new G4MuMultipleScattering();
kmsc->AddEmModel(0, new G4WentzelVIModel());
G4MuMultipleScattering* pmsc = new G4MuMultipleScattering();
pmsc->AddEmModel(0, new G4WentzelVIModel());
G4hMultipleScattering* hmsc = new G4hMultipleScattering("ionmsc");
G4MuMultipleScattering* mumsc = nullptr;
G4MuMultipleScattering* pimsc = nullptr;
G4MuMultipleScattering* kmsc = nullptr;
G4MuMultipleScattering* pmsc = nullptr;
G4hMultipleScattering* hmsc = nullptr;

// high energy limit for e+- scattering models and bremsstrahlung
G4double highEnergyLimit = 100*MeV;
Expand Down Expand Up @@ -226,6 +222,12 @@ void CMSEmStandardPhysics::ConstructProcess() {
} else if (particleName == "mu+" ||
particleName == "mu-" ) {

if(nullptr == mub) {
mub = new G4MuBremsstrahlung();
mup = new G4MuPairProduction();
mumsc = new G4MuMultipleScattering();
mumsc->AddEmModel(0, new G4WentzelVIModel());
}
ph->RegisterProcess(mumsc, particle);
ph->RegisterProcess(new G4MuIonisation(), particle);
ph->RegisterProcess(mub, particle);
Expand All @@ -235,19 +237,26 @@ void CMSEmStandardPhysics::ConstructProcess() {
} else if (particleName == "alpha" ||
particleName == "He3" ) {

//ph->RegisterProcess(hmsc, particle);
ph->RegisterProcess(new G4hMultipleScattering(), particle);
ph->RegisterProcess(new G4ionIonisation(), particle);

} else if (particleName == "GenericIon") {

if(nullptr == hmsc) {
hmsc = new G4hMultipleScattering("ionmsc");
}
ph->RegisterProcess(hmsc, particle);
ph->RegisterProcess(new G4ionIonisation(), particle);

} else if (particleName == "pi+" ||
particleName == "pi-" ) {

//G4hMultipleScattering* pimsc = new G4hMultipleScattering();
if(nullptr == pib) {
pib = new G4hBremsstrahlung();
pip = new G4hPairProduction();
pimsc = new G4MuMultipleScattering();
pimsc->AddEmModel(0, new G4WentzelVIModel());
}
ph->RegisterProcess(pimsc, particle);
ph->RegisterProcess(new G4hIonisation(), particle);
ph->RegisterProcess(pib, particle);
Expand All @@ -257,18 +266,27 @@ void CMSEmStandardPhysics::ConstructProcess() {
} else if (particleName == "kaon+" ||
particleName == "kaon-" ) {

//G4hMultipleScattering* kmsc = new G4hMultipleScattering();
if(nullptr == kb) {
kb = new G4hBremsstrahlung();
kp = new G4hPairProduction();
kmsc = new G4MuMultipleScattering();
kmsc->AddEmModel(0, new G4WentzelVIModel());
}
ph->RegisterProcess(kmsc, particle);
ph->RegisterProcess(new G4hIonisation(), particle);
ph->RegisterProcess(kb, particle);
ph->RegisterProcess(kp, particle);
ph->RegisterProcess(new G4CoulombScattering(), particle);

// } else if (particleName == "proton" ) {
} else if (particleName == "proton" ||
particleName == "anti_proton") {

//G4hMultipleScattering* pmsc = new G4hMultipleScattering();
if(nullptr == pb) {
pb = new G4hBremsstrahlung();
pp = new G4hPairProduction();
pmsc = new G4MuMultipleScattering();
pmsc->AddEmModel(0, new G4WentzelVIModel());
}
ph->RegisterProcess(pmsc, particle);
ph->RegisterProcess(new G4hIonisation(), particle);
ph->RegisterProcess(pb, particle);
Expand Down Expand Up @@ -306,6 +324,9 @@ void CMSEmStandardPhysics::ConstructProcess() {
particleName == "xi_c+" ||
particleName == "xi-" ) {

if(nullptr == hmsc) {
hmsc = new G4hMultipleScattering("ionmsc");
}
ph->RegisterProcess(hmsc, particle);
ph->RegisterProcess(new G4hIonisation(), particle);
}
Expand Down
41 changes: 31 additions & 10 deletions SimG4Core/PhysicsLists/src/CMSEmStandardPhysics95msc93.cc
Expand Up @@ -125,16 +125,16 @@ void CMSEmStandardPhysics95msc93::ConstructProcess()
// Add standard EM Processes

// muon & hadron bremsstrahlung and pair production
G4MuBremsstrahlung* mub = new G4MuBremsstrahlung();
G4MuPairProduction* mup = new G4MuPairProduction();
G4hBremsstrahlung* pib = new G4hBremsstrahlung();
G4hPairProduction* pip = new G4hPairProduction();
G4hBremsstrahlung* kb = new G4hBremsstrahlung();
G4hPairProduction* kp = new G4hPairProduction();
G4hBremsstrahlung* pb = new G4hBremsstrahlung();
G4hPairProduction* pp = new G4hPairProduction();
G4MuBremsstrahlung* mub = nullptr;
G4MuPairProduction* mup = nullptr;
G4hBremsstrahlung* pib = nullptr;
G4hPairProduction* pip = nullptr;
G4hBremsstrahlung* kb = nullptr;
G4hPairProduction* kp = nullptr;
G4hBremsstrahlung* pb = nullptr;
G4hPairProduction* pp = nullptr;

G4hMultipleScattering* hmsc = new G4hMultipleScattering("ionmsc");
G4hMultipleScattering* hmsc = nullptr;

// This EM builder takes default models of Geant4 10 EMV.
// Multiple scattering by Urban for all particles
Expand Down Expand Up @@ -188,6 +188,10 @@ void CMSEmStandardPhysics95msc93::ConstructProcess()
} else if (particleName == "mu+" ||
particleName == "mu-" ) {

if(nullptr == mub) {
mub = new G4MuBremsstrahlung();
mup = new G4MuPairProduction();
}
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4MuIonisation, -1, 2, 2);
pmanager->AddProcess(mub, -1,-3, 3);
Expand All @@ -197,12 +201,19 @@ void CMSEmStandardPhysics95msc93::ConstructProcess()
particleName == "He3" ||
particleName == "GenericIon") {

if(nullptr == hmsc) {
hmsc = new G4hMultipleScattering("ionmsc");
}
pmanager->AddProcess(hmsc, -1, 1, 1);
pmanager->AddProcess(new G4ionIonisation, -1, 2, 2);

} else if (particleName == "pi+" ||
particleName == "pi-" ) {

if(nullptr == pib) {
pib = new G4hBremsstrahlung();
pip = new G4hPairProduction();
}
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
pmanager->AddProcess(pib, -1,-3, 3);
Expand All @@ -211,14 +222,21 @@ void CMSEmStandardPhysics95msc93::ConstructProcess()
} else if (particleName == "kaon+" ||
particleName == "kaon-" ) {

if(nullptr == kb) {
kb = new G4hBremsstrahlung();
kp = new G4hPairProduction();
}
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
pmanager->AddProcess(kb, -1,-3, 3);
pmanager->AddProcess(kp, -1,-4, 4);

} else if (particleName == "proton" ||
particleName == "anti_proton" ) {

if(nullptr == pb) {
pb = new G4hBremsstrahlung();
pp = new G4hPairProduction();
}
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
pmanager->AddProcess(pb, -1,-3, 3);
Expand Down Expand Up @@ -252,6 +270,9 @@ void CMSEmStandardPhysics95msc93::ConstructProcess()
particleName == "xi_c+" ||
particleName == "xi-" ) {

if(nullptr == hmsc) {
hmsc = new G4hMultipleScattering("ionmsc");
}
pmanager->AddProcess(hmsc, -1, 1, 1);
pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
}
Expand Down

0 comments on commit de54ac8

Please sign in to comment.