Ignore:
Timestamp:
02/22/01 14:30:10 (24 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mraw
Files:
6 edited

Legend:

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

    r454 r609  
    1212#include "MRawCrateArray.h"
    1313
    14 #include <iostream.h>
     14#include <TClonesArray.h>
    1515
    16 #include <TClonesArray.h>
     16#include "MLog.h"
    1717
    1818ClassImp(MRawCrateArray)
     
    4545void MRawCrateArray::Print(Option_t *opt)
    4646{
    47     cout << "MRawCrateArray::Print()" << endl;
     47    *fLog << "MRawCrateArray::Print()" << endl;
    4848}
    4949
  • 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    }
  • trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc

    r454 r609  
    7171#include "MRawEvtHeader.h"
    7272
    73 #include <iostream.h>
    7473#include <iomanip.h>
    7574#include <fstream.h>
    7675
     76#include "MLog.h"
    7777#include "MTime.h"
    7878#include "MArrayB.h"
     
    145145    //  This member function prints all Data of one Event on screen.
    146146    //
    147     cout << "DAQEvtNr: " << dec << fDAQEvtNumber << "  (";
    148     cout << "Trigger: ";
    149     cout << "NumLvl1=" << fNumTrigLvl1 << " ";
    150     cout << "NumLvl2=" << fNumTrigLvl2 << " ";
    151     cout << "Pattern=" << hex << setfill('0');
    152     cout << setw(2) << fTrigPattern[0];
    153     cout << setw(2) << fTrigPattern[1] << " " << dec;
    154 
    155     cout << "Type=";
     147    *fLog << "DAQEvtNr: " << dec << fDAQEvtNumber << "  (";
     148    *fLog << "Trigger: ";
     149    *fLog << "NumLvl1=" << fNumTrigLvl1 << " ";
     150    *fLog << "NumLvl2=" << fNumTrigLvl2 << " ";
     151    *fLog << "Pattern=" << hex << setfill('0');
     152    *fLog << setw(2) << fTrigPattern[0];
     153    *fLog << setw(2) << fTrigPattern[1] << " " << dec;
     154
     155    *fLog << "Type=";
    156156    switch (fTrigType)
    157157    {
    158158    case 0:
    159         cout << "Trigger";
     159        *fLog << "Trigger";
    160160        break;
    161161    case 1:
    162         cout << "Pedestal";
     162        *fLog << "Pedestal";
    163163        break;
    164164    case 2:
    165         cout << "Calibration";
     165        *fLog << "Calibration";
    166166        break;
    167167    }
    168     cout << ")" << endl;
    169     cout << "Number of Lo Gains On: " << fNumLoGainOn << endl;
     168    *fLog << ")" << endl;
     169    *fLog << "Number of Lo Gains On: " << fNumLoGainOn << endl;
    170170
    171171    for (int i=0; i<fPixLoGainOn->GetSize(); i++)
     
    174174        {
    175175            const UInt_t on = (*fPixLoGainOn)[i]&(1<<j) ? 1 : 0;
    176             cout << on;
     176            *fLog << on;
    177177        }
    178178    }
    179179
    180     cout << endl;
    181 
    182     cout << endl;
     180    *fLog << endl;
     181
     182    *fLog << endl;
    183183
    184184}
  • trunk/MagicSoft/Mars/mraw/MRawFileRead.cc

    r454 r609  
    1111#include "MRawFileRead.h"
    1212
    13 #include <iostream.h>
    1413#include <fstream.h>
    1514
     15#include "MLog.h"
    1616#include "MTime.h"
    1717#include "MParList.h"
     
    3434    fIn = new ifstream(fname);
    3535
    36     /*
    37      FIXME: How can I test whether the construction of
    38             the instance was successfull?
    39     if (!fIn->is_open())
    40     cout << "Error: Trying to open file '" << fname << "'" << endl;
    41     */
     36    if (!(*fIn))
     37        *fLog << "Error: Trying to open file '" << fname << "'" << endl;
    4238}
    4339
     
    5652    if (!fRawRunHeader)
    5753    {
    58         cout << "MRawFileRead::PreProcess - WARNING: MRawRunHeader not found... creating." << endl;
     54        *fLog << "MRawFileRead::PreProcess - WARNING: MRawRunHeader not found... creating." << endl;
    5955        fRawRunHeader = new MRawRunHeader;
    6056        pList->AddToList(fRawRunHeader);
     
    6460    if (!fRawEvtHeader)
    6561    {
    66         cout << "MRawFileRead::PreProcess - WARNING: MRawEvtHeader not found... creating." << endl;
     62        *fLog << "MRawFileRead::PreProcess - WARNING: MRawEvtHeader not found... creating." << endl;
    6763        fRawEvtHeader = new MRawEvtHeader;
    6864        pList->AddToList(fRawEvtHeader);
     
    7268    if (!fRawEvtData)
    7369    {
    74         cout << "MRawFileRead::PreProcess - WARNING: MRawEvtData not found... creating." << endl;
     70        *fLog << "MRawFileRead::PreProcess - WARNING: MRawEvtData not found... creating." << endl;
    7571        fRawEvtData = new MRawEvtData;
    7672        pList->AddToList(fRawEvtData);
     
    8076    if (!fRawCrateArray)
    8177    {
    82         cout << "MRawFileRead::PreProcess - WARNING: MRawCrateArray not found... creating." << endl;
     78        *fLog << "MRawFileRead::PreProcess - WARNING: MRawCrateArray not found... creating." << endl;
    8379        fRawCrateArray = new MRawCrateArray;
    8480        pList->AddToList(fRawCrateArray);
     
    8884    if (!fRawEvtTime)
    8985    {
    90         cout << "MRawFileRead::PreProcess - WARNING: MRawEvtTime not found... creating." << endl;
     86        *fLog << "MRawFileRead::PreProcess - WARNING: MRawEvtTime not found... creating." << endl;
    9187        fRawEvtTime = new MTime("MRawEvtTime");
    9288        pList->AddToList(fRawEvtTime);
  • trunk/MagicSoft/Mars/mraw/MRawFileWrite.cc

    r532 r609  
    1010#include "MRawFileWrite.h"
    1111
    12 #include <iostream.h>
    13 
    1412#include <TFile.h>
    1513#include <TTree.h>
    1614#include <TBranch.h>
    1715
     16#include "MLog.h"
    1817#include "MParList.h"
    1918#include "MRawRunHeader.h"
     
    4342    if (!fOut->IsOpen())
    4443    {
    45         cout << "MRawFileWrite::MRawFileWrite: ERROR: Cannot open file '";
    46         cout << fname << "'" << endl;
     44        *fLog << "MRawFileWrite::MRawFileWrite: ERROR: Cannot open file '";
     45        *fLog << fname << "'" << endl;
    4746    }
    4847}
     
    6261    if (!fRawEvtHeader)
    6362    {
    64         cout << "MRawFileWrite::PreProcess - ERROR: MRawEvtHeader not found... aborting." << endl;
     63        *fLog << "MRawFileWrite::PreProcess - ERROR: MRawEvtHeader not found... aborting." << endl;
    6564        return kFALSE;
    6665    }
     
    6968    if (!fRawEvtData)
    7069    {
    71         cout << "MRawFileWrite::PreProcess - ERROR: MRawEvtData not found... aborting." << endl;
     70        *fLog << "MRawFileWrite::PreProcess - ERROR: MRawEvtData not found... aborting." << endl;
    7271        return kFALSE;
    7372    }
     
    7675    if (!fRawCrateArray)
    7776    {
    78         cout << "MRawFileWrite::PreProcess - ERROR: MRawCrateArray not found... aborting." << endl;
     77        *fLog << "MRawFileWrite::PreProcess - ERROR: MRawCrateArray not found... aborting." << endl;
    7978        return kFALSE;
    8079    }
     
    8382    if (!fRawEvtTime)
    8483    {
    85         cout << "MRawFileWrite::PreProcess - WARNING: MRawEvtTime not found... aborting." << endl;
     84        *fLog << "MRawFileWrite::PreProcess - WARNING: MRawEvtTime not found... aborting." << endl;
    8685        return kFALSE;
    8786    }
     
    9089    if (!fRawRunHeader)
    9190    {
    92         cout << "MRawFileWrite::PreProcess - ERROR: MRawRunHeader not found... aborting." << endl;
     91        *fLog << "MRawFileWrite::PreProcess - ERROR: MRawRunHeader not found... aborting." << endl;
    9392        return kFALSE;
    9493    }
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc

    r456 r609  
    1212#include <iomanip.h>
    1313
    14 //#include <TClass.h>
    15 
     14#include "MLog.h"
    1615#include "MArrayS.h"
    1716
     
    4645    if (fMagicNumber != kMagicNumber)
    4746    {
    48         cout << "Error: Wrong Magic Number: Not a Magic File!" << endl;
     47        *fLog << "Error: Wrong Magic Number: Not a Magic File!" << endl;
    4948        return;
    5049    }
     
    8887    // print run header information on screen
    8988    //
    90     cout << "MagicNumber:  0x" << hex << fMagicNumber << " - " << (fMagicNumber==0xc0c0?"OK":"Wrong!") << endl;
    91     cout << "Version:      " << dec << "Format=" << fFormatVersion << "  ";
    92     cout << "Software=" << fSoftVersion << endl;
    93     cout << "RunNumber:    " << fRunNumber << " (Type=";
     89    *fLog << "MagicNumber:  0x" << hex << fMagicNumber << " - " << (fMagicNumber==0xc0c0?"OK":"Wrong!") << endl;
     90    *fLog << "Version:      " << dec << "Format=" << fFormatVersion << "  ";
     91    *fLog << "Software=" << fSoftVersion << endl;
     92    *fLog << "RunNumber:    " << fRunNumber << " (Type=";
    9493    switch (fRunType)
    9594    {
    9695    case 0:
    97         cout << "Data";
     96        *fLog << "Data";
    9897        break;
    9998    case 1:
    100         cout << "Pedestal";
     99        *fLog << "Pedestal";
    101100        break;
    102101    case 2:
    103         cout << "Calibration";
     102        *fLog << "Calibration";
    104103        break;
    105104    }
    106     cout << ")" << endl;
    107     cout << "ProjectName: '" << fProjectName << "'" << endl;
    108     cout << "Source:      '" << fSourceName << "' " << "  ";
    109     cout << fSourceEpochChar << dec << fSourceEpochDate << endl;
    110     cout << "Date:         " << setprecision(1) << setiosflags(ios::fixed) << fMJD << " (MJD)  " << fDateYear << "/" << fDateMonth << "/" << fDateDay << endl;
    111     cout << "Crates:       " << fNumCrates << " x " << fNumPixInCrate << " Pixel/Crate = " << fNumCrates*fNumPixInCrate << " Pixel/Evt" << endl;
    112     cout << "Samples:      " << fNumSamplesLoGain << "/" << fNumSamplesHiGain << " (lo/hi) = " << (fNumSamplesLoGain+fNumSamplesHiGain) * fNumCrates * fNumPixInCrate /1024 << "kB/Evt" << endl;
    113     cout << "Evt Counter:  " << fNumEvents << endl;
     105    *fLog << ")" << endl;
     106    *fLog << "ProjectName: '" << fProjectName << "'" << endl;
     107    *fLog << "Source:      '" << fSourceName << "' " << "  ";
     108    *fLog << fSourceEpochChar << dec << fSourceEpochDate << endl;
     109    *fLog << "Date:         " << setprecision(1) << setiosflags(ios::fixed) << fMJD << " (MJD)  " << fDateYear << "/" << fDateMonth << "/" << fDateDay << endl;
     110    *fLog << "Crates:       " << fNumCrates << " x " << fNumPixInCrate << " Pixel/Crate = " << fNumCrates*fNumPixInCrate << " Pixel/Evt" << endl;
     111    *fLog << "Samples:      " << fNumSamplesLoGain << "/" << fNumSamplesHiGain << " (lo/hi) = " << (fNumSamplesLoGain+fNumSamplesHiGain) * fNumCrates * fNumPixInCrate /1024 << "kB/Evt" << endl;
     112    *fLog << "Evt Counter:  " << fNumEvents << endl;
    114113
    115     cout << hex;
     114    *fLog << hex;
    116115    for (int i=0; i<GetNumPixel(); i++)
    117         cout << setfill('0') << setw(3) << (*fPixAssignment)[i] << " ";
    118     cout << hex << endl;
     116        *fLog << setfill('0') << setw(3) << (*fPixAssignment)[i] << " ";
     117    *fLog << hex << endl;
    119118
    120     cout << endl;
     119    *fLog << endl;
    121120}
    122121
Note: See TracChangeset for help on using the changeset viewer.