fix: code style, include path

This commit is contained in:
liuyihui 2023-02-13 15:10:21 +08:00
parent 51622267f0
commit dbc12a3d02
11 changed files with 10 additions and 57 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ lib/
# Data # Data
*.root *.root
*.data

View File

@ -5,8 +5,9 @@
"includePath": [ "includePath": [
"${default}", "${default}",
"${workspaceFolder}/include", "${workspaceFolder}/include",
"/home/fox/G4Kit/Geant4/include", "/home/fox/G4Kit/ROOT/include",
"/home/fox/G4Kit/ROOT/include" "/home/fox/G4Kit/CLHEP/include",
"/home/fox/G4Kit/Geant4/include/Geant4"
], ],
"defines": [ "defines": [
"_DEBUG", "_DEBUG",

View File

@ -6,8 +6,6 @@
#include "G4ThreeVector.hh" #include "G4ThreeVector.hh"
#include "G4VHit.hh" #include "G4VHit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GeneHe3detHit : public G4VHit { class GeneHe3detHit : public G4VHit {
public: public:
GeneHe3detHit(); GeneHe3detHit();
@ -46,22 +44,16 @@ private:
G4double particleEnergy; G4double particleEnergy;
}; };
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
typedef G4THitsCollection<GeneHe3detHit> GeneHe3detHitsCollection; typedef G4THitsCollection<GeneHe3detHit> GeneHe3detHitsCollection;
extern G4Allocator<GeneHe3detHit> GeneHe3detHitAllocator; extern G4Allocator<GeneHe3detHit> GeneHe3detHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void* GeneHe3detHit::operator new(size_t) { inline void* GeneHe3detHit::operator new(size_t) {
void* aHit; void* aHit;
aHit = (void*)GeneHe3detHitAllocator.MallocSingle(); aHit = (void*)GeneHe3detHitAllocator.MallocSingle();
return aHit; return aHit;
} }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void GeneHe3detHit::operator delete(void* aHit) { GeneHe3detHitAllocator.FreeSingle((GeneHe3detHit*)aHit); } inline void GeneHe3detHit::operator delete(void* aHit) { GeneHe3detHitAllocator.FreeSingle((GeneHe3detHit*)aHit); }
#endif #endif

View File

