Changeset 4139 for trunk/MagicSoft/Mars/mtemp/mifae/library
- Timestamp:
- 05/24/04 11:26:25 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mtemp/mifae/library
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtemp/mifae/library/MDisplay.cc
r4117 r4139 26 26 // MDisplay 27 27 // 28 // Class to display camera events (MCamEvent) 29 // You can set an event-by-event display with pause between two consecutive 30 // events. You can set an output PS file. 31 // 32 // Input containers (to be provided to the constructor): 33 // 34 // MCamEvent 35 // MGeomCam 36 // 37 // Output containers: 28 38 // 29 39 // … … 33 43 #include <math.h> 34 44 45 #include "TCanvas.h" 46 #include "TPostScript.h" 47 35 48 #include "MParList.h" 36 49 #include "MDisplay.h" … … 38 51 #include "MGeomCam.h" 39 52 #include "MHCamera.h" 40 41 #include "TCanvas.h"42 53 43 54 #include "MLog.h" … … 48 59 using namespace std; 49 60 50 static const TString gsDefName = "MDisplay"; 51 static const TString gsDefTitle = "Camera display task"; 61 static const TString gsDefName = "MDisplay"; 62 static const TString gsDefTitle = "Camera display task"; 63 static const TString gsDefPSFileName = "display.ps"; 52 64 53 65 // ------------------------------------------------------------------------- 54 66 // 55 // Constructor. 67 // Constructor. Need to provide the MCamEvent container to be displayed <event> 68 // and camera geometry <geom>. Also the display type <type> can be specified 69 // (see the MHCamera documentation for more details) 56 70 // 57 71 MDisplay::MDisplay(MCamEvent* event, MGeomCam* geom, Int_t type, const char* name, const char* title) 58 : fGeomCam(geom), fCamEvent(event), fCanvas(NULL), f DisplayType(type)72 : fGeomCam(geom), fCamEvent(event), fCanvas(NULL), fPSFile(NULL), fDisplayType(type), fCreatePSFile(kFALSE), fPause(kTRUE) 59 73 { 60 74 fName = name ? name : gsDefName.Data(); … … 63 77 fDisplay = new MHCamera(*geom); 64 78 fDisplay->SetPrettyPalette(); 79 80 fPSFileName = gsDefPSFileName; 65 81 } 66 82 // ------------------------------------------------------------------------- … … 73 89 if(fCanvas) 74 90 delete fCanvas; 91 if(fPSFile) 92 delete fPSFile; 75 93 } 76 94 77 95 // ------------------------------------------------------------------------- 78 96 // 79 // Look for needed containers.97 // Create the canvas, eventually set the batch mode and open ps file 80 98 // 81 99 Int_t MDisplay::PreProcess(MParList* pList) 82 100 { 83 101 fCanvas = new TCanvas("myCanvas","Event Display",600,600); 102 if(fCreatePSFile) 103 fPSFile = new TPostScript(fPSFileName,111); 104 if(!fPause) 105 fCanvas->SetBatch(); 84 106 fCanvas->cd(1); 85 107 fDisplay->Draw(); … … 90 112 // ------------------------------------------------------------------------- 91 113 // 92 // Call to compute a new position and then save it in the histogram (fMode==kOn) 93 // of to read the new position from the histogram (fMode==kOff) 114 // Set the new containt of the camera event and update the display. 115 // Set new page if ps file is requested 116 // Pause execution if event-by-event display is chosen 94 117 // 95 118 Int_t MDisplay::Process() 96 119 { 120 // new page in ps file 121 if(fPSFile) 122 fPSFile->NewPage(); 123 124 // update the display contents 97 125 fDisplay->SetCamContent(*fCamEvent); 98 126 fCanvas->GetPad(1)->Modified(); … … 100 128 101 129 // pause execution 102 cout << "Type 'q' to exit, <return> to go on: "; 103 TString input; 104 input =cin.get(); 105 106 if (input=='q') 107 return kFALSE; 108 else 109 return kTRUE; 130 if(fPause) 131 { 132 cout << "Type 'q' to exit, <return> to go on: "; 133 TString input; 134 input =cin.get(); 135 136 if (input=='q') 137 return kFALSE; 138 } 139 140 return kTRUE; 110 141 } 111 142 112 143 // ------------------------------------------------------------------------- 113 144 // 114 // Dump 2D histo statistics145 // Close ps file if it was open 115 146 // 116 147 Int_t MDisplay::PostProcess() 117 148 { 149 if(fPSFile) fPSFile->Close(); 118 150 return kTRUE; 119 151 } -
trunk/MagicSoft/Mars/mtemp/mifae/library/MDisplay.h
r4117 r4139 10 10 class MGeomCam; 11 11 class TCanvas; 12 class TPostScript; 12 13 13 14 class MDisplay : public MTask 14 15 { 15 16 private: 16 MHCamera* fDisplay; // pointer to the camera display 17 MGeomCam* fGeomCam; // pointer to the camera geometry 18 MCamEvent* fCamEvent; // pointer to camera event 19 TCanvas* fCanvas; // pointer to the canvas 20 Int_t fDisplayType; 17 MHCamera* fDisplay; // pointer to the camera display 18 MGeomCam* fGeomCam; // pointer to the camera geometry 19 MCamEvent* fCamEvent; // pointer to camera event 20 TCanvas* fCanvas; // pointer to the canvas 21 TPostScript* fPSFile; // pointer to ps file 22 TString fPSFileName; // name for ps file 23 Int_t fDisplayType; // display type (see MHCamera) 24 Bool_t fCreatePSFile; // flag to produce a ps file with events 25 Bool_t fPause; // flag to pause execution between events 21 26 27 22 28 virtual Int_t PostProcess(); 23 29 … … 30 36 virtual ~MDisplay(); 31 37 32 MGeomCam* GetGeomCam() {return fGeomCam;} 33 void SetDisplayType(Int_t type) {fDisplayType=type;} 34 virtual void Paint(Option_t* option) {}; 38 virtual void Paint(Option_t* option) {}; 39 40 MGeomCam* GetGeomCam() {return fGeomCam;} 41 Bool_t GetPauseMode() {return fPause;} 42 Bool_t GetCreatePSFile() {return fCreatePSFile;} 43 44 void SetDisplayType(Int_t type) {fDisplayType=type;} 45 void SetPSFile(Bool_t set=kTRUE) {fCreatePSFile=set;} 46 void SetPSFileName(TString name) {fPSFileName=name;} 47 void SetPause(Bool_t set=kTRUE) {fPause=set;} 35 48 36 49 ClassDef(MDisplay, 0) // Task to display camera containers -
trunk/MagicSoft/Mars/mtemp/mifae/library/MHillasDisplay.cc
r4117 r4139 26 26 // MDisplayHillas 27 27 // 28 // Display the camera event of type MCerPhotEvt plus the computed hillas 29 // parameters. 28 30 // 31 // Input containers (in constructor): 32 // MCerPhotEvt 33 // MGeomCam 34 // 35 // Input containers 36 // MHillas 37 // [MSrcPosCam] 38 // 39 // Output containers 40 // [...] 29 41 // 30 42 ////////////////////////////////////////////////////////////////////////////// … … 56 68 // ------------------------------------------------------------------------- 57 69 // 58 // Constructor .70 // Constructor (see MDisplay documentation for more information) 59 71 // 60 72 MHillasDisplay::MHillasDisplay(MCerPhotEvt* event, MGeomCam* geom, Int_t type, const char* name, const char* title) … … 66 78 // ------------------------------------------------------------------------- 67 79 // 68 // Look for needed containers. 80 // Call for MHillas::PreProcess and look for MHillas and look for the 81 // needed containers 69 82 // 70 83 Int_t MHillasDisplay::PreProcess(MParList* pList) … … 99 112 { 100 113 // draw the hillas parameters 101 if(fHillas )114 if(fHillas && GetPauseMode()) 102 115 fHillas->Print(); 103 116 … … 109 122 // ------------------------------------------------------------------------- 110 123 // 111 // Paint124 // Stuff to be painted when canvas will be updated 112 125 // 113 126 void MHillasDisplay::Paint(Option_t* option)
Note:
See TracChangeset
for help on using the changeset viewer.