Ignore:
Timestamp:
06/24/03 15:01:48 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhist
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhist/MHCamEvent.cc

    r2221 r2229  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
     18!   Author(s): Thomas Bretz, 12/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    2020!   Copyright: MAGIC Software Development, 2000-2003
     
    2626//
    2727// MHCamEvent
     28//
     29// A histogram to store the sum of camera events. This can be photons,
     30// currents or enything else derived from MCamEvent
    2831//
    2932/////////////////////////////////////////////////////////////////////////////
     
    131134}
    132135
     136// --------------------------------------------------------------------------
     137//
     138// Return fSum.
     139//
    133140TH1 *MHCamEvent::GetHistByName(const TString name)
    134141{
  • trunk/MagicSoft/Mars/mhist/MHCamEvent.h

    r2209 r2229  
    1212{
    1313private:
    14     MHCamera *fSum;      // storing the sum
    15     MCamEvent   *fEvt;      //! the current event
     14    MHCamera  *fSum; // storing the sum
     15    MCamEvent *fEvt; //! the current event
    1616
    1717    TString fNameEvt;
  • trunk/MagicSoft/Mars/mhist/MHCamera.cc

    r2222 r2229  
    2828// MHCamera
    2929//
    30 // Camera Display. The Pixels are displayed in
    31 // contents/area [somthing/mm^2]
    32 //
    33 // To change the scale to a logarithmic scale SetLogz() of the Pad.
    34 //
     30// Camera Display, based on a TH1D. Pleas be carefull using the
     31// underlaying TH1D.
     32//
     33// To change the scale to a logarithmic scale SetLogy() of the Pad.
    3534//
    3635////////////////////////////////////////////////////////////////////////////
     
    4443#include <TLatex.h>
    4544#include <TStyle.h>
    46 #include <TMarker.h>
    4745#include <TCanvas.h>
    4846#include <TArrayF.h>
     
    5755#include "MGeomCam.h"
    5856
    59 #include "MRflEvtData.h"
    60 #include "MRflSinglePhoton.h"
    61 
    6257#include "MCerPhotPix.h"
    6358#include "MCerPhotEvt.h"
     
    8580    SetDirectory(NULL);
    8681
    87     fPhotons   = NULL;
    8882    fNotify  = NULL;
    8983
     
    9791// ------------------------------------------------------------------------
    9892//
    99 //  Constructor. Makes a clone of MGeomCam.
     93//  Constructor. Makes a clone of MGeomCam. Removed the TH1D from the
     94// current directory. Calls Sumw2(). Set the histogram line color
     95// (for error bars) to Green and the marker style to kFullDotMedium.
    10096//
    10197MHCamera::MHCamera(const MGeomCam &geom, const char *name, const char *title)
     
    121117    //    register BIT(8) as kNoContextMenu. If an object has this bit set it will
    122118    //    not get an automatic context menu when clicked with the right mouse button.
    123 
    124     fPhotons = new TClonesArray("TMarker", 0);
    125119
    126120    //
     
    139133// ------------------------------------------------------------------------
    140134//
    141 // Destructor. Deletes TClonesArrays for hexagons and legend elements.
     135// Destructor. Deletes the cloned fGeomCam and the notification list.
    142136//
    143137MHCamera::~MHCamera()
    144138{
    145     if (fPhotons)
    146     {
    147         fPhotons->Delete();
    148         delete fPhotons;
    149     }
    150139    if (fGeomCam)
    151140        delete fGeomCam;
     
    154143}
    155144
    156 Int_t MHCamera::Fill(Axis_t x)
    157 {
     145// ------------------------------------------------------------------------
     146//
     147// Taken from TH1D::Fill(). Uses the argument directly as bin index.
     148// Doesn't increment the number of entries.
     149//
    158150//   -*-*-*-*-*-*-*-*Increment bin with abscissa X by 1*-*-*-*-*-*-*-*-*-*-*
    159151//                   ==================================
     
    167159//
    168160//   -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
     161Int_t MHCamera::Fill(Axis_t x)
     162{
    169163
    170164#if ROOT_VERSION_CODE > ROOT_VERSION(3,05,00)
     
    186180}
    187181
    188 //______________________________________________________________________________
    189 Int_t MHCamera::Fill(Axis_t x, Stat_t w)
    190 {
     182// ------------------------------------------------------------------------
     183//
     184// Taken from TH1D::Fill(). Uses the argument directly as bin index.
     185// Doesn't increment the number of entries.
     186//
    191187//   -*-*-*-*-*-*Increment bin with abscissa X with a weight w*-*-*-*-*-*-*-*
    192188//               =============================================
     
    200196//
    201197//   -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    202 
     198Int_t MHCamera::Fill(Axis_t x, Stat_t w)
     199{
    203200#if ROOT_VERSION_CODE > ROOT_VERSION(3,05,00)
    204201   if (fBuffer) return BufferFill(x,w);
     
    310307}
    311308
    312 
     309// ------------------------------------------------------------------------
     310//
     311// Resizes the current pad so that the camera is displayed in its
     312// correct aspect ratio
     313//
    313314void MHCamera::SetRange()
    314315{
     
    349350}
    350351
     352// ------------------------------------------------------------------------
     353//
     354// Updates the pixel colors and paints the pixels
     355//
    351356void MHCamera::Update(Bool_t islog, Bool_t isbox, Bool_t iscol)
    352357{
     
    383388}
    384389
     390// ------------------------------------------------------------------------
     391//
     392// Print minimum and maximum
     393//
    385394void MHCamera::Print(Option_t *) const
    386395{
     
    395404}
    396405
     406// ------------------------------------------------------------------------
     407//
     408// Paint the y-axis title
     409//
    397410void MHCamera::PaintAxisTitle()
    398411{
     
    412425}
    413426
     427// ------------------------------------------------------------------------
     428//
     429// Paint the histogram title
     430//
    414431void MHCamera::PaintTitle()
    415432{
     
    485502// ------------------------------------------------------------------------
    486503//
    487 // This is called at any time the canvas should get repainted.
    488 // Here we maintain an aspect ratio of 1.15. This makes sure,
    489 // that the camera image doesn't get distorted by resizing the canvas.
     504// Paints the camera.
    490505//
    491506void MHCamera::Paint(Option_t *o)
     
    517532
    518533    // Paint primitives (pixels, color legend, photons, ...)
    519     { fPhotons->ForEach(TObject, Paint)(); }
    520 
    521534    PaintTitle();
    522535    PaintAxisTitle();
     
    525538// ------------------------------------------------------------------------
    526539//
    527 //  With this function you can change the color palette. For more
     540// With this function you can change the color palette. For more
    528541// information see TStyle::SetPalette. Only palettes with 50 colors
    529542// are allowed.
     
    580593}
    581594
    582 void MHCamera::DrawPixelNumbers()
     595void MHCamera::DrawPixelIndices()
    583596{
    584597    for (int i=0; i<kItemsLegend; i++)
     
    605618// ------------------------------------------------------------------------
    606619//
    607 // Call this function to fill the currents
     620// Call this function to add a MCamEvent on top of the present contents.
     621// Only 'used' pixels are added.
    608622//
    609623void MHCamera::AddCamContent(const MCamEvent &event, Int_t type)
     
    617631
    618632        Fill(idx, val); // FIXME: Slow!
    619         //fArray[idx+1]+=val;
    620633    }
    621634    fEntries++;
     
    624637// ------------------------------------------------------------------------
    625638//
    626 // Call this function to fill the currents
     639// Call this function to add a MHCamera on top of the present contents.
     640// Only 'used' pixels are added.
     641// Type:
     642//  0) bin content
     643//  1) errors
     644//  2) rel. errors
    627645//
    628646void MHCamera::AddCamContent(const MHCamera &d, Int_t type)
     
    657675// ------------------------------------------------------------------------
    658676//
    659 // Call this function to fill the currents
     677// Call this function to add a TArrayD on top of the present contents.
     678// Only 'used' pixels are added.
    660679//
    661680void MHCamera::AddCamContent(const TArrayD &event, Bool_t ispos)
    662681{
     682    if (event.GetSize()!=fNcells-2)
     683        return;
     684
    663685    for (Int_t idx=0; idx<fNcells-2; idx++)
    664686    {
    665687        Fill(idx, const_cast<TArrayD&>(event)[idx]); // FIXME: Slow!
    666         //fArray[idx+1]+=val;
    667688
    668689        if (!ispos || fArray[idx+1]>0)
     
    674695// ------------------------------------------------------------------------
    675696//
    676 // Call this function to fill the currents
     697// Call this function to add a MCamEvent on top of the present contents.
     698// 1 is added to each pixel if the contents of MCamEvent>threshold
    677699//
    678700void MHCamera::CntCamContent(const MCamEvent &event, Double_t threshold, Int_t type)
     
    693715// ------------------------------------------------------------------------
    694716//
    695 // Call this function to fill the currents
     717// Call this function to add a TArrayD on top of the present contents.
     718// 1 is added to each pixel if the contents of MCamEvent>threshold
    696719//
    697720void MHCamera::CntCamContent(const TArrayD &event, Double_t threshold, Bool_t ispos)
    698721{
     722    if (event.GetSize()!=fNcells-2)
     723        return;
     724
    699725    for (Int_t idx=0; idx<fNcells-2; idx++)
    700726    {
     
    708734}
    709735
     736// ------------------------------------------------------------------------
     737//
     738// Fill the pixels with random contents.
     739//
    710740void MHCamera::FillRandom()
    711741{
     
    752782{
    753783    FillLevels(event, clean.GetCleanLvl1(), clean.GetCleanLvl2());
    754 }
    755 
    756 // ------------------------------------------------------------------------
    757 //
    758 // Show a reflector event. EMarkerStyle is defined in root/include/Gtypes.h
    759 // To remove the photons from the display call FillRflEvent(NULL)
    760 //
    761 void MHCamera::ShowRflEvent(const MRflEvtData *event, EMarkerStyle ms)
    762 {
    763     const Int_t num = event ? event->GetNumPhotons() : 0;
    764 
    765     fPhotons->ExpandCreate(num);
    766     if (num < 1)
    767         return;
    768 
    769     Int_t i=num-1;
    770     do
    771     {
    772         const MRflSinglePhoton &ph = event->GetPhoton(i);
    773         TMarker &m = *static_cast<TMarker*>(fPhotons->UncheckedAt(i));
    774         m.SetX(ph.GetX());
    775         m.SetY(ph.GetY());
    776         m.SetMarkerStyle(ms);
    777     } while (i--);
    778784}
    779785
     
    917923// with the graphical primitive with the mouse!!!
    918924//
    919 // All calcutations are running in pixel coordinates
     925// All calcutations are done in pixel coordinates
    920926//
    921927Int_t MHCamera::DistancetoPrimitive(Int_t px, Int_t py)
     
    939945// ------------------------------------------------------------------------
    940946//
    941 // Execute a mouse event on the camera
    942 //
    943 /*
    944  void MHCamera::ExecuteEvent(Int_t event, Int_t px, Int_t py)
    945  {
    946  cout << "Execute Event Camera " << event << " @ " << px << " " << py << endl;
    947  }
    948  */
    949 
    950 
    951 // ------------------------------------------------------------------------
    952 //
    953947// Function introduced  (31-01-03)  WILL BE REMOVED IN THE FUTURE! DON'T
    954948// USE IT!
     
    960954}
    961955
     956// ------------------------------------------------------------------------
     957//
     958// Function introduced  (31-01-03)  WILL BE REMOVED IN THE FUTURE! DON'T
     959// USE IT!
     960//
    962961Int_t MHCamera::GetPixelIndex(Int_t px, Int_t py) const
    963962{
     
    10191018    cout << "Contents:             " << fArray[idx+1] << "  <";
    10201019    cout << (IsUsed(idx)?"on":"off");
    1021     cout << ">" << endl << endl;
     1020    cout << ">" << endl;
    10221021
    10231022    if (fNotify && fNotify->GetSize()>0)
  • trunk/MagicSoft/Mars/mhist/MHCamera.h

    r2216 r2229  
    55#include "MAGIC.h"
    66#endif
    7 #ifndef ROOT_Gtypes
    8 #include <Gtypes.h>
    9 #endif
    107#ifndef ROOT_TArrayC
    118#include <TArrayC.h>
     
    2118#endif
    2219
    23 #include "MGeomCam.h"
    24 #include "MGeomPix.h"
    25 class TBox;
    26 class TText;
    27 class TArrow;
    28 class TGStatusBar;
    29 
    3020class MGeomCam;
    31 class MHexagon;
    32 class MCurrents;
    3321class MCamEvent;
    3422class MRflEvtData;
    3523class MCerPhotEvt;
    36 class MCerPhotPix;
    3724class MImgCleanStd;
    38 class MPedestalPix;
    39 class MPedestalCam;
    4025
    4126class MHCamera : public TH1D
    4227{
    4328private:
    44     MGeomCam      *fGeomCam;     // pointer to camera geometry
    45 
    46     TArrayC        fUsed;
    47 
    48     TClonesArray  *fPhotons;     // array of reflector photons
     29    MGeomCam      *fGeomCam;     // pointer to camera geometry (y-axis)
     30    TArrayC        fUsed;        // array containing flags
    4931
    5032    TArrayI        fColors;      //! Color conversion table
     
    121103    Double_t GetMaximum() const { return GetMaximum(0/*kTRUE*/); }
    122104
    123     void  ShowRflEvent(const MRflEvtData *event=NULL, EMarkerStyle m=kFullDotMedium);
    124105    void  FillLevels(const MCerPhotEvt &event, Float_t lvl1, Float_t lvl2);
    125106    void  FillLevels(const MCerPhotEvt &event, const MImgCleanStd &clean);
     
    129110    void  FillRandom();
    130111
    131     void  DrawPixelNumbers();
     112    void  DrawPixelIndices();
    132113
    133114    void  PrintInfo() const { Print(""); } // *MENU*
  • trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.cc

    r2221 r2229  
    2828// MHTriggerLvl0
    2929//
    30 // This is intended to be a sort of "level 0 trigger display". What it really
    31 // does is to store the number of events of a data file in which each pixel
    32 // has gone above a given threshold (fPixelThreshold) which is chosen when
    33 // calling the constructor. Displaying a camera view with these values can
    34 // help identify noisy pixels. See the macro pixfixrate.C to see an example
    35 // of its use. Many things are to be fixed. Only inner pixels are shown now
    36 // (which are anyhow those involved in the trigger), and the camera geometry
    37 // (number of pixels, and how many inner ones) is not yet read from the input
    38 // file.
    39 // The "pedestal" we are using is just the signal in the first ADC slice
    40 // (seems reasonable from the inspection of the available test data files).
    41 //
     30// This is intended to be a sort of "level 0 trigger display". What it
     31// really does is to store the number of events of a data file in which
     32// each pixel has gone above a given threshold (fPixelThreshold) which
     33// is chosen when calling the constructor. Displaying a camera view with
     34// these values can help identify noisy pixels. See the macro pixfixrate.C
     35// to see an example of its use.
    4236//
    4337/////////////////////////////////////////////////////////////////////////////
     
    118112// --------------------------------------------------------------------------
    119113//
    120 // Fill the histograms with data from a MCerPhotEvt-Container.
     114// Fill the histograms with data from a MCamEvent-Container.
    121115//
    122116Bool_t MHTriggerLvl0::Fill(const MParContainer *par, const Stat_t w)
     
    136130// --------------------------------------------------------------------------
    137131//
    138 // Set to Unused outer pixels.
     132// Scale by the number of events
    139133//
    140134Bool_t MHTriggerLvl0::Finalize()
  • trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.h

    r2209 r2229  
    1212{
    1313private:
    14     MHCamera *fSum;      // storing the sum
    15     MCamEvent   *fEvt;      //! the current event
     14    MHCamera  *fSum;  // storing the sum
     15    MCamEvent *fEvt;  //! the current event
    1616
    1717    TString fNameEvt;
     
    3636    void Draw(Option_t * ="");
    3737
    38     ClassDef(MHTriggerLvl0, 1) // Histogram to sum level 0 triggers in all pixels
     38    ClassDef(MHTriggerLvl0, 1) // Histogram to count how often a pixel is above threshold
    3939};
    4040
Note: See TracChangeset for help on using the changeset viewer.