Changeset 609 for trunk/MagicSoft


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

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r604 r609  
    11                                                                  -*-*- END -*-*-
     2
     3 2000/02/22: Thomas Bretz
     4
     5 * merpp.cc, readraw.cc, mbase/MParContainer.cc, mbase/MParList.cc,
     6   mbase/MParList.h, mbase/MReadTree.cc, mbase/MTask.cc, mbase/MTask.h,
     7   mbase/MTaskList.cc, mbase/MTime.cc, mdatacheck/MDumpEvtHeader.cc,
     8   mdatacheck/MShowSpect.cc, meventdisp/MGFadcDisp.cc, mgui/MGPrototyp.h,
     9   mmc/MHeaderTrig.cxx, mraw/MRawCrateArray.cc, mraw/MRawEvtData.cc,
     10   mraw/MRawEvtHeader.cc, mraw/MRawFileRead.cc, mraw/MRawFileWrite.cc,
     11   mraw/MRawRunHeader.cc:
     12   exchanged cout with the new logging style (gLog, *fLog)
     13   
     14 * mraw/MRawEvtData.cc: added 'dec' option to Print
     15 
     16 * mmc/MHeaderTrig.cxx, mmc/MMcEvt.cxx, mmc/MMcTrig.cxx:
     17   small changes to the Print funtions
     18   
    219 
    320 2000/02/21: Thomas Bretz
  • trunk/MagicSoft/Mars/mbase/MAGIC.h

    r604 r609  
    3434// default pipes all output to the stdout
    3535//
     36
     37//This will be fixed soon. It doesn't work with Alphas at the moment
    3638class MLog;
     39#ifndef __CINT__
    3740extern MLog gLog;
     41#endif
    3842
    3943#endif
  • trunk/MagicSoft/Mars/mbase/MLog.cc

    r604 r609  
    4646}
    4747
    48 void MLog::Write()
     48void MLog::WriteBuffer()
    4949{
    5050    const int len = fPPtr - fBase;
     
    7676{
    7777//    cout << "*sync*";
    78     Write();
     78    WriteBuffer();
    7979
    8080    if (fDevice&eStdout)
     
    100100    // If the buffer is not really filled i is EOF(-1).
    101101    //
    102     if (fOutputLevel < fDebugLevel)
    103     {
    104         *fPPtr++ = (char)i;
     102    if (fOutputLevel >= fDebugLevel)
     103        return 0;
    105104
    106         if (fPPtr == fEPtr)
    107             Write();
    108     }
     105    *fPPtr++ = (char)i;
     106
     107    if (fPPtr == fEPtr)
     108        WriteBuffer();
    109109
    110110    return 0;
  • trunk/MagicSoft/Mars/mbase/MLog.h

    r604 r609  
    3636    void Init();
    3737
    38     void Write();
     38    void WriteBuffer();
    3939    int sync();
    4040    int overflow(int i); // i=EOF means not a real overflow
  • trunk/MagicSoft/Mars/mbase/MParContainer.cc

    r458 r609  
    1313#include "MParContainer.h"
    1414
    15 #include <iostream.h>    // cout
    16 
    1715#include <TClass.h>      // IsA
    1816#include <TROOT.h>       // TROOT::Identlevel
    1917#include <TVirtualPad.h> // gPad
     18
     19#include "MLog.h"
    2020
    2121ClassImp(MParContainer)
     
    7878
    7979   TROOT::IndentLevel();
    80    cout <<"OBJ: " << IsA()->GetName() << "\t" << GetName() << "\t" << GetTitle() << " : "
     80   *fLog <<"OBJ: " << IsA()->GetName() << "\t" << GetName() << "\t" << GetTitle() << " : "
    8181        << Int_t(TestBit(kCanDelete)) << endl;
    8282}
     
    8787   // Print MParContainer name and title.
    8888
    89    cout <<"OBJ: " << IsA()->GetName() << "\t" << GetName() << "\t" << GetTitle() << endl;
     89   *fLog <<"OBJ: " << IsA()->GetName() << "\t" << GetName() << "\t" << GetTitle() << endl;
    9090}
    9191
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r604 r609  
    2020#endif
    2121
    22 class MLog;
    2322class ofstream;
    2423class ifstream;
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r608 r609  
    1515//                                                                         //
    1616/////////////////////////////////////////////////////////////////////////////
    17 
    1817#include "MParList.h"
    1918
    2019#include <TNamed.h>
    2120
    22 #include "MParContainer.h"
     21#include "MLog.h"
    2322
    2423ClassImp(MParList)
     
    5756        cont->SetLogStream(log);
    5857
    59 //    SetLogStream(log);
     58    MParContainer::SetLogStream(log);
    6059}
    6160
     
    7473  if (!obj) return kTRUE;
    7574
    76   cout << "Adding " << obj->GetName() << " to " << GetName() << "... " << flush;
     75  *fLog << "Adding " << obj->GetName() << " to " << GetName() << "... " << flush;
    7776  //
    7877  //  check if it is in the list yet
     
    8079  if (fContainer.FindObject(obj))
    8180  {
    82       cout << "WARNING: MParList::add: Container already added" << endl;
     81      *fLog << "WARNING: MParList::add: Container already added" << endl;
    8382      return kTRUE;
    8483  }
     
    9291      if (!fContainer.FindObject(where))
    9392      {
    94           cout << "ERROR: MParList::add: Cannot find parameter container after which the new one should be added!" << endl;
     93          *fLog << "ERROR: MParList::add: Cannot find parameter container after which the new one should be added!" << endl;
    9594          return kFALSE;
    9695      }
     
    9897
    9998  fContainer.Add(obj);
    100   cout << "Done." << endl;
     99  *fLog << "Done." << endl;
    101100
    102101  return kTRUE;
     
    118117  //   print some information about the current status of MParList
    119118  //
    120   cout << "ParList: " << this->GetName() << " <" << this->GetTitle() << ">" << endl;
    121   cout << endl;
     119  *fLog << "ParList: " << this->GetName() << " <" << this->GetTitle() << ">" << endl;
     120  *fLog << endl;
    122121 
    123122}
  • trunk/MagicSoft/Mars/mbase/MParList.h

    r604 r609  
    1414#endif
    1515
    16 #include <iostream.h>
    17 
    1816#ifndef ROOT_TOrdCollection
    1917#include "TOrdCollection.h"
    2018#endif
     19#ifndef MPARCONTAINER_H
     20#include "MParContainer.h"
     21#endif
    2122
    2223class MLog;
    23 class MParContainer;
    2424
    25 class MParList : public TObject
     25class MParList : public MParContainer
    2626{
    2727private:
  • trunk/MagicSoft/Mars/mbase/MReadTree.cc

    r585 r609  
    1515#include "MReadTree.h"
    1616
    17 #include <iostream.h>
    1817#include <fstream.h>
    1918
     
    2221#include <TObjArray.h>
    2322
     23#include "MLog.h"
    2424#include "MTime.h"
    2525#include "MParList.h"
     
    4949    if (!fFile->IsOpen())
    5050    {
    51         cout << "MReadTree::PreProcess: ERROR: Cannot open file '";
    52         cout << fFileName << "'" << endl;
     51        *fLog << "MReadTree::PreProcess: ERROR: Cannot open file '";
     52        *fLog << fFileName << "'" << endl;
    5353        return kFALSE;
    5454    }
     
    5858    if (!fTree)
    5959    {
    60         cout << "MReadTree::PreProcess: ERROR: Cannot open tree '";
    61         cout << fTreeName << "'" << endl;
     60        *fLog << "MReadTree::PreProcess: ERROR: Cannot open tree '";
     61        *fLog << fTreeName << "'" << endl;
    6262        return kFALSE;
    6363    }
     
    6666    fNumEntry   = 0;
    6767
    68     cout << "File: '" << fFileName << "'  Tree: '" << fTreeName;
    69     cout << "' with " << fNumEntries << " Entries opened." << endl;
     68    *fLog << "File: '" << fFileName << "'  Tree: '" << fTreeName;
     69    *fLog << "' with " << fNumEntries << " Entries opened." << endl;
    7070
    7171    //
     
    9696            // if object is not existing in the list try to create one
    9797            //
    98             cout << "MReadTree::PreProcess - WARNING: '" << name << "' not found... creating." << endl;
     98            *fLog << "MReadTree::PreProcess - WARNING: '" << name << "' not found... creating." << endl;
    9999
    100100            //
     
    109109                // we cannot proceed reading this branch
    110110                //
    111                 cout << "MReadTree::PreProcess - Warning: Class '" << name << "' not existing in dictionary. Branch skipped." << endl;
     111                *fLog << "MReadTree::PreProcess - Warning: Class '" << name << "' not existing in dictionary. Branch skipped." << endl;
    112112                continue;
    113113            }
     
    117117            //
    118118            pcont = (MParContainer*)cls->New();
    119             cout << pcont << endl;
     119            *fLog << pcont << endl;
    120120            pList->AddToList(pcont);
    121121        }
     
    180180    if (fNumEntry < dec/*+1*/)
    181181    {
    182         cout << "MReadTree::SetPrevEvent: WARNING: " << fNumEntry/*-1*/ << "-" << dec << " out of Range." << endl;
     182        *fLog << "MReadTree::SetPrevEvent: WARNING: " << fNumEntry/*-1*/ << "-" << dec << " out of Range." << endl;
    183183        return kFALSE;
    184184    }
     
    203203    if (fNumEntry+inc/*-1*/ >= fNumEntries)
    204204    {
    205         cout << "MReadTree::SkipEvents: WARNING: " << fNumEntry/*-1*/ << "+" << inc << " out of Range." << endl;
     205        *fLog << "MReadTree::SkipEvents: WARNING: " << fNumEntry/*-1*/ << "+" << inc << " out of Range." << endl;
    206206        return kFALSE;
    207207    }
     
    218218    if (nr>=fNumEntries)
    219219    {
    220         cout << "MReadTree::SetEventNum: WARNING: " << nr << " out of Range." << endl;
     220        *fLog << "MReadTree::SetEventNum: WARNING: " << nr << " out of Range." << endl;
    221221        return kFALSE;
    222222    }
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r458 r609  
    3737#include "MTask.h"
    3838
    39 #include <string.h>
    40 #include <iostream.h>
    41 
    4239ClassImp(MTask)
    4340
    4441Bool_t MTask::PreProcess( MParList *pList )
    4542{
    46   //
    47   // This is processed before the eventloop starts
    48   //
    49   // It is the job of the PreProcess to connect the tasks
    50   // with the right container in the parameter list.
    51   //
    52   // the virtual implementation returns kTRUE
    53   //
    54   return kTRUE;
     43    //
     44    // This is processed before the eventloop starts
     45    //
     46    // It is the job of the PreProcess to connect the tasks
     47    // with the right container in the parameter list.
     48    //
     49    // the virtual implementation returns kTRUE
     50    //
     51    return kTRUE;
    5552}
    56 
    5753
    5854Bool_t MTask::Process()
    5955{
    60   //
    61   // This is processed for every event in the eventloop
    62   //
    63   // the virtual implementation returns kTRUE
    64   //
    65   return kTRUE;
     56    //
     57    // This is processed for every event in the eventloop
     58    //
     59    // the virtual implementation returns kTRUE
     60    //
     61    return kTRUE;
    6662}
    6763
    6864Bool_t MTask::PostProcess()
    6965{
    70   //
    71   // This is processed after the eventloop starts
    72   //
    73   // the virtual implementation returns kTRUE
    74   //
    75   return kTRUE;
     66    //
     67    // This is processed after the eventloop starts
     68    //
     69    // the virtual implementation returns kTRUE
     70    //
     71    return kTRUE;
    7672}
    7773
  • trunk/MagicSoft/Mars/mbase/MTask.h

    r604 r609  
    1818class MTask : public MInputStreamID
    1919{
    20     MLog *fLog; //!
    21 
    2220public:
    2321    ~MTask()
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r608 r609  
    99#include "MTaskList.h"
    1010
    11 #include <iostream.h>
    12 
     11#include "MLog.h"
    1312#include "MParList.h"
    1413#include "MInputStreamID.h"
     
    5655        task->SetLogStream(log);
    5756
    58 //    SetLogStream(log);
     57    MParContainer::SetLogStream(log);
    5958}
    6059
     
    7372    if (fTasks.FindObject(task))
    7473    {
    75         cout << "WARNING: MTaskList::AddToList: Task already existing." << endl;
     74        *fLog << "WARNING: MTaskList::AddToList: Task already existing." << endl;
    7675        return kTRUE;
    7776    }
     
    7978    if (fTasks.FindObject(name))
    8079    {
    81         cout << "WARNING: MTaskList::AddToList: '" << name << "' exists in List already." << endl;
     80        *fLog << "WARNING: MTaskList::AddToList: '" << name << "' exists in List already." << endl;
    8281        return kTRUE;
    8382    }
     
    9291    }
    9392
    94     cout << "Adding " << name << " to " << GetName() << " for " << type << "... " << flush;
     93    *fLog << "Adding " << name << " to " << GetName() << " for " << type << "... " << flush;
    9594
    9695    task->SetStreamId(type);
    9796    fTasks.Add(task);
    9897
    99     cout << "Done." << endl;
     98    *fLog << "Done." << endl;
    10099
    101100    return kTRUE;
     
    108107    // do pre processing (before eventloop) of all tasks in the task-list
    109108    //
    110     cout << "Preprocessing... " << flush;
     109    *fLog << "Preprocessing... " << flush;
    111110
    112111    //
     
    122121    while ( (task=(MTask*)Next()) )
    123122    {
    124         cout << task->GetName() << "... " << flush;
     123        *fLog << task->GetName() << "... " << flush;
    125124
    126125        if (!task->PreProcess( pList ))
     
    128127    }
    129128
    130     cout << endl;
     129    *fLog << endl;
    131130
    132131    return kTRUE;
     
    184183  //
    185184
    186     cout << "Postprocessing... " << flush;
     185    *fLog << "Postprocessing... " << flush;
    187186
    188187  //
     
    198197  while ( (task=(MTask*)Next()) )
    199198  {
    200       cout << task->GetName() << "... " << flush;
     199      *fLog << task->GetName() << "... " << flush;
    201200
    202201      if (!task->PostProcess())
     
    204203  }
    205204
    206   cout << endl;
     205  *fLog << endl;
    207206
    208207  return kTRUE;
     
    213212void MTaskList::Print(Option_t *t)
    214213{
    215   cout << "TaskList: " << this->GetName() << " <" <<  this->GetTitle() << ">" << endl;
     214  *fLog << "TaskList: " << this->GetName() << " <" <<  this->GetTitle() << ">" << endl;
    216215 
    217216  fTasks.Print();
    218217
    219   cout << endl;
    220 }
    221 
     218  *fLog << endl;
     219}
     220
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

    r604 r609  
    2626    TOrdCollection fTasks;      // Container for the ordered list of different tasks
    2727
    28 
    2928public:
    3029    MTaskList(const char *title=NULL);
  • trunk/MagicSoft/Mars/mbase/MTime.cc

    r458 r609  
    99#include "MTime.h"
    1010
    11 #include <iostream.h>
    1211#include <iomanip.h>
     12
     13#include "MLog.h"
    1314
    1415ClassImp(MTime)
    1516
    1617void MTime::Print(Option_t *)
    17 {
    18     cout << "MTime Information:  " << hex
    19         << " 0x" <<setfill('0') << setw(2) << fTimeStamp[0]
    20         << " 0x" <<setfill('0') << setw(2) << fTimeStamp[1] << endl << endl;
     18{
     19    fLog->setf(ios::showbase);
     20    *fLog << "MTime Information:  " << hex
     21        << " " <<setfill('0') << setw(2) << fTimeStamp[0]
     22        << " " <<setfill('0') << setw(2) << fTimeStamp[1] << endl << endl;
    2123}
    22     /*
    23 inline Bool_t operator<(MTime &t1, MTime &t2)
    24 {
    25     return (t1.GetTimeHi()<=t2.GetTimeHi()) && (t1.GetTimeLo()<t2.GetTimeLo());
    26 }
    2724
    28 inline Bool_t operator>(MTime &t1, MTime &t2)
    29 {
    30     return (t1.GetTimeHi()>=t2.GetTimeHi()) && (t1.GetTimeLo()>t2.GetTimeLo());
    31 }
    32 
    33 inline Bool_t operator<=(MTime &t1, MTime &t2)
    34 {
    35     return (t1.GetTimeHi()<=t2.GetTimeHi()) && (t1.GetTimeLo()<=t2.GetTimeLo());
    36 }
    37 
    38 inline Bool_t operator>=(MTime &t1, MTime &t2)
    39 {
    40     return (t1.GetTimeHi()>=t2.GetTimeHi()) && (t1.GetTimeLo()>=t2.GetTimeLo());
    41 }
    42 
    43 inline Bool_t operator==(MTime &t1, MTime &t2)
    44 {
    45     return (t1.GetTimeLo()==t2.GetTimeLo()) && (t1.GetTimeHi()==t2.GetTimeHi());
    46 }
    47 */
  • trunk/MagicSoft/Mars/mdatacheck/MDumpEvtHeader.cc

    r531 r609  
    11#include "MDumpEvtHeader.h"
     2
     3#include <iostream.h>
    24
    35#include "MParList.h"
  • trunk/MagicSoft/Mars/mdatacheck/MShowSpect.cc

    r531 r609  
    11#include "MShowSpect.h"
     2
     3#include <iostream.h>
    24
    35#include "MParList.h"      // MParList
     
    3537    {
    3638      cout << "ERROR: MShowSpect::PreProc(): " << fHistName << " not found!" << endl;
    37       return kFALSE ;
     39      return kFALSE;
    3840    }
    3941 
    40   return (kTRUE) ;
     42  return kTRUE;
    4143}
    4244
     
    4850  new MGDisplayAdc(fHists, gClient->GetRoot(), gClient->GetRoot(), 600, 600);
    4951
    50   return (kTRUE) ;
     52  return kTRUE;
    5153}
    5254
  • trunk/MagicSoft/Mars/merpp.cc

    r458 r609  
    1 #include <iostream.h>
    2 
    31#include <TSystem.h>
    42
     
    108#include "MRawFileWrite.h"
    119
     10#include "MLog.h"
     11#include "MTime.h"
     12#include "MRawEvtData.h"
    1213#include "MRawRunHeader.h"
    1314#include "MRawEvtHeader.h"
    14 #include "MRawEvtData.h"
    1515#include "MRawCrateArray.h"
    16 #include "MTime.h"
    1716#include "MInputStreamID.h"
    1817
     
    3433int main(const int argc, const char **argv)
    3534{
    36     cout << "==================================================" << endl ;
    37     cout << "                   MERPP v0.1" << endl;
    38     cout << "      MARS Merging and Preprocessing Program" << endl ;
    39     cout << "            Compiled on <" << __DATE__ << ">" << endl ;
    40     cout << "==================================================" << endl ;
    41     cout << endl;
     35    gLog << "==================================================" << endl ;
     36    gLog << "                   MERPP v0.1" << endl;
     37    gLog << "      MARS Merging and Preprocessing Program" << endl ;
     38    gLog << "            Compiled on <" << __DATE__ << ">" << endl ;
     39    gLog << "==================================================" << endl ;
     40    gLog << endl;
    4241
    4342    //
     
    4645    if (argc!=3)
    4746    {
    48         cout << "Sorry the usage is:" << endl;
    49         cout << "   merpp inputfile outputfile" << endl << endl;
     47        gLog << "Sorry the usage is:" << endl;
     48        gLog << "   merpp inputfile outputfile" << endl << endl;
    5049        return -1;
    5150    }
     
    6160    if (gSystem->AccessPathName(argv[1], kFileExists))
    6261    {
    63         cout << "Sorry, the file '" << argv[1] << "' doesn't exist." << endl;
     62        gLog << "Sorry, the file '" << argv[1] << "' doesn't exist." << endl;
    6463        return -1;
    6564    }
    6665
    6766    if (!gSystem->AccessPathName(argv[2], kFileExists))
    68         cout << "Warning: The file '" << argv[2] << "' exists." << endl;
     67        gLog << "Warning: The file '" << argv[2] << "' exists." << endl;
    6968    else
    7069        if (!gSystem->AccessPathName(argv[2], kWritePermission))
    7170        {
    72             cout << "Sorry, you don't have write permission for '" << argv[2] << "'." << endl;
     71            gLog << "Sorry, you don't have write permission for '" << argv[2] << "'." << endl;
    7372            return -1;
    7473        }
  • trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc

    r591 r609  
    22
    33#include <stdlib.h>
     4#include <iostream.h>
    45
    56#include <TGButton.h>      // TGPictureButton
     
    272273   // window menu item is selected.
    273274
    274   delete this ;
     275    delete this ;
    275276}
    276277       
  • trunk/MagicSoft/Mars/mgui/MGPrototyp.h

    r587 r609  
    99#include <TGFrame.h>
    1010#endif
    11 
    1211
    1312class TGMenuBar;
  • trunk/MagicSoft/Mars/mgui/MHexagon.h

    r589 r609  
    1 #ifndef M_HEXAGON
    2 #define M_HEXAGON
     1#ifndef MHEXAGON_H
     2#define MHEXAGON_H
    33
    44//////////////////////////////////////////////////////////////
  • 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
  • trunk/MagicSoft/Mars/readraw.cc

    r585 r609  
    1 #include <iostream.h>
     1//#include <iostream.h>
    22
    33#include <TSystem.h>
     
    1111#include "MEvtLoop.h"
    1212
     13#include "MLog.h"
    1314#include "MTime.h"
    1415#include "MRawRunHeader.h"
     
    3132int main(const int argc, const char **argv)
    3233{
    33     cout << "==================================================" << endl ;
    34     cout << "                   ReadRaw v0.1" << endl;
    35     cout << "      MARS Merging and Preprocessing Program" << endl ;
    36     cout << "            Compiled on <" << __DATE__ << ">" << endl ;
    37     cout << "==================================================" << endl ;
    38     cout << endl;
     34    gLog << "==================================================" << endl ;
     35    gLog << "                   ReadRaw v0.1" << endl;
     36    gLog << "      MARS Merging and Preprocessing Program" << endl ;
     37    gLog << "            Compiled on <" << __DATE__ << ">" << endl ;
     38    gLog << "==================================================" << endl ;
     39    gLog << endl;
    3940
    4041    //
     
    4344    if (argc!=2)
    4445    {
    45         cout << "Sorry the usage is:" << endl;
    46         cout << "   readraw inputfile" << endl << endl;
     46        gLog << "Sorry the usage is:" << endl;
     47        gLog << "   readraw inputfile" << endl << endl;
    4748        return -1;
    4849    }
     
    5859    if (gSystem->AccessPathName(argv[1], kFileExists))
    5960    {
    60         cout << "Sorry, the file '" << argv[1] << "' doesn't exist." << endl;
     61        gLog << "Sorry, the file '" << argv[1] << "' doesn't exist." << endl;
    6162        return -1;
    6263    }
     
    7475    //  open the file
    7576    //
    76     cout << " Open the file " << endl ;
     77    gLog << " Open the file " << endl ;
    7778    TFile input(argv[1], "READ");
    7879
     
    8081    // open the Run Header and read in
    8182    //
    82     cout << " Check the RunHeader " << endl ;
     83    gLog << " Check the RunHeader " << endl ;
    8384    TTree *runtree = (TTree*) input.Get("RunHeaders") ;
    8485   
    8586    if (!runtree)
    8687    {
    87         cout << endl
     88        gLog << endl
    8889            << "  WARNING: This file has NO RunHeader "
    8990            << endl << endl ;
     
    9192    else
    9293    {
    93         cout << " Entries in Tree RunHeaders: " << dec << runtree->GetEntries() << endl ;
     94        gLog << " Entries in Tree RunHeaders: " << dec << runtree->GetEntries() << endl ;
    9495
    9596        runtree->GetBranch("MRawRunHeader")->SetAddress(&runheader);
     
    102103    // open the DataTree and read in
    103104    //
    104     cout << " Check the Event Tree " << endl ;
     105    gLog << " Check the Event Tree " << endl ;
    105106    TTree *evttree = (TTree*) input.Get("Events") ;
    106     cout << " Check all the Branches in the Tree " << endl ;
     107    gLog << " Check all the Branches in the Tree " << endl ;
    107108   
    108109    //
     
    119120        const char *name = branch->GetName();
    120121       
    121         if (!strcmp(name, "MRawEvtHeader"))
     122        if (!strcmp(name, "MRawEvtHeader"))
    122123            evttree->GetBranch("MRawEvtHeader")->SetAddress(&evtheader);
    123124
     
    131132            evttree->GetBranch("MRawCrateArray")->SetAddress(&evtcrate);
    132133
    133         if ( ! strcmp(name, "MMcTrig") )
    134           evttree->GetBranch("MMcTrig")->SetAddress(&trigmc);
    135        
     134        if (!strcmp(name, "MMcTrig"))
     135            evttree->GetBranch("MMcTrig")->SetAddress(&trigmc);
     136
    136137        if (!strcmp(name, "MMcEvt"))
    137138            evttree->GetBranch("MMcEvt")->SetAddress(&evtmc);
    138 
    139139    }
    140140
     
    144144    Int_t nent = (Int_t)evttree->GetEntries();
    145145
    146     cout << endl << endl;
    147     cout << " Entries in Tree Data: " << dec << nent << endl;
     146    gLog << endl << endl;
     147    gLog << " Entries in Tree Data: " << dec << nent << endl;
    148148
    149149    for (Int_t i = 0; i<nent; i++)
    150150    {
    151         cout << "Entry: " << i << endl;
     151        gLog << "Entry: " << i << endl;
    152152
    153153        //
  • trunk/MagicSoft/include-Classes/MMcFormat/MHeaderTrig.cxx

    r479 r609  
    4747  //
    4848
    49   cout <<endl << "Monte Carlo Trigger output:" <<endl;
    50   cout << " XSTopology Trigger in this run : "<<topology<<endl;
    51   cout << " Multiplicity Trigger in this run : "<<multiplicity<<endl;
    52   cout << " Trigger Pattern in this run : "<<TriggerPattern[0]<<
    53     TriggerPattern[1]<<endl;
    54   cout << endl ;
     49    cout << endl;
     50    cout << "Monte Carlo Trigger output:" << endl;
     51    cout << " XSTopology Trigger in this run:   " << topology << endl;
     52    cout << " Multiplicity Trigger in this run: " << multiplicity << endl;
     53    cout << " Trigger Pattern in this run:      ";
     54    cout << TriggerPattern[0] << ", " << TriggerPattern[1] << endl;
     55    cout << endl;
    5556}
  • trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.cxx

    r574 r609  
    154154  //  print out the data member on screen
    155155  //
    156   cout <<endl << "Monte Carlo output:" <<endl;
    157   cout << " Particle Id    : " << usPartId ;
    158   cout << " Energy (GeV)   : " << fEnergy  ;
    159   cout << " Impactpar. (m) : " << fImpact  ;
    160   cout << " Photoelectrons : " << usPhotEl ;
     156  cout << endl << "Monte Carlo output:" << endl;
     157  cout << " Particle Id:    " << usPartId << endl;
     158  cout << " Energy [GeV]:   " << fEnergy  << endl;
     159  cout << " Impactpar. [m]: " << fImpact  << endl;
     160  cout << " Photoelectrons: " << usPhotEl << endl;
    161161  cout << endl ;
    162162}
  • trunk/MagicSoft/include-Classes/MMcFormat/MMcTrig.cxx

    r483 r609  
    6969
    7070  cout <<endl << "Monte Carlo Trigger output:" <<endl;
    71   cout << " First  Level Trigger in this Event : "<<nFirstLevel<<endl;
    72   cout << " Times of first  Level Trigger in this Event : ";
     71  cout << " First  Level Trigger in this Event: "<<nFirstLevel<<endl;
     72  cout << " Times of first  Level Trigger in this Event: ";
    7373  for (i=0;i<nFirstLevel;i++){
    7474    cout<< timeFirst[i]<<"-";
    7575  }
    7676  cout<<endl;
    77   cout << " Pixels of first  Level Trigger in this Event : ";
     77  cout << " Pixels of first  Level Trigger in this Event: ";
    7878  for (i=0;i<nFirstLevel;i++){
    7979    cout<<pixelFirst[i]<<"-";
    8080  }
    8181  cout<<endl;
    82   cout << " Second Level Trigger in this Event : " << nSecondLevel << endl ;
     82  cout << " Second Level Trigger in this Event: " << nSecondLevel << endl ;
    8383  cout << endl ;
    8484}
Note: See TracChangeset for help on using the changeset viewer.