/*************************************************************************** * 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. * ***************************************************************************/ #include "musrDetectorConstruction.hh" #include "musrDetectorMessenger.hh" #include "musrTabulatedElementField.hh" #include "musrQuadrupole.hh" #include "musrUniformField.hh" // Uniform EM field (B,E) implemented by Toni Shiroka #include "musrScintSD.hh" #include "musrEventAction.hh" #include "musrMuEnergyLossLandau.hh" #include "G4GeometryManager.hh" #include "G4PhysicalVolumeStore.hh" #include "G4LogicalVolumeStore.hh" #include "G4SolidStore.hh" #include "G4SDManager.hh" #include "G4PVParameterised.hh" #include "G4UnionSolid.hh" #include "G4IntersectionSolid.hh" #include "G4SubtractionSolid.hh" #include "G4Material.hh" #include "G4NistManager.hh" #include "G4Box.hh" #include "G4Cons.hh" #include "G4Polycone.hh" #include "G4Torus.hh" #include "G4LogicalVolume.hh" #include "G4PVPlacement.hh" #include "G4Tubs.hh" #include "G4Sphere.hh" #include "G4Trd.hh" #include "G4Para.hh" #include "G4PVDivision.hh" #include "G4UserLimits.hh" // In order to implement overlaping field as was done by // Gumplinger in examples/extended/field/field04/ #include "F04GlobalField.hh" #include "G4VisAttributes.hh" #include "G4Colour.hh" #include "G4ios.hh" #include "G4Region.hh" #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" #include "musrSteppingAction.hh" using namespace std; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... musrDetectorConstruction::musrDetectorConstruction(G4String steeringFileName) :checkOverlap(true), aScintSD(0) { parameterFileName = steeringFileName; DefineMaterials(); detectorMessenger = new musrDetectorMessenger(this); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... musrDetectorConstruction::~musrDetectorConstruction() { delete detectorMessenger; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "G4LogicalVolumeStore.hh" G4VPhysicalVolume* musrDetectorConstruction::Construct() { // Clean old geometry, if any // G4GeometryManager::GetInstance()->OpenGeometry(); G4PhysicalVolumeStore::GetInstance()->Clean(); G4LogicalVolumeStore::GetInstance()->Clean(); G4SolidStore::GetInstance()->Clean(); // G4cout<< "musrDetectorConstruction::Construct: ParameterFileName="<maxArrayLength) { G4cout<<"musrDetectorConstruction: arrayDef: currently the array can not have more than "< was it defined?"<second; } G4cout<<"zPLANE="; for (int iiiii=0; iiiii was it defined?"<second; } G4cout<<"rINNER="; for (int iiiii=0; iiiii was it defined?"<second; } G4cout<<"rOUTER="; for (int iiiii=0; iiiiirotateY(90.0*CLHEP::deg); } G4FieldManager* pFieldMan = pointerToField[actualFieldName]; if (pFieldMan!=NULL) {G4cout<<" volume with field, ";} else if ((strcmp(actualFieldName,"nofield"))) { G4cout <<"Field Manager \""<SetLogicalVolumeAsSpecialSaveVolume(logicName,volumeID); musrRootOutput::GetRootInstance()->SetSpecialSaveVolumeDefined(); } } // Unless specified as "dead", set the volume sensitive volume: if (strcmp(sensitiveDet,"dead")) { if (strcmp(sensitiveDet,"musr/ScintSD")==0) { if(!aScintSD) { G4SDManager* SDman = G4SDManager::GetSDMpointer(); G4String scintSDname = sensitiveDet; aScintSD = new musrScintSD( scintSDname ); SDman->AddNewDetector( aScintSD ); G4cout<<"musrDetectorConstruction.cc: aScintSD added: "<GetFullPathName()<SetSensitiveDetector( aScintSD ); } else { G4cout<<" musrDetectorConstruction.cc: unknown sensitive detector \""<SetVolumeIDMapping(logicName,volumeID); } // If the volume name is "Target", "M0", "M1" or "M2", let's save muon polarisation and time in these volumes: if ((strcmp(name,"Target")==0)||(strcmp(name,"target")==0)) { musrRootOutput::store_muTargetTime = true; musrRootOutput::store_muTargetPolX = true; musrRootOutput::store_muTargetPolY = true; musrRootOutput::store_muTargetPolZ = true; musrRootOutput::store_muTargetMomX = true; musrRootOutput::store_muTargetMomY = true; musrRootOutput::store_muTargetMomZ = true; } if ((strcmp(name,"M0")==0)||(strcmp(name,"m0")==0)) { musrRootOutput::store_muM0Time = true; musrRootOutput::store_muM0PolX = true; musrRootOutput::store_muM0PolY = true; musrRootOutput::store_muM0PolZ = true; } if ((strcmp(name,"M1")==0)||(strcmp(name,"m1")==0)) { musrRootOutput::store_muM1Time = true; musrRootOutput::store_muM1PolX = true; musrRootOutput::store_muM1PolY = true; musrRootOutput::store_muM1PolZ = true; } if ((strcmp(name,"M2")==0)||(strcmp(name,"m2")==0)) { musrRootOutput::store_muM2Time = true; musrRootOutput::store_muM2PolX = true; musrRootOutput::store_muM2PolY = true; musrRootOutput::store_muM2PolZ = true; } } else if (strcmp(tmpString1,"visattributes")==0){ sscanf(&line[0],"%*s %*s %*s %s",tmpString3); if (strncmp(tmpString2,"log_",4)==0) { G4LogicalVolume* pLogVol = FindLogicalVolume(tmpString2); if (pLogVol==NULL) { sprintf(eMessage,"musrDetectorConstruction.cc::Construct(): visattributes requested for %s, but this volume was not found.",tmpString2); musrErrorMessage::GetInstance()->musrError(WARNING,eMessage,false); } else {SetColourOfLogicalVolume(pLogVol,tmpString3);} } else { G4LogicalVolumeStore* pLogStore = G4LogicalVolumeStore::GetInstance(); if (pLogStore==NULL) { G4cout<<"ERROR: musrDetectorConstruction.cc: G4LogicalVolumeStore::GetInstance() not found!"<size(); i++) { G4LogicalVolume* pLogVol=pLogStore->at(i); G4String materialName=pLogVol->GetMaterial()->GetName(); if (tmpString2==materialName) { SetColourOfLogicalVolume(pLogVol,tmpString3); } } } } } // 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!"< S T O P F O R C E D"< OpticalTypeMap; std::map OpticalModelMap; std::map 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 \""< update musrDetectorConstruction.cc file!)"<< G4endl; G4cout << " ==> S T O P F O R C E D"< update musrDetectorConstruction.cc file!)"<< G4endl; G4cout << " ==> S T O P F O R C E D"< update musrDetectorConstruction.cc file!)"<< G4endl; G4cout << " ==> S T O P F O R C E D"<SetType(OpticalType); optSurfTMP->SetFinish(OpticalFinish); optSurfTMP->SetModel(OpticalModel); // Assign the "Material properties table" if required by the user: // G4cout<<"materialPropertiesTableName="< problem G4cout<<"\n\n musrDetectorConstruction(): Material Properties Table \""<second; } optSurfTMP->SetMaterialPropertiesTable(MPT_tmp); // optSurfTMP->GetMaterialPropertiesTable()->DumpTable(); } G4cout<<"Optical surface \""<musrError(FATAL,eMessage,false); } char varName[100]; double 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 %lf",&fVarValue); myMusrScintSD -> Set_OPSA_SignalSeparationTime(fVarValue*CLHEP::nanosecond); } else if (strcmp(varName,"photonFractions")==0) { double a, b, c, d; sscanf(&line[0],"%*s %*s %*s %lf %lf %lf %lf",&a, &b, &c, &d); myMusrScintSD -> Set_OPSA_variables(a,b,c,d); } 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; double min, max; sscanf(&line[0],"%*s %*s %*s %d %lf %lf",&nBins,&min,&max); myMusrScintSD -> SetOPSAhistoBinning(nBins,min*CLHEP::nanosecond,max*CLHEP::nanosecond); } else if (strcmp(varName,"pulseShapeArray")==0) { char fileName[500]; sscanf(&line[0],"%*s %*s %*s %s",fileName); myMusrScintSD -> ReadInPulseShapeArray(fileName); } else if (strcmp(varName,"CFD")==0) { double a1, delay, timeShiftOffset; sscanf(&line[0],"%*s %*s %*s %lf %lf %lf",&a1,&delay,&timeShiftOffset); myMusrScintSD -> Set_OPSA_CFD(a1,delay,timeShiftOffset); } else if (strcmp(varName,"APDcells")==0) { int nx, ny, nz; double halfLenght_x, halfLenght_y, halfLenght_z; sscanf(&line[0],"%*s %*s %*s %d %d %d %lf %lf %lf",&nx,&ny,&nz,&halfLenght_x,&halfLenght_y,&halfLenght_z); myMusrScintSD -> SetAPDcellSizes(nx, ny, nz, halfLenght_x, halfLenght_y, halfLenght_z); } else if (strcmp(varName,"SetAPDcellsTimeVariationSigma")==0) { double sigma; sscanf(&line[0],"%*s %*s %*s %lf",&sigma); myMusrScintSD ->SetAPDcellsTimeVariationSigma(sigma*CLHEP::nanosecond); } else if (strcmp(varName,"SetAPDcrossTalk")==0) { double crossTalkProb; sscanf(&line[0],"%*s %*s %*s %lf",&crossTalkProb); myMusrScintSD ->SetAPDcrossTalk(crossTalkProb); } else { G4cout<<"musrDetectorConstruction.cc: ERROR: Unknown parameterName \"" <musrError(FATAL,eMessage,false); } // Construct the field musrTabulatedElementField* myElementTableField = new musrTabulatedElementField(fieldInputFileName, fieldTableType, fieldValue*CLHEP::tesla, logVol, position); myElementTableField->SetElementFieldName(tmpString2); if (fieldNrOfSteps>0) { //cks The following line might require some correction for the electric field myElementTableField->SetEventNrDependentField(fieldValue*CLHEP::tesla,fieldValueFinal*CLHEP::tesla,fieldNrOfSteps); } // FieldList* fields = F04GlobalField::getObject()->getFields(); // if (fields) { // G4cout<<"DEBUG: Detector construction: fields->size()="<size()<musrError(FATAL,eMessage,false); } G4double fieldValue_tmp[6] = { fieldValue[0]*CLHEP::tesla, fieldValue[1]*CLHEP::tesla, fieldValue[2]*CLHEP::tesla, fieldValue[3]*(CLHEP::kilovolt/CLHEP::mm),fieldValue[4]*(CLHEP::kilovolt/CLHEP::mm),fieldValue[5]*(CLHEP::kilovolt/CLHEP::mm)}; musrUniformField* myElementUniformField = new musrUniformField(fieldValue_tmp, half_x, half_y, half_z, logVol, position); myElementUniformField->SetElementFieldName(tmpString2); } else if (strcmp(typeOfField,"quadrupole")==0) { double halfLength, fieldRadius, gradientValue, gradientValueFinal, fringeFactor; int gradientNrOfSteps = 0; char logicalVolumeName[100]; sscanf(&line[0],"%*s %*s %*s %*g %*g %*g %*s %lf %lf %lf %s %lf %lf %d",&halfLength,&fieldRadius,&fringeFactor,logicalVolumeName, &gradientValue,&gradientValueFinal,&gradientNrOfSteps); G4LogicalVolume* logVol = FindLogicalVolume(logicalVolumeName); if (logVol==NULL) { sprintf(eMessage,"musrDetectorConstruction.cc::Construct(): GLOBAL FIELD: Logical volume \"%s\" not found.", logicalVolumeName); musrErrorMessage::GetInstance()->musrError(FATAL,eMessage,false); } musrQuadrupole* myMusrQuadrupole = new musrQuadrupole(halfLength*CLHEP::mm,fieldRadius*CLHEP::mm,gradientValue*(CLHEP::tesla/CLHEP::m),fringeFactor,logVol,position); myMusrQuadrupole->SetElementFieldName(tmpString2); if (gradientNrOfSteps>0) { myMusrQuadrupole->SetEventNrDependentField(gradientValue*(CLHEP::tesla/CLHEP::m),gradientValueFinal*(CLHEP::tesla/CLHEP::m),gradientNrOfSteps); } } else if (strcmp(tmpString2,"setparameter")==0){ // First check that the magnetic field already exists: G4FieldManager* fieldMgr = G4TransportationManager::GetTransportationManager()->GetFieldManager(); G4PropagatorInField* propagMgr = G4TransportationManager::GetTransportationManager()->GetPropagatorInField(); if (fieldMgr==NULL) { ReportProblemInStearingFile(line); sprintf(eMessage,"musrDetectorConstruction.cc::Construct(): G4FieldManager not found: fieldMgr=NULL"); musrErrorMessage::GetInstance()->musrError(FATAL,eMessage,false); } if (propagMgr==NULL) { ReportProblemInStearingFile(line); sprintf(eMessage,"musrDetectorConstruction.cc::Construct(): G4PropagatorInField not found: propagMgr=NULL"); musrErrorMessage::GetInstance()->musrError(FATAL,eMessage,false); } else { char parameterName[100]; double parameterValue; sscanf(&line[0],"%*s %*s %*s %s %lf",parameterName,¶meterValue); if (strcmp(parameterName,"SetDeltaIntersection")==0){ fieldMgr->SetDeltaIntersection(parameterValue*CLHEP::mm); } else if (strcmp(parameterName,"SetDeltaOneStep")==0){ fieldMgr->SetDeltaOneStep(parameterValue*CLHEP::mm); } else if (strcmp(parameterName,"SetMinimumEpsilonStep")==0){ fieldMgr->SetMinimumEpsilonStep(parameterValue); } else if (strcmp(parameterName,"SetMaximumEpsilonStep")==0){ fieldMgr->SetMaximumEpsilonStep(parameterValue); } else if (strcmp(parameterName,"SetLargestAcceptableStep")==0) { propagMgr->SetLargestAcceptableStep(parameterValue*CLHEP::mm); } else if (strcmp(parameterName,"SetMaxLoopCount")==0) {propagMgr->SetMaxLoopCount(int(parameterValue)); } else { G4cout<<"musrDetectorConstruction.cc: ERROR: Unknown parameterName \"" <GetFieldManager(); G4PropagatorInField* propagMgr = G4TransportationManager::GetTransportationManager()->GetPropagatorInField(); if (fieldMgr==NULL) { G4cout<<"musrDetectorConstruction: ERROR: Field manager not found!"<AddPointForFieldTesting(G4ThreeVector(p0,p1,p2)); if (strcmp(tmpString2,"printFieldDerivativeAtPoint")==0) myGlobalField->AddPointForFieldDerivativeTesting(G4ThreeVector(p0,p1,p2)); } else { sprintf(eMessage,"musrDetectorConstruction.cc::Construct(): printFieldValueAtPoint requested, but field not found"); musrErrorMessage::GetInstance()->musrError(SERIOUS,eMessage,false); } } } else {ReportGeometryProblem(line);} } // Set range cut for a given volume, if requested by the macro file else if (strcmp(tmpString1,"SetUserLimits")==0){ G4LogicalVolume* pLogVol = FindLogicalVolume(tmpString2); if (pLogVol==NULL) { G4cout << "ERROR! musrDetectorConstruction::Construct(): SetUserLimits: Logical Volume \"" << tmpString2 <<"\" not found!"<0) {myUserLimits->SetMaxAllowedStep(ustepMax*CLHEP::mm); G4cout<<"ustepMax = "<0) {myUserLimits->SetUserMaxTrackLength(utrakMax*CLHEP::mm);G4cout<<"utrakMax = "<0) {myUserLimits->SetUserMaxTime(utimeMax*CLHEP::ns); G4cout<<"utimeMax = "<0) {myUserLimits->SetUserMinEkine(uekinMin*CLHEP::MeV); G4cout<<"uekinMin = "<0) {myUserLimits->SetUserMinRange(urangMin*CLHEP::mm); G4cout<<"urangMin = "<SetUserLimits(myUserLimits); } else if (strcmp(tmpString1,"rootOutputDirectoryName")==0){ char rootOutDirName[1000]; sscanf(&line[0],"%*s %*s %s",rootOutDirName); // Cut out the character '/' at the end of the directory name, if it was specified in the name if (rootOutDirName[strlen(rootOutDirName)-1]=='/') rootOutDirName[strlen(rootOutDirName)-1]='\0'; myRootOutput->setRootOutputDirectoryName(rootOutDirName); } else if (strcmp(tmpString1,"storeOnlyEventsWithHitInDetID")==0){ G4int variable; sscanf(&line[0],"%*s %*s %d",&variable); if (variable!=0){ musrParameters::storeOnlyEventsWithHits = true; musrParameters::storeOnlyEventsWithHitInDetID = variable; char eMessage[200]; sprintf(eMessage, "musrDetectorConstruction.cc:: Only the events with at least one hit in the detector ID=%d are stored", variable); musrErrorMessage::GetInstance()->musrError(INFO,eMessage,false); } } else if (strcmp(tmpString1,"storeOnlyEventsWithMuonsDecayedInDetID")==0){ G4int variable; sscanf(&line[0],"%*s %*s %d",&variable); if (variable!=0){ musrParameters::storeOnlyEventsWithMuonsDecayedInDetID = variable; char eMessage[200]; sprintf(eMessage, "musrDetectorConstruction.cc:: Only the events, in which muon stop in the detector ID=%d, are stored", variable); musrErrorMessage::GetInstance()->musrError(INFO,eMessage,false); } } else if (strcmp(tmpString1,"storeOnlyEventsWithHits")==0){ if (strcmp(tmpString2,"false")==0){ musrParameters::storeOnlyEventsWithHits = false; } } else if (strcmp(tmpString1,"storeOnlyTheFirstTimeHit")==0){ if (strcmp(tmpString2,"true")==0){ musrParameters::storeOnlyTheFirstTimeHit = true; } } else if (strcmp(tmpString1,"killAllElectrons")==0){ if (strcmp(tmpString2,"true")==0){ musrParameters::killAllElectrons = true; } else { musrParameters::killAllElectrons = false; } } else if (strcmp(tmpString1,"killAllPositrons")==0){ if (strcmp(tmpString2,"true")==0){ musrParameters::killAllPositrons = true; } else { musrParameters::killAllPositrons = false; } } else if (strcmp(tmpString1,"killAllGammas")==0){ if (strcmp(tmpString2,"true")==0){ musrParameters::killAllGammas = true; } else { musrParameters::killAllGammas = false; } } else if (strcmp(tmpString1,"killAllNeutrinos")==0){ if (strcmp(tmpString2,"true")==0){ musrParameters::killAllNeutrinos = true; } else { musrParameters::killAllNeutrinos = false; } } else if (strcmp(tmpString1,"maximumTimePerEvent")==0){ int variable; sscanf(&line[0],"%*s %*s %d",&variable); if (variable>0){ musrParameters::maximumTimePerEvent = variable; } } else if (strcmp(tmpString1,"maximumNrOfStepsPerTrack")==0){ int variable; sscanf(&line[0],"%*s %*s %d",&variable); if (variable>0){ musrParameters::maximumNrOfStepsPerTrack = variable; } } else if (strcmp(tmpString1,"getDetectorMass")==0){ G4LogicalVolume* massVol = FindLogicalVolume(tmpString2); if (massVol==NULL) { G4cout << "ERROR! musrDetectorConstruction::Construct(): Logical Volume \"" << tmpString3 <<"\" not found!"<GetMass()/CLHEP::kg<<" kg."< SetVolumeForMuonEventReweighting(G4String(tmpLogVolName),eventWeight); } else { sprintf(eMessage, "musrDetectorConstruction.cc:: logicalVolumeToBeReweighted - reweighting for particle %s not yet implemented", tmpString2); musrErrorMessage::GetInstance()->musrError(FATAL,eMessage,true); } } // Set G4Regions - intended mainly for the coulomb scattering or special production cuts (added on 2008.08.21) else if (strcmp(tmpString1,"region")==0) { if (strcmp(tmpString2,"define")==0) { char charRegionName[100]; char charLogicalVolumeName[100]; sscanf(&line[0],"%*s %*s %*s %s %s",charRegionName,charLogicalVolumeName); G4String regionName = charRegionName; G4String logicalVolumeName = charLogicalVolumeName; G4Region* myRegion = G4RegionStore::GetInstance()->GetRegion(regionName,false); if( myRegion == NULL ) { // First time - instantiate a region and a cut objects myRegion = new G4Region(regionName); G4cout<<"musrDetectorConstruction: G4Region "<SetProductionCuts(cuts); } else {G4cout<<"musrDetectorConstruction: G4Region "<GetProductionCuts(); // } G4LogicalVolume* logicalVolume = FindLogicalVolume(logicalVolumeName); if (logicalVolume != NULL) { myRegion->AddRootLogicalVolume(logicalVolume); G4cout<<" and volume "<musrError(SERIOUS,eMessage,false); } } else if (strcmp(tmpString2,"setProductionCut")==0) { char charRegionName[100]; double fGammaCut=0, fElectronCut=0, fPositronCut=0; sscanf(&line[0],"%*s %*s %*s %s %lf %lf %lf",charRegionName,&fGammaCut,&fElectronCut,&fPositronCut); G4String regionName = charRegionName; G4Region* myRegion = G4RegionStore::GetInstance()->GetRegion(regionName,false); if( myRegion == NULL ) { // G4Region does not exist G4cout<<"musrDetectorConstruction: setProductionCut required for the G4Region "<SetProductionCuts(cuts); } else { // G4Region exists, so set the cuts: G4ProductionCuts* cuts = myRegion->GetProductionCuts(); if (cuts==NULL) {G4cout<<"musrDetectorConstruction: DEBUG - ERROR !!!! cuts for G4Region not defined!!!!"<SetProductionCut(fGammaCut,"gamma"); if (fElectronCut!=0) cuts->SetProductionCut(fElectronCut,"e-"); if (fPositronCut!=0) cuts->SetProductionCut(fPositronCut,"e+"); } } } else { G4cout << "ERROR! musrDetectorConstruction::Construct(): Unknown command requested for the \"region\" keyword."< SetCalculationOfFieldIntegralRequested(true); } } } else if ((strcmp(tmpString1,"process")==0)||(strcmp(tmpString1,"G4OpticalPhotons")==0)||(strcmp(tmpString1,"G4OpticalPhotonsUnprocess")==0) ||(strcmp(tmpString1,"materialPropertiesTable")==0)||(strcmp(tmpString1,"setMaterialPropertiesTable")==0)) { ; // processes are interpreded later in musrPhysicsList.cc } else if (strcmp(tmpString1,"SetLandauMPV")==0){ sscanf(&line[0],"%*s %*s %lf",&musrMuEnergyLossLandau::landauMPV); cout << "landauMPV = " << musrMuEnergyLossLandau::landauMPV << endl; } else if (strcmp(tmpString1,"SetLandauSigma")==0){ sscanf(&line[0],"%*s %*s %lf",&musrMuEnergyLossLandau::landauSigma); cout << "landauSigma = " << musrMuEnergyLossLandau::landauSigma << endl; } else ReportGeometryProblem(line); } } fclose(fSteeringFile); // G4cout<< "musrDetectorConstruction.cc: pointerToWorldVolume="<FindOrBuildElement("H"); G4Element* C = man->FindOrBuildElement("C"); G4Element* N = man->FindOrBuildElement("N"); G4Element* O = man->FindOrBuildElement("O"); // Elements required for Brass G4Element* Cu = man->FindOrBuildElement("Cu"); G4Element* Zn = man->FindOrBuildElement("Zn"); // elements required for Stainless Steel G4Element* Cr = man->FindOrBuildElement("Cr"); G4Element* Fe = man->FindOrBuildElement("Fe"); G4Element* Ni = man->FindOrBuildElement("Ni"); // Elements required for MCPglass G4Element* Pb = man->FindOrBuildElement("Pb"); G4Element* Si = man->FindOrBuildElement("Si"); G4Element* K = man->FindOrBuildElement("K" ); G4Element* Rb = man->FindOrBuildElement("Rb"); G4Element* Ba = man->FindOrBuildElement("Ba"); G4Element* As = man->FindOrBuildElement("As"); G4Element* Cs = man->FindOrBuildElement("Cs"); G4Element* Na = man->FindOrBuildElement("Na"); // Elements required for Macor G4Element* B = man->FindOrBuildElement("B" ); G4Element* Al = man->FindOrBuildElement("Al"); G4Element* Mg = man->FindOrBuildElement("Mg"); // compounds required for MCP Macor G4Material* MgO = new G4Material("MgO", 3.60*CLHEP::g/CLHEP::cm3, ncomponents=2); MgO->AddElement(Mg, natoms=1); MgO->AddElement(O, natoms=1); G4Material* SiO2 = new G4Material("SiO2", 2.533*CLHEP::g/CLHEP::cm3, ncomponents=2); // quartz SiO2->AddElement(O, natoms=2); SiO2->AddElement(Si, natoms=1); G4Material* Al2O3 = new G4Material("Al2O3", 3.985*CLHEP::g/CLHEP::cm3, ncomponents=2); // saphire Al2O3->AddElement (Al, natoms=2); Al2O3->AddElement (O, natoms=3); G4Material* K2O = new G4Material("K2O", 2.350*CLHEP::g/CLHEP::cm3, ncomponents=2); K2O->AddElement(O, natoms=1); K2O->AddElement(K, natoms=2); G4Material* B2O3 = new G4Material("B2O3", 2.550*CLHEP::g/CLHEP::cm3, ncomponents=2); B2O3->AddElement (B, natoms=2); B2O3->AddElement (O, natoms=3); G4Material* Sci = new G4Material("Scintillator", density= 1.032*CLHEP::g/CLHEP::cm3, ncomponents=2); Sci->AddElement(C, natoms=9); Sci->AddElement(H, natoms=10); G4Material* Myl = new G4Material("Mylar", density= 1.397*CLHEP::g/CLHEP::cm3, ncomponents=3); Myl->AddElement(C, natoms=10); Myl->AddElement(H, natoms= 8); Myl->AddElement(O, natoms= 4); // Brass G4Material* brass = new G4Material("Brass", density= 8.40*CLHEP::g/CLHEP::cm3, ncomponents=2); brass -> AddElement(Zn, fractionmass = 30*CLHEP::perCent); brass -> AddElement(Cu, fractionmass = 70*CLHEP::perCent); // Stainless steel G4Material* steel = new G4Material("Steel", density= 7.93*CLHEP::g/CLHEP::cm3, ncomponents=3); steel->AddElement(Ni, fractionmass=0.11); steel->AddElement(Cr, fractionmass=0.18); steel->AddElement(Fe, fractionmass=0.71); G4Material* macor= // Macor (used in the MCP detector) new G4Material("Macor", density=2.52*CLHEP::g/CLHEP::cm3, ncomponents=5); macor->AddMaterial(SiO2, fractionmass=0.470); // quartz macor->AddMaterial(MgO, fractionmass=0.180); macor->AddMaterial(Al2O3,fractionmass=0.170); // saphire macor->AddMaterial(K2O, fractionmass=0.105); macor->AddMaterial(B2O3, fractionmass=0.075); G4Material* mcpglass = // Glass of the Multi Channel Plate new G4Material("MCPglass", density=2.0*CLHEP::g/CLHEP::cm3, ncomponents=9); mcpglass->AddElement(Pb, fractionmass= 0.480); mcpglass->AddElement(O, fractionmass= 0.258); mcpglass->AddElement(Si, fractionmass= 0.182); mcpglass->AddElement(K, fractionmass= 0.042); mcpglass->AddElement(Rb, fractionmass= 0.018); mcpglass->AddElement(Ba, fractionmass= 0.013); mcpglass->AddElement(As, fractionmass= 0.004); mcpglass->AddElement(Cs, fractionmass= 0.002); mcpglass->AddElement(Na, fractionmass= 0.001); // // define a material from elements. case 2: mixture by fractional mass // G4Material* Air = new G4Material("Air" , density= 1.290*CLHEP::mg/CLHEP::cm3, ncomponents=2); Air->AddElement(N, fractionmass=0.7); Air->AddElement(O, fractionmass=0.3); G4Material* Air1mbar = new G4Material("Air1mbar" , density= 1.290e-3*CLHEP::mg/CLHEP::cm3, ncomponents=2); Air1mbar->AddElement(N, fractionmass=0.7); Air1mbar->AddElement(O, fractionmass=0.3); G4Material* AirE1mbar = new G4Material("AirE1mbar" , density= 1.290e-4*CLHEP::mg/CLHEP::cm3, ncomponents=2); AirE1mbar->AddElement(N, fractionmass=0.7); AirE1mbar->AddElement(O, fractionmass=0.3); G4Material* AirE2mbar = new G4Material("AirE2mbar" , density= 1.290e-5*CLHEP::mg/CLHEP::cm3, ncomponents=2); AirE2mbar->AddElement(N, fractionmass=0.7); AirE2mbar->AddElement(O, fractionmass=0.3); G4Material* AirE3mbar = new G4Material("AirE3mbar" , density= 1.290e-6*CLHEP::mg/CLHEP::cm3, ncomponents=2); AirE3mbar->AddElement(N, fractionmass=0.7); AirE3mbar->AddElement(O, fractionmass=0.3); G4Material* AirE4mbar = new G4Material("AirE4mbar" , density= 1.290e-7*CLHEP::mg/CLHEP::cm3, ncomponents=2); AirE4mbar->AddElement(N, fractionmass=0.7); AirE4mbar->AddElement(O, fractionmass=0.3); G4Material* AirE5mbar = new G4Material("AirE5mbar" , density= 1.290e-8*CLHEP::mg/CLHEP::cm3, ncomponents=2); AirE5mbar->AddElement(N, fractionmass=0.7); AirE5mbar->AddElement(O, fractionmass=0.3); G4Material* AirE6mbar = new G4Material("AirE6mbar" , density= 1.290e-9*CLHEP::mg/CLHEP::cm3, ncomponents=2); AirE6mbar->AddElement(N, fractionmass=0.7); AirE6mbar->AddElement(O, fractionmass=0.3); // // examples of vacuum // // G4Material* Vacuum = new G4Material("Vacuum", z=1., a=1.01*CLHEP::g/CLHEP::mole,density= CLHEP::universe_mean_density, kStateGas, 2.73*CLHEP::kelvin, 3.e-18*CLHEP::pascal); new G4Material("ArgonGas", z= 18., a= 39.95*CLHEP::g/CLHEP::mole, density= 0.00000000001*CLHEP::mg/CLHEP::cm3); new G4Material("HeliumGas5mbar", z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.00000088132*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas6mbar", z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.000001057584*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas7mbar", z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.000001233848*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas8mbar", z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.000001410112*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas9mbar", z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.000001586376*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas10mbar",z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.00000176264*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas11mbar",z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.000001938904*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas12mbar",z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.000002115168*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas13mbar",z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.000002291432*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas14mbar",z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.000002467696*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas15mbar",z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.00000264396*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas20mbar",z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.00000352528*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas30mbar",z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.00000528792*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas40mbar",z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.00000705056*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas50mbar",z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.00000881320*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas60mbar",z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.00001057584*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas70mbar",z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.00001233848*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas80mbar",z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.00001410112*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas90mbar",z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.00001586376*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGas100mbar",z=2.,a=4.002602*CLHEP::g/CLHEP::mole, density= 0.00001762640*CLHEP::g/CLHEP::cm3); new G4Material("HeliumGasSat4K",z=2., a=4.002602*CLHEP::g/CLHEP::mole, density= 0.016891*CLHEP::g/CLHEP::cm3); // saturated vapour above liquid at 4.2K (JSL) new G4Material("HeliumGas5mbar4K",z=2.,a=4.002602*CLHEP::g/CLHEP::mole, density= 0.016891*5.0/1013.0*CLHEP::g/CLHEP::cm3); // typical cold exchange gas, 4.2K and 5 mbar new G4Material("HeliumGas2mbar4K",z=2.,a=4.002602*CLHEP::g/CLHEP::mole, density= 0.016891*2.0/1013.0*CLHEP::g/CLHEP::cm3); // typical cold exchange gas, 4.2K and 5 mbar 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(materialPropertiesTableName,MPT_tmp) ); } else { MPT_tmp = itMPT->second; } char propertyName[100]; int nEntries; sscanf(&line[0],"%*s %*s %*s %s %d",propertyName,&nEntries); // G4cout<<" Optical Material Def: MPT_tmp="<AddConstProperty(propertyName,value); if ( (strcmp(propertyName,"FASTSCINTILLATIONRISETIME")==0) || (strcmp(propertyName,"SLOWSCINTILLATIONRISETIME")==0) ) { if (value!=0) { musrParameters::finiteRiseTimeInScintillator = true; } } } else { // AddProperty char* pch = strstr(line,propertyName)+strlen(propertyName); double 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; iAddProperty(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 \""< S T O P F O R C E D"<second; } myMaterial->SetMaterialPropertiesTable(MPT_tmp); // G4cout<GetMaterialPropertiesTable()->DumpTable(); } } } } fclose(fSteeringFile); // G4cout<<" 1eV = "<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(); // } } } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "G4RunManager.hh" void musrDetectorConstruction::UpdateGeometry() { G4RunManager::GetRunManager()->DefineWorldVolume(Construct()); } void musrDetectorConstruction::ReportGeometryProblem(char myString[501]) { G4cout<<"\nE R R O R in musrDetectorConstruction.cc: " <<"Unknown keyword requested in \""<< parameterFileName <<"\" :"<FindOrBuildMaterial(materialName); if (Material==NULL) { G4cout<<"\nE R R O R in musrDetectorConstruction.cc::CharToMaterial " <<"Unknown material requested:"<entries(); i++) { for (unsigned int i=0; isize(); i++) { G4LogicalVolume* pLogVol=pLogStore->at(i); G4String iLogName=pLogVol->GetName(); if (iLogName==LogicalVolumeName) { return pLogVol; } } } return NULL; } G4VPhysicalVolume* musrDetectorConstruction::FindPhysicalVolume(G4String PhysicalVolumeName) { G4PhysicalVolumeStore* pPhysStore = G4PhysicalVolumeStore::GetInstance(); if (pPhysStore==NULL) { G4cout<<"ERROR: musrDetectorConstruction.cc: G4PhysicalVolumeStore::GetInstance() not found!"<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 " <SetVisAttributes(G4Colour(1,0,0));} else if (strcmp(colour,"green" )==0) {pLogVol->SetVisAttributes(G4Colour(0,1,0));} else if (strcmp(colour,"blue" )==0) {pLogVol->SetVisAttributes(G4Colour(0,0,1));} else if (strcmp(colour,"lightblue")==0) {pLogVol->SetVisAttributes(G4Colour(0,1,1));} else if (strcmp(colour,"white" )==0) {pLogVol->SetVisAttributes(G4Colour(1,1,1));} else if (strcmp(colour,"yellow" )==0) {pLogVol->SetVisAttributes(G4Colour(1,1,0));} else if (strcmp(colour,"black" )==0) {pLogVol->SetVisAttributes(G4Colour(0,0,0));} else if (strcmp(colour,"gray" )==0) {pLogVol->SetVisAttributes(G4Colour(0.5,0.5,0.5));} else if (strcmp(colour,"cyan" )==0) {pLogVol->SetVisAttributes(G4Colour(0,1,1));} else if (strcmp(colour,"magenta")==0) {pLogVol->SetVisAttributes(G4Colour(1,0,1));} else if (strcmp(colour,"invisible" )==0) {pLogVol->SetVisAttributes(G4VisAttributes::Invisible);} else if (strcmp(colour,"blue_style")==0) {pLogVol->SetVisAttributes(G4Colour(0.80,0.83,1));} // else if (strcmp(colour,"lightblue")==0) {pLogVol->SetVisAttributes(G4Colour(0,0.5,1));} else if (strcmp(colour,"darkblue")==0) {pLogVol->SetVisAttributes(G4Colour(0,0.25,0.5));} else if (strcmp(colour,"fblue_style")==0) {pLogVol->SetVisAttributes(G4Colour(0.85,.88,0.92));} else if (strcmp(colour,"oxsteel")==0) {pLogVol->SetVisAttributes(G4Colour(0.9,0.8,0.75));} else if (strcmp(colour,"darkred")==0) {pLogVol->SetVisAttributes(G4Colour(0.5,0,0));} else if (strcmp(colour,"MCP_style")==0) {pLogVol->SetVisAttributes(G4Colour(0.5,0.2,.7));} else if (strcmp(colour,"MACOR_style")==0) {pLogVol->SetVisAttributes(G4Colour(0.9,0.9,.1));} else if (strcmp(colour,"SCINT_style")==0) {pLogVol->SetVisAttributes(G4Colour(0.5,0.5,.75));} else if (strcmp(colour,"dSCINT_style")==0) {pLogVol->SetVisAttributes(G4Colour(0.3,0.3,0.3));} else if (strcmp(colour,"VTBB_style")==0) {pLogVol->SetVisAttributes(G4Colour(0.9,0.9,.9));} else if (strcmp(colour,"Grid_style")==0) {pLogVol->SetVisAttributes(G4Colour(0.87,0.72,0.53));} //burlywood else if (strcmp(colour,"RA_style")==0) {pLogVol->SetVisAttributes(G4Colour(0.8549,0.6471,0.1255));} //goldenrod else { G4cout<<"ERROR: musrDetectorConstruction::SetColourOfLogicalVolume: unknown colour requested: "<