MollerDetectorMessenger.cc

Go to the documentation of this file.
00001 // ****************************************************
00002 // *                                                  *
00003 // * MollerDetectorMessenger to change values of      *
00004 // * collimator positions/sizes.  Temporary solution; *
00005 // * I intend to have a general geometry readin if we *
00006 // * don't move to GEMC soon.                         *
00007 // *                                                  *
00008 // * Added 3-21-2011 by Juliette Mammei               *
00009 // *                                                  *
00010 // ****************************************************
00011 
00012 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00013 
00014 #include "MollerDetectorMessenger.hh"
00015 
00016 #include "MollerDetectorConstruction.hh"
00017 #include "G4UIdirectory.hh"
00018 #include "G4UIcmdWithAString.hh"
00019 #include "G4UIcmdWithAnInteger.hh"
00020 #include "G4UIcmdWithADoubleAndUnit.hh"
00021 #include "G4UIcmdWithABool.hh"
00022 //#include "globals.hh"
00023 
00024 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00025 
00026 MollerDetectorMessenger::MollerDetectorMessenger(MollerDetectorConstruction* myDet)
00027 :myDetector(myDet)
00028 {
00029   detDir = new G4UIdirectory("/moller/det/");
00030   detDir->SetGuidance("detector control.");
00031 
00032   TargLengthCmd = new G4UIcmdWithADoubleAndUnit("/moller/det/setTargetLength",this);
00033   TargLengthCmd->SetGuidance("Set the Target Length.");
00034   TargLengthCmd->SetParameterName("fTargetLength",true, true);
00035   TargLengthCmd->SetDefaultValue(150.);
00036   TargLengthCmd->SetUnitCategory("Length");
00037   TargLengthCmd->SetDefaultUnit("cm");
00038   TargLengthCmd->AvailableForStates(G4State_PreInit);
00039 
00040   NumCollCmd = new G4UIcmdWithAnInteger("/moller/det/setNumberofCollimators",this);
00041   NumCollCmd->SetGuidance("Set the number of collimators.");
00042   NumCollCmd->SetParameterName("NUM_COLLS",true);
00043   NumCollCmd->SetDefaultValue(10);
00044   NumCollCmd->AvailableForStates(G4State_PreInit);
00045 
00046   CollimGeomFileCmd = new G4UIcmdWithAString("/moller/det/setCollimatorFileName",this);
00047   CollimGeomFileCmd->SetGuidance("Set the Collimator geometry file name.");
00048   CollimGeomFileCmd->SetParameterName("collimfileName",true);
00049   CollimGeomFileCmd->SetDefaultValue("coll_default");
00050   CollimGeomFileCmd->AvailableForStates(G4State_PreInit);
00051 
00052   DetGeomFileCmd = new G4UIcmdWithAString("/moller/det/setDetectorFileName",this);
00053   DetGeomFileCmd->SetGuidance("Set the Detector geometry file name.");
00054   DetGeomFileCmd->SetParameterName("detfileName",true);
00055   DetGeomFileCmd->SetDefaultValue("geometry/detector_fastradModel/detector.gdml");
00056   DetGeomFileCmd->AvailableForStates(G4State_PreInit);
00057 
00058   ReadGeomFileCmd = new G4UIcmdWithABool("/moller/det/readGeometryFromFile",this);
00059   ReadGeomFileCmd->SetGuidance("Set to false to use hard-coded geometry.");
00060   ReadGeomFileCmd->SetParameterName("fReadGeoFile",true);
00061   ReadGeomFileCmd->SetDefaultValue(false);
00062   ReadGeomFileCmd->AvailableForStates(G4State_PreInit);
00063 
00064   WriteGeomFileCmd = new G4UIcmdWithAString("/moller/det/writeGeometry",this);
00065   WriteGeomFileCmd->SetGuidance("Write the geometry to GDML file.");
00066   WriteGeomFileCmd->SetParameterName("writeFileName",true);
00067   WriteGeomFileCmd->SetDefaultValue("moller.gdml");
00068   WriteGeomFileCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00069 }
00070 
00071 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00072 
00073 MollerDetectorMessenger::~MollerDetectorMessenger()
00074 {
00075   delete TargLengthCmd;
00076   delete WriteGeomFileCmd;
00077   delete CollimGeomFileCmd;
00078   delete DetGeomFileCmd;
00079   delete ReadGeomFileCmd;
00080   delete NumCollCmd;
00081 
00082   delete detDir;
00083 }
00084 
00085 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00086 
00087 void MollerDetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
00088 {
00089   if (command == TargLengthCmd)
00090     { myDetector->setTargetLength(TargLengthCmd->GetNewDoubleValue(newValue)); }
00091   else if (command == CollimGeomFileCmd)
00092     { myDetector->SetCollimGeomFile(newValue); }
00093   else if (command == DetGeomFileCmd)
00094     { myDetector->SetDetectorGeomFile(newValue); }
00095   else if (command == NumCollCmd)
00096     { myDetector->setNumColl(NumCollCmd->GetNewIntValue(newValue)); }
00097   else if (command == ReadGeomFileCmd)
00098     { myDetector->SetReadGeo(ReadGeomFileCmd->GetNewBoolValue(newValue));}
00099   else if (command == WriteGeomFileCmd)
00100     { myDetector->WriteGeometryFile(newValue); }
00101 }
00102 
00103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

Generated on 16 Jun 2013 for mollersim by  doxygen 1.6.1