Skip to content

Commit

Permalink
clang-format entire codebase (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
drbenmorgan authored Feb 28, 2024
1 parent 2482f39 commit de00eb3
Show file tree
Hide file tree
Showing 85 changed files with 1,837 additions and 2,289 deletions.
2 changes: 1 addition & 1 deletion examples/Example1/include/DetectorMessenger.hh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private:
/// Command printing current settings
G4UIcmdWithoutParameter *fPrintCmd = nullptr;

G4UIcmdWithAString *fFileNameCmd = nullptr;
G4UIcmdWithAString *fFileNameCmd = nullptr;

G4UIcmdWith3VectorAndUnit *fFieldCmd = nullptr;
};
Expand Down
2 changes: 1 addition & 1 deletion examples/Example1/include/EventActionMessenger.hh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public:
private:
EventAction *fEventAction = nullptr;

G4UIdirectory *fDir = nullptr;
G4UIdirectory *fDir = nullptr;
G4UIcmdWithAnInteger *fVerbosityCmd = nullptr;
};

Expand Down
6 changes: 3 additions & 3 deletions examples/Example1/include/SensitiveDetector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class G4VPhysicalVolume;
class SensitiveDetector : public G4VSensitiveDetector {
public:
SensitiveDetector(G4String aName);
SensitiveDetector(G4String aName, std::set<const G4VPhysicalVolume*> *aSensitivePhysicalVolumes);
SensitiveDetector(G4String aName, std::set<const G4VPhysicalVolume *> *aSensitivePhysicalVolumes);
~SensitiveDetector() = default;
/// Create hit collection
virtual void Initialize(G4HCofThisEvent *HCE) final;
Expand All @@ -56,9 +56,9 @@ public:

SimpleHit *RetrieveAndSetupHit(G4TouchableHistory *aTouchable);

std::vector<G4LogicalVolume*> fSensitiveLogicalVolumes;
std::vector<G4LogicalVolume *> fSensitiveLogicalVolumes;
/// Physical Volumes where we want to score
std::set<const G4VPhysicalVolume*> fSensitivePhysicalVolumes;
std::set<const G4VPhysicalVolume *> fSensitivePhysicalVolumes;

std::unordered_map<size_t, size_t> fScoringMap;

Expand Down
6 changes: 3 additions & 3 deletions examples/Example1/include/SimpleHit.hh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public:
inline G4int GetType() const { return fType; }

/// Set PhysicalVolumeName
inline void SetPhysicalVolumeName(G4String aPhysicalVolumeName) { fPhysicalVolumeName = aPhysicalVolumeName;}
inline void SetPhysicalVolumeName(G4String aPhysicalVolumeName) { fPhysicalVolumeName = aPhysicalVolumeName; }
/// Get PhysicalVolumeName
inline G4String GetPhysicalVolumeName() const { return fPhysicalVolumeName; }

Expand All @@ -99,8 +99,8 @@ public:
G4double fTime = -1;
/// Type: 0 = full sim, 1 = fast sim
G4int fType = -1;
/// These hits will be associated to PhysicalVolumes
G4String fPhysicalVolumeName = "";
/// These hits will be associated to PhysicalVolumes
G4String fPhysicalVolumeName = "";
};

typedef G4THitsCollection<SimpleHit> SimpleHitsCollection;
Expand Down
4 changes: 2 additions & 2 deletions examples/Example1/include/TrackingAction.hh
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ public:
virtual void PreUserTrackingAction(const G4Track *);
virtual void PostUserTrackingAction(const G4Track *);

inline void setSteppingAction(SteppingAction* aSteppingAction){fSteppingAction = aSteppingAction;}
inline void setSteppingAction(SteppingAction *aSteppingAction) { fSteppingAction = aSteppingAction; }

private:
SteppingAction* fSteppingAction;
SteppingAction *fSteppingAction;
};

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Expand Down
4 changes: 1 addition & 3 deletions examples/Example1/src/ActionInitialisation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
#include "TrackingAction.hh"
#include "SteppingAction.hh"

ActionInitialisation::ActionInitialisation() : G4VUserActionInitialization()
{
}
ActionInitialisation::ActionInitialisation() : G4VUserActionInitialization() {}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

