diff options
| author | shivesh <s.p.mandalia@qmul.ac.uk> | 2018-08-21 15:36:34 +0100 |
|---|---|---|
| committer | shivesh <s.p.mandalia@qmul.ac.uk> | 2018-08-21 15:36:34 +0100 |
| commit | 2925dbae7f488c3113b5f574eca1ceaba0ffdaac (patch) | |
| tree | 40d8a7000690af2ba40433fc77c38fd23c841b25 | |
| parent | 3e2608bb7c803eea644edf9fc7afa5bf3921a429 (diff) | |
| download | G4BeamTest-2925dbae7f488c3113b5f574eca1ceaba0ffdaac.tar.gz G4BeamTest-2925dbae7f488c3113b5f574eca1ceaba0ffdaac.zip | |
Tue 21 Aug 15:36:34 BST 2018
32 files changed, 494 insertions, 969 deletions
@@ -1,2 +1,3 @@ *.o *.out +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 46aca8b..932304b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.h) #---------------------------------------------------------------------------- # Add the executable, and link it to the Geant4 libraries # -add_executable(G4BeamTest G4BeamTest.cc ${sources} ${headers}) +add_executable(G4BeamTest G4BeamTest.cxx ${sources} ${headers}) target_link_libraries(G4BeamTest ${Geant4_LIBRARIES} ) #---------------------------------------------------------------------------- @@ -40,12 +40,7 @@ target_link_libraries(G4BeamTest ${Geant4_LIBRARIES} ) # relies on these scripts being in the current working directory. # set(G4BeamTest_SCRIPTS - G4BeamTest.out - G4BeamTest.in - optPhoton.mac - gui.mac - icons.mac - run.png + run1.mac vis.mac ) diff --git a/G4BeamTest.cxx b/G4BeamTest.cxx index afe05dd..287d689 100644 --- a/G4BeamTest.cxx +++ b/G4BeamTest.cxx @@ -1,22 +1,8 @@ -#ifdef G4MULTITHREADED -#include "G4MTRunManager.hh" -#else -#include "G4RunManager.hh" -#endif - #include "G4UImanager.hh" - -#include "BtPhysicsList.hh" -#include "BtDetectorConstruction.hh" -#include "BtActionInitialization.hh" - -#ifdef G4VIS_USE -#include "G4VisExecutive.hh" -#endif - -#ifdef G4UI_USE #include "G4UIExecutive.hh" -#endif + +#include "G4Interface.h" +#include "G4BeamTestTank.h" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... namespace { @@ -66,44 +52,21 @@ int main(int argc,char** argv) // G4Random::setTheEngine(new CLHEP::RanecuEngine); - // Construct the default run manager - // -#ifdef G4MULTITHREADED - G4MTRunManager * runManager = new G4MTRunManager; - if ( nThreads > 0 ) runManager->SetNumberOfThreads(nThreads); -#else - G4RunManager * runManager = new G4RunManager; -#endif - // Seed the random number generator manually G4Random::setTheSeed(myseed); - // Set mandatory initialization classes - // - // Detector construction - runManager-> SetUserInitialization(new btDetectorConstruction()); - // Physics list - runManager-> SetUserInitialization(new btPhysicsList()); - // User action initialization - runManager->SetUserInitialization(new btActionInitialization()); - // Initialize G4 kernel // - runManager->Initialize(); - -#ifdef G4VIS_USE - // Initialize visualization - // - G4VisManager* visManager = new G4VisExecutive; - // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance. - // G4VisManager* visManager = new G4VisExecutive("Quiet"); - visManager->Initialize(); -#endif + G4Interface *g4Interface_ = G4Interface::GetInstance(); + if (!g4Interface_) g4Interface_ = new G4Interface(macro); + G4BeamTestTank *g4Tank_ = new G4BeamTestTank(/* tankKey_, geometry */); + g4Interface_->InstallTank(g4Tank_); + g4Interface_->InitializeEvent(); // Get the pointer to the User Interface manager // G4UImanager* UImanager = G4UImanager::GetUIpointer(); - + if ( macro.size() ) { // Batch mode G4String command = "/control/execute "; @@ -116,7 +79,7 @@ int main(int argc,char** argv) #ifdef G4VIS_USE UImanager->ApplyCommand("/control/execute vis.mac"); #else - UImanager->ApplyCommand("/control/execute OpNovice.in"); + UImanager->ApplyCommand("/control/execute G4BeamTest.in"); #endif if (ui->IsGUI()) UImanager->ApplyCommand("/control/execute gui.mac"); @@ -129,11 +92,7 @@ int main(int argc,char** argv) // Free the store: user actions, physics_list and detector_description are // owned and deleted by the run manager, so they should not // be deleted in the main() program ! - -#ifdef G4VIS_USE - delete visManager; -#endif - delete runManager; + delete g4Interface_; return 0; } diff --git a/I3G4TankResponse.cxx b/I3G4TankResponse.cxx.backup index cc34d1e..53cee3d 100644 --- a/I3G4TankResponse.cxx +++ b/I3G4TankResponse.cxx.backup @@ -1,27 +1,13 @@ -/** - * Copyright (C) 2009 - * The IceCube collaboration - * ID: $Id: I3G4TankResponse.cxx 158929 2017-10-20 00:58:24Z cweaver $ - * - * @file I3G4TankResponse.cxx - * @version $Revision: 158929 $ - * @date $Date: 2017-10-20 01:58:24 +0100 (Fri, 20 Oct 2017) $ - * @author Tilo Waldenmaier <tilo.waldenmaier@desy.de>, Thomas Melzig <thomas.melzig@desy.de> - * - * $LastChangedBy: cweaver $ - */ - - #include <topsimulator/interface/I3IceTopResponseFactory.h> #include <topsimulator/GeoFunctions.h> -#include <g4-tankresponse/g4classes/G4IceTopTank.h> -#include <g4-tankresponse/g4classes/G4Interface.h> -#include <g4-tankresponse/I3G4TankResponse.h> +#include "G4IceTopTank.h" +#include "G4Interface.h" +#include "I3G4TankResponse.h" //#include <pmt-simulator/I3PMTConstants.h> -#include <phys-services/I3GSLRandomService.h> -#include <dataclasses/physics/I3Particle.h> -#include <dataclasses/I3Direction.h> -#include <simclasses/I3MCPE.h> +/* #include <phys-services/I3GSLRandomService.h> */ +/* #include <dataclasses/physics/I3Particle.h> */ +/* #include <dataclasses/I3Direction.h> */ +/* #include <simclasses/I3MCPE.h> */ #include <cmath> @@ -371,4 +357,4 @@ void I3G4TankResponse::EndEvent(HitHistoCollection &hitHC, HitHistoCollection& c } -I3_SERVICE_FACTORY(I3IceTopResponseFactory<I3G4TankResponse>); +/* I3_SERVICE_FACTORY(I3IceTopResponseFactory<I3G4TankResponse>); */ diff --git a/include/G4BeamTestDetectorConstruction.h b/include/G4BeamTestDetectorConstruction.h index ce53256..a3c0c9f 100644 --- a/include/G4BeamTestDetectorConstruction.h +++ b/include/G4BeamTestDetectorConstruction.h @@ -4,7 +4,7 @@ #include <G4VUserDetectorConstruction.hh> #include <G4ThreeVector.hh> -// class G4BeamTestTank; +#include "G4BeamTestTank.h"; class G4BeamTestDetectorConstruction: public G4VUserDetectorConstruction { @@ -17,7 +17,7 @@ class G4BeamTestDetectorConstruction: public G4VUserDetectorConstruction void SetVerboseLevel(G4int level) {verboseLevel_=level;} - /* void InstallTank(G4BeamTestTank* tank) {tankList_.push_back(tank);} */ + void InstallTank(G4BeamTestTank* tank) {tank_ = tank;} const G4ThreeVector& GetWorldOrigin() const {return origin_;} @@ -39,7 +39,7 @@ class G4BeamTestDetectorConstruction: public G4VUserDetectorConstruction G4int verboseLevel_; - // std::vector<G4BeamTestTank*> tankList_; + G4BeamTestTank* tank_; }; #endif diff --git a/include/G4BeamTestEMPhysics.h b/include/G4BeamTestEMPhysics.h index 797719e..bf20b62 100644 --- a/include/G4BeamTestEMPhysics.h +++ b/include/G4BeamTestEMPhysics.h @@ -1,15 +1,3 @@ -/* - * copyright (C) 2010 - * The Icecube Collaboration - * - * $Id: G4BeamTestEMPhysics.h 154687 2017-04-05 15:46:57Z jgonzalez $ - * - * @version $Revision: 154687 $ - * @date $LastChangedDate: 2017-04-05 16:46:57 +0100 (Wed, 05 Apr 2017) $ - * @author Fabian Kislat <fabian.kislat@desy.de>, Peter Nießen (tanktop) - * Last changed by: $LastChangedBy: jgonzalez $ - */ - #ifndef G4TANKRESPONSE_G4BEAMTESTEMPHYSICS_H_INCLUDED #define G4TANKRESPONSE_G4BEAMTESTEMPHYSICS_H_INCLUDED diff --git a/include/G4BeamTestGeneralPhysics.h b/include/G4BeamTestGeneralPhysics.h index 012bf40..19ab27b 100644 --- a/include/G4BeamTestGeneralPhysics.h +++ b/include/G4BeamTestGeneralPhysics.h @@ -1,14 +1,3 @@ -/* - * copyright (C) 2010 - * The Icecube Collaboration - * - * $Id: G4BeamTestGeneralPhysics.h 149388 2016-08-18 21:50:04Z jgonzalez $ - * - * @version $Revision: 149388 $ - * @date $LastChangedDate: 2016-08-18 22:50:04 +0100 (Thu, 18 Aug 2016) $ - * @author Fabian Kislat <fabian.kislat@desy.de> Last changed by: $LastChangedBy: jgonzalez $ - */ - #ifndef G4TANKRESPONSE_G4BEAMTESTGENERALPHYSICS_H_INCLUDED #define G4TANKRESPONSE_G4BEAMTESTGENERALPHYSICS_H_INCLUDED diff --git a/include/G4BeamTestHadronPhysics.h b/include/G4BeamTestHadronPhysics.h.backup index 0fd9868..dc2bf67 100644 --- a/include/G4BeamTestHadronPhysics.h +++ b/include/G4BeamTestHadronPhysics.h.backup @@ -1,14 +1,3 @@ -/* - * copyright (C) 2010 - * The Icecube Collaboration - * - * $Id: G4BeamTestHadronPhysics.h 154687 2017-04-05 15:46:57Z jgonzalez $ - * - * @version $Revision: 154687 $ - * @date $LastChangedDate: 2017-04-05 16:46:57 +0100 (Wed, 05 Apr 2017) $ - * @author Fabian Kislat <fabian.kislat@desy.de> Last changed by: $LastChangedBy: jgonzalez $ - */ - #ifndef G4TANKRESPONSE_G4BEAMTESTHADRONPHYSICS_H_INCLUDED #define G4TANKRESPONSE_G4BEAMTESTHADRONPHYSICS_H_INCLUDED diff --git a/include/G4BeamTestIonPhysics.h b/include/G4BeamTestIonPhysics.h.backup index 276b0d5..0a9d5f1 100644 --- a/include/G4BeamTestIonPhysics.h +++ b/include/G4BeamTestIonPhysics.h.backup @@ -1,15 +1,3 @@ -/* - * copyright (C) 2010 - * The Icecube Collaboration - * - * $Id: G4BeamTestIonPhysics.h 154687 2017-04-05 15:46:57Z jgonzalez $ - * - * @version $Revision: 154687 $ - * @date $LastChangedDate: 2017-04-05 16:46:57 +0100 (Wed, 05 Apr 2017) $ - * @author Fabian Kislat <fabian.kislat@desy.de>, Peter Nießen (tanktop) - * Last changed by: $LastChangedBy: jgonzalez $ - */ - #ifndef G4TANKRESPONSE_G4BEAMTESTIONPHYSICS_H_INCLUDED #define G4TANKRESPONSE_G4BEAMTESTIONPHYSICS_H_INCLUDED diff --git a/include/G4BeamTestMuonPhysics.h b/include/G4BeamTestMuonPhysics.h index de09d73..0c53595 100644 --- a/include/G4BeamTestMuonPhysics.h +++ b/include/G4BeamTestMuonPhysics.h @@ -1,15 +1,3 @@ -/* - * copyright (C) 2010 - * The Icecube Collaboration - * - * $Id: G4BeamTestMuonPhysics.h 154687 2017-04-05 15:46:57Z jgonzalez $ - * - * @version $Revision: 154687 $ - * @date $LastChangedDate: 2017-04-05 16:46:57 +0100 (Wed, 05 Apr 2017) $ - * @author Fabian Kislat <fabian.kislat@desy.de>, Peter Nießen (tanktop) - * Last changed by: $LastChangedBy: jgonzalez $ - */ - #ifndef G4TANKRESPONSE_G4BEAMTESTMUONPHYSICS_H_INCLUDED #define G4TANKRESPONSE_G4BEAMTESTMUONPHYSICS_H_INCLUDED @@ -20,7 +8,7 @@ #include <G4MuPairProduction.hh> #include <G4MuIonisation.hh> #include <G4hIonisation.hh> -#include <G4MuonMinusCaptureAtRest.hh> +#include <G4MuonMinusCapture.hh> /** @class G4BeamTestMuonPhysics @@ -58,7 +46,7 @@ private: G4MuBremsstrahlung muMinusBremsstrahlung_; G4MuPairProduction muMinusPairProduction_; - G4MuonMinusCaptureAtRest muMinusCaptureAtRest_; + G4MuonMinusCapture muMinusCapture_; // Tau physics G4MuMultipleScattering tauPlusMultipleScattering_; diff --git a/include/G4BeamTestPhysicsList.h b/include/G4BeamTestPhysicsList.h index e253e33..7fb7ed5 100644 --- a/include/G4BeamTestPhysicsList.h +++ b/include/G4BeamTestPhysicsList.h @@ -1,14 +1,3 @@ -/** - * Copyright (C) 2009 - * The IceCube collaboration - * ID: $Id: G4BeamTestPhysicsList.h 149388 2016-08-18 21:50:04Z jgonzalez $ - * - * @file G4BeamTestPhysicsList.h - * @version $Rev: 149388 $ - * @date $Date: 2016-08-18 22:50:04 +0100 (Thu, 18 Aug 2016) $ - * @author Tilo Waldenmaier, Thomas Melzig, Fabian Kislat - */ - #ifndef _TOPSIMULATOR_G4BEAMTESTPHYSICSLIST_H #define _TOPSIMULATOR_G4BEAMTESTPHYSICSLIST_H diff --git a/include/G4BeamTestRunManager.h b/include/G4BeamTestRunManager.h index c142b38..a7eaff0 100644 --- a/include/G4BeamTestRunManager.h +++ b/include/G4BeamTestRunManager.h @@ -1,15 +1,3 @@ -/** - * Copyright (C) 2009 - * The IceCube collaboration - * ID: $Id: G4BeamTestRunManager.h 149391 2016-08-18 21:58:04Z jgonzalez $ - * - * @file G4BeamTestRunManager.h - * @version $Rev: 149391 $ - * @date $Date: 2016-08-18 22:58:04 +0100 (Thu, 18 Aug 2016) $ - * @author Tilo Waldenmaier - */ - - #ifndef TOPSIMULATOR_G4BEAMTESTRUNMANAGER_H #define TOPSIMULATOR_G4BEAMTESTRUNMANAGER_H @@ -25,7 +13,7 @@ class G4BeamTestRunManager: public G4RunManager public: G4BeamTestRunManager(); - static G4BeamTestRunManager* GetIceTopRunManager() {return (G4IceTopRunManager*)GetRunManager();} + static G4BeamTestRunManager* GetIceTopRunManager() {return (G4BeamTestRunManager*)GetRunManager();} // Disable BeamOn void BeamOn(G4int n_event,const char* macroFile=0,G4int n_select=-1); diff --git a/include/G4BeamTestTank.h b/include/G4BeamTestTank.h index b08e223..c7a1713 100644 --- a/include/G4BeamTestTank.h +++ b/include/G4BeamTestTank.h @@ -1,22 +1,10 @@ -/** - * Copyright (C) 2009 - * The IceCube collaboration - * ID: $Id: G4BeamTestTank.h 149431 2016-08-19 17:38:06Z jgonzalez $ - * - * @file G4BeamTestTank.h - * @version $Rev: 149431 $ - * @date $Date: 2016-08-19 18:38:06 +0100 (Fri, 19 Aug 2016) $ - * @author Tilo Waldenmaier, Thomas Melzig - */ - - #ifndef _TOPSIMULATOR_G4BEAMTESTTANK_H_ #define _TOPSIMULATOR_G4BEAMTESTTANK_H_ -class OMKey; -struct TankKey; -class I3Geometry; -class I3Position; +// class OMKey; +// struct TankKey; +// class I3Geometry; +// class I3Position; class G4LogicalVolume; class G4VPhysicalVolume; @@ -26,8 +14,6 @@ class G4TankIceSD; #include <G4ThreeVector.hh> #include <map> -#include <icetray/I3Logging.h> - /** * This class constructs the physical volume of single tanks, serves as bridge to the sensitive detector in the tank, and computes the location of the point that define the snow surface. It also stores the basic tank dimensions (height, radius, snow). * @@ -39,49 +25,49 @@ class G4TankIceSD; class G4BeamTestTank { public: - G4BeamTestTank(const TankKey& tankKey, const I3Geometry& geometry); + G4BeamTestTank(/* const TankKey& tankKey, const I3Geometry& geometry */); ~G4BeamTestTank(); const G4ThreeVector& GetPos() const {return position_;} - /// Position of center of the tank - I3Position GetPos_I3(); - double GetX_I3(); - double GetY_I3(); - double GetZ_I3(); + /* /// Position of center of the tank */ + /* I3Position GetPos_I3(); */ + /* double GetX_I3(); */ + /* double GetY_I3(); */ + /* double GetZ_I3(); */ - /// Delaunay points around tank - const G4ThreeVector& GetDelaunayPoint1() const {return delaunayPoint1_;} - const G4ThreeVector& GetDelaunayPoint2() const {return delaunayPoint2_;} - const G4ThreeVector& GetDelaunayPoint3() const {return delaunayPoint3_;} + /* /// Delaunay points around tank */ + /* const G4ThreeVector& GetDelaunayPoint1() const {return delaunayPoint1_;} */ + /* const G4ThreeVector& GetDelaunayPoint2() const {return delaunayPoint2_;} */ + /* const G4ThreeVector& GetDelaunayPoint3() const {return delaunayPoint3_;} */ /// Tank dimensions in Geant4 units G4double GetTankHeight_G4() {return tankHeight_;} G4double GetTankRadius_G4() {return outerRadius_;} - G4double GetSnowHeight_G4() {return snowHeight_;} + G4double GetFillHeight_G4() {return fillHeight_;} - /// Tank dimensions in IceCube units and reference system - double GetTankHeight_I3(); - double GetTankRadius_I3(); - double GetSnowHeight_I3(); + /* /// Tank dimensions in IceCube units and reference system */ + /* double GetTankHeight_I3(); */ + /* double GetTankRadius_I3(); */ + /* double GetSnowHeight_I3(); */ /// Energy deposit for a given OM, in Geant4 units (from G4TankIceSD) - G4double GetEDep_G4(const OMKey& omKey); + G4double GetEDep_G4(/* const OMKey& omKey */); /// Emission time for a given OM, in Geant4 units (from G4TankIceSD) - G4double GetTime_G4(const OMKey& omKey); + G4double GetTime_G4(/* const OMKey& omKey */); - /// Energy deposit for a given OM, in Geant4 units (from G4TankIceSD) - double GetEDep_I3(const OMKey& omKey); - /// Emission time for a given OM, in Geant4 units (from G4TankIceSD) - double GetTime_I3(const OMKey& omKey); + /* /// Energy deposit for a given OM, in Geant4 units (from G4TankIceSD) */ + /* double GetEDep_I3(const OMKey& omKey); */ + /* /// Emission time for a given OM, in Geant4 units (from G4TankIceSD) */ + /* double GetTime_I3(const OMKey& omKey); */ /// Number of Cherenkovs for a given OM (from G4TankIceSD) - double GetNumCherenkov(const OMKey& omKey); + double GetNumCherenkov(/* const OMKey& omKey */); /// Number of Cherenkovs weighted by emission point (from G4TankIceSD) - double GetNumCherenkovWeight(const OMKey& omKey); + double GetNumCherenkovWeight(/* const OMKey& omKey */); - const TankKey& GetTankKey() const {return tankKey_;} + /* const TankKey& GetTankKey() const {return tankKey_;} */ /// Method to call when constructing detector G4VPhysicalVolume* InstallTank(G4VPhysicalVolume* mother, const G4ThreeVector& origin); @@ -94,27 +80,27 @@ class G4BeamTestTank G4double innerRadius_; G4double outerRadius_; - G4double snowHeight_; - G4double perliteHeight_; + G4double waterHeight_; + G4double airHeight_; G4double glassOuterRadius_; G4double glassThickness_; G4ThreeVector position_; - G4ThreeVector delaunayPoint1_; - G4ThreeVector delaunayPoint2_; - G4ThreeVector delaunayPoint3_; - - std::map<OMKey, G4ThreeVector> relDomPositions_; + // G4ThreeVector delaunayPoint1_; + // G4ThreeVector delaunayPoint2_; + // G4ThreeVector delaunayPoint3_; + // + // std::map<OMKey, G4ThreeVector> relDomPositions_; G4LogicalVolume* tankLog_; G4TankIceSD* iceSD_; - const TankKey& tankKey_; - const I3Geometry& geometry_; + /* const TankKey& tankKey_; */ + /* const I3Geometry& geometry_; */ - SET_LOGGER("G4BeamTestTank"); + /* SET_LOGGER("G4BeamTestTank"); */ }; #endif diff --git a/include/G4BeamTestUserSteppingAction.h b/include/G4BeamTestUserSteppingAction.h index 9807bbf..2d09799 100644 --- a/include/G4BeamTestUserSteppingAction.h +++ b/include/G4BeamTestUserSteppingAction.h @@ -1,19 +1,5 @@ #ifndef G4BEAMTESTUSERSTEPPINGACTION_H_INCLUDED #define G4BEAMTESTUSERSTEPPINGACTION_H_INCLUDED -/** - * Copyright (C) 2011 - * The IceCube collaboration - * ID: $Id$ - * - * @file G4BeamTestUserSteppingAction.h - * @version $Revision$ - * @date $Date$ - * @author Thomas Melzig - * - * $LastChangedBy$ - */ - - #include "G4UserSteppingAction.hh" /** diff --git a/include/G4BeamTestUserTrackingAction.h b/include/G4BeamTestUserTrackingAction.h index bb6d155..9786f52 100644 --- a/include/G4BeamTestUserTrackingAction.h +++ b/include/G4BeamTestUserTrackingAction.h @@ -1,19 +1,5 @@ #ifndef G4BEAMTESTUSERTRACKINGACTION_H_INCLUDED #define G4BEAMTESTUSERTRACKINGACTION_H_INCLUDED -/** - * Copyright (C) 2011 - * The IceCube collaboration - * ID: $Id$ - * - * @file G4BeamTestUserTrackingAction.h - * @version $Revision$ - * @date $Date$ - * @author Thomas Melzig - * - * $LastChangedBy$ - */ - - #include "G4UserTrackingAction.hh" /** diff --git a/include/G4Interface.h b/include/G4Interface.h index c9bec07..4b88f00 100644 --- a/include/G4Interface.h +++ b/include/G4Interface.h @@ -1,19 +1,8 @@ -/** - * Copyright (C) 2009 - * The IceCube collaboration - * ID: $Id: G4Interface.h 149388 2016-08-18 21:50:04Z jgonzalez $ - * - * @file G4Interface.h - * @version $Rev: 149388 $ - * @date $Date: 2016-08-18 22:50:04 +0100 (Thu, 18 Aug 2016) $ - * @author Tilo Waldenmaier - */ - #ifndef _TOPSIM_G4INTERFACE_H_ #define _TOPSIM_G4INTERFACE_H_ -#include <g4-tankresponse/g4classes/G4BeamTestRunManager.h> -#include <icetray/I3Logging.h> +#include "G4BeamTestRunManager.h" +/* #include <icetray/I3Logging.h> */ #ifdef G4VIS_USE class G4VisManager; @@ -44,7 +33,10 @@ class G4Interface /// To be called after simulating each IceTray event. void TerminateEvent(); /// Simulate a single particle (InitializeEvent must be called first) - void InjectParticle(const I3Particle& particle); + void InjectParticle(const std::string& particleName, + const G4ThreeVector& particlePosition, + const G4ThreeVector& particleDirection, + const G4double particleEnergy); private: void Initialize(); @@ -62,7 +54,7 @@ class G4Interface bool eventInitialized_; std::string visMacro_; - SET_LOGGER("G4Interface"); + /* SET_LOGGER("G4Interface"); */ }; #endif diff --git a/include/G4TankIceSD.h b/include/G4TankIceSD.h index 75375c1..25ce7ca 100644 --- a/include/G4TankIceSD.h +++ b/include/G4TankIceSD.h @@ -1,24 +1,12 @@ -/** - * Copyright (C) 2009 - * The IceCube collaboration - * ID: $Id: G4TankIceSD.h 149388 2016-08-18 21:50:04Z jgonzalez $ - * - * @file G4TankIceSD.h - * @version $Rev: 149388 $ - * @date $Date: 2016-08-18 22:50:04 +0100 (Thu, 18 Aug 2016) $ - * @author Tilo Waldenmaier, Thomas Melzig - */ - - #ifndef _G4TANKRESPONSE_G4TankIceSD_H #define _G4TANKRESPONSE_G4TankIceSD_H -#include <icetray/OMKey.h> +/* #include <icetray/OMKey.h> */ #include <G4VSensitiveDetector.hh> #include <G4ThreeVector.hh> -#include <map> +/* #include <map> */ class G4Step; class G4HCofThisEvent; @@ -26,7 +14,7 @@ class G4TouchableHistory; /** - * An "ice sensitive detector". This sensitive detector is meant to be associated with the ice logical volume in a tank. + * An "ice sensitive detector". This sensitive detector is meant to be associated with the ice logical volume in a tank. TODO(shivesh): make the PMT the SD * * This class keeps track of the energy losses and number Cherenkov photons produced in the ice of each tank. * The Cherenkov photons are counted in two ways. One is a simple count and the other is a weighted count @@ -35,7 +23,7 @@ class G4TouchableHistory; class G4TankIceSD : public G4VSensitiveDetector { public: - G4TankIceSD(G4String name, const std::map<OMKey, G4ThreeVector>& domPositions); + G4TankIceSD(G4String name/* , const std::map<OMKey, G4ThreeVector>& domPositions */); ~G4TankIceSD(); /// Methods called by Geant4 framework @@ -44,26 +32,26 @@ class G4TankIceSD : public G4VSensitiveDetector void EndOfEvent(G4HCofThisEvent *HCE); /// Get total energy deposit for a given OM (same for both OMs in a tank) - G4double GetEDep(const OMKey& omKey) {return sumEdep_[omKey];} + G4double GetEDep(/* const OMKey& omKey */) {return sumEdep_/* [omKey] */;} /// Get average emission time weighted by deposited energy (same for both OMs in a tank) - G4double GetTime(const OMKey& omKey) {return cogTime_[omKey];} + G4double GetTime(/* const OMKey& omKey */) {return cogTime_/* [omKey] */;} /// Get number of Cherenkov photons for a given OM (same for both OMs in a tank) - G4double GetNumCherenkov(const OMKey& omKey) {return cherenkovCounter_[omKey];} + G4double GetNumCherenkov(/* const OMKey& omKey */) {return cherenkovCounter_/* [omKey] */;} /// Get number of Cherenkov photons for a given OM weighted relative to emission point - G4double GetNumCherenkovWeight(const OMKey& omKey) {return cherenkovCounterWeight_[omKey];} + G4double GetNumCherenkovWeight(/* const OMKey& omKey */) {return cherenkovCounterWeight_/* [omKey] */;} private: //ExN04TrackerHitsCollection *trackerCollection; - const std::map<OMKey, G4ThreeVector> domPositions_; + const G4ThreeVector domPositions_; /// Cherenkov production. See technical note G4double GetCerenkovNumber(G4Step* aStep); G4double GetProbability(G4double radius, G4double height); - std::map<OMKey, G4double> sumEdep_; - std::map<OMKey, G4double> cogTime_; - std::map<OMKey, G4double> cherenkovCounter_; - std::map<OMKey, G4double> cherenkovCounterWeight_; + G4double sumEdep_; + G4double cogTime_; + G4double cherenkovCounter_; + G4double cherenkovCounterWeight_; }; #endif diff --git a/run1.mac b/run1.mac new file mode 100644 index 0000000..fceb1c4 --- /dev/null +++ b/run1.mac @@ -0,0 +1,11 @@ +/gps/particle mu- +/gps/energy 8 GeV + +/gps/pos/type Plane +/gps/pos/shape Circle +/gps/pos/centre 60 60 -25 cm +/gps/pos/radius 0.5 cm +/gps/ang/type iso + +/gps/direction 1 0 0 +/run/beamOn 1 diff --git a/src/G4BeamTestDetectorConstruction.cxx b/src/G4BeamTestDetectorConstruction.cxx index 6eeaa54..cf75551 100644 --- a/src/G4BeamTestDetectorConstruction.cxx +++ b/src/G4BeamTestDetectorConstruction.cxx @@ -30,71 +30,31 @@ G4VPhysicalVolume* G4BeamTestDetectorConstruction::Construct() CreateMaterials(); - // Determine bottom z position of snow volume - G4double zSnowBottom(tankList_.at(0)->GetPos().z()); - BOOST_FOREACH(G4BeamTestTank* tank, tankList_) - { - // z position of bottom of tank - G4double z = tank->GetPos().z() - 0.5*tank->GetTankHeight_G4(); - zSnowBottom = std::min(z, zSnowBottom); - } - - // Subtract safety margin - zSnowBottom -= 1.0*CLHEP::m; - - // Triangulate snow surface - G4Delaunay delaunay; - BOOST_FOREACH(G4BeamTestTank* tank, tankList_) - { - // z position of snow surface - G4double z = tank->GetPos().z() + 0.5 * tank->GetTankHeight_G4() + tank->GetSnowHeight_G4(); - - delaunay.AddPoint(tank->GetDelaunayPoint1().x(), - tank->GetDelaunayPoint1().y(), - z - zSnowBottom); - delaunay.AddPoint(tank->GetDelaunayPoint2().x(), - tank->GetDelaunayPoint2().y(), - z - zSnowBottom); - delaunay.AddPoint(tank->GetDelaunayPoint3().x(), - tank->GetDelaunayPoint3().y(), - z - zSnowBottom); - } - - // Create tesselated snow volume - G4TessellatedSolid* solidSnow = new G4TessellatedSolid("solid_snow"); - delaunay.BuildSolid(solidSnow, 50.0*CLHEP::m, 100.0*CLHEP::m); + /* // World origin in IceCube coordinates */ + /* origin_.set(delaunay.GetOrigin().x(), delaunay.GetOrigin().y(), zSnowBottom + zHalfLength); */ // Determine World dimensions - G4double xHalfLength = 0.5 * (delaunay.GetXmax() - delaunay.GetXmin()); - G4double yHalfLength = 0.5 * (delaunay.GetYmax() - delaunay.GetYmin()); - G4double zHalfLength = 0.5 * (delaunay.GetZmax() + 20.0 * CLHEP::m); // 20 m of atmosphere - - // World origin in IceCube coordinates - origin_.set(delaunay.GetOrigin().x(), delaunay.GetOrigin().y(), zSnowBottom + zHalfLength); + G4double xWorld = 20.0 * CLHEP::m; + G4double yWorld = 20.0 * CLHEP::m; + G4double zWorld = 20.0 * CLHEP::m; // Create world volume - G4Box* world_box = new G4Box("solid_world", xHalfLength, yHalfLength, zHalfLength); + G4Box* world_box = new G4Box("solid_world", xWorld, yWorld, zWorld); G4LogicalVolume* worldLog = - new G4LogicalVolume(world_box, G4Material::GetMaterial("Air"), "log_world", 0, 0, 0); + new G4LogicalVolume(world_box, G4Material::GetMaterial("G4_AIR"), "log_world", 0, 0, 0); G4VPhysicalVolume* worldPhys = new G4PVPlacement(0, G4ThreeVector(), worldLog, "world", 0, false, 0); - // Snow layer - G4LogicalVolume* snowLog = - new G4LogicalVolume(solidSnow, G4Material::GetMaterial("Snow"), "log_snow", 0, 0, 0); - G4VPhysicalVolume* snowPhys = - new G4PVPlacement(0, G4ThreeVector(0, 0, -zHalfLength), snowLog, "snow", worldLog, false, 0); - - // Instantiation of a set of visualization attributes with cyan colour - G4VisAttributes * snowVisAtt = new G4VisAttributes(G4Colour(0., 1., 1.)); - // Assignment of the visualization attributes to the logical volume - snowLog->SetVisAttributes(snowVisAtt); + /* // Instantiation of a set of visualization attributes with cyan colour */ + /* G4VisAttributes * snowVisAtt = new G4VisAttributes(G4Colour(0., 1., 1.)); */ + /* // Assignment of the visualization attributes to the logical volume */ + /* snowLog->SetVisAttributes(snowVisAtt); */ - // Install tanks - BOOST_FOREACH(G4BeamTestTank* tank, tankList_) - { - tank->InstallTank(snowPhys, origin_); - } + // Install tank + /* BOOST_FOREACH(G4BeamTestTank* tank, tankList_) */ + /* { */ + tank_->InstallTank(worldPhys, origin_); + // } // User limits (energy cutoffs) // Do not create photons or electrons below cherenkov threshold @@ -102,7 +62,7 @@ G4VPhysicalVolume* G4BeamTestDetectorConstruction::Construct() G4UserLimits* energyLimit = new G4UserLimits(); energyLimit->SetUserMinEkine(280.0 * CLHEP::keV); // Cherenkov threshold of electrons in ice TODO(shivesh) worldLog->SetUserLimits(energyLimit); - snowLog->SetUserLimits(energyLimit); + /* snowLog->SetUserLimits(energyLimit); */ return worldPhys; } @@ -128,7 +88,7 @@ void G4BeamTestDetectorConstruction::CreateMaterials() void G4BeamTestDetectorConstruction::CreateAir() { G4NistManager* nistManager = G4NistManager::Instance(); - nistManager->ConstructNewGasMaterial("Air","G4_AIR"/* , (273.15 - 40.0)*CLHEP::kelvin, 670.0E-3*CLHEP::bar */); + nistManager->ConstructNewGasMaterial("Air","G4_AIR" , (273.15 + 20.0)*CLHEP::kelvin, 1.0*CLHEP::atmosphere); } /*****************************************************************/ @@ -136,10 +96,19 @@ void G4BeamTestDetectorConstruction::CreateAir() void G4BeamTestDetectorConstruction::CreateWater() { G4NistManager* nistManager = G4NistManager::Instance(); - // G4Material* ice = new G4Material("Water", 1.0 * CLHEP::g / CLHEP::cm3, 2, kStateLiquid); - // ice->AddElement(nistManager->FindOrBuildElement("H"), 2); - // ice->AddElement(nistManager->FindOrBuildElement("O"), 1); - nistManager->ConstructNewGasMaterial("Water","G4_WATER"); + G4Material* water = new G4Material("Water", 1.0 * CLHEP::g / CLHEP::cm3, 2, kStateLiquid); + water->AddElement(nistManager->FindOrBuildElement("H"), 2); + water->AddElement(nistManager->FindOrBuildElement("O"), 1); + + // pmt spectral response 300-650nm + // https://docushare.icecube.wisc.edu/dsweb/Get/Document-6637/R7081-02%20data%20sheet.pdf<Paste> + // TODO(shivesh): add more properties? + const G4int water_bins = 2; + G4double water_ephot[water_bins] = {1.91 * CLHEP::eV, 4.13 * CLHEP::eV}; + G4double water_refr[water_bins] = {1.33, 1.33}; + G4MaterialPropertiesTable *mpt_water = new G4MaterialPropertiesTable (); + mpt_water->AddProperty ("RINDEX", water_ephot, water_refr, water_bins); + water->SetMaterialPropertiesTable(mpt_water); } /*****************************************************************/ diff --git a/src/G4BeamTestEMPhysics.cxx b/src/G4BeamTestEMPhysics.cxx index d36207a..55ecf99 100644 --- a/src/G4BeamTestEMPhysics.cxx +++ b/src/G4BeamTestEMPhysics.cxx @@ -1,16 +1,3 @@ -/* - * copyright (C) 2010 - * The Icecube Collaboration - * - * $Id: G4BeamTestEMPhysics.cxx 86420 2012-03-20 16:00:37Z kislat $ - * - * @version $Revision: 86420 $ - * @date $LastChangedDate: 2012-03-20 16:00:37 +0000 (Tue, 20 Mar 2012) $ - * @author Fabian Kislat <fabian.kislat@desy.de>, Peter Nießen (tanktop) - * Last changed by: $LastChangedBy: kislat $ - */ - - #include <globals.hh> #include <G4ParticleDefinition.hh> #include <G4ParticleTable.hh> diff --git a/src/G4BeamTestGeneralPhysics.cxx b/src/G4BeamTestGeneralPhysics.cxx index 2def9b4..93304a8 100644 --- a/src/G4BeamTestGeneralPhysics.cxx +++ b/src/G4BeamTestGeneralPhysics.cxx @@ -1,14 +1,3 @@ -/* - * copyright (C) 2010 - * The Icecube Collaboration - * - * $Id: G4BeamTestGeneralPhysics.cxx 152849 2017-01-20 21:44:25Z jgonzalez $ - * - * @version $Revision: 152849 $ - * @date $LastChangedDate: 2017-01-20 21:44:25 +0000 (Fri, 20 Jan 2017) $ - * @author Fabian Kislat <fabian.kislat@desy.de> Last changed by: $LastChangedBy: jgonzalez $ - */ - #include "G4BeamTestGeneralPhysics.h" #include <iomanip> diff --git a/src/G4BeamTestHadronPhysics.cxx b/src/G4BeamTestHadronPhysics.cxx.backup index 5150b67..1e37ed5 100644 --- a/src/G4BeamTestHadronPhysics.cxx +++ b/src/G4BeamTestHadronPhysics.cxx.backup @@ -1,16 +1,3 @@ -/* - * copyright (C) 2010 - * The Icecube Collaboration - * - * $Id: G4BeamTestHadronPhysics.cxx 152814 2017-01-19 21:34:52Z jgonzalez $ - * - * @version $Revision: 152814 $ - * @date $LastChangedDate: 2017-01-19 21:34:52 +0000 (Thu, 19 Jan 2017) $ - * @author Fabian Kislat <fabian.kislat@desy.de> Last changed by: $LastChangedBy: jgonzalez $ - * - * Copied from tanktop - */ - #include <iomanip> #include <globals.hh> diff --git a/src/G4BeamTestIonPhysics.cxx b/src/G4BeamTestIonPhysics.cxx.backup index 3c7e553..a8cc573 100644 --- a/src/G4BeamTestIonPhysics.cxx +++ b/src/G4BeamTestIonPhysics.cxx.backup @@ -1,15 +1,3 @@ -/* - * copyright (C) 2010 - * The Icecube Collaboration - * - * $Id: G4BeamTestIonPhysics.cxx 86420 2012-03-20 16:00:37Z kislat $ - * - * @version $Revision: 86420 $ - * @date $LastChangedDate: 2012-03-20 16:00:37 +0000 (Tue, 20 Mar 2012) $ - * @author Fabian Kislat <fabian.kislat@desy.de>, Peter Nießen (tanktop) - * Last changed by: $LastChangedBy: kislat $ - */ - #include <iomanip> #include <globals.hh> diff --git a/src/G4BeamTestMuonPhysics.cxx b/src/G4BeamTestMuonPhysics.cxx index 92264a2..2c5404e 100644 --- a/src/G4BeamTestMuonPhysics.cxx +++ b/src/G4BeamTestMuonPhysics.cxx @@ -1,16 +1,3 @@ -/* - * copyright (C) 2010 - * The Icecube Collaboration - * - * $Id: G4BeamTestMuonPhysics.cxx 86420 2012-03-20 16:00:37Z kislat $ - * - * @version $Revision: 86420 $ - * @date $LastChangedDate: 2012-03-20 16:00:37 +0000 (Tue, 20 Mar 2012) $ - * @author Fabian Kislat <fabian.kislat@desy.de>, Peter Nießen (tanktop) - * Last changed by: $LastChangedBy: kislat $ - */ - - #include <globals.hh> #include <G4ParticleDefinition.hh> #include <G4ParticleTable.hh> @@ -78,7 +65,7 @@ void G4BeamTestMuonPhysics::ConstructProcess() pManager->AddProcess(&muMinusBremsstrahlung_, -1, 3, 3); pManager->AddProcess(&muMinusPairProduction_, -1, 4, 4); - pManager->AddRestProcess(&muMinusCaptureAtRest_); + pManager->AddRestProcess(&muMinusCapture_); // Tau Plus Physics pManager = G4TauPlus::TauPlus()->GetProcessManager(); diff --git a/src/G4BeamTestPhysicsList.cxx b/src/G4BeamTestPhysicsList.cxx index 5a5befd..0c27b0b 100644 --- a/src/G4BeamTestPhysicsList.cxx +++ b/src/G4BeamTestPhysicsList.cxx @@ -1,15 +1,3 @@ -/** - * Copyright (C) 2009 - * The IceCube collaboration - * ID: $Id: G4BeamTestPhysicsList.cxx 152849 2017-01-20 21:44:25Z jgonzalez $ - * - * @file G4BeamTestPhysicsList.cxx - * @version $Rev: 152849 $ - * @date $Date: 2017-01-20 21:44:25 +0000 (Fri, 20 Jan 2017) $ - * @author Tilo Waldenmaier, Thomas Melzig, Javier Gonzalez - */ - - #include <globals.hh> #include <G4Version.hh> #include "G4BeamTestPhysicsList.h" diff --git a/src/G4BeamTestRunManager.cxx b/src/G4BeamTestRunManager.cxx index 753deb8..5ed2e05 100644 --- a/src/G4BeamTestRunManager.cxx +++ b/src/G4BeamTestRunManager.cxx @@ -1,20 +1,8 @@ -/** - * Copyright (C) 2009 - * The IceCube collaboration - * ID: $Id: G4BeamTestRunManager.cxx 162348 2018-04-25 20:09:46Z nega $ - * - * @file G4BeamTestRunManager.cxx - * @version $Rev: 162348 $ - * @date $Date: 2018-04-25 21:09:46 +0100 (Wed, 25 Apr 2018) $ - * @author Tilo Waldenmaier - */ - - // On Sun, to prevent conflict with ObjectSpace, G4Timer.hh has to be // loaded *before* globals.hh... #include "G4Timer.hh" -#include <g4-tankresponse/g4classes/G4BeamTestRunManager.h> +#include "G4BeamTestRunManager.h" #include <G4ParticleGun.hh> #include <G4Run.hh> diff --git a/src/G4BeamTestTank.cxx b/src/G4BeamTestTank.cxx index 4f12c7a..2fc5bed 100644 --- a/src/G4BeamTestTank.cxx +++ b/src/G4BeamTestTank.cxx @@ -1,25 +1,3 @@ -/** - * Copyright (C) 2009 - * The IceCube collaboration - * ID: $Id: G4BeamTestTank.cxx 158930 2017-10-20 01:17:41Z cweaver $ - * - * @file G4BeamTestTank.cxx - * @version $Rev: 158930 $ - * @date $Date: 2017-10-20 02:17:41 +0100 (Fri, 20 Oct 2017) $ - * @author Tilo Waldenmaier, Thomas Melzig - */ - - -#include <g4-tankresponse/g4classes/G4BeamTestTank.h> -#include <g4-tankresponse/g4classes/G4TankIceSD.h> -#include <icetray/I3Units.h> - -#include <icetray/OMKey.h> -#include <dataclasses/TankKey.h> -#include <dataclasses/geometry/I3TankGeo.h> -#include <dataclasses/geometry/I3Geometry.h> -#include <dataclasses/I3Position.h> - #include <G4LogicalVolume.hh> #include <G4PVPlacement.hh> #include <G4Material.hh> @@ -33,7 +11,10 @@ #include <G4UserLimits.hh> -#include <boost/foreach.hpp> +/* #include <boost/foreach.hpp> */ + +#include "G4BeamTestTank.h" +#include "G4TankIceSD.h" //prevent gcc to make something stupid with pretended unused variables #ifdef __GNUC__ @@ -43,121 +24,26 @@ #endif -G4BeamTestTank::G4BeamTestTank(const TankKey& tankKey, const I3Geometry& geometry): -tankKey_(tankKey), geometry_(geometry) +G4BeamTestTank::G4BeamTestTank() { - const I3StationGeoMap& stationMap = geometry.stationgeo; - unsigned int tankID = tankKey.tank==TankKey::TankA?0:1; - I3StationGeoMap::const_iterator station_iter = stationMap.find(tankKey.string); - - if(station_iter==stationMap.end()) - { - log_fatal("The requested station %d in not in the geometry!", tankKey.string); - return; - } - - if(station_iter->second.size()<tankID) - { - log_fatal("The number of tanks in station %d is not correct!", tankKey.string); - return; - } - const I3TankGeo& tankGeo = station_iter->second.at(tankID); - // Get tank dimensions - tankThickness_ = 0.5*CLHEP::cm; - tankHeight_ = (tankGeo.tankheight / I3Units::m) * CLHEP::m + tankThickness_; - innerRadius_ = (tankGeo.tankradius / I3Units::m) * CLHEP::m; + tankThickness_ = 0.5*CLHEP::cm; // TODO(shivesh) : check thickness + tankHeight_ = 76.83 * 2.54 * CLHEP::cm; + innerRadius_ = 32 * 2.54 * CLHEP::cm; outerRadius_ = innerRadius_ + tankThickness_; - - // Get fill and snow heights - fillHeight_ = (tankGeo.fillheight / I3Units::m) * CLHEP::m; - snowHeight_ = (tankGeo.snowheight / I3Units::m) * CLHEP::m; - perliteHeight_ = tankHeight_ - tankThickness_ - fillHeight_; - + + // Get fill height + fillHeight_ = 55.1 * 2.54 * CLHEP::cm; + // Set DOM dimensions glassOuterRadius_ = 6.5 * 2.54 * CLHEP::cm; // 6.5" outer glass sphere radius glassThickness_ = 0.5 * 2.54 * CLHEP::cm; // 0.5" glass sphere thickness - - // Calculate tank position (tank center) - // tankGeo.position corresponds to the average position of the two DOMs in a tank - position_.set((tankGeo.position.GetX() / I3Units::m) * CLHEP::m, - (tankGeo.position.GetY() / I3Units::m) * CLHEP::m, - (tankGeo.position.GetZ() / I3Units::m) * CLHEP::m - fillHeight_ + 0.5*tankHeight_); - - // Get positions of the doms relativ to tank center - BOOST_FOREACH(const OMKey& omKey, tankGeo.omKeyList_) - { - I3OMGeoMap::const_iterator omGeo_iter = geometry_.omgeo.find(omKey); - if(omGeo_iter==geometry_.omgeo.end()) - { - log_error_stream(omKey << " is missing in Tank " << tankKey_); - continue; - } - - G4ThreeVector relPos(omGeo_iter->second.position.GetX() - tankGeo.position.GetX(), - omGeo_iter->second.position.GetY() - tankGeo.position.GetY(), - omGeo_iter->second.position.GetZ() - tankGeo.position.GetZ()); - - relDomPositions_[omKey] = (relPos / I3Units::m) * CLHEP::m; - } - - // - // Calculate Delaunay points - // - G4ThreeVector triangleDir(NAN, NAN, NAN); - switch(station_iter->second.size()) - { - case 1: // Single tank - { - // Vector orthogonal to DOM positions - triangleDir.set(relDomPositions_.begin()->second.y(), - -relDomPositions_.begin()->second.x(), - 0.0); - break; - } - case 2: // Two tanks - { - const I3TankGeo& neighborGeo = station_iter->second.at(tankID==0?1:0); - G4ThreeVector neighborPos(neighborGeo.position.GetX(), - neighborGeo.position.GetY(), - neighborGeo.position.GetZ()); - - // Convert to G4 units - neighborPos *= CLHEP::m/I3Units::m; - - // Same z position same as other tank - neighborPos.setZ(position_.z()); - - triangleDir = position_ - neighborPos; - break; - } - default: - { - log_fatal("Invalid number of tanks (%zu) in station %d!", - station_iter->second.size(), tankKey_.string); - break; - } - } - - // side length - double triangleLength = 10.0 * CLHEP::m; - - triangleDir.setMag(0.5*triangleLength/cos(CLHEP::pi/6.0)); - delaunayPoint1_ = position_ + triangleDir; - - // Rotate by 120 deg - triangleDir.rotateZ(CLHEP::pi/1.5); - delaunayPoint2_ = position_ + triangleDir; - - // Rotate by 120 deg - triangleDir.rotateZ(CLHEP::pi/1.5); - delaunayPoint3_ = position_ + triangleDir; } G4BeamTestTank::~G4BeamTestTank() { - + } @@ -166,217 +52,219 @@ G4VPhysicalVolume* G4BeamTestTank::InstallTank(G4VPhysicalVolume* mother, const // User limits (energy cutoffs) // Do not create photons or electrons below cherenkov threshold // See also corresponding UserSpecialCuts in Physicslist !!!! - // Maybe do all of this as stepping action ?????? + // TODO(shivesh): Maybe do all of this as stepping action ?????? G4UserLimits* energyLimit = new G4UserLimits(); - energyLimit->SetUserMinEkine(280.0 * CLHEP::keV); // Cherenkov threshold of electrons in ice - - std::string tankName=boost::lexical_cast<std::string>(tankKey_); - - // Define plastic frame + energyLimit->SetUserMinEkine(264.1 * CLHEP::keV); // Cherenkov threshold of electrons in water + + // std::string tankName=boost::lexical_cast<std::string>(tankKey_); + std::string tankName = "BTT"; + + // Define plastic frame TODO(shivesh): plastic or polyethelene? G4Material* plastic = G4Material::GetMaterial("Plastic"); G4Tubs* solidTank = new G4Tubs(("solid_tank_" + tankName).c_str(), 0.0 * CLHEP::m, outerRadius_, 0.5 * tankHeight_, 0.0 * CLHEP::deg, 360.0 * CLHEP::deg); tankLog_ = new G4LogicalVolume(solidTank, plastic, ("log_tank_" + tankName).c_str(), 0, 0, 0); - - // Define ice volume - G4Material* ice = G4Material::GetMaterial("Ice"); - G4Tubs* solidIce = new G4Tubs(("solid_ice_" + tankName).c_str(), + + // Define water volume + G4Material* water = G4Material::GetMaterial("Water"); + G4Tubs* solidWater = new G4Tubs(("solid_water_" + tankName).c_str(), 0.0 * CLHEP::m, innerRadius_, 0.5 * fillHeight_, 0.0 * CLHEP::deg, 360.0 * CLHEP::deg); - G4LogicalVolume* logIce = - new G4LogicalVolume(solidIce, ice, ("log_ice_" + tankName).c_str(), 0, 0, 0); - G4ThreeVector physIcePosition(0, 0, -0.5*tankHeight_ + tankThickness_ + 0.5*fillHeight_); - G4VPhysicalVolume* physIce ATTRIBUTE_UNUSED = - new G4PVPlacement(0, physIcePosition, logIce, - ("ice_" + tankName).c_str(), tankLog_, false, 0); - - // Define perlite volume - G4Material* perlite = G4Material::GetMaterial("Perlite"); - G4Tubs* solidPerlite = new G4Tubs(("solid_perlite_" + tankName).c_str(), - 0.0 * CLHEP::m, innerRadius_, 0.5 * perliteHeight_, + G4LogicalVolume* logWater = + new G4LogicalVolume(solidWater, water, ("log_water_" + tankName).c_str(), 0, 0, 0); + G4ThreeVector physWaterPosition(0, 0, -0.5*tankHeight_ + tankThickness_ + 0.5*fillHeight_); + G4VPhysicalVolume* physWater ATTRIBUTE_UNUSED = + new G4PVPlacement(0, physWaterPosition, logWater, + ("water_" + tankName).c_str(), tankLog_, false, 0); + + // Define air volume + G4Material* air = G4Material::GetMaterial("Air"); + G4Tubs* solidAir = new G4Tubs(("solid_air_" + tankName).c_str(), + 0.0 * CLHEP::m, innerRadius_, 0.5 * airHeight_, 0.0 * CLHEP::deg, 360.0 * CLHEP::deg); - G4LogicalVolume* logPerlite = - new G4LogicalVolume(solidPerlite, perlite, ("log_perlite_" + tankName).c_str(), 0, 0, 0); - G4ThreeVector physPerlitePosition(0, 0, -0.5 * tankHeight_ + 0.5 * CLHEP::cm + fillHeight_ + - 0.5 * perliteHeight_); - G4VPhysicalVolume* physPerlite ATTRIBUTE_UNUSED = - new G4PVPlacement(0, physPerlitePosition, logPerlite, - ("perlite_" + tankName).c_str(), tankLog_, false, 0); - + G4LogicalVolume* logAir = + new G4LogicalVolume(solidAir, air, ("log_air_" + tankName).c_str(), 0, 0, 0); + G4ThreeVector physAirPosition(0, 0, -0.5 * tankHeight_ + 0.5 * CLHEP::cm + fillHeight_ + + 0.5 * airHeight_); + G4VPhysicalVolume* physAir_UNUSED = + new G4PVPlacement(0, physAirPosition, logAir, + ("air_" + tankName).c_str(), tankLog_, false, 0); + // Define glass sphere & effective DOM material splitted in upper and lower part G4Material* glass = G4Material::GetMaterial("Glass"); G4Material* effectiveDOM = G4Material::GetMaterial("effectiveDOM"); - - std::map<OMKey, G4ThreeVector> domPosIce; - std::map<OMKey, G4ThreeVector>::const_iterator om_iter; - for(om_iter=relDomPositions_.begin(); om_iter!=relDomPositions_.end(); ++om_iter) - { - const OMKey& omKey = om_iter->first; - - G4ThreeVector upperDOMpos(om_iter->second.x(), om_iter->second.y(), -0.5 * perliteHeight_); - G4ThreeVector lowerDOMpos(om_iter->second.x(), om_iter->second.y(), 0.5 * fillHeight_); - - domPosIce[omKey] = lowerDOMpos; - - std::string omName=boost::lexical_cast<std::string>(omKey); - - G4Sphere *upperglasssphere = new G4Sphere (("solid_dom_up_" + omName).c_str(), - 0.0 * CLHEP::m, glassOuterRadius_, - 0.0 * CLHEP::deg, 360.0 * CLHEP::deg, - 0.0 * CLHEP::deg, 90.0 * CLHEP::deg); - G4Sphere *lowerglasssphere = new G4Sphere (("solid_dom_lo_" + omName).c_str(), - 0.0 * CLHEP::m, glassOuterRadius_, - 0.0 * CLHEP::deg, 360.0 * CLHEP::deg, - 90.0 * CLHEP::deg, 180.0 * CLHEP::deg); - - G4double domInnerRadius = glassOuterRadius_ - glassThickness_; - G4Sphere *upperdomsphere = new G4Sphere (("solid_inside_dom_up_" + omName).c_str(), - 0.0 * CLHEP::m, domInnerRadius, + + // std::map<OMKey, G4ThreeVector> domPosIce; + // std::map<OMKey, G4ThreeVector>::const_iterator om_iter; + // for(om_iter=relDomPositions_.begin(); om_iter!=relDomPositions_.end(); ++om_iter) + // { + /* const OMKey& omKey = om_iter->first; */ + + G4ThreeVector upperDOMpos(0, 0, -0.5 * airHeight_); + G4ThreeVector lowerDOMpos(0, 0, 0.5 * fillHeight_); + + // domPosIce[omKey] = lowerDOMpos; + + // std::string omName=boost::lexical_cast<std::string>(omKey); + std::string omName="BTOM"; + + G4Sphere *upperglasssphere = new G4Sphere (("solid_dom_up_" + omName).c_str(), + 0.0 * CLHEP::m, glassOuterRadius_, 0.0 * CLHEP::deg, 360.0 * CLHEP::deg, 0.0 * CLHEP::deg, 90.0 * CLHEP::deg); - G4Sphere *lowerdomsphere = new G4Sphere (("solid_inside_dom_lo_" + omName).c_str(), - 0.0 * CLHEP::m, domInnerRadius, + G4Sphere *lowerglasssphere = new G4Sphere (("solid_dom_lo_" + omName).c_str(), + 0.0 * CLHEP::m, glassOuterRadius_, 0.0 * CLHEP::deg, 360.0 * CLHEP::deg, 90.0 * CLHEP::deg, 180.0 * CLHEP::deg); - - G4LogicalVolume* logUpperGlass = - new G4LogicalVolume(upperglasssphere, glass, - ("log_dom_up_" + omName).c_str(), 0, 0, 0); - G4LogicalVolume* logLowerGlass = - new G4LogicalVolume(lowerglasssphere, glass, - ("log_dom_lo_" + omName).c_str(), 0, 0, 0); - G4LogicalVolume* logUpperDOM = - new G4LogicalVolume(upperdomsphere, effectiveDOM, - ("log_inside_dom_up_" + omName).c_str(), 0, 0, 0); - G4LogicalVolume* logLowerDOM = - new G4LogicalVolume(lowerdomsphere, effectiveDOM, - ("log_inside_dom_lo_" + omName).c_str(), 0, 0, 0); - G4VPhysicalVolume* physUpperGlass ATTRIBUTE_UNUSED = - new G4PVPlacement(0, upperDOMpos, logUpperGlass, - ("dom_up_" + omName).c_str(), logPerlite, false, 0); - G4VPhysicalVolume* physLowerGlass ATTRIBUTE_UNUSED = - new G4PVPlacement(0, lowerDOMpos, logLowerGlass, - ("dom_lo_" + omName).c_str(), logIce, false, 0); - G4VPhysicalVolume* physUpperDOM ATTRIBUTE_UNUSED = - new G4PVPlacement(0, G4ThreeVector(0,0,0), logUpperDOM, - ("inside_dom_up_" + omName).c_str(), logUpperGlass, false, 0); - G4VPhysicalVolume* physLowerDOM ATTRIBUTE_UNUSED = - new G4PVPlacement(0, G4ThreeVector(0,0,0), logLowerDOM, - ("inside_dom_lo_" + omName).c_str(), logLowerGlass, false, 0); - - // apply energy limits - logUpperGlass->SetUserLimits(energyLimit); - logLowerGlass->SetUserLimits(energyLimit); - logUpperDOM->SetUserLimits(energyLimit); - logLowerDOM->SetUserLimits(energyLimit); - } - - // Define sensitive detector + + G4double domInnerRadius = glassOuterRadius_ - glassThickness_; + G4Sphere *upperdomsphere = new G4Sphere (("solid_inside_dom_up_" + omName).c_str(), + 0.0 * CLHEP::m, domInnerRadius, + 0.0 * CLHEP::deg, 360.0 * CLHEP::deg, + 0.0 * CLHEP::deg, 90.0 * CLHEP::deg); + G4Sphere *lowerdomsphere = new G4Sphere (("solid_inside_dom_lo_" + omName).c_str(), + 0.0 * CLHEP::m, domInnerRadius, + 0.0 * CLHEP::deg, 360.0 * CLHEP::deg, + 90.0 * CLHEP::deg, 180.0 * CLHEP::deg); + + G4LogicalVolume* logUpperGlass = + new G4LogicalVolume(upperglasssphere, glass, + ("log_dom_up_" + omName).c_str(), 0, 0, 0); + G4LogicalVolume* logLowerGlass = + new G4LogicalVolume(lowerglasssphere, glass, + ("log_dom_lo_" + omName).c_str(), 0, 0, 0); + G4LogicalVolume* logUpperDOM = + new G4LogicalVolume(upperdomsphere, effectiveDOM, + ("log_inside_dom_up_" + omName).c_str(), 0, 0, 0); + G4LogicalVolume* logLowerDOM = + new G4LogicalVolume(lowerdomsphere, effectiveDOM, + ("log_inside_dom_lo_" + omName).c_str(), 0, 0, 0); + G4VPhysicalVolume* physUpperGlass ATTRIBUTE_UNUSED = + new G4PVPlacement(0, upperDOMpos, logUpperGlass, + ("dom_up_" + omName).c_str(), logAir, false, 0); + G4VPhysicalVolume* physLowerGlass ATTRIBUTE_UNUSED = + new G4PVPlacement(0, lowerDOMpos, logLowerGlass, + ("dom_lo_" + omName).c_str(), logWater, false, 0); + G4VPhysicalVolume* physUpperDOM ATTRIBUTE_UNUSED = + new G4PVPlacement(0, G4ThreeVector(0,0,0), logUpperDOM, + ("inside_dom_up_" + omName).c_str(), logUpperGlass, false, 0); + G4VPhysicalVolume* physLowerDOM ATTRIBUTE_UNUSED = + new G4PVPlacement(0, G4ThreeVector(0,0,0), logLowerDOM, + ("inside_dom_lo_" + omName).c_str(), logLowerGlass, false, 0); + + // apply energy limits + logUpperGlass->SetUserLimits(energyLimit); + logLowerGlass->SetUserLimits(energyLimit); + logUpperDOM->SetUserLimits(energyLimit); + logLowerDOM->SetUserLimits(energyLimit); + // } + + // Define sensitive detector TODO(shivesh): make the PMT the SD G4SDManager* sdManager = G4SDManager::GetSDMpointer(); - iceSD_ = new G4TankIceSD(("ice_SD_" + tankName).c_str(), domPosIce); + iceSD_ = new G4TankIceSD(("ice_SD_" + tankName).c_str()); sdManager->AddNewDetector(iceSD_); - logIce->SetSensitiveDetector(iceSD_); - + logWater->SetSensitiveDetector(iceSD_); + // Instantiation of a set of visualization attributes with red colour G4VisAttributes * tankVisAtt = new G4VisAttributes(G4Colour(1,0,0)); - // Set the forced wireframe style + // Set the forced wireframe style //snowVisAtt->SetForceWireFrame(true); // Assignment of the visualization attributes to the logical volume tankLog_->SetVisAttributes(tankVisAtt); - + G4ThreeVector tankPos = position_ - origin - mother->GetTranslation(); - + G4VPhysicalVolume* tankPhys = new G4PVPlacement(0, tankPos, tankLog_, ("tank_" + tankName).c_str(), mother->GetLogicalVolume(), false, 0); - + // apply energy limits tankLog_->SetUserLimits(energyLimit); - logPerlite->SetUserLimits(energyLimit); - logIce->SetUserLimits(energyLimit); - - return tankPhys; -} - - -double G4BeamTestTank::GetNumCherenkov(const OMKey& omKey) -{ - return std::max(iceSD_->GetNumCherenkov(omKey), 0.); -} - + logAir->SetUserLimits(energyLimit); + logWater->SetUserLimits(energyLimit); -double G4BeamTestTank::GetNumCherenkovWeight(const OMKey& omKey) -{ - return std::max(iceSD_->GetNumCherenkovWeight(omKey), 0.); -} - - -double G4BeamTestTank::GetEDep_G4(const OMKey& omKey) -{ - return std::max(iceSD_->GetEDep(omKey), 0.); -} - - -double G4BeamTestTank::GetTime_G4(const OMKey& omKey) -{ - return iceSD_->GetTime(omKey); -} - - -double G4BeamTestTank::GetEDep_I3(const OMKey& omKey) -{ - return std::max(iceSD_->GetEDep(omKey), 0.) / CLHEP::keV * I3Units::keV; -} - - -double G4BeamTestTank::GetTime_I3(const OMKey& omKey) -{ - return (iceSD_->GetTime(omKey) / CLHEP::s) * I3Units::s; -} - - -I3Position G4BeamTestTank::GetPos_I3() -{ - I3Position pos((position_.x() / CLHEP::m) * I3Units::m, - (position_.y() / CLHEP::m) * I3Units::m, - (position_.z() / CLHEP::m) * I3Units::m); - return pos; -} - - -double G4BeamTestTank::GetX_I3() -{ - return (position_.x() / CLHEP::m) * I3Units::m; + return tankPhys; } -double G4BeamTestTank::GetY_I3() +double G4BeamTestTank::GetNumCherenkov(/* const OMKey& omKey */) { - return (position_.y() / CLHEP::m) * I3Units::m; + return std::max(iceSD_->GetNumCherenkov(/* omKey */), 0.); } -double G4BeamTestTank::GetZ_I3() +double G4BeamTestTank::GetNumCherenkovWeight(/* const OMKey& omKey */) { - return (position_.z() / CLHEP::m) * I3Units::m; + return std::max(iceSD_->GetNumCherenkovWeight(/* omKey */), 0.); } -double G4BeamTestTank::GetTankHeight_I3() +double G4BeamTestTank::GetEDep_G4(/* const OMKey& omKey */) { - return (tankHeight_ / CLHEP::m) * I3Units::m; + return std::max(iceSD_->GetEDep(/* omKey */), 0.); } -double G4BeamTestTank::GetTankRadius_I3() +double G4BeamTestTank::GetTime_G4(/* const OMKey& omKey */) { - return (outerRadius_ / CLHEP::m) * I3Units::m; + return iceSD_->GetTime(/* omKey */); } -double G4BeamTestTank::GetSnowHeight_I3() -{ - return (snowHeight_ / CLHEP::m) * I3Units::m; -} +/* double G4BeamTestTank::GetEDep_I3(const OMKey& omKey) */ +/* { */ +/* return std::max(iceSD_->GetEDep(omKey), 0.) / CLHEP::keV * I3Units::keV; */ +/* } */ + + +/* double G4BeamTestTank::GetTime_I3(const OMKey& omKey) */ +/* { */ +/* return (iceSD_->GetTime(omKey) / CLHEP::s) * I3Units::s; */ +/* } */ + + +/* I3Position G4BeamTestTank::GetPos_I3() */ +/* { */ +/* I3Position pos((position_.x() / CLHEP::m) * I3Units::m, */ +/* (position_.y() / CLHEP::m) * I3Units::m, */ +/* (position_.z() / CLHEP::m) * I3Units::m); */ +/* return pos; */ +/* } */ + + +/* double G4BeamTestTank::GetX_I3() */ +/* { */ +/* return (position_.x() / CLHEP::m) * I3Units::m; */ +/* } */ +/* */ +/* */ +/* double G4BeamTestTank::GetY_I3() */ +/* { */ +/* return (position_.y() / CLHEP::m) * I3Units::m; */ +/* } */ +/* */ +/* */ +/* double G4BeamTestTank::GetZ_I3() */ +/* { */ +/* return (position_.z() / CLHEP::m) * I3Units::m; */ +/* } */ +/* */ + +/* double G4BeamTestTank::GetTankHeight_I3() */ +/* { */ +/* return (tankHeight_ / CLHEP::m) */ +/* } */ +/* */ +/* */ +/* double G4BeamTestTank::GetTankRadius_I3() */ +/* { */ +/* return (outerRadius_ / CLHEP::m) */ +/* } */ +/* */ +/* */ +/* double G4BeamTestTank::GetFillHeight_I3() */ +/* { */ +/* return (fillHeight_ / CLHEP::m) */ +/* } */ diff --git a/src/G4BeamTestUserSteppingAction.cxx b/src/G4BeamTestUserSteppingAction.cxx index b16098c..e064628 100644 --- a/src/G4BeamTestUserSteppingAction.cxx +++ b/src/G4BeamTestUserSteppingAction.cxx @@ -1,18 +1,4 @@ -/** - * Copyright (C) 2011 - * The IceCube collaboration - * ID: $Id$ - * - * @file G4BeamTestUserSteppingAction.cxx - * @version $Revision$ - * @date $Date$ - * @author Thomas Melzig - * - * $LastChangedBy$ - */ - - -#include <g4-tankresponse/g4classes/G4BeamTestUserSteppingAction.h> +#include "G4BeamTestUserSteppingAction.h" #include "G4Step.hh" #include "G4Track.hh" diff --git a/src/G4BeamTestUserTrackingAction.cxx b/src/G4BeamTestUserTrackingAction.cxx index d554152..c6317df 100644 --- a/src/G4BeamTestUserTrackingAction.cxx +++ b/src/G4BeamTestUserTrackingAction.cxx @@ -1,18 +1,4 @@ -/** - * Copyright (C) 2011 - * The IceCube collaboration - * ID: $Id$ - * - * @file G4BeamTestUserTrackingAction.cxx - * @version $Revision$ - * @date $Date$ - * @author Thomas Melzig - * - * $LastChangedBy$ - */ - - -#include <g4-tankresponse/g4classes/G4BeamTestUserTrackingAction.h> +#include "G4BeamTestUserTrackingAction.h" #include "G4Track.hh" #include "G4UserLimits.hh" diff --git a/src/G4Interface.cxx b/src/G4Interface.cxx index 36ba3d9..9f44d3e 100644 --- a/src/G4Interface.cxx +++ b/src/G4Interface.cxx @@ -1,23 +1,12 @@ -/** - * Copyright (C) 2009 - * The IceCube collaboration - * ID: $Id: G4Interface.cxx 149388 2016-08-18 21:50:04Z jgonzalez $ - * - * @file G4Interface.cxx - * @version $Rev: 149388 $ - * @date $Date: 2016-08-18 22:50:04 +0100 (Thu, 18 Aug 2016) $ - * @author Tilo Waldenmaier - */ - -#include <dataclasses/physics/I3Particle.h> - -#include <g4-tankresponse/g4classes/G4Interface.h> -#include <g4-tankresponse/g4classes/G4BeamTestDetectorConstruction.h> -#include <g4-tankresponse/g4classes/G4BeamTestPhysicsList.h> -#include <g4-tankresponse/g4classes/G4BeamTestUserTrackingAction.h> -#include <g4-tankresponse/g4classes/G4BeamTestUserSteppingAction.h> - -#include <icetray/I3Logging.h> +/* #include <dataclasses/physics/I3Particle.h> */ + +#include "G4Interface.h" +#include "G4BeamTestDetectorConstruction.h" +#include "G4BeamTestPhysicsList.h" +#include "G4BeamTestUserTrackingAction.h" +#include "G4BeamTestUserSteppingAction.h" + +/* #include <icetray/I3Logging.h> */ #ifdef G4VIS_USE #include <G4VisExecutive.hh> @@ -26,7 +15,7 @@ #include <G4ParticleGun.hh> #include <G4ParticleTable.hh> #include <G4ParticleDefinition.hh> -#include <G4UImanager.hh> +/* #include <G4UImanager.hh> */ G4Interface* G4Interface::g4Interface_ = NULL; @@ -40,11 +29,8 @@ G4Interface::G4Interface(const std::string& visMacro): // Visualization manager #ifdef G4VIS_USE visManager_ = NULL; - if(!visMacro_.empty()) - { - visManager_ = new G4VisExecutive(); - visManager_->Initialize(); - } + visManager_ = new G4VisExecutive(); + visManager_->Initialize(); #endif } @@ -63,7 +49,8 @@ void G4Interface::InstallTank(G4BeamTestTank* tank) { if(initialized_) { - log_fatal("G4Interface aleady initialized. Cannot install tank!"); + /* log_fatal("G4Interface aleady initialized. Cannot install tank!"); */ + G4cout << "G4Interface aleady initialized. Cannot install tank!" << G4endl; return; } @@ -92,117 +79,37 @@ void G4Interface::InitializeEvent() } -void G4Interface::InjectParticle(const I3Particle& particle) +void G4Interface::InjectParticle( + const std::string& particleName, const G4ThreeVector& particlePosition, + const G4ThreeVector& particleDirection, const G4double particleEnergy + ) { if(!eventInitialized_) { - log_fatal("No event initialized. Cannot inject particle!"); + /* log_fatal("No event initialized. Cannot inject particle!"); */ + G4cout << "No event initialized. Cannot inject particle!" << G4endl; return; } G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); G4ParticleDefinition* particleDef = NULL; - switch(particle.GetType()) - { - case I3Particle::Gamma: - particleDef = particleTable->FindParticle("gamma"); - break; - case I3Particle::EMinus: - particleDef = particleTable->FindParticle("e-"); - break; - case I3Particle::EPlus: - particleDef = particleTable->FindParticle("e+"); - break; - case I3Particle::MuMinus: - particleDef = particleTable->FindParticle("mu-"); - break; - case I3Particle::MuPlus: - particleDef = particleTable->FindParticle("mu+"); - break; - case I3Particle::PPlus: - particleDef = particleTable->FindParticle("proton"); - break; - case I3Particle::PMinus: - particleDef = particleTable->FindParticle("anti_proton"); - break; - case I3Particle::Neutron: - particleDef = particleTable->FindParticle("neutron"); - break; -#ifdef I3PARTICLE_SUPPORTS_PDG_ENCODINGS - case I3Particle::NeutronBar: -#else - case 25: -#endif - particleDef = particleTable->FindParticle("anti_neutron"); - break; - case I3Particle::PiPlus: - particleDef = particleTable->FindParticle("pi+"); - break; - case I3Particle::PiMinus: - particleDef = particleTable->FindParticle("pi-"); - break; - case I3Particle::Pi0: - particleDef = particleTable->FindParticle("pi0"); - break; - case I3Particle::KPlus: - particleDef = particleTable->FindParticle("kaon+"); - break; - case I3Particle::KMinus: - particleDef = particleTable->FindParticle("kaon-"); - break; - case I3Particle::K0_Long: - particleDef = particleTable->FindParticle("kaon0L"); - break; - case I3Particle::K0_Short: - particleDef = particleTable->FindParticle("kaon0S"); - break; - case I3Particle::NuE: - particleDef = particleTable->FindParticle("nu_e"); - break; - case I3Particle::NuEBar: - particleDef = particleTable->FindParticle("anti_nu_e"); - break; - case I3Particle::NuMu: - particleDef = particleTable->FindParticle("nu_mu"); - break; - case I3Particle::NuMuBar: - particleDef = particleTable->FindParticle("anti_nu_mu"); - break; - case I3Particle::NuTau: - particleDef = particleTable->FindParticle("nu_tau"); - break; - case I3Particle::NuTauBar: - particleDef = particleTable->FindParticle("anti_nu_tau"); - break; - default: - log_warn("Man, check out that strange particle \"%s\" ?!", particle.GetTypeString().c_str()); - return; - } - - // Particle position in G4 units - G4ThreeVector position((particle.GetX() / I3Units::m) * CLHEP::m, - (particle.GetY() / I3Units::m) * CLHEP::m, - (particle.GetZ() / I3Units::m) * CLHEP::m); + particleDef = particleTable->FindParticle(particleName); - // Transform I3 coorinates to world system - position -= detector_->GetWorldOrigin(); - - G4ThreeVector direction(particle.GetDir().GetX(), - particle.GetDir().GetY(), - particle.GetDir().GetZ()); + // Transform coordinates to world system + G4ThreeVector position = particlePosition - detector_->GetWorldOrigin(); G4ParticleGun gun(1); gun.SetParticleDefinition(particleDef); - gun.SetParticleEnergy((particle.GetEnergy() / I3Units::GeV) * CLHEP::GeV); + gun.SetParticleEnergy(particleEnergy); gun.SetParticlePosition(position); - gun.SetParticleMomentumDirection(direction); + gun.SetParticleMomentumDirection(particleDirection); - log_trace("Injecting %s: x=%.2f m, y=%.2f m, z=%.2f m, E=%.3f MeV", - particle.GetTypeString().c_str(), + G4cout << "Injecting %s: x=%.2f m, y=%.2f m, z=%.2f m, E=%.3f MeV", + particleName.c_str(), position.x() / CLHEP::m, position.y() / CLHEP::m, position.z() / CLHEP::m, - gun.GetParticleEnergy() / CLHEP::MeV); + gun.GetParticleEnergy() / CLHEP::MeV; runManager_.InjectParticle(&gun); } @@ -227,66 +134,73 @@ void G4Interface::Initialize() { if(initialized_) { - log_error("G4Interface has already been initialized. Ignoring this call!"); + /* log_error("G4Interface has already been initialized. Ignoring this call!"); */ + G4cout << "G4Interface has already been initialized. Ignoring this call!" << G4endl; return; } - log_debug("Init geometry ..."); + /* log_debug("Init geometry ..."); */ + G4cout << "Init geometry ..." << G4endl; runManager_.SetUserInitialization(detector_); - log_debug("Init physics list ..."); + /* log_debug("Init physics list ..."); */ + G4cout << "Init physics list ..." << G4endl; runManager_.SetUserInitialization(new G4BeamTestPhysicsList()); - log_debug("Init UserTrackingAction ..."); + /* log_debug("Init UserTrackingAction ..."); */ + G4cout << "Init UserTrackingAction ..." << G4endl; runManager_.SetUserAction(new G4BeamTestUserTrackingAction()); - log_debug("Init UserSteppingAction ..."); + /* log_debug("Init UserSteppingAction ..."); */ + G4cout << "Init UserSteppingAction ..." << G4endl; runManager_.SetUserAction(new G4BeamTestUserSteppingAction()); // Initialize G4 kernel - log_debug("Init run manager ..."); + /* log_debug("Init run manager ..."); */ + G4cout << "Init run manager ..." << G4endl; runManager_.Initialize(); - // Set verbosity - int verboseLevel = 0; - switch (GetIcetrayLogger()->LogLevelForUnit("G4Interface")) - { - case I3LOG_FATAL: - case I3LOG_ERROR: - case I3LOG_WARN: - case I3LOG_INFO: - case I3LOG_NOTICE: - default: - verboseLevel = 0; - break; - case I3LOG_DEBUG: - verboseLevel = 1; - break; - case I3LOG_TRACE: - verboseLevel = 2; - break; - } - - runManager_.SetVerboseLevel(verboseLevel); - G4EventManager::GetEventManager()->SetVerboseLevel(verboseLevel); - G4EventManager::GetEventManager()->GetStackManager()->SetVerboseLevel(verboseLevel); - G4EventManager::GetEventManager()->GetTrackingManager()->SetVerboseLevel(verboseLevel); -#ifdef G4VIS_USE - if(visManager_) visManager_->SetVerboseLevel(verboseLevel); -#endif + /* // Set verbosity */ + /* int verboseLevel = 0; */ + /* switch (GetIcetrayLogger()->LogLevelForUnit("G4Interface")) */ + /* { */ + /* case I3LOG_FATAL: */ + /* case I3LOG_ERROR: */ + /* case I3LOG_WARN: */ + /* case I3LOG_INFO: */ + /* case I3LOG_NOTICE: */ + /* default: */ + /* verboseLevel = 0; */ + /* break; */ + /* case I3LOG_DEBUG: */ + /* verboseLevel = 1; */ + /* break; */ + /* case I3LOG_TRACE: */ + /* verboseLevel = 2; */ + /* break; */ + /* } */ + + // TODO(shivesh): verbosity +/* runManager_.SetVerboseLevel(verboseLevel); */ +/* G4EventManager::GetEventManager()->SetVerboseLevel(verboseLevel); */ +/* G4EventManager::GetEventManager()->GetStackManager()->SetVerboseLevel(verboseLevel); */ +/* G4EventManager::GetEventManager()->GetTrackingManager()->SetVerboseLevel(verboseLevel); */ +/* #ifdef G4VIS_USE */ +/* if(visManager_) visManager_->SetVerboseLevel(verboseLevel); */ +/* #endif */ // Execute visualization macro (if specified) - if(!visMacro_.empty()) - { - G4UImanager* uim = G4UImanager::GetUIpointer(); - - // Checking geometry - uim->ApplyCommand("/geometry/test/grid_test"); - - // Execute visualization macro - std::string visCmd = "/control/execute " + visMacro_; - uim->ApplyCommand(visCmd.c_str()); - } + /* if(!visMacro_.empty()) */ + /* { */ + /* G4UImanager* uim = G4UImanager::GetUIpointer(); */ + /* */ + /* // Checking geometry */ + /* uim->ApplyCommand("/geometry/test/grid_test"); */ + /* */ + /* // Execute visualization macro */ + /* std::string visCmd = "/control/execute " + visMacro_; */ + /* uim->ApplyCommand(visCmd.c_str()); */ + /* } */ initialized_ = true; } diff --git a/src/G4TankIceSD.cxx b/src/G4TankIceSD.cxx index 4a1be0b..2974837 100644 --- a/src/G4TankIceSD.cxx +++ b/src/G4TankIceSD.cxx @@ -1,17 +1,5 @@ -/** - * Copyright (C) 2009 - * The IceCube collaboration - * ID: $Id: G4TankIceSD.cxx 152814 2017-01-19 21:34:52Z jgonzalez $ - * - * @file G4TankIceSD.cxx - * @version $Rev: 152814 $ - * @date $Date: 2017-01-19 21:34:52 +0000 (Thu, 19 Jan 2017) $ - * @author Tilo Waldenmaier, Thomas Melzig - */ - - -#include <g4-tankresponse/g4classes/G4TankIceSD.h> -#include <g4-tankresponse/g4classes/G4BeamTestTank.h> +#include "G4TankIceSD.h" +#include "G4BeamTestTank.h" #include <G4Step.hh> #include <G4HCofThisEvent.hh> @@ -25,7 +13,7 @@ #include <G4OpticalPhoton.hh> #include "G4Poisson.hh" -#include <icetray/I3Units.h> +/* #include <icetray/I3Units.h> */ #include "G4Version.hh" @@ -38,8 +26,8 @@ #endif -G4TankIceSD::G4TankIceSD(G4String name, const std::map<OMKey, G4ThreeVector>& domPositions) - : G4VSensitiveDetector(name), domPositions_(domPositions) +G4TankIceSD::G4TankIceSD(G4String name/* , const std::map<OMKey, G4ThreeVector>& domPositions */) + : G4VSensitiveDetector(name)/* , domPositions_(domPositions) */ {} @@ -48,14 +36,14 @@ G4TankIceSD::~G4TankIceSD() {} void G4TankIceSD::Initialize(G4HCofThisEvent* HCE) { - std::map<OMKey, G4ThreeVector>::const_iterator om_iter; - for(om_iter=domPositions_.begin(); om_iter!=domPositions_.end(); ++om_iter) - { - sumEdep_[om_iter->first] = 0; - cogTime_[om_iter->first] = 0; - cherenkovCounter_[om_iter->first] = 0; - cherenkovCounterWeight_[om_iter->first] = 0; - } + // std::map<OMKey, G4ThreeVector>::const_iterator om_iter; + // for(om_iter=domPositions_.begin(); om_iter!=domPositions_.end(); ++om_iter) + // { + sumEdep_ = 0; + cogTime_ = 0; + cherenkovCounter_ = 0; + cherenkovCounterWeight_ = 0; + // } } @@ -76,32 +64,32 @@ G4bool G4TankIceSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) G4ThreeVector localPosition = theTouchable->GetHistory()-> GetTopTransform().TransformPoint(worldPosition); - std::map<OMKey, G4ThreeVector>::const_iterator om_iter; - for(om_iter=domPositions_.begin(); om_iter!=domPositions_.end(); ++om_iter) - { - G4double radius = sqrt(pow(om_iter->second.x() - localPosition.x(), 2) + - pow(om_iter->second.y() - localPosition.y(), 2)); - G4double height = (om_iter->second.z() - localPosition.z()); - - sumEdep_[om_iter->first] += edep; - cogTime_[om_iter->first] += edep*time; - cherenkovCounterWeight_[om_iter->first] += GetProbability(radius, height) * cherenkovNumber; - cherenkovCounter_[om_iter->first] += cherenkovNumber; - } + // std::map<OMKey, G4ThreeVector>::const_iterator om_iter; + // for(om_iter=domPositions_.begin(); om_iter!=domPositions_.end(); ++om_iter) + // { + G4double radius = sqrt(pow(domPositions_.x() - localPosition.x(), 2) + + pow(domPositions_.y() - localPosition.y(), 2)); + G4double height = (domPositions_.z() - localPosition.z()); + + sumEdep_ += edep; + cogTime_ += edep*time; + cherenkovCounterWeight_ += GetProbability(radius, height) * cherenkovNumber; + cherenkovCounter_ += cherenkovNumber; + // } return true; } void G4TankIceSD::EndOfEvent(G4HCofThisEvent*) { - std::map<OMKey, G4ThreeVector>::const_iterator om_iter; - for(om_iter=domPositions_.begin(); om_iter!=domPositions_.end(); ++om_iter) + // std::map<OMKey, G4ThreeVector>::const_iterator om_iter; + // for(om_iter=domPositions_.begin(); om_iter!=domPositions_.end(); ++om_iter) + // { + if(sumEdep_>0) { - if(sumEdep_[om_iter->first]>0) - { - cogTime_[om_iter->first] /= sumEdep_[om_iter->first]; - } + cogTime_ /= sumEdep_; } + // } } @@ -122,7 +110,7 @@ G4double G4TankIceSD::GetCerenkovNumber(G4Step* aStep) G4MaterialPropertyVector* Rindex = aMaterialPropertiesTable->GetProperty("RINDEX"); if (!Rindex) return 0.0; - const G4double Rfact = 369.81 / (CLHEP::eV * CLHEP::cm); + const G4double Rfact = 369.81 / (CLHEP::eV * CLHEP::cm); // TODO(shivesh): check this const G4double charge = aParticle->GetDefinition()->GetPDGCharge(); const G4double beta = (pPreStepPoint->GetBeta() + pPostStepPoint->GetBeta()) / 2.; if (beta <= 0.0) return 0.0; @@ -147,7 +135,8 @@ G4double G4TankIceSD::GetCerenkovNumber(G4Step* aStep) #endif if (nMin!=nMax) { - log_error("Support for energy dependent refraction index not yet implemented!"); + /* log_error("Support for energy dependent refraction index not yet implemented!"); */ + G4cout << "Support for energy dependent refraction index not yet implemented!"; return 0.0; } @@ -163,6 +152,7 @@ G4double G4TankIceSD::GetCerenkovNumber(G4Step* aStep) } +// TODO(shivesh): what is this G4double G4TankIceSD::GetProbability(G4double radius, G4double height) { height = 0.90 - height / CLHEP::m; @@ -0,0 +1,69 @@ +# Use this open statement to create an OpenGL view: +/vis/open OGL 600x600-0+0 +# +# Use this open statement to create a .prim file suitable for +# viewing in DAWN: +#/vis/open DAWNFILE +# +# Use this open statement to create a .heprep file suitable for +# viewing in HepRApp: +#/vis/open HepRepFile +# +# Use this open statement to create a .wrl file suitable for +# viewing in a VRML viewer: +#/vis/open VRML2FILE +# +# Disable auto refresh and quieten vis messages whilst scene and +# trajectories are established: +/vis/viewer/set/autoRefresh false +/vis/verbose errors +# +# Draw geometry: +/vis/drawVolume +# +# Specify view angle: +#/vis/viewer/set/viewpointThetaPhi 90. 0. +# +# Specify zoom value: +/vis/viewer/zoom 1.5 +# +# Specify style (surface or wireframe): +#/vis/viewer/set/style wireframe +# +# Draw coordinate axes: +#/vis/scene/add/axes 0 0 0 1 m +# +# Draw smooth trajectories at end of event, showing trajectory points +# as markers 2 pixels wide: +/vis/scene/add/trajectories smooth +/vis/modeling/trajectories/create/drawByCharge +/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true +/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 +# (if too many tracks cause core dump => /tracking/storeTrajectory 0) +# +# Draw hits at end of event: +#/vis/scene/add/hits +# +# To draw only gammas: +#/vis/filtering/trajectories/create/particleFilter +#/vis/filtering/trajectories/particleFilter-0/add gamma +# +# To invert the above, drawing all particles except gammas, +# keep the above two lines but also add: +#/vis/filtering/trajectories/particleFilter-0/invert true +# +# Many other options are available with /vis/modeling and /vis/filtering. +# For example, to select colour by particle ID: +#/vis/modeling/trajectories/create/drawByParticleID +#/vis/modeling/trajectories/drawByParticleID-0/set e- blue +# +# To superimpose all of the events from a given run: +/vis/scene/endOfEventAction accumulate +# +# Re-establish auto refreshing and verbosity: +/vis/viewer/set/autoRefresh true +/vis/verbose warnings +# +# For file-based drivers, use this to create an empty detector view: +#/vis/viewer/flush + |
