// RAT includes #include #include #include // Geant4 includes #include #include #include #include #include namespace RAT { SolarMessenger::SolarMessenger(SolarGen *sg) : fSolarGen(sg),fNuDirection(0),fTimeGen(0),fPosGen(0) { fDir = new G4UIdirectory("/generator/solar/"); fDir->SetGuidance("Control the parameters of the solar neutrino generator."); fNuDirection = new G4UIcmdWith3Vector("/generator/solar/direction",this); fNuDirection->SetGuidance("Allows the direction of the ES events to be fixed."); fNuDirection->SetParameterName("x dir","y dir", "zdir",false); fNuDirection->SetDefaultValue(sg->GetNuDirection()); fTimeGen = new G4UIcmdWithAString("/generator/solar/timegen",this); fTimeGen->SetGuidance("Costumizes the time generator to use."); fTimeGen->SetGuidance("Default : poisson."); fTimeGen->SetParameterName("setting","s",true); fTimeGen->SetDefaultValue(sg->GetTimeGenerator()); fPosGen = new G4UIcmdWithAString("/generator/solar/posgen",this); fPosGen->SetGuidance("Costumizes the position generator to use."); fPosGen->SetGuidance("Default : fill."); fPosGen->SetParameterName("setting","s",true); fPosGen->SetDefaultValue(sg->GetPosGenerator()); fFluxScale = new G4UIcmdWithADouble("/generator/solar/fluxscale",this); fFluxScale->SetGuidance("Re-scales the neutrino flux (units of SSM)"); fFluxScale->SetGuidance("Default : 1.0 (SSM flux)."); fFluxScale->SetParameterName("setting","d",true); fFluxScale->SetDefaultValue(sg->GetFluxScale()); fPosState = new G4UIcmdWithAString("/generator/solar/set_position_state",this); fPosState->SetGuidance("State string to be passed to the SetState method of the position generator."); fPosState->SetGuidance("Default: 0.0 0.0 0.0 (center of the detector)"); fPosState->SetParameterName("state","s",true); fPosState->SetDefaultValue(sg->GetPosState()); } SolarMessenger::~SolarMessenger() { // Obsessively clean all memory // delete initialized commands if (fNuDirection) delete fNuDirection; if (fTimeGen) delete fTimeGen; if (fPosGen) delete fPosGen; if (fFluxScale) delete fFluxScale; delete fPosState; // If we don't have the messenger, we also don't need the directory if (fDir) delete fDir; } void SolarMessenger::SetNewValue(G4UIcommand* command, G4String newValue) { if ( command == fNuDirection ) { fSolarGen->SetNuDirection(fNuDirection->GetNew3VectorValue(newValue)); } else if (command == fTimeGen) { fSolarGen->SetTimeGenerator(newValue); } else if (command == fPosGen) { fSolarGen->SetPosGenerator(newValue); } else if (command == fFluxScale) { fSolarGen->SetFluxScale(fFluxScale->GetNewDoubleValue(newValue)); } else if (command == fPosState ) { fSolarGen->SetPosState(newValue); } else { warn << "SolarMessenger::SetNewValue : ERROR > Invalid SolarMessenger \"set\" command " << command->GetCommandName() << newline; } } G4String SolarMessenger::GetCurrentValue(G4UIcommand* command) { if ( command == fNuDirection ) { fNuDirection->SetDefaultValue(fSolarGen->GetNuDirection( )); return fNuDirection->GetCurrentValue(); } else if (command == fTimeGen) { return fSolarGen->GetTimeGenerator(); } else if (command == fPosGen) { return fSolarGen->GetPosGenerator(); } else if (command == fFluxScale) { fFluxScale->SetDefaultValue(fSolarGen->GetFluxScale()); return fFluxScale->GetCurrentValue(); } else if (command == fPosState ) { return fSolarGen->GetPosState(); } else { warn << "SolarMessenger::SetNewValue : ERROR > Invalid SolarMessenger \"get\" command " << command->GetCommandName() << newline; return G4String("Command not found."); } } } // -- namespace RAT