Expand Down
41 changes: 17 additions & 24 deletions examples/Example1/src/DetectorConstruction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ DetectorConstruction::DetectorConstruction() : G4VUserDetectorConstruction()

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

DetectorConstruction::~DetectorConstruction()
{
}
DetectorConstruction::~DetectorConstruction() {}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

Expand Down Expand Up @@ -97,45 +95,40 @@ void DetectorConstruction::ConstructSDandField()
We will have one hit per Placement of a sensitive LogicalVolume
SensitiveDetector will store the mapping of PhysicalVolumes to hits, and use it in ProcessHits
fSensitive_volumes Contains the names of the LogicalVolumes we want to make sensitive, at this point
fSensitive_volumes Contains the names of the LogicalVolumes we want to make sensitive, at this point
it has been already filled through macro commands
In order to find all placements of these sensitive volumes, we need to walk the tree
*/
int numSensitiveTouchables = 0;
int numTouchables = 0;
int numTouchables = 0;

SensitiveDetector *caloSD = new SensitiveDetector("AdePTDetector");

G4SDManager::GetSDMpointer()->AddNewDetector(caloSD);
std::vector<G4LogicalVolume*> aSensitiveLogicalVolumes;
std::vector<G4LogicalVolume *> aSensitiveLogicalVolumes;

