Changeset 956 for trunk/MagicSoft/Mars
- Timestamp:
- 09/28/01 13:36:14 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r954 r956 21 21 * mmontecarlo/MMcTriggerRateCalc.cc: 22 22 - removed output stuff from PostProcessing 23 24 * meventdisp/MGFadcDisp.[h,cc]: 25 - reorganized code (constructor) 26 - reorganized deletion of gui objects 27 - fixed many, many memory leaks 23 28 24 29 -
trunk/MagicSoft/Mars/mdatacheck/MDumpEvtHeader.cc
r749 r956 28 28 #include "MLog.h" 29 29 #include "MLogManip.h" 30 30 31 #include "MParList.h" 31 32 #include "MRawEvtHeader.h" … … 40 41 { 41 42 *fLog << dbginf << " Error: MRawEvtHeader not found... exit." << endl; 42 return kFALSE 43 return kFALSE; 43 44 } 44 45 … … 47 48 { 48 49 *fLog << dbginf << " Error: MRawEvtData not found... exit." << endl; 49 return kFALSE 50 return kFALSE; 50 51 } 51 52 … … 55 56 Bool_t MDumpEvtHeader::Process() 56 57 { 57 fRawEvtHeader->Print() ;58 fRawEvtHeader->Print(); 58 59 59 MRawEvtPixelIter pixel( fRawEvtData);60 MRawEvtPixelIter pixel(fRawEvtData); 60 61 61 while ( pixel.Next() ) 62 { 63 *fLog << " " << pixel.GetPixelId() ; 64 } 62 while (pixel.Next()) 63 *fLog << " " << pixel.GetPixelId(); 65 64 66 *fLog << endl 65 *fLog << endl; 67 66 68 67 return kTRUE; -
trunk/MagicSoft/Mars/mdatacheck/MDumpEvtHeader.h
r698 r956 14 14 class MParList; 15 15 16 class MDumpEvtHeader : public MTask { 17 private: 18 MRawEvtHeader *fRawEvtHeader; 16 class MDumpEvtHeader : public MTask 17 { 18 private: 19 MRawEvtHeader *fRawEvtHeader; 20 MRawEvtData *fRawEvtData; 19 21 20 MRawEvtData *fRawEvtData; 21 22 public: 23 MDumpEvtHeader () : fRawEvtHeader(NULL) { } ; 22 public: 23 MDumpEvtHeader () : fRawEvtHeader(NULL) { }; 24 24 25 25 Bool_t PreProcess(MParList *pList); 26 Bool_t Process() 26 Bool_t Process(); 27 27 28 28 ClassDef(MDumpEvtHeader, 0) // Class to dump the pixel ids of a raw evt to the screen -
trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc
r928 r956 26 26 #include "MGFadcDisp.h" 27 27 28 #include <stdlib.h> 29 #include <iostream.h> 30 31 #include <TGButton.h> // TGPictureButton 32 #include <TGLabel.h> // TGLabel 33 #include <TGTab.h> // TGTab 34 #include <TGListBox.h> // TGListBox 35 #include <TGSlider.h> // TGVSlider 36 #include <TRootEmbeddedCanvas.h> // TRootEmbeddedCanvas 37 #include <TCanvas.h> 38 #include <TGTextEntry.h> 39 #include <TGMsgBox.h> 40 #include <TG3DLine.h> // TGHorizontal3DLine 41 // use TGSplitter instead for root<3.00 42 43 28 #include <stdlib.h> // atoi 29 #include <iostream.h> // cout for debugging 30 31 #include <TList.h> // TList 32 #include <TCanvas.h> // TCanvas 33 #include <TRootEmbeddedCanvas.h> // TRootEmbeddedCanvas 34 35 #include <TGTab.h> // TGTab 36 #include <TGLabel.h> // TGLabel 37 #include <TGButton.h> // TGPictureButton 38 #include <TGSlider.h> // TGVSlider 39 #include <TGMsgBox.h> // TGMsgBox 40 #include <TGListBox.h> // TGListBox 41 #include <TGTextEntry.h> // TGTextEntry 42 43 #include <TG3DLine.h> // TGHorizontal3DLine 44 // use TGSplitter instead for root<3.00 44 45 #include "MParList.h" 45 #include "MRawRunHeader.h" 46 #include "MRawEvtHeader.h" 47 #include "MTime.h" 46 #include "MReadTree.h" 48 47 #include "MRawEvtData.h" 49 #include "MRawCrateArray.h"50 #include "MReadTree.h"51 48 #include "MRawEvtPixelIter.h" 52 49 53 ClassImp(MGFadcDisp) 54 55 56 MGFadcDisp::MGFadcDisp(char *filename, char *treename, 57 const TGWindow *p, const TGWindow *main, 58 UInt_t w, UInt_t h ) 59 : TGTransientFrame(p, main, w, h ) 60 { 61 // default constructor 62 63 // first connect the file with this Object 50 ClassImp(MGFadcDisp); 51 52 enum MGFadcDispCommand 53 { 54 M_PIXELLIST = 4201, 55 M_PREVEVT, 56 M_NEXTEVT, 57 M_EVTNUMBER, 58 59 M_PREVPIXEL, 60 M_NEXTPIXEL, 61 62 M_PRINT, 63 M_CLOSE 64 }; 65 66 void MGFadcDisp::AddTopFramePart1(TGVerticalFrame *frame, 67 const char *filename, 68 const char *treename) 69 { 70 // 71 // --- the top1 part of the window --- 72 // 73 TGHorizontalFrame *top1 = new TGHorizontalFrame(frame, 300, 100); 74 fList->Add(top1); 75 76 // 77 // create gui elements 78 // 79 TGLabel *lfile = new TGLabel(top1, new TGString("File:")); 80 TGLabel *file = new TGLabel(top1, new TGString(filename)); 81 TGLabel *ltree = new TGLabel(top1, new TGString("Tree:")); 82 TGLabel *tree = new TGLabel(top1, new TGString(treename)); 83 84 fList->Add(lfile); 85 fList->Add(file); 86 fList->Add(ltree); 87 fList->Add(tree); 88 89 // 90 // layout and add gui elements in/to frame 91 // 92 TGLayoutHints *laystd = new TGLayoutHints(kLHintsLeft, 10, 10, 10, 10); 93 fList->Add(laystd); 94 95 top1->AddFrame(lfile, laystd); 96 top1->AddFrame(file, laystd); 97 top1->AddFrame(ltree, laystd); 98 top1->AddFrame(tree, laystd); 99 100 // 101 // layout and add frame 102 // 103 TGLayoutHints *laytop1 = new TGLayoutHints(kLHintsTop); 104 fList->Add(laytop1); 105 106 frame->AddFrame(top1, laytop1); 107 } 108 109 void MGFadcDisp::AddTopFramePart2(TGVerticalFrame *frame) 110 { 111 // 112 // --- the top2 part of the window --- 113 // 114 TGHorizontalFrame *top2 = new TGHorizontalFrame(frame, 300, 100); 115 fList->Add(top2); 116 117 // 118 // Create the gui elements 119 // 120 TGTextButton *prevevt = new TGTextButton(top2, "<< Previous Event", M_PREVEVT); 121 prevevt->Associate(this); 122 123 TGLabel *evtnr = new TGLabel(top2, new TGString("Event: ")); 124 125 fTxtEvtNr = new TGTextEntry(top2, new TGTextBuffer(100), M_EVTNUMBER); 126 fTxtEvtNr->Resize(60, fTxtEvtNr->GetDefaultHeight()); 127 fTxtEvtNr->Associate(this); 128 129 char wortdummy[100]; 130 sprintf(wortdummy, "out of %d Events", fReadTree->GetEntries()); 131 TGLabel *totnr = new TGLabel(top2, new TGString(wortdummy)); 132 133 TGTextButton *nextevt = new TGTextButton (top2, "Next Event >>", M_NEXTEVT); 134 nextevt->Associate(this); 135 136 // 137 // Add gui elements to 'atotodel' 138 // 139 fList->Add(prevevt); 140 fList->Add(evtnr); 141 fList->Add(fTxtEvtNr); 142 fList->Add(totnr); 143 fList->Add(nextevt); 144 145 // 146 // add the gui elements to the frame 147 // 148 TGLayoutHints *laystd = new TGLayoutHints(kLHintsLeft, 10, 10, 10, 10); 149 TGLayoutHints *laytentry = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5); 150 151 fList->Add(laystd); 152 fList->Add(laytentry); 153 154 top2->AddFrame(prevevt, laystd); 155 top2->AddFrame(evtnr, laystd); 156 top2->AddFrame(fTxtEvtNr, laytentry); 157 top2->AddFrame(totnr, laystd); 158 top2->AddFrame(nextevt, laystd); 159 160 frame->AddFrame(top2, new TGLayoutHints(kLHintsCenterX)); 161 } 162 163 void MGFadcDisp::AddMidFrame(TGHorizontalFrame *frame) 164 { 165 // 166 // create tab control 167 // 168 TGTab *tabs = new TGTab(frame, 300, 300); 169 170 // 171 // Create Tab1 172 // 173 TGCompositeFrame *tab1 = tabs->AddTab("PixelList"); 174 tab1->ChangeOptions(kHorizontalFrame); 175 176 // 177 // Create first gui element for tab1 178 // 179 fPixelList = new TGListBox(tab1, M_PIXELLIST); 180 fPixelList->Associate(this); 181 fPixelList->Resize(80, 230); 182 183 TGLayoutHints *layplist = new TGLayoutHints(kLHintsExpandY|kLHintsLeft, 5, 5, 5, 5); 184 tab1->AddFrame(fPixelList, layplist); 185 186 // 187 // Crete second gui elemet for tab1 (TGVertical Frame) 188 // 189 TGVerticalFrame *mid1 = new TGVerticalFrame(tab1, 300, 100); 190 191 // 192 // Create gui elements for vertical frame 193 // 194 TGTextButton *prevpix = new TGTextButton(mid1, "<< Prev Pixel", M_PREVPIXEL); 195 TGTextButton *nextpix = new TGTextButton(mid1, "Next Pixel >>", M_NEXTPIXEL); 196 prevpix->Associate(this); 197 nextpix->Associate(this); 198 199 TGVSlider *slider = new TGVSlider(mid1, 200, kSlider1|kScaleBoth); 200 slider->Associate(this); 201 slider->SetRange(0, 576); 202 203 // 204 // Layout gui elements 205 // 206 TGLayoutHints *laybut = new TGLayoutHints(kLHintsRight); 207 TGLayoutHints *layslider = new TGLayoutHints(kLHintsCenterX|kLHintsExpandY); 208 209 mid1->AddFrame(prevpix, laybut); 210 mid1->AddFrame(slider, layslider); 211 mid1->AddFrame(nextpix, laybut); 212 213 TGLayoutHints *laytab = new TGLayoutHints(kLHintsRight|kLHintsExpandY, 5, 5, 5, 5); 214 tab1->AddFrame(mid1, laytab); 215 216 TGLayoutHints *laytabs = new TGLayoutHints(kLHintsNormal|kLHintsExpandY, 10, 10, 10, 10); 217 frame->AddFrame(tabs, laytabs); 218 219 // 220 // Create second part of frame 221 // 222 TGTab *tabdisp = new TGTab(frame, 300, 300); 223 224 TGCompositeFrame *tab2 = tabdisp->AddTab("Digital Scope"); 225 226 TRootEmbeddedCanvas *canvas = new TRootEmbeddedCanvas("Digi Scope", tab2, 400, 400); 227 228 TGLayoutHints *laycanvas = new TGLayoutHints(kLHintsCenterX|kLHintsCenterY|kLHintsExpandX|kLHintsExpandY); 229 tab2->AddFrame(canvas, laycanvas); 230 231 fCanvas = canvas->GetCanvas(); 232 233 // 234 // Add second part to frame 235 // 236 TGLayoutHints *laydisp = new TGLayoutHints(kLHintsNormal|kLHintsExpandY|kLHintsExpandX, 10, 10, 10, 10); 237 frame->AddFrame(tabdisp, laydisp); 238 239 // 240 // Now add all gui elements to 'autodel'-list 241 // 242 fList->Add(tabdisp); 243 fList->Add(canvas); 244 fList->Add(laycanvas); 245 fList->Add(laydisp); 246 fList->Add(fPixelList); 247 fList->Add(layplist); 248 fList->Add(mid1); 249 fList->Add(prevpix); 250 fList->Add(laybut); 251 fList->Add(slider); 252 fList->Add(layslider); 253 fList->Add(nextpix); 254 fList->Add(laytab); 255 fList->Add(laytabs); 256 257 } 258 259 void MGFadcDisp::AddLowFrame(TGHorizontalFrame *frame) 260 { 261 TGTextButton *but1 = new TGTextButton(frame, "Print", M_PRINT); 262 TGTextButton *but2 = new TGTextButton(frame, "Close", M_CLOSE); 263 264 but1->Associate(this); 265 but2->Associate(this); 266 267 fList->Add(but1); 268 fList->Add(but2); 269 270 TGLayoutHints *laybut = new TGLayoutHints(kLHintsLeft, 10, 10, 10, 10); 271 fList->Add(laybut); 272 273 frame->AddFrame(but1, laybut); 274 frame->AddFrame(but2, laybut); 275 } 276 277 void MGFadcDisp::CreateGui(const char *filename, const char *treename) 278 { 279 // 280 // Create the frame elements and add gui elements to it 281 // 282 TGVerticalFrame *frametop = new TGVerticalFrame(this, 300, 100); 283 AddTopFramePart1(frametop, filename, treename); 284 AddTopFramePart2(frametop); 285 286 TGHorizontal3DLine *line1 = new TGHorizontal3DLine(this); 287 288 TGHorizontalFrame *framemid = new TGHorizontalFrame(this, 300, 100); 289 AddMidFrame(framemid); 290 291 TGHorizontal3DLine *line2 = new TGHorizontal3DLine(this); 292 293 TGHorizontalFrame *framelow = new TGHorizontalFrame(this, 300, 100); 294 AddLowFrame(framelow); 295 296 // 297 // add frame elements to 'autodel' 298 // 299 fList->Add(frametop); 300 fList->Add(line1); 301 fList->Add(framemid); 302 fList->Add(line2); 303 fList->Add(framelow); 304 305 // 306 // Layout frame elements and add elements to frame 307 // 308 TGLayoutHints *laytop = new TGLayoutHints(kLHintsTop|kLHintsCenterX); 309 TGLayoutHints *layline = new TGLayoutHints(kLHintsTop|kLHintsExpandX); 310 TGLayoutHints *laymid = new TGLayoutHints(kLHintsExpandY|kLHintsExpandX); 311 TGLayoutHints *laylow = new TGLayoutHints(kLHintsTop); 312 313 fList->Add(laytop); 314 fList->Add(layline); 315 fList->Add(laymid); 316 fList->Add(laylow); 317 318 AddFrame(frametop, laytop); 319 AddFrame(line1, layline); 320 AddFrame(framemid, laymid); 321 AddFrame(line2, layline); 322 AddFrame(framelow, laylow); 323 } 324 325 void MGFadcDisp::SetupFileAccess(const char *filename, const char *treename) 326 { 327 // 328 // Create the file access elements 329 // 330 fEvtData = new MRawEvtData(); 64 331 65 332 pList = new MParList(); 66 67 fRunHeader = new MRawRunHeader(); 68 pList->AddToList(fRunHeader); 69 70 fEvtHeader = new MRawEvtHeader(); 71 pList->AddToList(fEvtHeader); 72 fEvtTime = new MTime(); 73 pList->AddToList(fEvtTime); 74 fEvtData = new MRawEvtData(); 75 pList->AddToList(fEvtData); 76 fEvtCrate = new MRawCrateArray(); 77 pList->AddToList(fEvtCrate); 78 79 80 fReadTree = new MReadTree ( treename, filename ) ; 81 fReadTree->PreProcess( pList ) ; 82 83 // 84 // the top part of the window 85 // 86 fFrameTop = new TGVerticalFrame (this, 300, 100 ) ; 87 88 fTop1 = new TGHorizontalFrame (fFrameTop, 300, 100 ) ; 89 90 fLabelFile = new TGLabel(fTop1, new TGString("File:") ); 91 fTop1->AddFrame( fLabelFile, new TGLayoutHints (kLHintsLeft, 10, 10, 10, 10)) ; 92 93 fNameFile = new TGLabel(fTop1, new TGString( filename ) ); 94 fTop1->AddFrame( fNameFile, new TGLayoutHints (kLHintsLeft, 10, 10, 10, 10)) ; 95 96 fLabelTree = new TGLabel(fTop1, new TGString("Tree:") ); 97 fTop1->AddFrame( fLabelTree, new TGLayoutHints (kLHintsLeft, 10, 10, 10, 10)) ; 98 99 fNameTree = new TGLabel(fTop1, new TGString( treename ) ); 100 fTop1->AddFrame( fNameTree, new TGLayoutHints (kLHintsLeft, 10, 10, 10, 10)) ; 101 102 fFrameTop->AddFrame(fTop1,new TGLayoutHints (kLHintsTop ) ) ; 103 104 fTop2 = new TGHorizontalFrame (fFrameTop, 300, 100 ) ; 105 106 fButtonPrevEvt = new TGTextButton (fTop2, "<< Previous Event", M_PREVEVT ) ; 107 fButtonPrevEvt->Associate(this) ; 108 fTop2->AddFrame (fButtonPrevEvt, new TGLayoutHints (kLHintsLeft, 10, 10, 10, 10 ) ) ; 109 110 fLabelEvtNr = new TGLabel(fTop2, new TGString("Event: ") ); 111 fTop2->AddFrame( fLabelEvtNr, new TGLayoutHints (kLHintsLeft, 10, 10, 10, 10)) ; 112 113 fTxtEvtNr = new TGTextEntry(fTop2, fTxtBufEvtNr = new TGTextBuffer(100), M_EVTNUMBER); 114 fTxtEvtNr->Resize(60, fTxtEvtNr->GetDefaultHeight()); 115 fTxtEvtNr->Associate(this) ; 116 fTop2->AddFrame(fTxtEvtNr, new TGLayoutHints(kLHintsTop | kLHintsLeft, 117 5, 5, 5, 5)); 118 119 char wortdummy[100] ; 120 sprintf (wortdummy, "out of %d Events", fReadTree->GetEntries() ) ; 121 fLabelTotNr = new TGLabel(fTop2, new TGString( wortdummy ) ); 122 fTop2->AddFrame( fLabelTotNr, new TGLayoutHints (kLHintsLeft, 10, 10, 10, 10)) ; 123 124 fButtonNextEvt = new TGTextButton (fTop2, "Next Event >>", M_NEXTEVT ) ; 125 fButtonNextEvt->Associate(this) ; 126 fTop2->AddFrame (fButtonNextEvt, new TGLayoutHints (kLHintsLeft, 10, 10, 10, 10 ) ) ; 127 128 129 fFrameTop->AddFrame(fTop2,new TGLayoutHints ( kLHintsCenterX ) ) ; 130 131 132 133 AddFrame(fFrameTop, new TGLayoutHints (kLHintsTop | kLHintsCenterX ) ) ; 134 135 // a line between top and mid frame 136 137 fLineSep1 = new TGHorizontal3DLine(this) ; 138 AddFrame(fLineSep1, new TGLayoutHints(kLHintsTop | kLHintsExpandX) ); 139 140 // 141 // the middle part of the window 142 // 143 144 fFrameMid = new TGHorizontalFrame (this, 300, 100 ) ; 145 146 // the left part is the control tab enviroment 147 148 fTabControl = new TGTab(fFrameMid, 300, 300); 149 TGCompositeFrame *tControl = fTabControl->AddTab("PixelList"); 150 tControl->ChangeOptions ( kHorizontalFrame ) ; 151 152 153 fPixelList = new TGListBox(tControl, M_PIXELLIST ) ; 154 fPixelList->Associate(this) ; 155 tControl->AddFrame(fPixelList, new TGLayoutHints(kLHintsExpandY | kLHintsLeft, 5, 5, 5, 5 ) ) ; 156 fPixelList->Resize(80, 230 ) ; 157 158 fMid1 = new TGVerticalFrame (tControl, 300, 100 ) ; 159 160 161 fButtonPrevPix = new TGTextButton (fMid1, "<< Prev Pixel", 9999 ) ; 162 fMid1->AddFrame(fButtonPrevPix, new TGLayoutHints(kLHintsRight) ) ; 163 164 fPixSlider = new TGVSlider (fMid1, 200, kSlider1 | kScaleBoth, 9999 ); 165 fPixSlider->Associate(this); 166 fPixSlider->SetRange(0, 576); 167 fMid1->AddFrame(fPixSlider, new TGLayoutHints(kLHintsCenterX | kLHintsExpandY)); 168 169 fButtonNextPix = new TGTextButton (fMid1, "Next Pixel >>", 9999 ) ; 170 fMid1->AddFrame(fButtonNextPix, new TGLayoutHints(kLHintsRight) ) ; 171 172 tControl->AddFrame(fMid1, new TGLayoutHints(kLHintsRight | kLHintsExpandY, 5, 5, 5, 5)) ; 173 174 fFrameMid-> AddFrame(fTabControl, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY, 10, 10, 10 ,10 ) ); 175 176 // the right part is the display tab enviroment 177 178 fTabDisplay = new TGTab(fFrameMid, 300, 300); 179 TGCompositeFrame *tDisplay = fTabDisplay->AddTab("Digital Scope"); 180 181 fECanDigScope = new TRootEmbeddedCanvas("fECanDigScope", tDisplay, 400, 400 ) ; 182 tDisplay->AddFrame( fECanDigScope, new TGLayoutHints ( kLHintsCenterX | kLHintsCenterY | kLHintsExpandX | kLHintsExpandY ) ) ; 183 184 fCan = fECanDigScope->GetCanvas() ; 185 186 187 fFrameMid-> AddFrame(fTabDisplay, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY | kLHintsExpandX , 10, 10, 10 ,10 ) ); 188 189 190 AddFrame(fFrameMid, new TGLayoutHints (kLHintsExpandY | kLHintsExpandX ) ) ; 191 192 // a line between mid and low frame 193 194 fLineSep2 = new TGHorizontal3DLine(this) ; 195 AddFrame(fLineSep2, new TGLayoutHints(kLHintsTop | kLHintsExpandX) ); 196 197 // the low part of the window 198 // 199 fFrameLow = new TGHorizontalFrame (this, 300, 100 ) ; 200 201 202 fButtonPrint = new TGTextButton(fFrameLow, "Print", M_PRINT) ; 203 fButtonPrint->Associate(this) ; 204 fFrameLow->AddFrame( fButtonPrint, new TGLayoutHints(kLHintsLeft , 10, 10, 10, 10 ) ) ; 205 206 fButtonClose = new TGTextButton(fFrameLow, "Close", M_CLOSE) ; 207 fButtonClose->Associate(this) ; 208 fFrameLow->AddFrame( fButtonClose, new TGLayoutHints(kLHintsLeft, 10, 10, 10, 10 ) ) ; 209 210 211 AddFrame(fFrameLow, new TGLayoutHints (kLHintsTop ) ) ; 212 213 // 214 // Map the window, set up the layout, etc. 215 // 216 SetWMSizeHints(450, 400, 1000, 1000, 10, 10 ) ; // set the smallest and biggest size of the Main frame 217 218 MapSubwindows(); 219 220 Layout(); 221 222 SetWindowName("FadcDisplay"); 223 SetIconName("FadcDisp"); 224 225 MapWindow(); 226 227 // 228 // fReadTree the first event and update the window 229 // 230 fReadTree->GetEvent() ; 231 CreatePixelList() ; 232 UpdateEventCounter() ; 233 333 pList->AddToList(fEvtData); 334 335 fReadTree = new MReadTree(treename, filename); 336 fReadTree->PreProcess(pList); 337 fReadTree->GetEvent(); 338 } 339 340 MGFadcDisp::MGFadcDisp(char *filename, char *treename, 341 const TGWindow *p, const TGWindow *main, 342 UInt_t w, UInt_t h) 343 : TGTransientFrame(p, main, w, h) 344 { 345 346 // 347 // create an autodelete-list for the gui elements 348 // 349 fList = new TList; 350 fList->SetOwner(); 351 352 SetupFileAccess(filename, treename); 353 CreateGui(filename, treename); 354 355 // 356 // Map the window, set up the layout, etc. 357 // 358 SetWMSizeHints(450, 400, 1000, 1000, 10, 10 ); // set the smallest and biggest size of the Main frame 359 360 MapSubwindows(); 361 362 Layout(); 363 364 SetWindowName("FadcDisplay"); 365 SetIconName("FadcDisp"); 366 367 MapWindow(); 368 369 CreatePixelList(); 370 UpdateEventCounter(); 234 371 } 235 372 … … 237 374 MGFadcDisp::~MGFadcDisp() 238 375 { 239 // close the file 240 241 fReadTree->PostProcess() ; 242 243 delete fRunHeader ; 244 delete fEvtHeader ; 245 delete fEvtTime ; 246 delete fEvtData ; 247 delete fEvtCrate ; 248 249 delete pList ; 250 251 delete fReadTree ; 252 253 // destruct the graphical members 254 255 delete fButtonPrint ; 256 delete fButtonClose ; 257 258 // delete fCan ; 259 delete fECanDigScope ; 260 delete fTabDisplay ; 261 262 delete fPixSlider ; 263 delete fButtonPrevPix ; 264 delete fButtonNextPix ; 265 delete fMid1 ; 266 delete fPixelList; 267 delete fTabControl ; 268 269 delete fLabelEvtNr ; 270 delete fLabelTotNr ; 271 //delete fTxtBufEvtNr ; 272 delete fTxtEvtNr ; 273 delete fButtonNextEvt ; 274 delete fButtonPrevEvt ; 275 delete fLabelTree ; 276 delete fNameTree ; 277 delete fNameFile ; 278 delete fLabelFile ; 279 delete fTop2 ; 280 delete fTop1 ; 281 282 delete fFrameLow ; 283 delete fLineSep2 ; 284 delete fFrameMid ; 285 delete fLineSep1 ; 286 delete fFrameTop ; 376 // 377 // close the file 378 // 379 fReadTree->PostProcess(); 380 381 delete fEvtData; 382 delete pList; 383 384 delete fReadTree; 385 386 // 387 // destruct the graphical members 388 // 389 delete fList; 287 390 } 288 391 … … 295 398 // window menu item is selected. 296 399 297 delete this 400 delete this; 298 401 } 299 402 … … 312 415 while (pixel.Next()) 313 416 { 314 char wortdummy[100] 417 char wortdummy[100]; 315 418 sprintf(wortdummy, "%d", pixel.GetPixelId()); 316 419 fPixelList->AddEntry(wortdummy, pixel.GetPixelId()); … … 323 426 // check if the pixel from last event also occurs in this event 324 427 // 325 fCan ->Clear();326 fCan ->cd();428 fCanvas->Clear(); 429 fCanvas->cd(); 327 430 328 431 if (lastsel<0 || !pixel.Jump(lastsel)) … … 333 436 } 334 437 335 char wortdummy[100] 438 char wortdummy[100]; 336 439 sprintf(wortdummy, "GRAPH%d", lastsel); 337 440 fEvtData->Draw(wortdummy); 338 441 fPixelList->Select(lastsel, kTRUE); 339 442 340 fCan ->Modified();341 fCan ->Update();443 fCanvas->Modified(); 444 fCanvas->Update(); 342 445 } 343 446 344 447 void MGFadcDisp::UpdateEventCounter() 345 448 { 346 // Update the event counter347 348 char wortdummy[256] ;349 350 sprintf (wortdummy, "%d", fReadTree->GetEventNum() ) ;351 352 fTxtEvtNr->SetText(wortdummy) ;449 // Update the event counter 450 451 char wortdummy[256]; 452 453 sprintf(wortdummy, "%d", fReadTree->GetEventNum()); 454 455 fTxtEvtNr->SetText(wortdummy); 353 456 } 354 457 … … 356 459 { 357 460 Int_t buttons = 4; 358 Int_t retval = 0;461 Int_t retval = 0; 359 462 360 463 // first check if the new event is in the range of possible events 361 464 362 if ( iEvt >= fReadTree->GetEntries())465 if (iEvt >= fReadTree->GetEntries()) 363 466 { 364 467 new TGMsgBox(fClient->GetRoot(), this, … … 382 485 } 383 486 487 void MGFadcDisp::DisplayPix(UInt_t i) 488 { 489 char wortdummy[256]; 490 491 sprintf(wortdummy, "GRAPH%d", i); 492 493 fCanvas->Clear(); 494 fCanvas->cd(); 495 496 fEvtData->Draw(wortdummy); 497 498 fCanvas->Modified(); 499 fCanvas->Update(); 500 501 // 502 // FIXME: too complicated! 503 // 504 fPixelList->RemoveEntries(0, fEvtData->GetNumPixels()); 505 CreatePixelList(i); 506 } 507 384 508 Bool_t MGFadcDisp::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) 385 509 { 386 //------------------------------------------------------------------ 387 // 388 // ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) 389 // 390 // Processes information from all GUI items. 391 // Selecting an item usually generates an event with 4 parameters. 392 // The first two are packed into msg (first and second bytes). 393 // The other two are parm1 and parm2. 394 // 395 //------------------------------------------------------------------ 396 char wortdummy[256] ; 397 Int_t buttons = 4, retval = 0 ; 398 399 switch(GET_MSG(msg)) 510 //------------------------------------------------------------------ 511 // 512 // ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) 513 // 514 // Processes information from all GUI items. 515 // Selecting an item usually generates an event with 4 parameters. 516 // The first two are packed into msg (first and second bytes). 517 // The other two are parm1 and parm2. 518 // 519 //------------------------------------------------------------------ 520 521 switch(GET_MSG(msg)) 400 522 { 401 523 case kC_COMMAND: 402 403 switch(GET_SUBMSG(msg)) 404 { 405 406 case kCM_BUTTON: 407 408 switch (parm1) 409 { 410 case M_PREVEVT: 411 ReadinEvent(fReadTree->GetEventNum()-1 ) ; 412 break; 413 414 case M_NEXTEVT: 415 ReadinEvent(fReadTree->GetEventNum()+1 ) ; 416 break; 417 418 419 case M_PRINT: 420 new TGMsgBox(fClient->GetRoot(), this, 421 "INFORMATION!", 422 "Your are invited to program that!!", 423 kMBIconExclamation, buttons, &retval); 424 425 break ; 426 427 case M_CLOSE: 428 CloseWindow() ; 429 break; 430 431 } 432 433 case kCM_LISTBOX: 434 switch (parm1) 435 { 436 case M_PIXELLIST: 437 sprintf(wortdummy, "GRAPH%d", fPixelList->GetSelected()); 438 439 fCan->Clear() ; 440 fCan->cd() ; 441 442 fEvtData->Draw(wortdummy) ; 443 444 fCan->Modified() ; 445 fCan->Update() ; 446 break; 447 } 448 break; 449 450 } 451 524 switch(GET_SUBMSG(msg)) 525 { 526 case kCM_BUTTON: 527 switch (parm1) 528 { 529 case M_PREVEVT: 530 ReadinEvent(fReadTree->GetEventNum()-1); 531 return kTRUE; 532 533 case M_NEXTEVT: 534 ReadinEvent(fReadTree->GetEventNum()+1); 535 return kTRUE; 536 537 case M_PREVPIXEL: 538 DisplayPix(fPixelList->GetSelected()-1); 539 return kTRUE; 540 541 case M_NEXTPIXEL: 542 DisplayPix(fPixelList->GetSelected()+1); 543 return kTRUE; 544 545 case M_PRINT: 546 cout << "Sorry, not yet implemented!" << endl; 547 return kTRUE; 548 549 case M_CLOSE: 550 CloseWindow(); 551 return kTRUE; 552 } 553 return kTRUE; 554 555 case kCM_LISTBOX: 556 if (parm1 != M_PIXELLIST) 557 return kTRUE; 558 559 DisplayPix(fPixelList->GetSelected()); 560 return kTRUE; 561 } 562 return kTRUE; 563 452 564 case kC_TEXTENTRY: 453 454 switch(GET_SUBMSG(msg)) 455 { 456 case kTE_TEXTCHANGED: 457 break ; 458 459 case kTE_ENTER: 460 { 461 const char *txt = fTxtEvtNr->GetText(); 462 ReadinEvent(atoi(txt)); 463 } 464 break; 465 } 466 break; 467 468 default: 469 break; 565 if (GET_SUBMSG(msg) == kTE_ENTER) 566 ReadinEvent(atoi(fTxtEvtNr->GetText())); 567 568 return kTRUE; 470 569 } 471 570 472 return kTRUE ;473 } 571 return kTRUE; 572 } -
trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h
r730 r956 10 10 #endif 11 11 12 class MParList ; 13 class MRawRunHeader ; 14 class MRawEvtHeader ; 15 class MTime ; 16 class MRawEvtData ; 17 class MRawCrateArray ; 12 class MParList; 13 class MReadTree; 14 class MRawEvtData; 18 15 19 class MReadTree ; 16 class TList; 17 class TCanvas; 18 class TGListBox; 19 class TGTextEntry; 20 20 21 class TGHorizontal3DLine; 22 class TGLabel ; 23 class TGTextButton ; 24 class TGTab ; 25 class TGListBox ; 26 class TGVSlider; 27 class TRootEmbeddedCanvas ; 28 class TCanvas ; 29 class TGTextEntry ; 30 class TGTextBuffer ; 21 class MGFadcDisp : public TGTransientFrame 22 { 23 private: 24 // 25 // GUI stuff 26 // 27 TList *fList; 31 28 32 enum MGFadcDispCommand { 33 34 M_PIXELLIST = 4201 , 35 M_PREVEVT, 36 M_NEXTEVT, 37 M_EVTNUMBER, 29 TGTextEntry *fTxtEvtNr; 30 TGListBox *fPixelList; 38 31 39 M_PREVPIXEL, 40 M_NEXTPIXEL, 32 TCanvas *fCanvas; 41 33 42 M_PRINT, 43 M_CLOSE 44 34 void AddTopFramePart1(TGVerticalFrame *frame, 35 const char *filename, 36 const char *treename); 37 void AddTopFramePart2(TGVerticalFrame *frame); 38 void AddMidFrame(TGHorizontalFrame *frame); 39 void AddLowFrame(TGHorizontalFrame *frame); 45 40 46 }; 41 void CreateGui(const char *filename, const char *treename); 42 void SetupFileAccess(const char *filename, const char *treename); 47 43 48 // 49 // 44 // 45 // File Access stuff 46 // 47 MParList *pList; 48 MRawEvtData *fEvtData; 49 MReadTree *fReadTree; 50 50 51 class MGFadcDisp : public TGTransientFrame { 51 void ReadinEvent(UInt_t iEvt); 52 void DisplayPix(UInt_t i); 52 53 53 private: 54 public: 54 55 55 // 56 // members to read in the file 57 // 56 MGFadcDisp(char *filename, char *treename, 57 const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h); 58 58 59 MParList *pList ; 60 MRawRunHeader *fRunHeader ; 61 MRawEvtHeader *fEvtHeader ; 62 MTime *fEvtTime ; 63 MRawEvtData *fEvtData ; 64 MRawCrateArray *fEvtCrate ; 59 ~MGFadcDisp(); 65 60 66 MReadTree *fReadTree ; 67 68 // 69 // members for the gui 70 // 71 72 // divide the whole frame in three subframes 73 74 TGVerticalFrame *fFrameTop ; 75 TGHorizontalFrame *fFrameMid, *fFrameLow ; 76 TGHorizontal3DLine *fLineSep1, *fLineSep2 ; 61 void CloseWindow(); 77 62 78 // members in the top frame 63 void CreatePixelList(Int_t lastsel=-1); 64 void UpdateEventCounter(); 79 65 80 TGHorizontalFrame *fTop1, *fTop2 ; 81 TGLabel *fLabelFile, *fNameFile, *fLabelTree, *fNameTree ; 82 TGTextButton *fButtonPrevEvt, *fButtonNextEvt ; 83 TGLabel *fLabelEvtNr, *fLabelTotNr ; 84 TGTextEntry *fTxtEvtNr ; 85 TGTextBuffer *fTxtBufEvtNr ; //! no output for this member 86 // neccessary to compile H.K. 66 virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2); 87 67 88 // members in the mid frame 89 90 TGTab *fTabControl ; 91 TGListBox *fPixelList ; 92 TGVerticalFrame *fMid1 ; 93 TGTextButton *fButtonPrevPix, *fButtonNextPix ; 94 TGVSlider *fPixSlider ; 95 96 TGTab *fTabDisplay ; 97 TRootEmbeddedCanvas *fECanDigScope ; 98 99 TCanvas *fCan ; 100 101 // members in the low frame 102 103 TGTextButton *fButtonPrint, *fButtonClose ; 104 105 public: 106 107 MGFadcDisp(char *filename, char *treename, 108 const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h ) ; 109 110 ~MGFadcDisp() ; 111 112 void CloseWindow() ; 113 114 void CreatePixelList(Int_t lastsel=-1) ; 115 void UpdateEventCounter() ; 116 void ReadinEvent(UInt_t iEvt) ; 117 118 virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2); 119 120 ClassDef(MGFadcDisp, 0) 121 }; 68 ClassDef(MGFadcDisp, 0) 69 }; 122 70 123 71 #endif
Note:
See TracChangeset
for help on using the changeset viewer.