ScanFrame Class Reference

#include <ScanFrame.h>

Inheritance diagram for ScanFrame:
ScanFrameCC ScanFrameNC ScanFrameTwoTrack

List of all members.

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 (std::ofstream &)

Static Public Member Functions

static void EnableXMLFormat (Bool_t enable=true)
static ScanFrameCreateScanSheet (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

static Bool_t fgEnableXMLFormat

Detailed Description

Definition at line 134 of file ScanFrame.h.


Constructor & Destructor Documentation

ScanFrame::ScanFrame ( const TGWindow *  p = 0,
Bool_t  buildScanFrame = true 
)

Definition at line 46 of file ScanFrame.cxx.

References BuildScanFrame(), exit(), 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 }

ScanFrame::~ScanFrame (  )  [virtual]

Definition at line 63 of file ScanFrame.cxx.

00063                       {
00064 }


Member Function Documentation

void ScanFrame::BuildScanFrame ( const TGWindow *  p  )  [protected]

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 }

virtual void ScanFrame::BuildScanSheet (  )  [inline, virtual]

Reimplemented in ScanFrameCC, ScanFrameNC, and ScanFrameTwoTrack.

Definition at line 160 of file ScanFrame.h.

Referenced by BuildScanFrame().

00160 {}

ScanFrame::ClassDef ( ScanFrame  ,
 
) [protected]

Reimplemented in ScanFrameCC, ScanFrameNC, and ScanFrameTwoTrack.

ScanFrame * ScanFrame::CreateScanSheet ( const TGWindow *  p,
const char *  name = 0 
) [static]

Definition at line 30 of file ScanFrame.cxx.

References Msg::kError, Msg::kInfo, 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 }

void ScanFrame::EnableXMLFormat ( Bool_t  enable = true  )  [static]

Definition at line 22 of file ScanFrame.cxx.

References Msg::kError, and 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 }

void ScanFrame::EntryProc (  ) 

Definition at line 149 of file ScanFrame.cxx.

References Comment, fComment, fEnableXMLFormat, fEvent, fname, 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 }

void ScanFrame::Init ( void   )  [protected]

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 }

virtual void ScanFrame::InitScanSheet (  )  [inline, virtual]

Reimplemented in ScanFrameCC, ScanFrameNC, and ScanFrameTwoTrack.

Definition at line 161 of file ScanFrame.h.

Referenced by Init().

00161 {}

virtual void ScanFrame::Pass ( const std::string   )  [inline, virtual]

Reimplemented in ScanFrameCC, and ScanFrameNC.

Definition at line 152 of file ScanFrame.h.

Referenced by MadScanDisplay::InFidNoTrk(), and MadScanDisplay::InFidTrk().

00152 {};

virtual void ScanFrame::PassChar ( const std::string  ,
char   
) [inline, virtual]

Reimplemented in ScanFrameTwoTrack.

Definition at line 153 of file ScanFrame.h.

Referenced by MadScanDisplay::DrawTextBox().

00153 {};

virtual void ScanFrame::PassFloat ( const std::string  ,
Double_t   
) [inline, virtual]
virtual void ScanFrame::PassInt ( const std::string  ,
Long_t   
) [inline, virtual]

Reimplemented in ScanFrameCC, ScanFrameNC, and ScanFrameTwoTrack.

Definition at line 154 of file ScanFrame.h.

Referenced by MadScanDisplay::Display(), and MadScanDisplay::DrawTextBox().

00154 {};

virtual void ScanFrame::PassString ( const std::string  ,
const std::string   
) [inline, virtual]

Definition at line 156 of file ScanFrame.h.

00156 {};

void ScanFrame::ResetDisplay ( std::string  mode = ""  )  [virtual]

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(), and EntryProc().

00218                                                  {
00219 
00220   runLabel->SetText(fRun);
00221   snarlLabel->SetText(fSnarl);
00222   eventLabel->SetText(fEvent);
00223   sliceLabel->SetText(fSlice);
00224   Comment->SetText(" ");
00225 
00226 }

virtual void ScanFrame::ResyncData (  )  [inline, virtual]

Reimplemented in ScanFrameTwoTrack.

