Ignore:
Timestamp:
02/22/01 14:30:10 (24 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r604 r609  
    2626#include "MRawEvtData.h"
    2727
    28 #include <iostream.h>
    2928#include <iomanip.h>
    3029
     
    3534#include <TArrayC.h>
    3635
     36#include "MLog.h"
    3737#include "MArrayS.h"
    3838#include "MArrayB.h"
     
    8787
    8888
    89 void MRawEvtData::Print(Option_t *)
     89void MRawEvtData::Print(Option_t *opt)
    9090{
    9191    //
    9292    // print fadc inforation to screen
     93    // Possible Options:
     94    // - DEC: Print values decimal instead of hexadecimal (default)
    9395    //
    9496    const Byte_t nHiSamp = GetNumHiGainSamples();
     
    98100    const UShort_t nLoPix = fLoGainPixId->GetSize();;
    99101
    100     cout << dec;
    101     cout << "HiGain: " << nHiPix << " Pixels with " << (Int_t)nHiSamp << " Samples" << endl;
    102     cout << "LoGain: " << nLoPix << " Pixels with " << (Int_t)nLoSamp << " Samples" << endl;
     102    fLog->unsetf(ios::showbase);
     103
     104    *fLog << dec;
     105    *fLog << "HiGain: " << nHiPix << " Pixels with " << (Int_t)nHiSamp << " Samples" << endl;
     106    *fLog << "LoGain: " << nLoPix << " Pixels with " << (Int_t)nLoSamp << " Samples";;
     107
     108    TString str(opt);
     109    Int_t manip = str.Contains("dec", TString::kIgnoreCase);
    103110
    104111    Int_t l=0;
    105112    for (int i=0; i<nHiPix; i++)
    106113    {
    107         cout << " " << setfill(' ') << setw(3) << i << ": " << hex << flush;
    108 
    109         cout << setfill('0');
     114        *fLog << endl;
     115        *fLog << " " << setfill(' ') << setw(3) << dec << i << ": ";
     116        *fLog << (manip?dec:hex) << flush;
     117
     118        if (!manip)
     119            *fLog << setfill('0');
    110120
    111121        for (int j=0; j<nHiSamp; j++)
    112             cout << setw(2)
    113                 << ((UShort_t)(*fHiGainFadcSamples)[j+i*nHiSamp]&0xff) << flush;
    114 
    115         if (l<nLoPix && (*fLoGainPixId)[l]==(*fHiGainPixId)[i])
    116122        {
    117             for (int j=0; j<nLoSamp; j++)
    118                 cout << setw(2)
    119                     <<((UShort_t)(*fLoGainFadcSamples)[j+i*nLoSamp]&0xff) << flush;
    120             l++;
     123            *fLog << setw(manip?3:2);
     124            *fLog << ((UShort_t)(*fHiGainFadcSamples)[j+i*nHiSamp]&0xff);
     125            if (manip)
     126                *fLog << ' ';
     127            *fLog << flush;
    121128        }
    122         cout << dec << endl;
     129
     130        if (!(l<nLoPix && (*fLoGainPixId)[l]==(*fHiGainPixId)[i]))
     131            continue;
     132
     133        if (manip)
     134            *fLog << "/ ";
     135
     136        for (int j=0; j<nLoSamp; j++)
     137        {
     138            *fLog << setw(manip?3:2);
     139            *fLog << ((UShort_t)(*fLoGainFadcSamples)[j+i*nLoSamp]&0xff);
     140            if (manip)
     141                *fLog << ' ';
     142            *fLog << flush;
     143        }
     144        l++;
    123145    }
    124     cout << endl;
     146    *fLog << endl;
    125147}
    126148
     
    135157  if (str.BeginsWith("GRAPH", TString::kIgnoreCase))
    136158  {
    137     if (str.Length()>5)
    138       sscanf(&str[5], "%d", &num);
    139    
    140     if (num>=GetNumPixels())
    141       num= GetNumPixels();
    142    
    143     cout << "Drawing Graph of Pixel " << num << endl;
    144    
    145     const Int_t n = GetNumHiGainSamples();
    146    
    147     Float_t *x = new Float_t[n];
    148     Float_t *y = new Float_t[n];
    149    
    150     for (int i=0; i<n; i++)
    151     {
    152       x[i] = i;
    153       y[i] = (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()];
    154     }
    155    
    156     TGraph *graph = new TGraph(n, x, y);
    157     graph->SetMaximum (256) ;
    158     graph->SetMinimum (0) ;
    159    
    160     graph->Draw("AC*");
    161    
    162     return;
     159      if (str.Length()>5)
     160          sscanf(&str[5], "%d", &num);
     161
     162      if (num>=GetNumPixels())
     163          num= GetNumPixels();
     164
     165      *fLog << "Drawing Graph of Pixel " << num << endl;
     166
     167      const Int_t n = GetNumHiGainSamples();
     168
     169      Float_t *x = new Float_t[n];
     170      Float_t *y = new Float_t[n];
     171
     172      for (int i=0; i<n; i++)
     173      {
     174          x[i] = i;
     175          y[i] = (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()];
     176      }
     177
     178      TGraph *graph = new TGraph(n, x, y);
     179      graph->SetMaximum (256) ;
     180      graph->SetMinimum (0) ;
     181
     182      graph->Draw("AC*");
     183
     184      return;
    163185  }
    164  
     186
    165187  if (str.BeginsWith("HIST", TString::kIgnoreCase))
    166188  {
    167     cout << "Length: " << str.Length() << endl;
    168    
    169     if (str.Length()>4)
    170       sscanf(&str[4], "%d", &num);
    171    
    172     if (num>=GetNumPixels())
    173       num= GetNumPixels();
    174    
    175     cout << "Drawing Histogram of Pixel " << num << endl;
    176    
    177     const Int_t n = GetNumHiGainSamples();
    178    
    179     char *name = new char[16];
    180    
    181     sprintf(name, "Pixel No.%d", (*fHiGainPixId)[num]);
    182    
    183     TH1F *hist = new TH1F(name, "Hi Gain Samples FADC", n, 0, n);
    184    
    185     for (int i=0; i<n; i++)
    186       hist->Fill(0.5+i, (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()]);
    187    
    188     hist->Draw();
    189 
    190     return;
     189      *fLog << "Length: " << str.Length() << endl;
     190
     191      if (str.Length()>4)
     192          sscanf(&str[4], "%d", &num);
     193
     194      if (num>=GetNumPixels())
     195          num= GetNumPixels();
     196
     197      *fLog << "Drawing Histogram of Pixel " << num << endl;
     198
     199      const Int_t n = GetNumHiGainSamples();
     200
     201      char *name = new char[16];
     202
     203      sprintf(name, "Pixel No.%d", (*fHiGainPixId)[num]);
     204
     205      TH1F *hist = new TH1F(name, "Hi Gain Samples FADC", n, 0, n);
     206
     207      for (int i=0; i<n; i++)
     208          hist->Fill(0.5+i, (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()]);
     209
     210      hist->Draw();
     211
     212      return;
    191213  }
    192  
    193   cout << "MRawEvtData::Draw: Warning: You must specify either 'GRAPH' or 'HIST'" << endl;
     214
     215  *fLog << "MRawEvtData::Draw: Warning: You must specify either 'GRAPH' or 'HIST'" << endl;
    194216}
    195217
     
    238260    if (nSamp && ns!=nSamp)
    239261    {
    240         cout << "RawEvtData::FillPixel: Error, number of samples in ";
    241         cout << "TArrayC doesn't match actual number" << endl;
     262        *fLog << "RawEvtData::FillPixel: Error, number of samples in ";
     263        *fLog << "TArrayC doesn't match actual number" << endl;
    242264        return;
    243265    }
Note: See TracChangeset for help on using the changeset viewer.