Ignore:
Timestamp:
04/07/03 17:28:54 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r1082 r1914  
    6262#include "MArrayB.h"
    6363#include "MRawRunHeader.h"
     64#include "MRawEvtPixelIter.h"
    6465
    6566ClassImp(MRawEvtData);
     
    217218    TString str(opt);
    218219
    219     UInt_t num = 0;
     220    UInt_t id = 0;
    220221
    221222    if (str.BeginsWith("GRAPH", TString::kIgnoreCase))
    222     {
    223223        if (str.Length()>5)
    224             sscanf(&str[5], "%d", &num);
    225 
    226         if (num>=GetNumPixels())
    227             num= GetNumPixels();
    228 
    229         *fLog << inf << "Drawing Graph: Pixel #" << num << " of " << (int)GetNumPixels() << endl;
    230 
    231         const Int_t n = GetNumHiGainSamples();
    232 
    233         Float_t *x = new Float_t[n];
    234         Float_t *y = new Float_t[n];
     224            sscanf(&str[5], "%d", &id);
     225    if (str.BeginsWith("HIST", TString::kIgnoreCase))
     226        if (str.Length()>4)
     227            sscanf(&str[4], "%d", &id);
     228
     229    MRawEvtPixelIter pix(this);
     230    if (!pix.Jump(id))
     231    {
     232        *fLog << warn << "Pixel Id #" << id << " doesn't exist!" << endl;
     233        return;
     234    }
     235
     236    const Byte_t *higains = pix.GetHiGainSamples();
     237
     238    const Int_t n = GetNumHiGainSamples();
     239
     240    TString name = "Pixel No.";
     241    name += pix.GetPixelId();
     242
     243    if (str.BeginsWith("GRAPH", TString::kIgnoreCase))
     244    {
     245        *fLog << inf << "Drawing Graph: Pixel Id #" << pix.GetPixelId();
     246        *fLog << " of " << (int)GetNumPixels() << "Pixels" << endl;
     247
     248        TGraph *graph = new TGraph;
    235249
    236250        for (int i=0; i<n; i++)
    237         {
    238             x[i] = i;
    239             y[i] = (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()];
    240         }
    241 
    242         TGraph *graph = new TGraph(n, x, y);
     251            graph->SetPoint(graph->GetN(), i, higains[i]);
     252
    243253        graph->SetMaximum(256);
    244254        graph->SetMinimum(0);
     
    257267    if (str.BeginsWith("HIST", TString::kIgnoreCase))
    258268    {
    259         *fLog << "Length: " << str.Length() << endl;
    260 
    261         if (str.Length()>4)
    262             sscanf(&str[4], "%d", &num);
    263 
    264         if (num>=GetNumPixels())
    265             num= GetNumPixels();
    266 
    267         *fLog << "Drawing Histogram of Pixel " << num << endl;
    268 
    269         const Int_t n = GetNumHiGainSamples();
    270 
    271         char *name = new char[16];
    272 
    273         sprintf(name, "Pixel No.%d", (*fHiGainPixId)[num]);
     269        *fLog << "Drawing Histogram of Pixel with Id " << pix.GetPixelId() << endl;
    274270
    275271        TH1F *hist = new TH1F(name, "Hi Gain Samples FADC", n, 0, n);
     
    278274
    279275        for (int i=0; i<n; i++)
    280             hist->Fill(0.5+i, (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()]);
     276            hist->Fill(0.5+i, higains[i]);
    281277
    282278        hist->SetBit(kCanDelete);
Note: See TracChangeset for help on using the changeset viewer.