Changeset 666


Ignore:
Timestamp:
03/02/01 12:48:15 (24 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r665 r666  
    11                                                                  -*-*- END -*-*-
    2  2000/03/01: Thomas Bretz
     2 2000/03/02: Thomas Bretz
    33
    44 * manalysis/Makefile, mdatacheck/Makefile, meventdisp/Makefile,
     
    66   new
    77   
    8  * mdatacheck/MFillAdcSpect.[h,cc]:
    9    changed high and low to hi and lo
     8 * mbase/MParList.[cc,h]:
     9   Added FindCreateObj member function
     10 
     11 * mbase/MReadTree.cc:
     12   changed to use FindCreateObj
     13
     14 * mdatacheck/MDumpEvtHeader.cc:
     15   removed fPixelIter from member list, changed cout to *fLog
     16   
     17 * mdatacheck/MFillAdcSpect.cc
     18   removed fPixelIter from member list, changed cout to *fLog,
     19   changed to use FindCreateObj, changed high and low to hi and lo
     20   
     21 * mdatacheck/MShowSpect.cc
     22   changed cout to *fLog
     23   
     24 * mraw/MRawFileRead.cc:
     25   changed to use FindCreateObj
    1026   
    1127 * mdatacheck/MGDisplayAdc.[h,cc]:
  • trunk/MagicSoft/Mars/manalysis/MCerPhotPix.h

    r654 r666  
    2222  void Print(Option_t *opt = NULL) ;
    2323             
    24   Int_t GetPixId() const        { return fPixId ;    }
     24  Int_t   GetPixId() const      { return fPixId ;    }
    2525  Float_t GetNumPhotons() const { return fPhot ;     }
    2626  Float_t GetErrorPhot() const  { return fErrPhot ;  }
     
    3232  void   SetPixelUsed()         { fIsUsed = kTRUE ;  }
    3333
    34   void SetCorePixel()           { fIsCore = kTRUE ;  }
     34  void   SetCorePixel()         { fIsCore = kTRUE ;  }
    3535  Bool_t IsCorePixel() const    { return fIsCore ;   }
    3636
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r652 r666  
    1818
    1919#include <TNamed.h>
     20#include <TClass.h>
    2021
    2122#include "MLog.h"
     
    111112}
    112113
     114MParContainer *MParList::FindCreateObj(const char *name)
     115{
     116    //
     117    //  Find an object in the list.
     118    //  'name' is the name of the object you are searching for.
     119    //  If the object doesn't exist we try to create one from the
     120    //  dictionary. If this isn't possible NULL is returned
     121    //
     122    MParContainer *pcont = (MParContainer*)FindObject(name);
     123
     124    if (pcont)
     125        return pcont;
     126
     127    //
     128    // if object is not existing in the list try to create one
     129    //
     130    *fLog << "MParList::CreateObject - Warning: '" << name << "' not found... creating." << endl;
     131
     132    //
     133    // try to get class from root environment
     134    //
     135    TClass *cls = gROOT->GetClass(name);
     136
     137    if (!cls)
     138    {
     139        //
     140        // if class is not existing in the root environment
     141        //
     142        *fLog << "MParList::CreateObject - Warning: Class '" << name << "' not existing in dictionary." << endl;
     143        return NULL;
     144    }
     145
     146    //
     147    // create the container and add it to the list
     148    //
     149    pcont = (MParContainer*)cls->New();
     150    AddToList(pcont);
     151
     152    //
     153    //  Find an object in the list.
     154    //  'name' is the name of the object you are searching for.
     155    //
     156    return pcont;
     157}
    113158
    114159void MParList::Print(Option_t *t)
  • trunk/MagicSoft/Mars/mbase/MParList.h

    r652 r666  
    4040    void SetLogStream(MLog *log);
    4141
    42     TObject *FindObject(const char *name) const;
     42    TObject       *FindObject(const char *name) const;
     43    MParContainer *FindCreateObj(const char *name);
    4344
    4445    void Print(Option_t *t = NULL);
  • trunk/MagicSoft/Mars/mbase/MReadTree.cc

    r659 r666  
    101101        // check if object is existing in the list
    102102        //
    103         MParContainer *pcont = (MParContainer*)pList->FindObject(name);
     103        MParContainer *pcont = pList->FindCreateObj(name);
    104104
    105105        if (!pcont)
    106106        {
    107107            //
    108             // if object is not existing in the list try to create one
     108            // if class is not existing in the (root) environment
     109            // we cannot proceed reading this branch
    109110            //
    110             *fLog << "MReadTree::PreProcess - WARNING: '" << name << "' not found... creating." << endl;
    111 
    112             //
    113             // try to get class from root environment
    114             //
    115             TClass *cls = gROOT->GetClass(name);
    116 
    117             if (!cls)
    118             {
    119                 //
    120                 // if class is not existing in the root environment
    121                 // we cannot proceed reading this branch
    122                 //
    123                 *fLog << "MReadTree::PreProcess - Warning: Class '" << name << "' not existing in dictionary. Branch skipped." << endl;
    124                 continue;
    125             }
    126 
    127             //
    128             // create the container and add it to the list
    129             //
    130             pcont = (MParContainer*)cls->New();
    131             *fLog << pcont << endl;
    132             pList->AddToList(pcont);
     111            *fLog << "MReadTree::PreProcess - Warning: Class '" << name << "' not existing in dictionary. Branch skipped." << endl;
     112            continue;
    133113        }
    134114
  • trunk/MagicSoft/Mars/mdatacheck/DataCheckLinkDef.h

    r545 r666  
    77#pragma link C++ class MShowSpect;
    88#pragma link C++ class MHistosAdc;
     9#pragma link C++ class MFillAdcSpect;
     10
     11#pragma link C++ class MDumpEvtHeader;
    912
    1013#endif
  • trunk/MagicSoft/Mars/mdatacheck/MDumpEvtHeader.cc

    r609 r666  
    11#include "MDumpEvtHeader.h"
    22
    3 #include <iostream.h>
    4 
     3#include "MLog.h"
     4#include "MLogManip.h"
    55#include "MParList.h"
    66#include "MRawEvtHeader.h"
    77#include "MRawEvtPixelIter.h"
    88
    9 //ClassImp(MDumpEvtHeader)
     9ClassImp(MDumpEvtHeader)
    1010
    1111Bool_t MDumpEvtHeader::PreProcess (MParList *pList)
    1212{
    13   fRawEvtHeader = (MRawEvtHeader*)pList->FindObject("MRawEvtHeader");
    14   if (!fRawEvtHeader)
     13    fRawEvtHeader = (MRawEvtHeader*)pList->FindObject("MRawEvtHeader");
     14    if (!fRawEvtHeader)
    1515    {
    16       cout << "MRawFileRead::PreProcess - WARNING: MRawEvtHeader not found... creating." << endl;
    17       return kFALSE ;
    18     }
    19  
    20   fRawEvtData = (MRawEvtData*)pList->FindObject("MRawEvtData");
    21  
    22   if (!fRawEvtData)
    23     {
    24       cout << "MRawFileRead::PreProcess - WARNING: MRawEvtData not found... creating." << endl;
    25       return kFALSE ;
     16        *fLog << dbginf << " Error: MRawEvtHeader not found... exit." << endl;
     17        return kFALSE ;
    2618    }
    2719
    28   fPixelIter = new MRawEvtPixelIter( fRawEvtData );
    29  
    30   return kTRUE ;
     20    fRawEvtData = (MRawEvtData*)pList->FindObject("MRawEvtData");
     21    if (!fRawEvtData)
     22    {
     23        *fLog << dbginf << " Error: MRawEvtData not found... exit." << endl;
     24        return kFALSE ;
     25    }
    3126
     27    return kTRUE ;
    3228}
    3329
    34    
    3530Bool_t MDumpEvtHeader::Process()
    3631{
    3732  fRawEvtHeader->Print() ;
    3833
    39   //fRawEvtData->Print() ;
     34  MRawEvtPixelIter pixel( fRawEvtData );
    4035
    41   fPixelIter->Reset() ;
     36  while ( pixel.Next() )
     37  {
     38      *fLog << " " << pixel.GetPixelId() ;
     39  }
    4240
    43   while ( fPixelIter->Next() )
    44     {
    45       cout << " " << fPixelIter->GetPixelId() ;
    46      
    47     }
    48 
    49   cout << endl ;
     41  *fLog << endl ;
    5042 
    5143  return kTRUE;
    52 
    5344}
  • trunk/MagicSoft/Mars/mdatacheck/MDumpEvtHeader.h

    r466 r666  
    1212class MRawEvtHeader;
    1313class MRawEvtData;
    14 class MRawEvtPixelIter;
    1514class MParList;
    1615
     
    2120  MRawEvtData      *fRawEvtData;
    2221
    23   MRawEvtPixelIter *fPixelIter ;
    24 
    25  public:   
    26   MDumpEvtHeader () {
    27     fRawEvtHeader = NULL ;
    28   } ;
     22 public:
     23  MDumpEvtHeader () : fRawEvtHeader(NULL) { } ;
    2924
    3025  Bool_t PreProcess(MParList *pList);
    3126  Bool_t Process() ;
    3227 
    33   //  ClassDef(MDumpEvtHeader, 1)       // Task to read the raw data binary file
     28  ClassDef(MDumpEvtHeader, 1)   // Class to dump the pixel ids of a raw evt to the screen
    3429
    3530};
  • trunk/MagicSoft/Mars/mdatacheck/MFillAdcSpect.cc

    r665 r666  
    11#include "MFillAdcSpect.h"
    22
    3 #include <iostream.h>
    4 
     3#include "MLog.h"
     4#include "MLogManip.h"
    55#include "MParList.h"
    66#include "MHistosAdc.h"
     
    88#include "MRawEvtPixelIter.h"
    99
    10 //ClassImp(MFillAdcSpect)
     10ClassImp(MFillAdcSpect)
    1111
    12 MFillAdcSpect::MFillAdcSpect (const char *name, const char *title)
     12    MFillAdcSpect::MFillAdcSpect (const char *name, const char *title) : fRawEvtData(NULL)
    1313{
    1414  *fName  = name  ? name  : "MFillAdcSpect";
    1515  *fTitle = title ? title : "Task to fill the adc spectra with  raw data";
    16  
    17   fRawEvtData   = NULL ;
    18   fPixelIter    = NULL ;
    1916}
    20 
    21 
    2217
    2318Bool_t MFillAdcSpect::PreProcess (MParList *pList)
     
    2520  // connect the raw data with this task
    2621 
    27   fHistos = (MHistosAdc*)pList->FindObject("MHistosAdc");
    28   if (!fHistos)
    29     {
    30         cout << "MRawFileRead::PreProcess - WARNING: MHistosAdc not found... creating." << endl;
    31         fHistos = new MHistosAdc;
    32         pList->AddToList(fHistos);
    33     }
     22  fHistos = (MHistosAdc*)pList->FindCreateObj("MHistosAdc");
     23  if (!fHistos)
     24      return kFALSE;
    3425
    35   fRawEvtData = (MRawEvtData*)pList->FindObject("MRawEvtData");
     26  fRawEvtData = (MRawEvtData*)pList->FindCreateObj("MRawEvtData");
    3627  if (!fRawEvtData)
    37     {
    38         cout << "MRawFileRead::PreProcess - WARNING: MRawEvtData not found... exit." << endl;
    39         return kFALSE;
    40     }
    41 
    42   fPixelIter = new MRawEvtPixelIter( fRawEvtData );
     28  {
     29      *fLog << dbginf << " Error: MRawEvtData not found... exit." << endl;
     30      return kFALSE ;
     31  }
    4332
    4433  return kTRUE ;
     
    4635}
    4736
    48    
    4937Bool_t MFillAdcSpect::Process()
    5038{
    5139  //  loop over the pixels and fill the values in the histograms
    5240 
    53   fPixelIter->Reset() ;
     41  MRawEvtPixelIter pixel(fRawEvtData);
    5442
    5543  const Int_t nhisamples = fRawEvtData->GetNumHiGainSamples() ;
     
    5846  //  cout << "HighSamples " << iHighSamples ;
    5947
    60   while ( fPixelIter->Next() )
     48  while ( pixel.Next() )
    6149    {
    6250      for (Int_t i=0 ; i<nhisamples ; i++ )
    6351        {
    64           fHistos->FillAdcHistHi ( fPixelIter->GetPixelId(),
    65                                      fPixelIter->GetHiGainFadcSamples()[i] );
     52          fHistos->FillAdcHistHi ( pixel.GetPixelId(),
     53                                   pixel.GetHiGainFadcSamples()[i] );
    6654        }
    6755
    6856      for (Int_t i=0 ; i<nlosamples ; i++ )
    6957        {
    70           fHistos->FillAdcHistLo ( fPixelIter->GetPixelId(),
    71                                     fPixelIter->GetLoGainFadcSamples()[i] );
     58          fHistos->FillAdcHistLo ( pixel.GetPixelId(),
     59                                   pixel.GetLoGainFadcSamples()[i] );
    7260        }
    7361    }
  • trunk/MagicSoft/Mars/mdatacheck/MFillAdcSpect.h

    r466 r666  
    1313class MHistosAdc;
    1414class MRawEvtData;
    15 class MRawEvtPixelIter;
    1615
    1716class MFillAdcSpect : public MTask {
    1817 private:
    1918  MRawEvtData      *fRawEvtData;
    20   MRawEvtPixelIter *fPixelIter ;
    2119
    2220  MHistosAdc       *fHistos ;
     
    2826  Bool_t Process() ;
    2927 
    30   //  ClassDef(MFillAdcSpect, 1)        // Task to read the raw data binary file
     28  ClassDef(MFillAdcSpect, 1)    // Task to fill a MHistosAdc Container with data
    3129
    3230};
  • trunk/MagicSoft/Mars/mdatacheck/MShowSpect.cc

    r609 r666  
    11#include "MShowSpect.h"
    22
    3 #include <iostream.h>
    4 
     3#include "MLog.h"
     4#include "MLogManip.h"
    55#include "MParList.h"      // MParList
    66#include "MGDisplayAdc.h"  // MGDisplayAdc
     
    3636  if (!fHists)
    3737    {
    38       cout << "ERROR: MShowSpect::PreProc(): " << fHistName << " not found!" << endl;
    39       return kFALSE;
     38        *fLog << dbginf << " Error: MHistosAdc '" << fHistName << "' not found!" << endl;
     39        return kFALSE;
    4040    }
    4141 
  • trunk/MagicSoft/Mars/mraw/MRawFileRead.cc

    r665 r666  
    8484    //  if not create one and add them to the list
    8585    //
    86     fRawRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     86    fRawRunHeader = (MRawRunHeader*)pList->FindCreateObj("MRawRunHeader");
    8787    if (!fRawRunHeader)
    88     {
    89         *fLog << "MRawFileRead::PreProcess - WARNING: MRawRunHeader not found... creating." << endl;
    90         fRawRunHeader = new MRawRunHeader;
    91         pList->AddToList(fRawRunHeader);
    92     }
     88        return kFALSE;
    9389
    94     fRawEvtHeader = (MRawEvtHeader*)pList->FindObject("MRawEvtHeader");
     90    fRawEvtHeader = (MRawEvtHeader*)pList->FindCreateObj("MRawEvtHeader");
    9591    if (!fRawEvtHeader)
    96     {
    97         *fLog << "MRawFileRead::PreProcess - WARNING: MRawEvtHeader not found... creating." << endl;
    98         fRawEvtHeader = new MRawEvtHeader;
    99         pList->AddToList(fRawEvtHeader);
    100     }
     92        return kFALSE;
    10193
    102     fRawEvtData = (MRawEvtData*)pList->FindObject("MRawEvtData");
     94    fRawEvtData = (MRawEvtData*)pList->FindCreateObj("MRawEvtData");
    10395    if (!fRawEvtData)
    104     {
    105         *fLog << "MRawFileRead::PreProcess - WARNING: MRawEvtData not found... creating." << endl;
    106         fRawEvtData = new MRawEvtData;
    107         pList->AddToList(fRawEvtData);
    108     }
     96        return kFALSE;
    10997
    110     fRawCrateArray = (MRawCrateArray*)pList->FindObject("MRawCrateArray");
     98    fRawCrateArray = (MRawCrateArray*)pList->FindCreateObj("MRawCrateArray");
    11199    if (!fRawCrateArray)
    112     {
    113         *fLog << "MRawFileRead::PreProcess - WARNING: MRawCrateArray not found... creating." << endl;
    114         fRawCrateArray = new MRawCrateArray;
    115         pList->AddToList(fRawCrateArray);
    116     }
     100        return kFALSE;
    117101
    118     fRawEvtTime = (MTime*)pList->FindObject("MRawEvtTime");
     102    fRawEvtTime = (MTime*)pList->FindCreateObj("MRawEvtTime");
    119103    if (!fRawEvtTime)
    120     {
    121         *fLog << "MRawFileRead::PreProcess - WARNING: MRawEvtTime not found... creating." << endl;
    122         fRawEvtTime = new MTime("MRawEvtTime");
    123         pList->AddToList(fRawEvtTime);
    124     }
     104        return kTRUE;
    125105
    126106    //
Note: See TracChangeset for help on using the changeset viewer.