std::function<void(G4VPhysicalVolume const *)> visitAndSetupScoring = [&](G4VPhysicalVolume const *pvol) {
const auto lvol = pvol->GetLogicalVolume();
int nd = lvol->GetNoDaughters();
int nd = lvol->GetNoDaughters();
numTouchables++;

// Check if the LogicalVolume is sensitive
auto aAuxInfoList = fParser.GetVolumeAuxiliaryInformation(lvol);
for(auto iaux = aAuxInfoList.begin(); iaux != aAuxInfoList.end(); iaux++ )
{
G4String str=iaux->type;
G4String val=iaux->value;
G4String unit=iaux->unit;

if(str == "SensDet")
{
for (auto iaux = aAuxInfoList.begin(); iaux != aAuxInfoList.end(); iaux++) {
G4String str = iaux->type;
G4String val = iaux->value;
G4String unit = iaux->unit;

if (str == "SensDet") {
// If it is, record the PV
if( caloSD->fSensitivePhysicalVolumes.find(pvol) == caloSD->fSensitivePhysicalVolumes.end() )
{
caloSD->fSensitivePhysicalVolumes.insert(pvol);
if (caloSD->fSensitivePhysicalVolumes.find(pvol) == caloSD->fSensitivePhysicalVolumes.end()) {
caloSD->fSensitivePhysicalVolumes.insert(pvol);
}
// If this is the first time we see this LV
if(std::find(caloSD->fSensitiveLogicalVolumes.begin(),
caloSD->fSensitiveLogicalVolumes.end(),
lvol) == caloSD->fSensitiveLogicalVolumes.end())
{
if (std::find(caloSD->fSensitiveLogicalVolumes.begin(), caloSD->fSensitiveLogicalVolumes.end(), lvol) ==
caloSD->fSensitiveLogicalVolumes.end()) {
// Make LogicalVolume sensitive by registering a SensitiveDetector for it
SetSensitiveDetector(lvol, caloSD);
// We keep a list of Logical sensitive volumes, used for initializing AdePTTransport
Expand Down
10 changes: 5 additions & 5 deletions examples/Example1/src/EventAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "G4PhysicalVolumeStore.hh"
#include "G4SystemOfUnits.hh"

EventAction::EventAction(): G4UserEventAction(), fHitCollectionID(-1), fTimer()
EventAction::EventAction() : G4UserEventAction(), fHitCollectionID(-1), fTimer()
{
fMessenger = new EventActionMessenger(this);
}
Expand All @@ -50,7 +50,7 @@ EventAction::~EventAction() {}

void EventAction::BeginOfEventAction(const G4Event *)
{
auto eventId = G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID();
auto eventId = G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID();

fTimer.Start();
}
Expand All @@ -59,7 +59,7 @@ void EventAction::BeginOfEventAction(const G4Event *)

void EventAction::EndOfEventAction(const G4Event *aEvent)
{
auto eventId = G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID();
auto eventId = G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID();

fTimer.Stop();

Expand All @@ -82,14 +82,14 @@ void EventAction::EndOfEventAction(const G4Event *aEvent)

// Store the original IO precission and width
auto aOriginalPrecission = std::cout.precision();
auto aOriginalWidth = std::cout.width();
auto aOriginalWidth = std::cout.width();

for (size_t iHit = 0; iHit < hitsCollection->entries(); iHit++) {
hit = static_cast<SimpleHit *>(hitsCollection->GetHit(iHit));
hitEn = hit->GetEdep();
totalEnergy += hitEn;
G4String vol_name = hit->GetPhysicalVolumeName();

if (hitEn > 1 && fVerbosity > 1)
G4cout << "EndOfEventAction " << eventId << " : id " << std::setw(5) << iHit << " edep " << std::setprecision(2)
<< std::setw(12) << std::fixed << hitEn / MeV << " [MeV] logical " << vol_name << G4endl;
Expand Down
7 changes: 2 additions & 5 deletions examples/Example1/src/PrimaryGeneratorAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

PrimaryGeneratorAction::PrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction(), fParticleGun(0)
PrimaryGeneratorAction::PrimaryGeneratorAction() : G4VUserPrimaryGeneratorAction(), fParticleGun(0)
{
fParticleGun = new ParticleGun();
fParticleGun = new ParticleGun();
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Expand All @@ -32,5 +31,3 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event *aEvent)
{
fParticleGun->GeneratePrimaries(aEvent);
}


5 changes: 1 addition & 4 deletions examples/Example1/src/RunAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@
#include <thread>
#include <mutex>

RunAction::RunAction()
: G4UserRunAction()
{
}
RunAction::RunAction() : G4UserRunAction() {}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

Expand Down
5 changes: 2 additions & 3 deletions examples/Example1/src/SensitiveDetector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ void SensitiveDetector::Initialize(G4HCofThisEvent *aHCE)
// Fill calorimeter hits with zero energy deposition
// Retrieving the hits through the map allows us to set the Volume name associated to the hits
int hitID = 0;
for(auto pvol: (fSensitivePhysicalVolumes))
{
for (auto pvol : (fSensitivePhysicalVolumes)) {
auto hit = new SimpleHit();
hit->SetPhysicalVolumeName(pvol->GetName());
fScoringMap.insert(std::pair<int, int>(pvol->GetInstanceID(), hitID));
Expand Down Expand Up @@ -84,7 +83,7 @@ G4bool SensitiveDetector::ProcessHits(G4Step *aStep, G4TouchableHistory *)

// Set hit type to full simulation (only if hit is not already marked as fast sim)
if (hit->GetType() != 1) hit->SetType(0);

return true;
}

Expand Down
4 changes: 1 addition & 3 deletions examples/Example1/src/SteppingAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
#include "SteppingAction.hh"
#include "G4Step.hh"

SteppingAction::SteppingAction() : G4UserSteppingAction()
{
}
SteppingAction::SteppingAction() : G4UserSteppingAction() {}

SteppingAction::~SteppingAction() {}

Expand Down
2 changes: 1 addition & 1 deletion examples/Example1/src/TrackingAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ TrackingAction::TrackingAction() : G4UserTrackingAction() {}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void TrackingAction::PreUserTrackingAction(const G4Track *aTrack)
void TrackingAction::PreUserTrackingAction(const G4Track *aTrack)
{
// Reset step counter
fSteppingAction->SetNumSteps(0);
Expand Down
2 changes: 1 addition & 1 deletion examples/IntegrationBenchmark/include/DetectorMessenger.hh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private:
/// Command printing current settings
G4UIcmdWithoutParameter *fPrintCmd = nullptr;

G4UIcmdWithAString *fFileNameCmd = nullptr;
G4UIcmdWithAString *fFileNameCmd = nullptr;

G4UIcmdWith3VectorAndUnit *fFieldCmd = nullptr;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public:
private:
EventAction *fEventAction = nullptr;

G4UIdirectory *fDir = nullptr;
G4UIdirectory *fDir = nullptr;
G4UIcmdWithAnInteger *fVerbosityCmd = nullptr;
};

Expand Down
8 changes: 4 additions & 4 deletions examples/IntegrationBenchmark/include/Run.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public:
void Merge(const G4Run *run) override;

TestManager<TAG_TYPE> *GetTestManager() const { return fTestManager; }
void SetDoBenchmark( bool aDoBenchmark ){ fDoBenchmark = aDoBenchmark; }
bool GetDoBenchmark(){ return fDoBenchmark; }
void SetDoValidation( bool aDoValidation ){ fDoValidation = aDoValidation; }
bool GetDoValidation(){ return fDoValidation; }
void SetDoBenchmark(bool aDoBenchmark) { fDoBenchmark = aDoBenchmark; }
bool GetDoBenchmark() { return fDoBenchmark; }
void SetDoValidation(bool aDoValidation) { fDoValidation = aDoValidation; }
bool GetDoValidation() { return fDoValidation; }

/** @brief Compute and display collected metrics */
void EndOfRunSummary(G4String aOutputDirectory, G4String aOutputFilename);
Expand Down
7 changes: 3 additions & 4 deletions examples/IntegrationBenchmark/include/RunAction.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,15 @@ class RunAction : public G4UserRunAction {
public:
/// Constructor. Defines the histograms.
RunAction();
RunAction(G4String aOutputDirectory, G4String aOutputFilename,
bool aDoBenchmark, bool aDoValidation);
RunAction(G4String aOutputDirectory, G4String aOutputFilename, bool aDoBenchmark, bool aDoValidation);
virtual ~RunAction();

/// Open the file for the analysis
virtual void BeginOfRunAction(const G4Run *) final;
/// Write and close the file
virtual void EndOfRunAction(const G4Run *) final;

G4Run* GenerateRun() override;
G4Run *GenerateRun() override;

private:
/// Pointer to detector construction to retrieve the detector dimensions to
Expand All @@ -67,7 +66,7 @@ private:
bool fDoBenchmark;
bool fDoValidation;
vecgeom::Stopwatch fTimer;
Run* fRun;
Run *fRun;
};

#endif /* RUNACTION_HH */
6 changes: 3 additions & 3 deletions examples/IntegrationBenchmark/include/SensitiveDetector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class G4VPhysicalVolume;
class SensitiveDetector : public G4VSensitiveDetector {
public:
SensitiveDetector(G4String aName);
SensitiveDetector(G4String aName, std::set<const G4VPhysicalVolume*> *aSensitivePhysicalVolumes);
SensitiveDetector(G4String aName, std::set<const G4VPhysicalVolume *> *aSensitivePhysicalVolumes);
~SensitiveDetector() = default;
/// Create hit collection
virtual void Initialize(G4HCofThisEvent *HCE) final;
Expand All @@ -64,9 +64,9 @@ public:

SimpleHit *RetrieveAndSetupHit(G4TouchableHistory *aTouchable);

std::vector<G4LogicalVolume*> fSensitiveLogicalVolumes;
std::vector<G4LogicalVolume *> fSensitiveLogicalVolumes;
/// Physical Volumes where we want to score
std::set<const G4VPhysicalVolume*> fSensitivePhysicalVolumes;
std::set<const G4VPhysicalVolume *> fSensitivePhysicalVolumes;

std::unordered_map<size_t, size_t> fScoringMap;

Expand Down
6 changes: 3 additions & 3 deletions examples/IntegrationBenchmark/include/SimpleHit.hh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public:
inline G4int GetType() const { return fType; }

/// Set PhysicalVolumeName
inline void SetPhysicalVolumeName(G4String aPhysicalVolumeName) { fPhysicalVolumeName = aPhysicalVolumeName;}
inline void SetPhysicalVolumeName(G4String aPhysicalVolumeName) { fPhysicalVolumeName = aPhysicalVolumeName; }
/// Get PhysicalVolumeName
inline G4String GetPhysicalVolumeName() const { return fPhysicalVolumeName; }

Expand All @@ -99,8 +99,8 @@ public:
G4double fTime = -1;
/// Type: 0 = full sim, 1 = fast sim
G4int fType = -1;
/// These hits will be associated to PhysicalVolumes
G4String fPhysicalVolumeName = "";
/// These hits will be associated to PhysicalVolumes
G4String fPhysicalVolumeName = "";
};

typedef G4THitsCollection<SimpleHit> SimpleHitsCollection;
Expand Down
Loading

0 comments on commit de00eb3

Please sign in to comment.