Changeset 4139
- Timestamp:
- 05/24/04 11:26:25 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mtemp/mifae
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtemp/mifae/Changelog
r4138 r4139 19 19 -*-*- END OF LINE -*-*- 20 20 21 2004/05/24 Javier Rico 22 * library/MDisplay.[h,cc], library/MHillasDisplay.[h,cc] 23 programs/makeHillas.cc, programs/makehillas.datacard 24 - Add possibility to save a ps file 25 - Update documentation 26 21 27 2004/05/21 Oscar Blanch 22 28 * makeHillas.cc -
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) -
trunk/MagicSoft/Mars/mtemp/mifae/programs/makeHillas.cc
r4118 r4139 72 72 TString idirname; 73 73 TString filter; 74 TString psfilename("makehillas.ps"); 74 75 MRunIter caliter; 75 76 MRunIter pediter; 76 77 MRunIter datiter; 77 Bool_t display = kFALSE;78 UInt_t display = 0; 78 79 ULong_t nmaxevents= 999999999; 79 80 Short_t calflag = 1; … … 302 303 MDisplay* disphillas=NULL; 303 304 304 if(!display) 305 { 306 write = new MWriteRootFile(outname,"RECREATE"); 307 308 write->AddContainer("MHillas" , "Parameters"); 309 write->AddContainer("MHillasSrc" , "Parameters"); 310 write->AddContainer("MHillasExt" , "Parameters"); 311 write->AddContainer("MNewImagePar" , "Parameters"); 312 write->AddContainer("MRawEvtHeader" , "Parameters"); 313 write->AddContainer("MRawRunHeader" , "Parameters"); 314 write->AddContainer("MConcentration" , "Parameters"); 315 write->AddContainer("MSrcPosCam" , "Parameters"); 316 317 if (islflag == 1 || islflag == 2) 318 write->AddContainer("MIslands1" , "Parameters"); 319 if (islflag == 2) 320 write->AddContainer("MIslands2" , "Parameters"); 321 } 322 else 323 { 324 disphillas = new MHillasDisplay(&nphot,&geomcam); 325 } 305 write = new MWriteRootFile(outname,"RECREATE"); 306 307 write->AddContainer("MHillas" , "Parameters"); 308 write->AddContainer("MHillasSrc" , "Parameters"); 309 write->AddContainer("MHillasExt" , "Parameters"); 310 write->AddContainer("MNewImagePar" , "Parameters"); 311 write->AddContainer("MRawEvtHeader" , "Parameters"); 312 write->AddContainer("MRawRunHeader" , "Parameters"); 313 write->AddContainer("MConcentration" , "Parameters"); 314 write->AddContainer("MSrcPosCam" , "Parameters"); 315 316 if (islflag == 1 || islflag == 2) 317 write->AddContainer("MIslands1" , "Parameters"); 318 if (islflag == 2) 319 write->AddContainer("MIslands2" , "Parameters"); 320 321 if(display) 322 disphillas = new MHillasDisplay(&nphot,&geomcam); 326 323 327 324 tlist4.AddToList(&read4); … … 348 345 tlist4.AddToList(&csrc1); 349 346 tlist4.AddToList(&applycut); 350 if(!display) 351 tlist4.AddToList(write); 352 else 353 tlist4.AddToList(disphillas); 347 tlist4.AddToList(write); 348 if(display) 349 { 350 disphillas->SetPSFile(); 351 disphillas->SetPSFileName(psfilename); 352 if(display==2) 353 disphillas->SetPause(kFALSE); 354 tlist4.AddToList(disphillas); 355 } 356 354 357 355 358 // Create and setup the eventloop … … 450 453 if(strcmp(word.Data(),"DISPLAY")==0) 451 454 ifun >> display; 455 456 // ps file name 457 if(strcmp(word.Data(),"PSFILENAME")==0) 458 ifun >> psfilename; 452 459 453 460 // calibration flag … … 499 506 if(filter.Length()) 500 507 cout << "Applying rejection cut: " << filter << endl; 501 if(!display) 502 cout << "Output file name: " << outname << endl; 508 cout << "Output file name: " << outname << endl; 509 if(display) 510 cout << "Generating PS file: " << psfilename << endl; 503 511 cout << "Calibration flag: " << calflag << endl; 504 512 cout << "Cleaning level: ("<<lcore<<","<<ltail<<")" << endl; -
trunk/MagicSoft/Mars/mtemp/mifae/programs/makehillas.datacard
r4117 r4139 21 21 FILTER (MHillas.fLength<100) && (MHillas.fLength>50) 22 22 23 // Display flag (DISPLAY=1 will show event display and skip saving into output file) 24 DISPLAY 1 23 // Display flag 24 // DISPLAY 0 will simply produce the hillas parameters files 25 // DISPLAY 1 will show event display and produce ps file 26 // DISPLAY 2 will produce the ps files, no display 27 DISPLAY 0 28 29 // PS file name 30 PSFILENAME makehillas.ps 25 31 26 32 // calibration flag:
Note:
See TracChangeset
for help on using the changeset viewer.