#include <ScanFrame.h>
Inheritance diagram for ScanFrame:

Public Member Functions | |
| ScanFrame (const TGWindow *p=0, Bool_t buildScanFrame=true) | |
| virtual | ~ScanFrame () |
| void | EntryProc () |
| virtual void | ResetDisplay (std::string mode="") |
| void | SetRun (Int_t s) |
| void | SetSnarl (Int_t s) |
| void | SetSlice (Int_t s) |
| void | SetEvent (Int_t s) |
| virtual void | Pass (const std::string) |
| virtual void | PassChar (const std::string, char) |
| virtual void | PassInt (const std::string, Long_t) |
| virtual void | PassFloat (const std::string, Double_t) |
| virtual void | PassString (const std::string, const std::string) |
| virtual void | BuildScanSheet () |
| virtual void | InitScanSheet () |
| virtual void | ResyncData () |
| virtual void | WriteScanSheet (ofstream &) |
Static Public Member Functions | |
| void | EnableXMLFormat (Bool_t enable=true) |
| ScanFrame * | CreateScanSheet (const TGWindow *p, const char *name=0) |
Protected Member Functions | |
| void | BuildScanFrame (const TGWindow *p) |
| void | Init () |
| ClassDef (ScanFrame, 1) | |
Protected Attributes | |
| TGMainFrame * | fMain |
| TGVerticalFrame * | fSframe |
| Transient, do not output. | |
| TGTextEntry * | Comment |
| Transient, do not output. | |
| TGTextEntry * | Scanner |
| Transient, do not output. | |
| TGLabel * | runLabel |
| Transient, do not output. | |
| TGLabel * | snarlLabel |
| Transient, do not output. | |
| TGLabel * | sliceLabel |
| Transient, do not output. | |
| TGLabel * | eventLabel |
| Transient, do not output. | |
| Bool_t | fEnableXMLFormat |
| Transient, do not output. | |
| std::string | fComment |
| Transient, do not output. | |
| std::string | fScanner |
| std::string | fScanName |
| std::string | fScanFormat |
| Long_t | fSnarl |
| Long_t | fRun |
| Long_t | fSlice |
| Long_t | fEvent |
Static Protected Attributes | |
| Bool_t | fgEnableXMLFormat |
ScanFrame is the base class for Mad-based scan forms. It has been developed from Jim Musser's ScanFrame which has been renamed to ScanFrameCC and sub-classed from ScanFrame.
Two interfaces are described here:-
1) The front-end (client i.e. MadScanDisplay) interface. 2) The back-end (implementation e.g. ScanFrameCC) interface.
The front-end (client) interface ********************************
Clients create a ScanFrame or sub-class object using the static factory method:-
ScanFrame* ScanFrame::CreateScanSheet(const TGWindow *p, const char* name = 0 )
This supports multiple scan sheets (see the CreateScanSheet method for the full list) including a very primitive ScanFrame (name="Base") that only records scanner name and comments.
The run, snarl, slice and event state are set using the methods:-
void SetRun(Int_t s) void SetSnarl(Int_t s) void SetSlice(Int_t s) void SetEvent(Int_t s)
The scan is written out using the method:-
void EntryProc();
by default the file format is ASCII where each event consists of a single, space separated, set of values. XML format is also supported and can be enabled by calling the static method:-
void ScanFrame::EnableXMLFormat(Bool_t enable = true)
before creating the sheet.
The scan file name has the format:-
<scan-name>-scan-<scanner-name>.<ext>
where <ext> = "txt" ASCII file "xml" XML file
The scan state refills all widgets from the object state using the method:-
void ResetDisplay(std::string mode = "");
The mode argument allows clients to support qualified resets (see ScanFrameCC).
All additional information is passed to the sub-class object via the generic interface:-
virtual void Pass(const std::string attribute); virtual void PassInt(const std::string attribute,Long_t value); virtual void PassFloat(const std::string attribute,Double_t value); virtual void PassString(const std::string attribute,const std::string value);
The methods are called "PassXxx" rather than "SetXxx" as the sub-class object is free to accept or ignore such data. The model is that the client collects all the information that any type of scan requires and passes it all. Thus the client does not need to know what type of scan is being performed.
The back-end (implementation) interface ***************************************
A client has to reimplemented:-
o Any PassXxx method if it has to collect data of Xxx type.
o virtual void ResetDisplay(std::string mode = "");
This method refills all widgets from the object state. The method should call ScanFrame::ResetDisplay to reset it unless doing a qualified reset that does not require it.
o virtual void BuildScanSheet();
This method fills out the scan specific part of the scan sheet ScanFrame::BuildScanFrame() performs the overall build of the graphical interface and calls this method to embed the scan sheet.
o virtual void InitScanSheet();
This method resets to default the object (non-widget) state. ScanFrame::Init() calls this method. It should set the scan name e.g.:-
fScanName = "CC";
o virtual void ResyncData();
Implementation is optional but allows "lazy synchronisation" whereby updates via graphics to the widgets are not immediately propagated to the non-widget state. Instead all widget state is propagated in this method which is called as a precursor to I/O, thus ensuring that the full state is recorded. This means that it is not necessary to connect slots to each widget and write a function for each to receive the update signal.
o virtual void WriteScanSheet(ofstream& out);
This method writes out the scan specific part of the scan sheet ScanFrame::EntryProc() performs the overall output and calls this method
Definition at line 131 of file ScanFrame.h.
|
||||||||||||
|
Definition at line 46 of file ScanFrame.cxx. References BuildScanFrame(), and Init(). Referenced by CreateScanSheet(). 00047 : 00048 fEnableXMLFormat(fgEnableXMLFormat) // Capture current setting of global XML flag. 00049 { 00050 00051 // Note: The case p == is NOT supported but CINT appears to require that 00052 // base classes have default constructors. 00053 00054 if ( ! p ) { 00055 std::cout << "ScanFrame called with TGWindow *p == 0. This is not supported!" << std::endl; 00056 exit(1); 00057 } 00058 00059 this->Init(); 00060 if ( buildScanFrame ) this->BuildScanFrame(p); 00061 }
|
|
|
Definition at line 63 of file ScanFrame.cxx. 00063 {
00064 }
|
|
|
Definition at line 66 of file ScanFrame.cxx. References BuildScanSheet(), Comment, eventLabel, fEvent, fMain, fRun, fSframe, fSlice, fSnarl, runLabel, Scanner, sliceLabel, and snarlLabel. Referenced by ScanFrame(). 00066 {
00067
00068 // Initialise all the widigits and display the scan frame.
00069
00070 fMain = new TGMainFrame(p,600,600);
00071 fSframe = new TGVerticalFrame(fMain,600,600);
00072 fMain->AddFrame(fSframe,new TGLayoutHints(kLHintsCenterX,2,2,2,2));
00073
00074 // Draw the run, snarl, slice, event and scanner box
00075
00076 TGHorizontal3DLine* Line1 = new TGHorizontal3DLine(fSframe,400,2);
00077 fSframe->AddFrame(Line1, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
00078
00079 TGHorizontalFrame * tframe1 = new TGHorizontalFrame(fSframe,400,10);
00080
00081 TGLabel* Label1 = new TGLabel(tframe1," Run: ");
00082 TGLabel* Label2 = new TGLabel(tframe1," Snarl: ");
00083 TGLabel* Label3 = new TGLabel(tframe1," Slice: ");
00084 TGLabel* Label4 = new TGLabel(tframe1," Event: ");
00085
00086 runLabel = new TGLabel(tframe1);
00087 snarlLabel = new TGLabel(tframe1);
00088 eventLabel = new TGLabel(tframe1);
00089 sliceLabel = new TGLabel(tframe1);
00090
00091 runLabel->SetText(fRun);
00092 snarlLabel->SetText(fSnarl);
00093 eventLabel->SetText(fEvent);
00094 sliceLabel->SetText(fSlice);
00095
00096 tframe1->AddFrame(Label1,new TGLayoutHints(kLHintsLeft|kLHintsExpandY,2,2,2,2));
00097 tframe1->AddFrame(runLabel,new TGLayoutHints(kLHintsLeft|kLHintsExpandY,2,2,2,2));
00098 tframe1->AddFrame(Label2,new TGLayoutHints(kLHintsLeft|kLHintsExpandY,2,2,2,2));
00099 tframe1->AddFrame(snarlLabel,new TGLayoutHints(kLHintsLeft|kLHintsExpandY,2,2,2,2));
00100 tframe1->AddFrame(Label3,new TGLayoutHints(kLHintsLeft|kLHintsExpandY,2,2,2,2));
00101 tframe1->AddFrame(sliceLabel,new TGLayoutHints(kLHintsLeft|kLHintsExpandY,2,2,2,2));
00102 tframe1->AddFrame(Label4,new TGLayoutHints(kLHintsLeft|kLHintsExpandY,2,2,2,2));
00103 tframe1->AddFrame(eventLabel,new TGLayoutHints(kLHintsLeft|kLHintsExpandY,2,2,2,2));
00104
00105 fSframe->AddFrame(tframe1,new TGLayoutHints(kLHintsCenterX ,2,2,2,2));
00106
00107 TGHorizontalFrame * tframe2 = new TGHorizontalFrame(fSframe,400,10);
00108
00109 TGLabel* Label5 = new TGLabel(tframe2," Scanner: ");
00110 tframe2->AddFrame(Label5,new TGLayoutHints(kLHintsLeft|kLHintsExpandY,2,2,2,2));
00111 Scanner = new TGTextEntry(tframe2);
00112 Scanner->SetText("Unknown");
00113 tframe2->AddFrame(Scanner,new TGLayoutHints(kLHintsLeft|kLHintsExpandY,2,2,2,2));
00114
00115 fSframe->AddFrame(tframe2,new TGLayoutHints(kLHintsCenterX ,2,2,2,2));
00116
00117 TGHorizontal3DLine* Line3 = new TGHorizontal3DLine(fSframe,400,2);
00118 fSframe->AddFrame(Line3, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
00119
00120 // Fill out the scan-specific data.
00121
00122 this->BuildScanSheet();
00123
00124 // Output the comment section.
00125
00126 TGHorizontal3DLine* Line5 = new TGHorizontal3DLine(fSframe,400,2);
00127 fSframe->AddFrame(Line5, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
00128
00129 TGHorizontalFrame* tframe = new TGHorizontalFrame(fSframe,400,10);
00130 fSframe->AddFrame(tframe ,new TGLayoutHints(kLHintsLeft|kLHintsExpandX,2,2,2,2));
00131
00132 TGLabel* Label = new TGLabel(tframe,"Comment");
00133 tframe->AddFrame(Label,new TGLayoutHints(kLHintsLeft,2,2,2,2));
00134 Comment = new TGTextEntry(tframe);
00135 Comment->SetText(" ");
00136 tframe->AddFrame(Comment,new TGLayoutHints(kLHintsExpandX,2,2,2,2));
00137
00138 TGHorizontal3DLine* Line6 = new TGHorizontal3DLine(fSframe,400,2);
00139 fSframe->AddFrame(Line6, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
00140
00141 // Complete the canvas and display.
00142
00143 fMain->SetWindowName("Scan Result Entry");
00144 fMain->MapSubwindows();
00145 fMain->Resize(fMain->GetDefaultSize());
00146 fMain->MapWindow();
00147 }
|
|
|
Reimplemented in ScanFrameCC, ScanFrameNC, and ScanFrameTwoTrack. Definition at line 157 of file ScanFrame.h. Referenced by BuildScanFrame(). 00157 {}
|
|
||||||||||||
|
Reimplemented in ScanFrameCC, ScanFrameNC, and ScanFrameTwoTrack. |
|
||||||||||||
|
Definition at line 30 of file ScanFrame.cxx. References MSG, and ScanFrame(). Referenced by MadScanDisplay::MadScanDisplay(). 00031 {
00032 std::string name( nm ? nm : "CC");
00033 MSG("Mad",Msg::kInfo) << "Creating a scan sheet named " << name << std::endl;
00034
00035 if ( name == "Base" ) return new ScanFrame(p);
00036 if ( name == "CC" ) return new ScanFrameCC(p);
00037 if ( name == "NC" ) return new ScanFrameNC(p);
00038 if ( name == "TwoTrack" ) return new ScanFrameTwoTrack(p);
00039
00040 MSG("Mad",Msg::kError) << "Cannot create a scan sheet named " << name
00041 << " creating 'Default' instead." << std::endl;
00042 return new ScanFrameCC(p);
00043
00044 }
|
|
|
Definition at line 22 of file ScanFrame.cxx. References MSG. 00022 {
00023 // fgEnableXMLFormat = enable;
00024 MSG("Mad",Msg::kError) << "Support for XML is currently disabled as ROOT SegVs when reading the output"
00025 << std::endl;
00026 }
|
|
|
Definition at line 149 of file ScanFrame.cxx. References Comment, fComment, fEnableXMLFormat, fEvent, fRun, fScanFormat, fScanName, fScanner, fSlice, fSnarl, gSystem(), Init(), ResetDisplay(), ResyncData(), Scanner, and WriteScanSheet(). Referenced by MadScanDisplay::FindUnSliced(), MadScanDisplay::NextEvt(), MadScanDisplay::NextFidNoTrk(), MadScanDisplay::NextFidTrk(), MadScanDisplay::NextInterestingEvent(), MadScanDisplay::PrevEvt(), and MadScanDisplay::PrevPass(). 00149 {
00150
00151 // Ensure synchronisation between widget and non-widget state.
00152 this->ResyncData();
00153
00154 // Append state to scanner file.
00155
00156 fComment = Comment->GetText();
00157 fScanner = Scanner->GetText();
00158 char fname[256];
00159 const char* ext = fEnableXMLFormat ? "xml" : "txt";
00160 sprintf(fname,"%s-scan-%s.%s",fScanName.c_str(),Scanner->GetText(),ext);
00161
00162 // Sound beep so scanner knows file updated.
00163 gSystem->Beep();
00164
00165 // If XML is enabled, use ROOT I/O.
00166
00167 if ( fEnableXMLFormat ) {
00168 // Save current directory.
00169 TDirectory* cwd = gDirectory;
00170 TFile *f = TFile::Open(fname,"update");
00171 this->Write();
00172 delete f;
00173 // Switch back to old current directory
00174 cwd->cd();
00175 return;
00176 }
00177
00178 // Otherwise append to ASCII file.
00179
00180 ofstream fout(fname,std::ios::app);
00181 fout << fScanFormat << " "
00182 << fScanner << " "
00183 << fSnarl << " "
00184 << fRun << " "
00185 << fSlice << " "
00186 << fEvent << " " ;
00187
00188 // Output the scan-specific data.
00189 this->WriteScanSheet(fout);
00190
00191 // Complete the output
00192
00193 fout << "\"" << " " << fComment << " " << "\" " << std::endl;
00194 std::cout << " ENTRY ADDED TO " << fname << std::endl;
00195
00196 // Reset the form.
00197 Init();
00198 ResetDisplay();
00199
00200 }
|
|
|
Definition at line 202 of file ScanFrame.cxx. References fComment, fEvent, fRun, fScanFormat, fScanName, fScanner, fSlice, fSnarl, and InitScanSheet(). Referenced by EntryProc(), and ScanFrame(). 00202 {
00203
00204 fComment="";
00205 fScanner="";
00206 fScanName="Base";
00207 fScanFormat="Base_v1";
00208 fSnarl=0;
00209 fRun=0;
00210 fSlice=0;
00211 fEvent=0;
00212
00213 // Initialise the scan-specific data.
00214 this->InitScanSheet();
00215
00216 }
|
|
|
Reimplemented in ScanFrameCC, ScanFrameNC, and ScanFrameTwoTrack. Definition at line 158 of file ScanFrame.h. Referenced by Init(). 00158 {}
|
|
|
Reimplemented in ScanFrameCC, and ScanFrameNC. Definition at line 149 of file ScanFrame.h. Referenced by MadScanDisplay::InFidNoTrk(), and MadScanDisplay::InFidTrk(). 00149 {};
|
|
||||||||||||
|
Reimplemented in ScanFrameTwoTrack. Definition at line 150 of file ScanFrame.h. Referenced by MadScanDisplay::DrawTextBox(). 00150 {};
|
|
||||||||||||
|
Reimplemented in ScanFrameCC, ScanFrameNC, and ScanFrameTwoTrack. Definition at line 152 of file ScanFrame.h. Referenced by MadScanDisplay::Display(), MadScanDisplay::DrawTextBox(), MadScanDisplay::ROICalc(), and MadScanDisplay::ShwROICalc(). 00152 {};
|
|
||||||||||||
|
Reimplemented in ScanFrameCC, ScanFrameNC, and ScanFrameTwoTrack. Definition at line 151 of file ScanFrame.h. Referenced by MadScanDisplay::Display(), and MadScanDisplay::DrawTextBox(). 00151 {};
|
|
||||||||||||
|
Definition at line 153 of file ScanFrame.h. 00153 {};
|
|
|
Reimplemented in ScanFrameCC, ScanFrameNC, and ScanFrameTwoTrack. Definition at line 218 of file ScanFrame.cxx. References Comment, eventLabel, fEvent, fRun, fSlice, fSnarl, runLabel, sliceLabel, and snarlLabel. Referenced by MadScanDisplay::Display(), EntryProc(), ScanFrameTwoTrack::ResetDisplay(), ScanFrameNC::ResetDisplay(), and ScanFrameCC::ResetDisplay(). 00218 {
00219
00220 runLabel->SetText(fRun);
00221 snarlLabel->SetText(fSnarl);
00222 eventLabel->SetText(fEvent);
00223 sliceLabel->SetText(fSlice);
00224 Comment->SetText(" ");
00225
00226 }
|
|
|
Reimplemented in ScanFrameTwoTrack. Definition at line 159 of file ScanFrame.h. Referenced by EntryProc(). 00159 {}
|
|
|
Definition at line 145 of file ScanFrame.h. References fEvent. Referenced by MadScanDisplay::Display(), and MadScanDisplay::FindUnSliced(). 00145 {fEvent=s;}
|
|
|
Definition at line 142 of file ScanFrame.h. References fRun. Referenced by MadScanDisplay::Display(). 00142 {fRun=s;}
|
|
|
Definition at line 144 of file ScanFrame.h. References fSlice. Referenced by MadScanDisplay::Display(), and MadScanDisplay::FindUnSliced(). 00144 {fSlice=s;}
|
|
|
Definition at line 143 of file ScanFrame.h. References fSnarl. Referenced by MadScanDisplay::Display(). 00143 {fSnarl=s;}
|
|
|
Reimplemented in ScanFrameCC, ScanFrameNC, and ScanFrameTwoTrack. Definition at line 160 of file ScanFrame.h. Referenced by EntryProc(). 00160 {}
|
|
|
Transient, do not output.
Definition at line 177 of file ScanFrame.h. Referenced by BuildScanFrame(), EntryProc(), and ResetDisplay(). |
|
|
Transient, do not output.
Definition at line 183 of file ScanFrame.h. Referenced by BuildScanFrame(), and ResetDisplay(). |
|
|
Transient, do not output.
Definition at line 187 of file ScanFrame.h. Referenced by EntryProc(), and Init(). |
|
|
Transient, do not output.
Definition at line 185 of file ScanFrame.h. Referenced by EntryProc(). |
|
|
Definition at line 195 of file ScanFrame.h. Referenced by BuildScanFrame(), EntryProc(), Init(), ResetDisplay(), and SetEvent(). |
|
|
|
|
|
Definition at line 174 of file ScanFrame.h. Referenced by BuildScanFrame(). |
|
|
Definition at line 193 of file ScanFrame.h. Referenced by BuildScanFrame(), EntryProc(), Init(), ResetDisplay(), and SetRun(). |
|
|
Definition at line 190 of file ScanFrame.h. Referenced by EntryProc(), and Init(). |
|
|
Definition at line 189 of file ScanFrame.h. Referenced by EntryProc(), and Init(). |
|
|
Definition at line 188 of file ScanFrame.h. Referenced by EntryProc(), and Init(). |
|
|
Transient, do not output.
Definition at line 175 of file ScanFrame.h. Referenced by BuildScanFrame(). |
|
|
Definition at line 194 of file ScanFrame.h. Referenced by BuildScanFrame(), EntryProc(), Init(), ResetDisplay(), and SetSlice(). |
|
|
Definition at line 192 of file ScanFrame.h. Referenced by BuildScanFrame(), EntryProc(), Init(), ResetDisplay(), and SetSnarl(). |
|
|
Transient, do not output.
Definition at line 180 of file ScanFrame.h. Referenced by BuildScanFrame(), and ResetDisplay(). |
|
|
Transient, do not output.
Definition at line 178 of file ScanFrame.h. Referenced by BuildScanFrame(), and EntryProc(). |
|
|
Transient, do not output.
Definition at line 182 of file ScanFrame.h. Referenced by BuildScanFrame(), and ResetDisplay(). |
|
|
Transient, do not output.
Definition at line 181 of file ScanFrame.h. Referenced by BuildScanFrame(), and ResetDisplay(). |
1.3.9.1