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
*.root
*.data

View File

@ -5,8 +5,9 @@
"includePath": [
"${default}",
"${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": [
"_DEBUG",

View File

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

View File

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

View File

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

View File

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

View File

@ -17,16 +17,11 @@
#include "Randomize.hh"
#define ANALYSIS_USE
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GeneEventAction::GeneEventAction() : GeneHe3detSDCollID(-1), drawFlag("non") {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GeneEventAction::~GeneEventAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GeneEventAction::BeginOfEventAction(const G4Event* evt) {
G4int evtNb = evt->GetEventID();
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) {
// G4int event_id = evt->GetEventID();
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();

View File

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

View File

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

View File

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

View File

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