Ignore:
Timestamp:
06/16/03 13:45:01 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mraw
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mraw/MRawEvtData.cc

    r2173 r2178  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2001
     18!   Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2003
    2121!
    2222!
     
    4545//  --------------------------
    4646//  see fHiGainFadcSaples
     47//
     48//
     49//   Version 2: Derives from MCamEvent now
    4750//
    4851/////////////////////////////////////////////////////////////////////////////
     
    232235    if (!pix.Jump(id))
    233236    {
    234         *fLog << warn << "Pixel Id #" << id << " doesn't exist!" << endl;
     237        *fLog << warn << "Pixel Idx #" << id << " doesn't exist!" << endl;
    235238        return;
    236239    }
    237240
    238241    const Byte_t *higains = pix.GetHiGainSamples();
    239 
    240     const Int_t n = GetNumHiGainSamples();
    241 
    242     TString name = "Pixel No.";
     242    const Byte_t *logains = pix.GetLoGainSamples();
     243
     244    const Int_t nh = GetNumHiGainSamples();
     245    const Int_t nl = GetNumLoGainSamples();
     246
     247    TString name = "Pixel Idx.";
    243248    name += pix.GetPixelId();
    244249
     250    Bool_t same = str.Contains("same", TString::kIgnoreCase);
     251
    245252    if (str.BeginsWith("GRAPH", TString::kIgnoreCase))
    246253    {
    247         *fLog << inf << "Drawing Graph: Pixel Id #" << pix.GetPixelId();
     254        *fLog << inf << "Drawing Graph: Pixel Idx #" << pix.GetPixelId();
    248255        *fLog << " of " << (int)GetNumPixels() << "Pixels" << endl;
    249256
    250257        TGraph *graph = new TGraph;
    251258
    252         for (int i=0; i<n; i++)
     259        for (int i=0; i<nh; i++)
    253260            graph->SetPoint(graph->GetN(), i, higains[i]);
    254261
     
    257264
    258265        graph->SetBit(kCanDelete);
    259         graph->Draw("AC*");
     266        graph->Draw(same ? "C*" : "AC*");
    260267
    261268        TH1F *hist = graph->GetHistogram();
     
    269276    if (str.BeginsWith("HIST", TString::kIgnoreCase))
    270277    {
    271         *fLog << "Drawing Histogram of Pixel with Id " << pix.GetPixelId() << endl;
    272 
    273         TH1F *hist = new TH1F(name, "Hi Gain Samples FADC", n, 0, n);
    274         hist->SetXTitle("Time/FADC Slices");
    275         hist->SetYTitle("Signal/FADC Units");
    276 
    277         for (int i=0; i<n; i++)
    278             hist->Fill(0.5+i, higains[i]);
    279 
    280         hist->SetBit(kCanDelete);
    281         hist->Draw();
    282 
     278        // FIXME: Add Legend
     279        *fLog << "Drawing Histogram of Pixel with Idx " << pix.GetPixelId() << endl;
     280
     281        TH1F *histh = new TH1F(name, "FADC Samples",      nh, -0.5, nh-.5);
     282        histh->SetXTitle("Time [FADC Slices]");
     283        histh->SetYTitle("Signal [FADC Units]");
     284        histh->SetDirectory(NULL);
     285        for (int i=0; i<nh; i++)
     286            histh->Fill(i, higains[i]);
     287        histh->SetBit(kCanDelete);
     288        histh->Draw(same ? "same" : "");
     289
     290        if (nh>0)
     291        {
     292            TH1F *histl = new TH1F(name+";2", "FADC Samples", nl, -0.5, nl-.5);
     293            histl->SetLineColor(kBlue);
     294            histl->SetDirectory(NULL);
     295            for (int i=0; i<nl; i++)
     296                histl->Fill(i, logains[i]);
     297            histl->SetBit(kCanDelete);
     298            histl->Draw("same");
     299        }
    283300        return;
    284301    }
     
    447464}
    448465
     466Bool_t MRawEvtData::GetPixelContent(Float_t &val, Int_t idx, Float_t ratio, Int_t type) const
     467{
     468    MRawEvtPixelIter Next(const_cast<MRawEvtData*>(this));
     469    if (!Next.Jump(idx))
     470        return kFALSE;
     471
     472    val = Next.GetSumHiGainSamples();
     473    return kTRUE;
     474}
  • trunk/MagicSoft/Mars/mraw/MRawEvtData.h

    r2173 r2178  
    22#define MARS_MRawEvtData
    33
    4 #ifndef MARS_MParContainer
    5 #include "MParContainer.h"
     4#ifndef MARS_MCamEvent
     5#include "MCamEvent.h"
    66#endif
    77
     
    1616class MArrayB;
    1717
    18 class MRawEvtData : public MParContainer
     18#include <iostream.h>
     19
     20class MRawEvtData : public MCamEvent
    1921{
    2022    friend class MRawEvtPixelIter;
     
    6365    void ReadEvt(istream &fin);
    6466
    65     ClassDef(MRawEvtData, 1) //Container to store the raw Event Data
     67    Bool_t GetPixelContent(Float_t &val, Int_t idx, Float_t ratio=1, Int_t type=0) const;
     68    void   DrawPixelContent(Int_t num) const
     69    {
     70        TString s("HIST");
     71        s += num;
     72        const_cast<MRawEvtData*>(this)->Draw(s);
     73    }
     74
     75    ClassDef(MRawEvtData, 2) //Container to store the raw Event Data
    6676};
    6777
  • trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc

    r1548 r2178  
    187187}
    188188
     189Float_t MRawEvtPixelIter::GetVarHiGainSamples() const
     190{
     191    Byte_t *ptr = fHiGainPos;
     192    const Byte_t *end = ptr + fNumHiGainSamples;
     193
     194    ULong_t sum=0;
     195    ULong_t sqsum=0;
     196
     197    do {
     198        sum += *ptr;
     199        sqsum += (*ptr)*(*ptr);
     200    } while (++ptr != end);
     201
     202    return (sqsum-(Float_t)sum*sum/fNumHiGainSamples)/(fNumHiGainSamples-1);
     203}
     204
    189205// --------------------------------------------------------------------------
    190206//
  • trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h

    r2123 r2178  
    7979    ULong_t GetSumHiGainSamples() const;
    8080    ULong_t GetSumSqrHiGainSamples() const;
     81    Float_t GetVarHiGainSamples() const;
    8182
    8283    Bool_t HasLoGain() const
  • trunk/MagicSoft/Mars/mraw/Makefile

    r1160 r2178  
    2222#  connect the include files defined in the config.mk file
    2323#
    24 INCLUDES = -I. -I../mbase -I../MBase
     24INCLUDES = -I. -I../mbase -I../MBase -I../mgui
    2525
    2626#------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.