#include "PixelMessenger.hh" #include "Pixel.hh" PixelMessenger::PixelMessenger(Pixel* p) :pixel(p) { pixelDir = new G4UIdirectory("/Pixel/"); pixelDir->SetGuidance("Commands to modify the Pixel charge spreading for the Range Telescope"); sensorLengthCmd = new G4UIcmdWithADoubleAndUnit("/Pixel/SetSensorLength", this); sensorLengthCmd->SetGuidance("Set the length of the XY sides of the CMOS sensor"); sensorLengthCmd->SetParameterName("length", false); sensorLengthCmd->SetUnitCategory("Length"); sensorLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle); pixelPitchCmd = new G4UIcmdWithADoubleAndUnit("/Pixel/SetPixelPitch", this); pixelPitchCmd->SetGuidance("Set the pitch of the pixels of the CMOS sensor"); pixelPitchCmd->SetParameterName("pitch", false); pixelPitchCmd->SetUnitCategory("Length"); pixelPitchCmd->AvailableForStates(G4State_PreInit,G4State_Idle); thresholdCmd = new G4UIcmdWithADouble("/Pixel/SetThreshold", this); thresholdCmd->SetGuidance("Set the threshold of the pixels of the CMOS sensor"); thresholdCmd->SetParameterName("pitch", false); thresholdCmd->AvailableForStates(G4State_PreInit,G4State_Idle); } PixelMessenger::~PixelMessenger() { delete pixelDir; delete sensorLengthCmd; delete pixelPitchCmd; delete thresholdCmd; } void PixelMessenger::SetNewValue(G4UIcommand* command, G4String newValue) { if(command == pixelPitchCmd) pixel->SetPixelPitch(pixelPitchCmd->GetNewDoubleValue(newValue)); if(command == sensorLengthCmd) pixel->SetSensorLength(sensorLengthCmd->GetNewDoubleValue(newValue)); if(command == thresholdCmd) pixel->SetThreshold(thresholdCmd->GetNewDoubleValue(newValue)); }