Skip to content
Snippets Groups Projects
Commit 30c60fb1 authored by Scott Snyder's avatar Scott Snyder Committed by Tadej Novak
Browse files

Quirks: Fix cppcheck warnings.

Quirks: Fix cppcheck warnings.

Prefer to initialize class members in an initialization list.
Delete copy/assignment for class that manages memory.
Add abort() calls after G4Exception(), which is missing a [[noreturn]]
declaration.
parent 0a940a43
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include "DummyEquation.h"
DummyEquation::DummyEquation() :
G4EquationOfMotion(nullptr)
G4EquationOfMotion(nullptr),
m_dummyField (std::make_unique<G4UniformMagField>(0, 0, 0))
{
m_dummyField = std::make_unique<G4UniformMagField>(0, 0, 0);
SetFieldObj(m_dummyField.get());
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include "G4ParticleTable.hh"
......@@ -32,7 +32,10 @@ Quirk::Quirk(
G4ParticleDefinition* partner = particleTable->FindParticle(GetAntiPDGEncoding());
if (partner != 0) {
Quirk* qpartner = dynamic_cast<Quirk*>(partner);
if (qpartner == 0) G4Exception("Quirk::Quirk", "NonQuirkAntiparticle", FatalErrorInArgument, "Antiparticle of quirk must be a quirk");
if (qpartner == 0) {
G4Exception("Quirk::Quirk", "NonQuirkAntiparticle", FatalErrorInArgument, "Antiparticle of quirk must be a quirk");
std::abort();
}
m_stringIn->SetReactionForce(qpartner->m_stringIn);
qpartner->m_stringIn->SetReactionForce(m_stringIn);
}
......
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#ifndef QUIRK_H
......@@ -29,6 +29,9 @@ public:
const InfracolorForce& GetStringIn() const { return *m_stringIn; }
InfracolorForce& GetStringIn() { return *m_stringIn; }
Quirk (const Quirk&) = delete;
Quirk& operator= (const Quirk&) = delete;
private:
InfracolorForce* m_stringIn;
};
......
......@@ -193,6 +193,7 @@ AlongStepGetPhysicalInteractionLength( const G4Track& track,
Quirk* quirkDef = dynamic_cast<Quirk*>(pParticleDef);
if (quirkDef == 0) {
G4Exception("QuirkTransportation::AlongStepGetPhysicalInteractionLength", "NonQuirk", FatalErrorInArgument, "QuirkTransportation run on non-quirk particle");
std::abort();
}
HyperbolaStepper quirkStepper(
quirkDef->GetStringIn(),
......@@ -622,6 +623,7 @@ QuirkTransportation::StartTracking(G4Track* aTrack)
Quirk* quirkDef = dynamic_cast<Quirk*>(part_nc);
if (quirkDef == 0) {
G4Exception("QuirkTransportation::StartTracking", "NonQuirk", FatalErrorInArgument, "QuirkTransportation run on non-quirk particle");
std::abort();
}
quirkDef->GetStringIn().StartTracking(aTrack);
}
......
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
#include "G4TrackStatus.hh"
......@@ -37,6 +37,7 @@ G4VParticleChange* QuirkWatcher::PostStepDoIt(
Quirk* quirkDef = dynamic_cast<Quirk*>(part_nc);
if (quirkDef == 0) {
G4Exception("QuirkWatcher::PostStepDoIt", "NonQuirk", FatalErrorInArgument, "QuirkWatcher run on non-quirk particle");
std::abort();
}
InfracolorForce& string = quirkDef->GetStringIn();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment