21.1.2011 Kamil Sedlak
This version contains many changes! 1) Optical photon simulation is now possible - some work still may need to be done (e.g. the manual is not updated yet), but it should basically work already now. 2) Changes in the musrSimAna - correction of some bugs (mainly in the coincidence of coincidence and veto detectors) and some other improvements
This commit is contained in:
@ -64,6 +64,9 @@
|
||||
#include "G4RegionStore.hh"
|
||||
#include "G4ProductionCuts.hh"
|
||||
|
||||
//#include "G4OpticalSurface.hh"
|
||||
#include "G4LogicalBorderSurface.hh"
|
||||
|
||||
#include "musrRootOutput.hh" //cks for storing some info in the Root output file
|
||||
#include "musrParameters.hh"
|
||||
#include "musrErrorMessage.hh"
|
||||
@ -71,9 +74,10 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
musrDetectorConstruction::musrDetectorConstruction()
|
||||
:parameterFileName("Unset"), checkOverlap(true), aScintSD(0)
|
||||
musrDetectorConstruction::musrDetectorConstruction(G4String steeringFileName)
|
||||
:checkOverlap(true), aScintSD(0)
|
||||
{
|
||||
parameterFileName = steeringFileName;
|
||||
DefineMaterials();
|
||||
detectorMessenger = new musrDetectorMessenger(this);
|
||||
}
|
||||
@ -102,7 +106,9 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
|
||||
// G4double roundingErr=0.01*mm; // 0.01mm precision is OK for displaying subtracted volumes, while 0.001mm is not
|
||||
//----------------------
|
||||
|
||||
musrRootOutput* myRootOutput = musrRootOutput::GetRootInstance();
|
||||
musrRootOutput* myRootOutput = musrRootOutput::GetRootInstance();
|
||||
musrSteppingAction* mySteppingAction = musrSteppingAction::GetInstance();
|
||||
|
||||
|
||||
G4VPhysicalVolume* pointerToWorldVolume=NULL;
|
||||
// Read detector configuration parameters from the steering file:
|
||||
@ -483,7 +489,6 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
|
||||
if (strstr(name,"save")!=NULL) {
|
||||
if (volumeID!=0) { // do not store hits in special "save" volume if ID of this volume is 0
|
||||
// (due to difficulties to distinguish between ID=0 and no save volume when using std::map)
|
||||
musrSteppingAction* mySteppingAction = musrSteppingAction::GetInstance();
|
||||
mySteppingAction->SetLogicalVolumeAsSpecialSaveVolume(logicName,volumeID);
|
||||
musrRootOutput::GetRootInstance()->SetSpecialSaveVolumeDefined();
|
||||
}
|
||||
@ -562,6 +567,164 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
|
||||
}
|
||||
}
|
||||
|
||||
// cks: Optical Boundary (needed only when simulating optical photons)
|
||||
else if (strcmp(tmpString1,"opticalSurface")==0) {
|
||||
if (musrParameters::boolG4OpticalPhotons) {
|
||||
char optSurfaceName[100];
|
||||
char physVolName1[100];
|
||||
char physVolName2[100];
|
||||
char type[100];
|
||||
char finish[100];
|
||||
char model[100];
|
||||
char materialPropertiesTableName[100]="Undefined";
|
||||
sscanf(&line[0],"%*s %*s %s %s %s %s %s %s %s",optSurfaceName,physVolName1,physVolName2,type,finish,model,materialPropertiesTableName);
|
||||
G4VPhysicalVolume* pPhysVol1 = FindPhysicalVolume(physVolName1);
|
||||
G4VPhysicalVolume* pPhysVol2 = FindPhysicalVolume(physVolName2);
|
||||
if ((pPhysVol1==NULL)||(pPhysVol2==NULL)) {
|
||||
G4cout << "ERROR! musrDetectorConstruction::Construct(): Physical Volume not found!"<<G4endl;
|
||||
G4cout << " ==> S T O P F O R C E D"<<G4endl;
|
||||
ReportGeometryProblem(line);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
G4OpticalSurface* optSurfTMP = new G4OpticalSurface(optSurfaceName);
|
||||
new G4LogicalBorderSurface(optSurfaceName,pPhysVol1,pPhysVol2,optSurfTMP);
|
||||
|
||||
std::map<std::string,G4SurfaceType> OpticalTypeMap;
|
||||
std::map<std::string,G4OpticalSurfaceModel> OpticalModelMap;
|
||||
std::map<std::string,G4OpticalSurfaceFinish> OpticalFinishMap;
|
||||
|
||||
OpticalTypeMap["dielectric_metal"]=dielectric_metal; // dielectric-metal interface
|
||||
OpticalTypeMap["dielectric_dielectric"]=dielectric_dielectric; // dielectric-dielectric interface
|
||||
OpticalTypeMap["dielectric_LUT"]=dielectric_LUT; // dielectric-Look-Up-Table interface
|
||||
OpticalTypeMap["firsov"]=firsov; // for Firsov Process
|
||||
OpticalTypeMap["x_ray"]=x_ray; // for x-ray mirror process
|
||||
|
||||
OpticalModelMap["glisur"]=glisur; // original GEANT3 model
|
||||
OpticalModelMap["unified"]=unified; // UNIFIED model
|
||||
OpticalModelMap["LUT"]=LUT; // Look-Up-Table model
|
||||
|
||||
OpticalFinishMap["polished"]=polished; // smooth perfectly polished surface
|
||||
OpticalFinishMap["polishedfrontpainted"]=polishedfrontpainted; // smooth top-layer (front) paint
|
||||
OpticalFinishMap["polishedbackpainted"]=polishedbackpainted; // same is 'polished' but with a back-paint
|
||||
OpticalFinishMap["ground"]=ground; // rough surface
|
||||
OpticalFinishMap["groundfrontpainted"]=groundfrontpainted; // rough top-layer (front) paint
|
||||
OpticalFinishMap["groundbackpainted"]=groundbackpainted; // same as 'ground' but with a back-paint
|
||||
OpticalFinishMap["polishedlumirrorair"]=polishedlumirrorair; // mechanically polished surface, with lumirror
|
||||
OpticalFinishMap["polishedlumirrorglue"]=polishedlumirrorglue; // mechanically polished surface, with lumirror & meltmount
|
||||
OpticalFinishMap["polishedair"]=polishedair; // mechanically polished surface
|
||||
OpticalFinishMap["polishedteflonair"]=polishedteflonair; // mechanically polished surface, with teflon
|
||||
OpticalFinishMap["polishedtioair"]=polishedtioair; // mechanically polished surface, with tio paint
|
||||
OpticalFinishMap["polishedtyvekair"]=polishedtyvekair; // mechanically polished surface, with tyvek
|
||||
OpticalFinishMap["polishedvm2000air"]=polishedvm2000air; // mechanically polished surface, with esr film
|
||||
OpticalFinishMap["polishedvm2000glue"]=polishedvm2000glue; // mechanically polished surface, with esr film & meltmount
|
||||
OpticalFinishMap["etchedlumirrorair"]=etchedlumirrorair; // chemically etched surface, with lumirror
|
||||
OpticalFinishMap["etchedlumirrorglue"]=etchedlumirrorglue; // chemically etched surface, with lumirror & meltmount
|
||||
OpticalFinishMap["etchedair"]=etchedair; // chemically etched surface
|
||||
OpticalFinishMap["etchedteflonair"]=etchedteflonair; // chemically etched surface, with teflon
|
||||
OpticalFinishMap["etchedtioair"]=etchedtioair; // chemically etched surface, with tio paint
|
||||
OpticalFinishMap["etchedtyvekair"]=etchedtyvekair; // chemically etched surface, with tyvek
|
||||
OpticalFinishMap["etchedvm2000air"]=etchedvm2000air; // chemically etched surface, with esr film
|
||||
OpticalFinishMap["etchedvm2000glue"]=etchedvm2000glue; // chemically etched surface, with esr film & meltmount
|
||||
OpticalFinishMap["groundlumirrorair"]=groundlumirrorair; // rough-cut surface, with lumirror
|
||||
OpticalFinishMap["groundlumirrorglue"]=groundlumirrorglue; // rough-cut surface, with lumirror & meltmount
|
||||
OpticalFinishMap["groundair"]=groundair; // rough-cut surface
|
||||
OpticalFinishMap["groundteflonair"]=groundteflonair; // rough-cut surface, with teflon
|
||||
OpticalFinishMap["groundtioair"]=groundtioair; // rough-cut surface, with tio paint
|
||||
OpticalFinishMap["groundtyvekair"]=groundtyvekair; // rough-cut surface, with tyvek
|
||||
OpticalFinishMap["groundvm2000air"]=groundvm2000air; // rough-cut surface, with esr film
|
||||
OpticalFinishMap["groundvm2000glue"]=groundvm2000glue; // rough-cut surface, with esr film & meltmount
|
||||
|
||||
|
||||
G4SurfaceType OpticalType = OpticalTypeMap[type];
|
||||
G4OpticalSurfaceModel OpticalModel = OpticalModelMap[model];
|
||||
G4OpticalSurfaceFinish OpticalFinish = OpticalFinishMap[finish];
|
||||
if ((OpticalType==0)&&(strcmp(type,"dielectric_metal")!=0)) {
|
||||
G4cout<<"ERROR! musrDetectorConstruction::Construct(): Optical type \""<<type<<"\" not found!"<<G4endl;
|
||||
G4cout << " ==> S T O P F O R C E D"<<G4endl;
|
||||
G4cout<<" "<<line;
|
||||
exit(1);
|
||||
}
|
||||
if ((OpticalModel==0)&&(strcmp(model,"glisur")!=0)) {
|
||||
G4cout<<"ERROR! musrDetectorConstruction::Construct(): Optical surface model \""<<model<<"\" not found!"<<G4endl;
|
||||
G4cout << " ==> S T O P F O R C E D"<<G4endl;
|
||||
G4cout<<" "<<line;
|
||||
exit(1);
|
||||
}
|
||||
if ((OpticalFinish==0)&&(strcmp(finish,"polished")!=0)) {
|
||||
G4cout<<"ERROR! musrDetectorConstruction::Construct(): Optical surface finish \""<<finish<<"\" not found!"<<G4endl;
|
||||
G4cout << " ==> S T O P F O R C E D"<<G4endl;
|
||||
G4cout<<" "<<line;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
optSurfTMP->SetType(OpticalType);
|
||||
optSurfTMP->SetFinish(OpticalFinish);
|
||||
optSurfTMP->SetModel(OpticalModel);
|
||||
// Assign the "Material properties table" if required by the user:
|
||||
G4cout<<"materialPropertiesTableName="<<materialPropertiesTableName<<G4endl;
|
||||
if (strcmp(materialPropertiesTableName,"Undefined")!=0) {
|
||||
G4MaterialPropertiesTable* MPT_tmp=NULL;
|
||||
itMPT = materialPropertiesTableMap.find(materialPropertiesTableName);
|
||||
if (itMPT==materialPropertiesTableMap.end()) { // G4MaterialPropertiesTable of this name does not exist --> problem
|
||||
G4cout<<"\n\n musrDetectorConstruction(): Material Properties Table \""<<materialPropertiesTableName
|
||||
<<"\" should be assigned to G4OpticalSurface \""<<optSurfaceName<<"\""<<G4endl;
|
||||
G4cout<<" but the table was not defined yet (by command /musr/command materialPropertiesTable )"<<G4endl;
|
||||
G4cout << "S T O P F O R C E D"<<G4endl;
|
||||
G4cout << line << G4endl;
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
MPT_tmp = itMPT->second;
|
||||
}
|
||||
optSurfTMP->SetMaterialPropertiesTable(MPT_tmp);
|
||||
G4cout<<optSurfTMP<<G4endl;
|
||||
optSurfTMP->GetMaterialPropertiesTable()->DumpTable();
|
||||
}
|
||||
G4cout<<"Optical surface \""<<optSurfaceName<<"\" created. OpticalType="<<OpticalType
|
||||
<<" OpticalFinish="<<OpticalFinish<<" OpticalModel="<<OpticalModel<<G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
else if (strcmp(tmpString1,"OPSA")==0){ // optical photon signal analysis
|
||||
if (musrParameters::boolG4OpticalPhotons) {
|
||||
musrScintSD* myMusrScintSD = musrScintSD::GetInstance();
|
||||
if (myMusrScintSD==NULL) {
|
||||
sprintf(eMessage,"musrDetectorConstruction.cc::Construct(): musrScintSD::GetInstance() is NULL - no musr/ScintSD set?");
|
||||
musrErrorMessage::GetInstance()->musrError(FATAL,eMessage,false);
|
||||
}
|
||||
char varName[100];
|
||||
float fVarValue;
|
||||
int iVarValue;
|
||||
sscanf(&line[0],"%*s %*s %s",varName);
|
||||
if (strcmp(varName,"minNrOfDetectedPhotons")==0) {
|
||||
sscanf(&line[0],"%*s %*s %*s %d",&iVarValue);
|
||||
myMusrScintSD -> Set_OPSA_minNrOfDetectedPhotons(iVarValue);
|
||||
}
|
||||
else if (strcmp(varName,"signalSeparationTime")==0) {
|
||||
sscanf(&line[0],"%*s %*s %*s %g",&fVarValue);
|
||||
myMusrScintSD -> Set_OPSA_SignalSeparationTime(fVarValue*nanosecond);
|
||||
}
|
||||
else if (strcmp(varName,"photonFractions")==0) {
|
||||
float a, b, c, d, e;
|
||||
sscanf(&line[0],"%*s %*s %*s %g %g %g %g %g",&a, &b, &c, &d, &e);
|
||||
myMusrScintSD -> Set_OPSA_frac(a,b,c,d,e);
|
||||
}
|
||||
else if (strcmp(varName,"eventsForOPSAhistos")==0) {
|
||||
int i_eventID, i_detectorID;
|
||||
sscanf(&line[0],"%*s %*s %*s %d %d",&i_eventID,&i_detectorID);
|
||||
myMusrScintSD -> AddEventIDToMultimapOfEventIDsForOPSAhistos(i_eventID,i_detectorID);
|
||||
}
|
||||
else if (strcmp(varName,"OPSAhist")==0) {
|
||||
int nBins;
|
||||
float min, max;
|
||||
sscanf(&line[0],"%*s %*s %*s %d %g %g",&nBins,&min,&max);
|
||||
myMusrScintSD -> SetOPSAhistoBinning(nBins,min*nanosecond,max*nanosecond);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// cks: Implementation of the Global Field (to allow overlapping fields) based
|
||||
// on the Peter Gumplinger's implementation of G4BeamLine code into Geant4.
|
||||
//
|
||||
@ -823,7 +986,6 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
|
||||
int eventWeight;
|
||||
char tmpLogVolName[100];
|
||||
sscanf(&line[0],"%*s %*s %*s %s %d",tmpLogVolName,&eventWeight);
|
||||
musrSteppingAction* mySteppingAction = musrSteppingAction::GetInstance();
|
||||
mySteppingAction -> SetVolumeForMuonEventReweighting(G4String(tmpLogVolName),eventWeight);
|
||||
}
|
||||
else {
|
||||
@ -979,6 +1141,15 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
|
||||
if (strcmp(tmpString2,"det_VvvProcID")==0){musrRootOutput::store_det_VvvProcID = false;}
|
||||
if (strcmp(tmpString2,"det_VvvTrackID")==0){musrRootOutput::store_det_VvvTrackID = false;}
|
||||
if (strcmp(tmpString2,"det_VvvParticleID")==0){musrRootOutput::store_det_VvvParticleID = false;}
|
||||
if (strcmp(tmpString2,"odet_ID")==0) {musrRootOutput::store_odet_ID = false;}
|
||||
if (strcmp(tmpString2,"odet_nPhot")==0) {musrRootOutput::store_odet_nPhot = false;}
|
||||
if (strcmp(tmpString2,"odet_timeFirst")==0) {musrRootOutput::store_odet_timeFirst = false;}
|
||||
if (strcmp(tmpString2,"odet_timeA")==0) {musrRootOutput::store_odet_timeA = false;}
|
||||
if (strcmp(tmpString2,"odet_timeB")==0) {musrRootOutput::store_odet_timeB = false;}
|
||||
if (strcmp(tmpString2,"odet_timeC")==0) {musrRootOutput::store_odet_timeC = false;}
|
||||
if (strcmp(tmpString2,"odet_timeD")==0) {musrRootOutput::store_odet_timeD = false;}
|
||||
if (strcmp(tmpString2,"odet_timeE")==0) {musrRootOutput::store_odet_timeE = false;}
|
||||
if (strcmp(tmpString2,"odet_timeLast")==0) {musrRootOutput::store_odet_timeLast = false;}
|
||||
}
|
||||
else if(strcmp(storeIt,"on")==0) {
|
||||
if (strcmp(tmpString2,"fieldIntegralBx")==0){musrRootOutput::store_fieldIntegralBx = true;}
|
||||
@ -991,12 +1162,13 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
|
||||
if ((musrRootOutput::store_fieldIntegralBx)||(musrRootOutput::store_fieldIntegralBy)||
|
||||
(musrRootOutput::store_fieldIntegralBz)||(musrRootOutput::store_fieldIntegralBz1)||
|
||||
(musrRootOutput::store_fieldIntegralBz2)||(musrRootOutput::store_fieldIntegralBz3) ) {
|
||||
musrSteppingAction::GetInstance()->SetCalculationOfFieldIntegralRequested(true);
|
||||
mySteppingAction -> SetCalculationOfFieldIntegralRequested(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (strcmp(tmpString1,"process")==0) {
|
||||
else if ((strcmp(tmpString1,"process")==0)||(strcmp(tmpString1,"G4OpticalPhotons")==0)
|
||||
||(strcmp(tmpString1,"materialPropertiesTable")==0)||(strcmp(tmpString1,"setMaterialPropertiesTable")==0)) {
|
||||
; // processes are interpreded later in musrPhysicsList.cc
|
||||
}
|
||||
|
||||
@ -1133,49 +1305,140 @@ void musrDetectorConstruction::DefineMaterials()
|
||||
|
||||
new G4Material("ArgonGas", z= 18., a= 39.95*g/mole, density= 0.00000000001*mg/cm3);
|
||||
|
||||
if (musrParameters::boolG4OpticalPhotons) {
|
||||
G4NistManager* man = G4NistManager::Instance();
|
||||
G4Material* scintik = man->FindOrBuildMaterial("G4_PLASTIC_SC_VINYLTOLUENE");
|
||||
// G4Material* scintik = G4Material::GetMaterial("G4_PLASTIC_SC_VINYLTOLUENE");
|
||||
G4cout<<"scintik="<<scintik<<G4endl;
|
||||
if (scintik!=NULL) {
|
||||
const G4int nEntries = 14;
|
||||
G4double PhotonEnergy[nEntries] =
|
||||
{ 2.695*eV, 2.75489*eV, 2.8175*eV, 2.88302*eV, // 460, 450, 440, 430 nm
|
||||
2.95167*eV, 3.02366*eV, 3.09925*eV, 3.17872*eV, 3.26237*eV, // 420, 410, 400, 390, 380 nm
|
||||
3.30587*eV, 3.35054*eV, 3.44361*eV, 3.542*eV, 3.64618*eV }; // 375, 370, 360, 350, 340 nm
|
||||
G4double RefractiveIndex[nEntries] =
|
||||
{ 1.58, 1.58, 1.58, 1.58,
|
||||
1.58, 1.58, 1.58, 1.58, 1.58,
|
||||
1.58, 1.58, 1.58, 1.58, 1.58 };
|
||||
G4double Absorption[nEntries] =
|
||||
{ 8*cm, 8*cm, 8*cm, 8*cm,
|
||||
8*cm, 8*cm, 8*cm, 8*cm, 8*cm,
|
||||
8*cm, 8*cm, 8*cm, 8*cm, 8*cm };
|
||||
G4double ScintilFast[nEntries] =
|
||||
{ 0.01, 0.07, 0.15, 0.26,
|
||||
0.375, 0.52, 0.65, 0.80, 0.95,
|
||||
1, 0.88, 0.44, 0.08, 0.01 };
|
||||
G4double ScintilSlow[nEntries] =
|
||||
{ 0.01, 0.07, 0.15, 0.26,
|
||||
0.375, 0.52, 0.65, 0.80, 0.95,
|
||||
1, 0.88, 0.44, 0.08, 0.01 };
|
||||
G4MaterialPropertiesTable* myMPT1 = new G4MaterialPropertiesTable();
|
||||
myMPT1->AddProperty("RINDEX", PhotonEnergy, RefractiveIndex, nEntries);
|
||||
myMPT1->AddProperty("ABSLENGTH", PhotonEnergy, Absorption, nEntries);
|
||||
myMPT1->AddProperty("FASTCOMPONENT", PhotonEnergy, ScintilFast, nEntries);
|
||||
myMPT1->AddProperty("SLOWCOMPONENT", PhotonEnergy, ScintilSlow, nEntries);
|
||||
myMPT1->AddConstProperty("SCINTILLATIONYIELD", 8400./MeV);
|
||||
myMPT1->AddConstProperty("RESOLUTIONSCALE",1.0);
|
||||
myMPT1->AddConstProperty("FASTTIMECONSTANT",1.6*ns);
|
||||
myMPT1->AddConstProperty("SLOWTIMECONSTANT",1.6*ns);
|
||||
myMPT1->AddConstProperty("YIELDRATIO",1.0);
|
||||
scintik->SetMaterialPropertiesTable(myMPT1);
|
||||
|
||||
scintik->GetMaterialPropertiesTable()->DumpTable();
|
||||
if (musrParameters::boolG4OpticalPhotons) {
|
||||
|
||||
FILE *fSteeringFile=fopen(parameterFileName.c_str(),"r");
|
||||
if (fSteeringFile) {
|
||||
char line[5001];
|
||||
while (!feof(fSteeringFile)) {
|
||||
fgets(line,5000,fSteeringFile);
|
||||
if ((line[0]!='#')&&(line[0]!='\n')&&(line[0]!='\r')) {
|
||||
char tmpString0[100]="Unset";
|
||||
sscanf(&line[0],"%s",tmpString0);
|
||||
if ( (strcmp(tmpString0,"/musr/ignore")!=0) &&(strcmp(tmpString0,"/musr/command")!=0) ) continue;
|
||||
|
||||
|
||||
char tmpString1[100]="Unset",tmpString2[100]="Unset";
|
||||
sscanf(&line[0],"%*s %s %s",tmpString1,tmpString2);
|
||||
if (strcmp(tmpString1,"materialPropertiesTable")==0){
|
||||
std::string materialPropertiesTableName=tmpString2;
|
||||
G4MaterialPropertiesTable* MPT_tmp;
|
||||
itMPT = materialPropertiesTableMap.find(materialPropertiesTableName);
|
||||
if (itMPT==materialPropertiesTableMap.end()) { // G4MaterialPropertiesTable of this name does not exist yet --> create it
|
||||
MPT_tmp = new G4MaterialPropertiesTable();
|
||||
materialPropertiesTableMap.insert ( std::pair<std::string,G4MaterialPropertiesTable*>(materialPropertiesTableName,MPT_tmp) );
|
||||
}
|
||||
else {
|
||||
MPT_tmp = itMPT->second;
|
||||
}
|
||||
|
||||
char propertyName[100];
|
||||
int nEntries;
|
||||
sscanf(&line[0],"%*s %*s %*s %s %d",propertyName,&nEntries);
|
||||
std::cout<<" Optical Material Def: MPT_tmp="<<MPT_tmp<<", materialPropertiesTableName="<<materialPropertiesTableName
|
||||
<<", propertyName="<<propertyName<<", nEntries="<<nEntries<<std::endl;
|
||||
|
||||
if (nEntries==0) { // AddConstProperty
|
||||
float value;
|
||||
sscanf(&line[0],"%*s %*s %*s %*s %*d %g",&value);
|
||||
MPT_tmp->AddConstProperty(propertyName,value);
|
||||
}
|
||||
else { // AddProperty
|
||||
char* pch = strstr(line,propertyName)+strlen(propertyName);
|
||||
float value;
|
||||
G4double photonEnergyArray[100];
|
||||
G4double valueArray[100];
|
||||
char dummy[100];
|
||||
sscanf(pch,"%s",dummy); char* pch2=strstr(pch,dummy)+strlen(dummy); pch = pch2;
|
||||
for (int i=0; i<nEntries; i++) {
|
||||
sscanf(pch,"%g",&value);
|
||||
// G4cout<<" DDDDD var1="<<value<<" &pch="<<&pch<<G4endl;
|
||||
photonEnergyArray[i]=value;
|
||||
sscanf(pch,"%s",dummy); char* pch2=strstr(pch,dummy)+strlen(dummy); pch = pch2;
|
||||
}
|
||||
for (int i=0; i<nEntries; i++) {
|
||||
sscanf(pch,"%g",&value);
|
||||
// G4cout<<" DDDDD var2="<<value<<" &pch="<<&pch<<G4endl;
|
||||
valueArray[i]=value;
|
||||
sscanf(pch,"%s",dummy); char* pch2=strstr(pch,dummy)+strlen(dummy); pch = pch2;
|
||||
}
|
||||
MPT_tmp->AddProperty(propertyName,photonEnergyArray,valueArray,nEntries);
|
||||
}
|
||||
}
|
||||
else if (strcmp(tmpString1,"setMaterialPropertiesTable")==0){
|
||||
char tmpString3[100]="Unset";
|
||||
sscanf(&line[0],"%*s %*s %*s %s",tmpString3);
|
||||
std::string materialPropertiesTableName=tmpString2;
|
||||
std::string materialName = tmpString3;
|
||||
G4NistManager* man = G4NistManager::Instance();
|
||||
G4Material* myMaterial = man->FindOrBuildMaterial(materialName);
|
||||
|
||||
G4MaterialPropertiesTable* MPT_tmp=NULL;
|
||||
itMPT = materialPropertiesTableMap.find(materialPropertiesTableName);
|
||||
if (itMPT==materialPropertiesTableMap.end()) { // G4MaterialPropertiesTable of this name does not exist --> problem
|
||||
G4cout<<"\n\n musrDetectorConstruction::DefineMaterials(): Material Properties Table \""<<materialPropertiesTableName
|
||||
<<"\" should be assigned to material \""<<materialName<<"\""<<G4endl;
|
||||
G4cout<<" but the table was not defined yet (by command /musr/command materialPropertiesTable )"<<G4endl;
|
||||
G4cout <<" ===> S T O P F O R C E D"<<G4endl;
|
||||
G4cout<<line<<G4endl;
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
MPT_tmp = itMPT->second;
|
||||
}
|
||||
myMaterial->SetMaterialPropertiesTable(MPT_tmp);
|
||||
G4cout<<myMaterial<<G4endl;
|
||||
myMaterial->GetMaterialPropertiesTable()->DumpTable();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
G4cout<<"OK konec"<<G4endl;
|
||||
exit(0);
|
||||
fclose(fSteeringFile);
|
||||
|
||||
// G4cout<<" 1eV = "<<eV<<G4endl;
|
||||
// G4cout<<" 1MeV = "<<MeV<<G4endl;
|
||||
// G4cout<<" 1ns = "<<ns<<G4endl;
|
||||
//
|
||||
// G4NistManager* man = G4NistManager::Instance();
|
||||
// G4Material* scintik = man->FindOrBuildMaterial("G4_PLASTIC_SC_VINYLTOLUENE");
|
||||
// G4cout<<"scintik="<<scintik<<G4endl;
|
||||
// if (scintik!=NULL) {
|
||||
// const G4int nEntries = 14;
|
||||
// G4double PhotonEnergy[nEntries] =
|
||||
// { 2.695*eV, 2.75489*eV, 2.8175*eV, 2.88302*eV, // 460, 450, 440, 430 nm
|
||||
// 2.95167*eV, 3.02366*eV, 3.09925*eV, 3.17872*eV, 3.26237*eV, // 420, 410, 400, 390, 380 nm
|
||||
// 3.30587*eV, 3.35054*eV, 3.44361*eV, 3.542*eV, 3.64618*eV }; // 375, 370, 360, 350, 340 nm
|
||||
// G4double RefractiveIndex[nEntries] =
|
||||
// { 1.58, 1.58, 1.58, 1.58,
|
||||
// 1.58, 1.58, 1.58, 1.58, 1.58,
|
||||
// 1.58, 1.58, 1.58, 1.58, 1.58 };
|
||||
// G4double Absorption[nEntries] =
|
||||
// { 8*cm, 8*cm, 8*cm, 8*cm,
|
||||
// 8*cm, 8*cm, 8*cm, 8*cm, 8*cm,
|
||||
// 8*cm, 8*cm, 8*cm, 8*cm, 8*cm };
|
||||
// G4double ScintilFast[nEntries] =
|
||||
// { 0.01, 0.07, 0.15, 0.26,
|
||||
// 0.375, 0.52, 0.65, 0.80, 0.95,
|
||||
// 1, 0.88, 0.44, 0.08, 0.01 };
|
||||
// G4double ScintilSlow[nEntries] =
|
||||
// { 0.01, 0.07, 0.15, 0.26,
|
||||
// 0.375, 0.52, 0.65, 0.80, 0.95,
|
||||
// 1, 0.88, 0.44, 0.08, 0.01 };
|
||||
// G4MaterialPropertiesTable* myMPT1 = new G4MaterialPropertiesTable();
|
||||
// myMPT1->AddProperty("RINDEX", PhotonEnergy, RefractiveIndex, nEntries);
|
||||
// myMPT1->AddProperty("ABSLENGTH", PhotonEnergy, Absorption, nEntries);
|
||||
// myMPT1->AddProperty("FASTCOMPONENT", PhotonEnergy, ScintilFast, nEntries);
|
||||
// myMPT1->AddProperty("SLOWCOMPONENT", PhotonEnergy, ScintilSlow, nEntries);
|
||||
// myMPT1->AddConstProperty("SCINTILLATIONYIELD", 8400./MeV);
|
||||
// myMPT1->AddConstProperty("RESOLUTIONSCALE",1.0);
|
||||
// myMPT1->AddConstProperty("FASTTIMECONSTANT",1.6*ns);
|
||||
// myMPT1->AddConstProperty("SLOWTIMECONSTANT",1.6*ns);
|
||||
// myMPT1->AddConstProperty("YIELDRATIO",1.0);
|
||||
// scintik->SetMaterialPropertiesTable(myMPT1);
|
||||
|
||||
// scintik->GetMaterialPropertiesTable()->DumpTable();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1240,6 +1503,25 @@ G4LogicalVolume* musrDetectorConstruction::FindLogicalVolume(G4String LogicalVol
|
||||
return NULL;
|
||||
}
|
||||
|
||||
G4VPhysicalVolume* musrDetectorConstruction::FindPhysicalVolume(G4String PhysicalVolumeName) {
|
||||
G4PhysicalVolumeStore* pPhysStore = G4PhysicalVolumeStore::GetInstance();
|
||||
if (pPhysStore==NULL) {
|
||||
G4cout<<"ERROR: musrDetectorConstruction.cc: G4PhysicalVolumeStore::GetInstance() not found!"<<G4endl;
|
||||
}
|
||||
else {
|
||||
for (unsigned int i=0; i<pPhysStore->size(); i++) {
|
||||
G4VPhysicalVolume* pPhysVol=pPhysStore->at(i);
|
||||
G4String iPhysName=pPhysVol->GetName();
|
||||
if (iPhysName==PhysicalVolumeName) {
|
||||
return pPhysVol;
|
||||
}
|
||||
}
|
||||
}
|
||||
G4cout<<"\n musrDetectorConstruction.cc::FindPhysicalVolume: \n ERROR !!! Physical volume "
|
||||
<<PhysicalVolumeName<<" not found !!!"<<G4endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void musrDetectorConstruction::SetColourOfLogicalVolume(G4LogicalVolume* pLogVol,char* colour) {
|
||||
if (pLogVol!=NULL) {
|
||||
if (strcmp(colour,"red" )==0) {pLogVol->SetVisAttributes(G4Colour(1,0,0));}
|
||||
|
Reference in New Issue
Block a user