Files
musrsim/include/musrDetectorConstruction.hh

109 lines
4.8 KiB
C++

/***************************************************************************
* musrSim - the program for the simulation of (mainly) muSR instruments. *
* More info on http://lmu.web.psi.ch/simulation/index.html . *
* musrSim is based od Geant4 (http://geant4.web.cern.ch/geant4/) *
* *
* Copyright (C) 2009 by Paul Scherrer Institut, 5232 Villigen PSI, *
* Switzerland *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
***************************************************************************/
#ifndef musrDetectorConstruction_h
#define musrDetectorConstruction_h 1
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4ThreeVector.hh"
#include "G4RotationMatrix.hh"
#include "G4FieldManager.hh"
#include "G4OpticalSurface.hh"
#include "G4GDMLParser.hh"
#include <map>
#include <string>
class G4Tubs;
class G4Box;
class G4Cons;
class G4Trd;
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4Material;
class musrDetectorMessenger;
class musrScintSD;
class musrMuEnergyLossLandau;
class musrRootOutput;
class musrSteppingAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class musrDetectorConstruction : public G4VUserDetectorConstruction {
public:
musrDetectorConstruction(G4String steeringFileName);
~musrDetectorConstruction();
G4VPhysicalVolume *Construct();
void UpdateGeometry();
void SetInputParameterFileName(G4String fileName) { parameterFileName = fileName; };
void ReportGeometryProblem(const std::string &myString);
void ReportProblemInStearingFile(const std::string &myString);
G4Material *StringToMaterial(const std::string &myString);
G4LogicalVolume *FindLogicalVolume(G4String LogicalVolumeName);
G4VPhysicalVolume *FindPhysicalVolume(G4String PhysicalVolumeName);
void SetColourOfLogicalVolume(G4LogicalVolume *pLogVol, const std::string &colour);
// Reading/writing GDML
void SetWriteFile(const G4String &fname);
private:
G4String parameterFileName; // name of the file with the geometry parameters
G4bool checkOverlap; // parameter to check ovelaping volumes
G4double largestAcceptableStep; // parameter defining largest step in the magnetic field
musrScintSD *aScintSD;
std::unique_ptr<musrDetectorMessenger> detectorMessenger; // pointer to the Messenger
std::map<std::string, G4RotationMatrix *> pointerToRotationMatrix;
std::map<std::string, std::vector<double>> fArrays;
std::map<std::string, std::vector<double>>::iterator iterArray;
std::map<std::string, G4FieldManager *> pointerToField;
std::map<std::string, G4MaterialPropertiesTable *> materialPropertiesTableMap;
std::map<std::string, G4MaterialPropertiesTable *>::iterator itMPT;
void DefineMaterials();
void ParseRotationCommand(const std::string &line);
void ParseArrayDefCommand(const std::string &line);
G4VPhysicalVolume *ParseConstructCommand(const std::string &line, musrRootOutput *myRootOutput, musrSteppingAction *mySteppingAction);
void ParseVisAttributesCommand(const std::string &line);
void ParseOpticalSurfaceCommand(const std::string &line);
void ParseOPSACommand(const std::string &line);
void ParseGlobalFieldCommand(const std::string &line);
void ParseSetUserLimitsCommand(const std::string &line);
void ParseRegionCommand(const std::string &line);
void ParseRootOutputCommand(const std::string &line);
void ParseSimulationSettingCommand(const std::string &line, musrRootOutput *myRootOutput, musrSteppingAction *mySteppingAction);
// GDML Parser
std::unique_ptr<G4GDMLParser> fParser;
// Read/write settings
G4String fWriteFile;
G4bool fWriteChoice;
};
#endif