@ -8,8 +8,6 @@
class G4Step; class G4Step;
class G4HCofThisEvent; class G4HCofThisEvent;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GeneHe3detSD : public G4VSensitiveDetector { class GeneHe3detSD : public G4VSensitiveDetector {
public: public:
GeneHe3detSD(G4String); GeneHe3detSD(G4String);

View File

@ -17,7 +17,7 @@
#include "Randomize.hh" #include "Randomize.hh"
int main(int argc, char **argv) { int main(int argc, char **argv) {
G4UIExecutive* ui = nullptr; G4UIExecutive *ui = nullptr;
if (argc == 1) ui = new G4UIExecutive(argc, argv); if (argc == 1) ui = new G4UIExecutive(argc, argv);
gROOT->GetInterpreter(); gROOT->GetInterpreter();

View File

@ -39,9 +39,9 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
// world // world
G4Material* Air = manager->FindOrBuildMaterial("G4_AIR"); G4Material* Air = manager->FindOrBuildMaterial("G4_AIR");
G4double world_xyz = 2. * m; G4double world_xyz = 2. * m;
G4Box* solidWorld = new G4Box("world_S", 0.5 * world_xyz, 0.5 * world_xyz, 0.5 * world_xyz); G4Box* solidWorld = new G4Box("world", 0.5 * world_xyz, 0.5 * world_xyz, 0.5 * world_xyz);
logicalWorld = new G4LogicalVolume(solidWorld, Air, "world_L", 0, 0, 0); logicalWorld = new G4LogicalVolume(solidWorld, Air, "world", 0, 0, 0);
physicalWorld = new G4PVPlacement(0, G4ThreeVector(), "world_P", logicalWorld, physicalWorld = new G4PVPlacement(0, G4ThreeVector(), "world", logicalWorld,
NULL, // mother volume NULL, // mother volume
false, // no boolean operation false, // no boolean operation
0); // copy number 0); // copy number

View File

@ -17,16 +17,11 @@
#include "Randomize.hh" #include "Randomize.hh"
#define ANALYSIS_USE #define ANALYSIS_USE
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GeneEventAction::GeneEventAction() : GeneHe3detSDCollID(-1), drawFlag("non") {} GeneEventAction::GeneEventAction() : GeneHe3detSDCollID(-1), drawFlag("non") {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GeneEventAction::~GeneEventAction() {} GeneEventAction::~GeneEventAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GeneEventAction::BeginOfEventAction(const G4Event* evt) { void GeneEventAction::BeginOfEventAction(const G4Event* evt) {
G4int evtNb = evt->GetEventID(); G4int evtNb = evt->GetEventID();
if (evtNb % 1000 == 0) G4cout << "Event No." << evtNb << G4endl; if (evtNb % 1000 == 0) G4cout << "Event No." << evtNb << G4endl;
@ -37,8 +32,6 @@ void GeneEventAction::BeginOfEventAction(const G4Event* evt) {
} }
} }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GeneEventAction::EndOfEventAction(const G4Event* evt) { void GeneEventAction::EndOfEventAction(const G4Event* evt) {
// G4int event_id = evt->GetEventID(); // G4int event_id = evt->GetEventID();
G4HCofThisEvent* HCE = evt->GetHCofThisEvent(); G4HCofThisEvent* HCE = evt->GetHCofThisEvent();

View File

@ -10,8 +10,6 @@
G4Allocator<GeneHe3detHit> GeneHe3detHitAllocator; G4Allocator<GeneHe3detHit> GeneHe3detHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GeneHe3detHit::GeneHe3detHit() { GeneHe3detHit::GeneHe3detHit() {
cpNo = -1; cpNo = -1;
edep = 0.; edep = 0.;
@ -21,12 +19,8 @@ GeneHe3detHit::GeneHe3detHit() {
particleEnergy = 0.; particleEnergy = 0.;
} }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GeneHe3detHit::~GeneHe3detHit() { ; } GeneHe3detHit::~GeneHe3detHit() { ; }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GeneHe3detHit::GeneHe3detHit(const GeneHe3detHit& right) : G4VHit(right) { GeneHe3detHit::GeneHe3detHit(const GeneHe3detHit& right) : G4VHit(right) {
cpNo = right.cpNo; cpNo = right.cpNo;
edep = right.edep; edep = right.edep;
@ -36,8 +30,6 @@ GeneHe3detHit::GeneHe3detHit(const GeneHe3detHit& right) : G4VHit(right) {
particleEnergy = right.particleEnergy; particleEnergy = right.particleEnergy;
} }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const GeneHe3detHit& GeneHe3detHit::operator=(const GeneHe3detHit& right) { const GeneHe3detHit& GeneHe3detHit::operator=(const GeneHe3detHit& right) {
cpNo = right.cpNo; cpNo = right.cpNo;
edep = right.edep; edep = right.edep;
@ -48,18 +40,11 @@ const GeneHe3detHit& GeneHe3detHit::operator=(const GeneHe3detHit& right) {
return *this; return *this;
} }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
int GeneHe3detHit::operator==(const GeneHe3detHit& right) const { return (this == &right) ? 1 : 0; } int GeneHe3detHit::operator==(const GeneHe3detHit& right) const { return (this == &right) ? 1 : 0; }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GeneHe3detHit::Draw() { ; } void GeneHe3detHit::Draw() { ; }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GeneHe3detHit::Print() { void GeneHe3detHit::Print() {
G4cout << " He3 detector hitcollection: " << std::setw(5) << G4BestUnit(edep, "Energy") << ", at " G4cout << " He3 detector hitcollection: " << std::setw(5) << G4BestUnit(edep, "Energy") << ", at "
<< G4BestUnit(pos, "Length") << G4endl; << G4BestUnit(pos, "Length") << G4endl;
} }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....

View File

@ -10,27 +10,19 @@
#include "G4ios.hh" #include "G4ios.hh"
#include "GeneHe3detHit.hh" #include "GeneHe3detHit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GeneHe3detSD::GeneHe3detSD(G4String name) : G4VSensitiveDetector(name) { GeneHe3detSD::GeneHe3detSD(G4String name) : G4VSensitiveDetector(name) {
G4String HCname = "GeneHe3detHitCollection"; G4String HCname = "GeneHe3detHitCollection";
collectionName.insert(HCname); collectionName.insert(HCname);
} }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GeneHe3detSD::~GeneHe3detSD() {} GeneHe3detSD::~GeneHe3detSD() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GeneHe3detSD::Initialize(G4HCofThisEvent*) { void GeneHe3detSD::Initialize(G4HCofThisEvent*) {
scintillatorCollection = new GeneHe3detHitsCollection(SensitiveDetectorName, collectionName[0]); scintillatorCollection = new GeneHe3detHitsCollection(SensitiveDetectorName, collectionName[0]);
HitID = -1; HitID = -1;
} }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool GeneHe3detSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) { G4bool GeneHe3detSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) {
G4double edep = aStep->GetTotalEnergyDeposit(); G4double edep = aStep->GetTotalEnergyDeposit();
G4ParticleDefinition* particleType = aStep->GetTrack()->GetDefinition(); G4ParticleDefinition* particleType = aStep->GetTrack()->GetDefinition();
@ -59,8 +51,6 @@ G4bool GeneHe3detSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) {
return true; return true;
} }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GeneHe3detSD::EndOfEvent(G4HCofThisEvent* HCE) { void GeneHe3detSD::EndOfEvent(G4HCofThisEvent* HCE) {
G4String HCname = collectionName[0]; G4String HCname = collectionName[0];
static G4int HCID = -1; static G4int HCID = -1;
@ -72,16 +62,8 @@ void GeneHe3detSD::EndOfEvent(G4HCofThisEvent* HCE) {
if (verboseLevel >= 2) scintillatorCollection->PrintAllHits(); if (verboseLevel >= 2) scintillatorCollection->PrintAllHits();
} }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GeneHe3detSD::clear() {} void GeneHe3detSD::clear() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GeneHe3detSD::DrawAll() {} void GeneHe3detSD::DrawAll() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GeneHe3detSD::PrintAll() {} void GeneHe3detSD::PrintAll() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....

View File

@ -31,7 +31,6 @@ void GeneRunAction::BeginOfRunAction(const G4Run*) {
analysisManager->book(); analysisManager->book();
#endif #endif
} }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GeneRunAction::EndOfRunAction(const G4Run*) { void GeneRunAction::EndOfRunAction(const G4Run*) {
// Run ended, update the visualization // Run ended, update the visualization

View File

@ -20,6 +20,8 @@
# 设置颜色 # 设置颜色
/vis/viewer/set/style surface /vis/viewer/set/style surface
# 设置 World 不可见
/vis/geometry/set/visibility world 0 false
# 坐标轴 # 坐标轴
/vis/scene/add/scale # Simple scale line /vis/scene/add/scale # Simple scale line