Definition at line 162 of file ScanFrame.h.

Referenced by EntryProc().

00162 {}

void ScanFrame::SetEvent ( Int_t  s  )  [inline]

Definition at line 148 of file ScanFrame.h.

References fEvent.

Referenced by MadScanDisplay::Display(), and MadScanDisplay::FindUnSliced().

00148 {fEvent=s;}

void ScanFrame::SetRun ( Int_t  s  )  [inline]

Definition at line 145 of file ScanFrame.h.

References fRun.

Referenced by MadScanDisplay::Display().

00145 {fRun=s;}

void ScanFrame::SetSlice ( Int_t  s  )  [inline]

Definition at line 147 of file ScanFrame.h.

References fSlice.

Referenced by MadScanDisplay::Display(), and MadScanDisplay::FindUnSliced().

00147 {fSlice=s;}

void ScanFrame::SetSnarl ( Int_t  s  )  [inline]

Definition at line 146 of file ScanFrame.h.

References fSnarl.

Referenced by MadScanDisplay::Display().

00146 {fSnarl=s;}

virtual void ScanFrame::WriteScanSheet ( std::ofstream &   )  [inline, virtual]

Reimplemented in ScanFrameCC, ScanFrameNC, and ScanFrameTwoTrack.

Definition at line 163 of file ScanFrame.h.

Referenced by EntryProc().

00163 {}


Member Data Documentation

TGTextEntry* ScanFrame::Comment [protected]

Transient, do not output.

Definition at line 180 of file ScanFrame.h.

Referenced by BuildScanFrame(), EntryProc(), and ResetDisplay().

TGLabel* ScanFrame::eventLabel [protected]

Transient, do not output.

Definition at line 186 of file ScanFrame.h.

Referenced by BuildScanFrame(), ResetDisplay(), ScanFrameNC::ResetDisplay_noPH(), and ScanFrameCC::ResetDisplay_noPH().

std::string ScanFrame::fComment [protected]

Transient, do not output.

Definition at line 190 of file ScanFrame.h.

Referenced by EntryProc(), and Init().

Bool_t ScanFrame::fEnableXMLFormat [protected]

Transient, do not output.

Definition at line 188 of file ScanFrame.h.

Referenced by EntryProc().

Long_t ScanFrame::fEvent [protected]
Bool_t ScanFrame::fgEnableXMLFormat [static, protected]

Definition at line 172 of file ScanFrame.h.

TGMainFrame* ScanFrame::fMain [protected]

Definition at line 177 of file ScanFrame.h.

Referenced by BuildScanFrame().

Long_t ScanFrame::fRun [protected]
std::string ScanFrame::fScanFormat [protected]
std::string ScanFrame::fScanName [protected]
std::string ScanFrame::fScanner [protected]

Definition at line 191 of file ScanFrame.h.

Referenced by EntryProc(), and Init().

TGVerticalFrame* ScanFrame::fSframe [protected]
Long_t ScanFrame::fSlice [protected]
Long_t ScanFrame::fSnarl [protected]
TGLabel* ScanFrame::runLabel [protected]

Transient, do not output.

Definition at line 183 of file ScanFrame.h.

Referenced by BuildScanFrame(), ResetDisplay(), ScanFrameNC::ResetDisplay_noPH(), and ScanFrameCC::ResetDisplay_noPH().

TGTextEntry* ScanFrame::Scanner [protected]

Transient, do not output.

Definition at line 181 of file ScanFrame.h.

Referenced by BuildScanFrame(), and EntryProc().

TGLabel* ScanFrame::sliceLabel [protected]

Transient, do not output.

Definition at line 185 of file ScanFrame.h.

Referenced by BuildScanFrame(), ResetDisplay(), ScanFrameNC::ResetDisplay_noPH(), and ScanFrameCC::ResetDisplay_noPH().

TGLabel* ScanFrame::snarlLabel [protected]

Transient, do not output.

Definition at line 184 of file ScanFrame.h.

Referenced by BuildScanFrame(), ResetDisplay(), ScanFrameNC::ResetDisplay_noPH(), and ScanFrameCC::ResetDisplay_noPH().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1