fix: code style
This commit is contained in:
parent
dbc12a3d02
commit
b1e07c6ade
@ -1,14 +1,11 @@
|
||||
#ifndef GENEANALYSISMANAGER_HH
|
||||
#define GENEANALYSISMANAGER_HH 1
|
||||
|
||||
#define ANALYSIS_USE
|
||||
#include "globals.hh"
|
||||
|
||||
#ifdef ANALYSIS_USE
|
||||
#include "TFile.h"
|
||||
#include "TROOT.h"
|
||||
#include "TTree.h"
|
||||
#endif
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
struct detEvent {
|
||||
G4double Thetacm;
|
||||
@ -37,24 +34,20 @@ public:
|
||||
void FillAng(G4double thetacm, G4double thetalab);
|
||||
void FillDetData(G4int ndets, G4double *edet, G4int *ndet);
|
||||
|
||||
// void EventNo();
|
||||
// void EventNo();
|
||||
|
||||
#ifdef ANALYSIS_USE
|
||||
void book();
|
||||
void FillTree();
|
||||
void save();
|
||||
#endif
|
||||
|
||||
private:
|
||||
static GeneAnalysisManager *instance;
|
||||
struct detEvent mydata;
|
||||
|
||||
// G4int evtNo;
|
||||
// G4int evtNo;
|
||||
G4String analysisFileName;
|
||||
|
||||
#ifdef ANALYSIS_USE
|
||||
TFile *theTFile;
|
||||
TTree *tr;
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
@ -2,24 +2,16 @@
|
||||
|
||||
GeneAnalysisManager* GeneAnalysisManager::instance = 0;
|
||||
|
||||
GeneAnalysisManager::GeneAnalysisManager()
|
||||
#ifdef ANALYSIS_USE
|
||||
: analysisFileName("Simulation_C13an.root"),
|
||||
theTFile(0),
|
||||
tr(0)
|
||||
#endif
|
||||
{
|
||||
// evtNo = 0;
|
||||
GeneAnalysisManager::GeneAnalysisManager() : analysisFileName("Simulation_C13an.root"), theTFile(0), tr(0) {
|
||||
// evtNo = 0;
|
||||
memset(&mydata, 0x00, sizeof(mydata));
|
||||
}
|
||||
|
||||
GeneAnalysisManager::~GeneAnalysisManager() {
|
||||
#ifdef ANALYSIS_USE
|
||||
delete theTFile;
|
||||
theTFile = 0;
|
||||
delete tr;
|
||||
tr = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
GeneAnalysisManager* GeneAnalysisManager::GetInstance() {
|
||||
@ -42,13 +34,8 @@ void GeneAnalysisManager::FillAng(G4double thetacm, G4double thetalab) {
|
||||
mydata.Thetalab = thetalab;
|
||||
}
|
||||
|
||||
/*
|
||||
void GeneAnalysisManager::EventNo(){
|
||||
evtNo++;
|
||||
}
|
||||
*/
|
||||
// void GeneAnalysisManager::EventNo() { evtNo++; }
|
||||
|
||||
#ifdef ANALYSIS_USE
|
||||
void GeneAnalysisManager::book() {
|
||||
// delete all associated variables created via new, moreover it delete itself.
|
||||
if (theTFile != 0) delete theTFile;
|
||||
@ -75,8 +62,6 @@ void GeneAnalysisManager::save() {
|
||||
theTFile->Write();
|
||||
theTFile->Close();
|
||||
}
|
||||
// evtNo = 0;
|
||||
// G4cout<<" --> reactNum: "<< reactNum <<G4endl;
|
||||
// evtNo = 0;
|
||||
// 4cout<<" --> reactNum: "<< reactNum <<G4endl;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -121,9 +121,9 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
|
||||
G4VisAttributes* He3active_vis = new G4VisAttributes(G4Colour(1.0, 0.0, 0.0));
|
||||
He3active_vis->SetForceSolid(true);
|
||||
He3active_log->SetVisAttributes(He3active_vis);
|
||||
// He3gas_log -> SetVisAttributes(G4VisAttributes::GetInvisible);
|
||||
// He3gas_log -> SetVisAttributes(G4VisAttributes::GetInvisible);
|
||||
He3tub_log->SetVisAttributes(G4VisAttributes::GetInvisible);
|
||||
// He3active_log -> SetVisAttributes(G4VisAttributes::GetInvisible);
|
||||
// He3active_log -> SetVisAttributes(G4VisAttributes::GetInvisible);
|
||||
|
||||
G4SubtractionSolid* solid_PE = new G4SubtractionSolid("solid_PE", PE_box, PE_hole);
|
||||
G4SubtractionSolid* sub_BPE = new G4SubtractionSolid("sub_BPE", BPE_box, PE_box);
|
||||
@ -161,12 +161,12 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
|
||||
// PE_vis->SetForceWireframe(true);
|
||||
PE_log->SetVisAttributes(PE_vis);
|
||||
|
||||
// G4VisAttributes* BPE_vis= new G4VisAttributes(G4Colour(1.0,1.0,1.0,0.1));
|
||||
// BPE_vis->SetForceSolid(true);
|
||||
// G4VisAttributes* BPE_vis= new G4VisAttributes(G4Colour(1.0,1.0,1.0,0.1));
|
||||
// BPE_vis->SetForceSolid(true);
|
||||
// BPE_vis->SetForceWireframe(true);
|
||||
// BPE_log->SetVisAttributes(BPE_vis);
|
||||
// BPE_log->SetVisAttributes(BPE_vis);
|
||||
|
||||
// PE_log -> SetVisAttributes(G4VisAttributes::GetInvisible);
|
||||
// PE_log -> SetVisAttributes(G4VisAttributes::GetInvisible);
|
||||
BPE_log->SetVisAttributes(G4VisAttributes::GetInvisible);
|
||||
|
||||
G4double posz = tube_hole_len - 0.5 * BPE_xyz - 0.5 * tube_len;
|
||||
@ -258,10 +258,10 @@ G4VPhysicalVolume* GeneDetectorConstruction::Construct() {
|
||||
CuSubstrate_log1->SetVisAttributes(CuSub_vis);
|
||||
CuSubstrate_log2->SetVisAttributes(CuSub_vis);
|
||||
CuSubstrate_log3->SetVisAttributes(CuSub_vis);
|
||||
// CuSubstrate_log0 -> SetVisAttributes(G4VisAttributes::GetInvisible);
|
||||
// CuSubstrate_log1 -> SetVisAttributes(G4VisAttributes::GetInvisible);
|
||||
// CuSubstrate_log2 -> SetVisAttributes(G4VisAttributes::GetInvisible);
|
||||
// CuSubstrate_log3 -> SetVisAttributes(G4VisAttributes::GetInvisible);
|
||||
// CuSubstrate_log0 -> SetVisAttributes(G4VisAttributes::GetInvisible);
|
||||
// CuSubstrate_log1 -> SetVisAttributes(G4VisAttributes::GetInvisible);
|
||||
// CuSubstrate_log2 -> SetVisAttributes(G4VisAttributes::GetInvisible);
|
||||
// CuSubstrate_log3 -> SetVisAttributes(G4VisAttributes::GetInvisible);
|
||||
|
||||
// Target flange
|
||||
G4double flange0_thickness = 9.0 * mm;
|
||||
|
@ -15,7 +15,7 @@ GeneDetectorConstructionMessenger::GeneDetectorConstructionMessenger(GeneDetecto
|
||||
ZoffsetCmd->SetGuidance("Set detector Z offset");
|
||||
ZoffsetCmd->SetParameterName("Zoffset", false);
|
||||
ZoffsetCmd->SetUnitCategory("Length");
|
||||
// ZoffsetCmd->SetRange("Zoffset>0");
|
||||
// ZoffsetCmd->SetRange("Zoffset>0");
|
||||
ZoffsetCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
|
||||
ZactiveshiftCmd = new G4UIcmdWithADoubleAndUnit("/Gene/Detector/SetZactiveshift", this);
|
||||
|
@ -16,8 +16,6 @@
|
||||
#include "GeneHe3detHit.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
#define ANALYSIS_USE
|
||||
|
||||
GeneEventAction::GeneEventAction() : GeneHe3detSDCollID(-1), drawFlag("non") {}
|
||||
|
||||
GeneEventAction::~GeneEventAction() {}
|
||||
@ -33,7 +31,7 @@ void GeneEventAction::BeginOfEventAction(const G4Event* evt) {
|
||||
}
|
||||
|
||||
void GeneEventAction::EndOfEventAction(const G4Event* evt) {
|
||||
// G4int event_id = evt->GetEventID();
|
||||
// G4int event_id = evt->GetEventID();
|
||||
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
|
||||
GeneHe3detHitsCollection* GeneHe3detHC = 0;
|
||||
GeneAnalysisManager* analysisManager = GeneAnalysisManager::GetInstance();
|
||||
@ -65,15 +63,13 @@ void GeneEventAction::EndOfEventAction(const G4Event* evt) {
|
||||
}
|
||||
}
|
||||
analysisManager->FillDetData(cpNo, Etot, Ndet);
|
||||
// analysisManager->EventNo(); // evtNo++ only for detected events
|
||||
#ifdef ANALYSIS_USE
|
||||
// analysisManager->EventNo(); // evtNo++ only for detected events
|
||||
analysisManager->FillTree();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// G4cout<<"--> EndOfEventAction in EventAction"<<G4endl;
|
||||
// G4cout<<"--> EndOfEventAction in EventAction"<<G4endl;
|
||||
|
||||
if (drawFlag == "all") drawtracks(evt);
|
||||
}
|
||||
|
@ -27,9 +27,9 @@ G4bool GeneHe3detSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) {
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
G4ParticleDefinition* particleType = aStep->GetTrack()->GetDefinition();
|
||||
G4String particleName = particleType->GetParticleName();
|
||||
// G4double stepl = 0.;
|
||||
// if (particleType->GetPDGCharge() != 0.)
|
||||
// stepl = aStep->GetStepLength();
|
||||
// G4double stepl = 0.;
|
||||
// if (particleType->GetPDGCharge() != 0.)
|
||||
// stepl = aStep->GetStepLength();
|
||||
if (particleName == "opticalphoton") return false;
|
||||
if ((edep == 0.)) return false;
|
||||
|
||||
|
@ -15,8 +15,6 @@
|
||||
|
||||
#include "fstream"
|
||||
|
||||
#define ANALYSIS_USE
|
||||
|
||||
GenePrimaryGeneratorAction::GenePrimaryGeneratorAction() {
|
||||
G4int n_particle = 1;
|
||||
particleGun = new G4ParticleGun(n_particle);
|
||||
@ -190,10 +188,8 @@ void GenePrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) {
|
||||
G4double y0 = std::sin(thetalabr) * std::sin(phi);
|
||||
G4double z0 = std::cos(thetalabr);
|
||||
|
||||
#ifdef ANALYSIS_USE
|
||||
GeneAnalysisManager* analysisManager = GeneAnalysisManager::GetInstance();
|
||||
analysisManager->FillAng(thetacmr, thetalabr);
|
||||
#endif
|
||||
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(x0, y0, z0));
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "GeneAnalysisManager.hh"
|
||||
#include "GeneRunActionMessenger.hh"
|
||||
|
||||
#define ANALYSIS_USE
|
||||
GeneRunAction::GeneRunAction() : G4UserRunAction() {
|
||||
RunNo = "00";
|
||||
pMessenger = new GeneRunActionMessenger(this);
|
||||
@ -23,13 +22,11 @@ void GeneRunAction::BeginOfRunAction(const G4Run*) {
|
||||
UI->ApplyCommand("/vis/scene/notifyHandlers");
|
||||
}
|
||||
|
||||
#ifdef ANALYSIS_USE
|
||||
GeneAnalysisManager* analysisManager = GeneAnalysisManager::GetInstance();
|
||||
G4String sFileName = "Simulation_RunNo" + RunNo + ".root";
|
||||
analysisManager->SetAnalysisFileName(sFileName);
|
||||
// Open an output file
|
||||
analysisManager->book();
|
||||
#endif
|
||||
}
|
||||
|
||||
void GeneRunAction::EndOfRunAction(const G4Run*) {
|
||||
@ -38,8 +35,6 @@ void GeneRunAction::EndOfRunAction(const G4Run*) {
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
|
||||
}
|
||||
|
||||
#ifdef ANALYSIS_USE
|
||||
GeneAnalysisManager* analysisManager = GeneAnalysisManager::GetInstance();
|
||||
analysisManager->save();
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user