Ignore:
Timestamp:
05/24/04 11:26:25 (21 years ago)
Author:
rico
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mtemp/mifae/library
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtemp/mifae/library/MDisplay.cc

    r4117 r4139  
    2626// MDisplay
    2727//
     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:
    2838//
    2939//
     
    3343#include <math.h>
    3444
     45#include "TCanvas.h"
     46#include "TPostScript.h"
     47
    3548#include "MParList.h"
    3649#include "MDisplay.h"
     
    3851#include "MGeomCam.h"
    3952#include "MHCamera.h"
    40 
    41 #include "TCanvas.h"
    4253
    4354#include "MLog.h"
     
    4859using namespace std;
    4960
    50 static const TString gsDefName  = "MDisplay";
    51 static const TString gsDefTitle = "Camera display task";
     61static const TString gsDefName       = "MDisplay";
     62static const TString gsDefTitle      = "Camera display task";
     63static const TString gsDefPSFileName = "display.ps";
    5264
    5365// -------------------------------------------------------------------------
    5466//
    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)
    5670//
    5771MDisplay::MDisplay(MCamEvent* event, MGeomCam* geom, Int_t type, const char* name, const char* title)
    58   :  fGeomCam(geom), fCamEvent(event),  fCanvas(NULL), fDisplayType(type)
     72  :  fGeomCam(geom), fCamEvent(event),  fCanvas(NULL), fPSFile(NULL), fDisplayType(type), fCreatePSFile(kFALSE), fPause(kTRUE)
    5973{
    6074  fName  = name  ? name  : gsDefName.Data();
     
    6377  fDisplay = new MHCamera(*geom);
    6478  fDisplay->SetPrettyPalette();
     79 
     80  fPSFileName = gsDefPSFileName;
    6581}
    6682// -------------------------------------------------------------------------
     
    7389  if(fCanvas)
    7490    delete fCanvas;
     91  if(fPSFile)
     92    delete fPSFile;
    7593}
    7694
    7795// -------------------------------------------------------------------------
    7896//
    79 // Look for needed containers.
     97// Create the canvas, eventually set the batch mode and open ps file
    8098//
    8199Int_t MDisplay::PreProcess(MParList* pList)
    82100{
    83101  fCanvas = new TCanvas("myCanvas","Event Display",600,600);
     102  if(fCreatePSFile)
     103    fPSFile = new TPostScript(fPSFileName,111);
     104  if(!fPause)
     105    fCanvas->SetBatch();
    84106  fCanvas->cd(1);
    85107  fDisplay->Draw();
     
    90112// -------------------------------------------------------------------------
    91113//
    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
    94117//
    95118Int_t MDisplay::Process()
    96119
     120  // new page in ps file
     121  if(fPSFile)
     122    fPSFile->NewPage();
     123
     124  // update the display contents
    97125  fDisplay->SetCamContent(*fCamEvent);
    98126  fCanvas->GetPad(1)->Modified();
     
    100128
    101129  // 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;
    110141}
    111142
    112143// -------------------------------------------------------------------------
    113144//
    114 // Dump 2D histo statistics
     145// Close ps file if it was open
    115146//
    116147Int_t MDisplay::PostProcess()
    117148{
     149  if(fPSFile) fPSFile->Close();
    118150  return kTRUE;
    119151}
  • trunk/MagicSoft/Mars/mtemp/mifae/library/MDisplay.h

    r4117 r4139  
    1010class MGeomCam;
    1111class TCanvas;
     12class TPostScript;
    1213
    1314class MDisplay : public MTask
    1415{
    1516 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
    2126 
     27
    2228  virtual Int_t PostProcess();
    2329
     
    3036  virtual ~MDisplay();
    3137
    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;}
    3548
    3649  ClassDef(MDisplay, 0) // Task to display camera containers
  • trunk/MagicSoft/Mars/mtemp/mifae/library/MHillasDisplay.cc

    r4117 r4139  
    2626// MDisplayHillas
    2727//
     28// Display the camera event of type MCerPhotEvt plus the computed hillas
     29// parameters.
    2830//
     31// Input containers (in constructor):
     32//  MCerPhotEvt
     33//  MGeomCam
     34//
     35// Input containers
     36//  MHillas
     37//  [MSrcPosCam]
     38//
     39// Output containers
     40//  [...]
    2941//
    3042//////////////////////////////////////////////////////////////////////////////
     
    5668// -------------------------------------------------------------------------
    5769//
    58 // Constructor.
     70// Constructor (see MDisplay documentation for more information)
    5971//
    6072MHillasDisplay::MHillasDisplay(MCerPhotEvt* event, MGeomCam* geom, Int_t type, const char* name, const char* title)
     
    6678// -------------------------------------------------------------------------
    6779//
    68 // Look for needed containers.
     80// Call for MHillas::PreProcess and look for MHillas and look for the
     81// needed containers
    6982//
    7083Int_t MHillasDisplay::PreProcess(MParList* pList)
     
    99112{
    100113   // draw the hillas parameters
    101   if(fHillas)
     114  if(fHillas && GetPauseMode())
    102115    fHillas->Print();
    103116   
     
    109122// -------------------------------------------------------------------------
    110123//
    111 // Paint
     124// Stuff to be painted when canvas will be updated
    112125//
    113126void MHillasDisplay::Paint(Option_t* option)
Note: See TracChangeset for help on using the changeset viewer.