Changeset 3183


Ignore:
Timestamp:
02/16/04 11:18:25 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3180 r3183  
    44
    55                                                 -*-*- END OF LINE -*-*-
     6 2004/02/14: Thomas Bretz
     7
     8   * manalysis/AnalysisLinkDef.h:
     9     - added missing MCerPhotEvtIter
     10
     11   * merpp.cc:
     12     - added possible usage of database
     13
     14   * star.cc:
     15     - moved source code into new class MJStar - preliminary
     16
     17   * manalysis/MCerPhotPix.cc:
     18     - updated class header
     19     - fixed Print-output
     20
     21   * mbase/MAGIC.h:
     22     - removed definition of MLog
     23
     24   * mbase/MArgs.h:
     25     - removed include of MAGIC.h
     26
     27   * mbase/MLog.h:
     28     - added extern definition of gLog
     29
     30   * mbase/MParContainer.[h,cc]:
     31     - move body of constructors to source file
     32
     33   * mcalib/MCalibrate.cc, mcalib/MCalibrateData.cc,
     34     mraw/MRawCrateArray.cc, mraw/MRawCrateData.cc,
     35     mraw/MRawEvtData.cc, mraw/MRawEvtHeader.cc, mraw/MRawRead.cc,
     36     mraw/MRawEvtPixelIter.cc, mraw/MRawFileWrite.cc:
     37     - fixed documentation header
     38
     39   * mcalib/MMcCalibrationCalc.[h,cc]:
     40     - fixed documentation header
     41     - fixed usage of FindCreateObj and FindObject
     42     - removed data member to count entries (use histogram instead)
     43     - use TH1 function Integral instead of doing it manually
     44
     45   * mfilter/MFCosmics.cc:
     46     - fixed documentation
     47
     48   * mimage/MHillas.cc, mimage/MImgCleanStd.cc,
     49     mimage/MNewImagePar.[h,cc]:
     50     - replaced for-loops by Iterators
     51
     52   * mraw/MRawFileRead.cc, mraw/MRawSocketRead.cc:
     53     - fixed documentation header
     54     - check return value of MRawRunHeader::ReadEvt
     55
     56   * mraw/mraw/MRawRunHeader.[h,cc]:
     57     - fixed documentation header
     58     - added return value to MRawRunHeader::ReadEvt
     59     - added constant number for max format version - preliminary
     60       (should by a static data member)
     61
     62
    663
    764 2004/02/16: Markus Gaug
    865
    9    * mcalib/Makefile
    10    * mcalib/CalibLinkDef.h
    11 
    12    * mcalib/MHCalibrationRelTimePix.[h,cc]
    13    * mcalib/MHCalibrationRelTimeCam.[h,cc]
     66   * mcalib/Makefile, mcalib/CalibLinkDef.h:
     67     - added MHCalibrationRelTimePix
     68
     69   * mcalib/MHCalibrationRelTimePix.[h,cc],
     70     mcalib/MHCalibrationRelTimeCam.[h,cc]:
    1471     - new classes to fit and display the relative arrival times.
    1572     - filled from MArrivalTime
     
    2380
    2481
     82
    2583 2004/02/14: Markus Gaug
    2684
    27    * mcalib/Makefile
    28    * mcalib/CalibLinkDef.h
     85   * mcalib/Makefile, mcalib/CalibLinkDef.h:
     86     - added MHCalibrationChargePINDiode
    2987
    3088   * mcalib/MHCalibrationChargePINDiode.[h,cc]
     
    62120   * macros/calibration.C
    63121     - changed pedestal displays accordingly
    64 
    65122
    66123   * mjobs/MJPedestal.h
     
    78135   * mcalib/MHGausEvent.[h,cc], mcalib/Makefile, mcalib/CalibLinkDef.h:
    79136     - replaced by the improved version: MHGausEvents.[h,cc]
    80 
    81137
    82138
  • trunk/MagicSoft/Mars/manalysis/MCerPhotPix.cc

    r2860 r3183  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
    19 !   Author(s): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de)
     18!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!   Author(s): Harald Kornmayer 1/2001
    2020!
    21 !   Copyright: MAGIC Software Development, 2000-2001
     21!   Copyright: MAGIC Software Development, 2000-2004
    2222!
    2323!
     
    3131// Storage container for the signal in a pixel in number of photons.
    3232//
    33 // NOTE: This container is NOT ment for I/O. Write it to a file on your own
    34 //       risk!
     33// NOTE: This container is NOT ment for I/O. Write it to a file on your
     34//       own risk!
     35//
     36// fIsSaturated: boolean variable set to kTRUE whenever one or more of
     37//               the low gain FADC slices of the pixel is in saturation.
    3538//
    3639// Version 2:
    3740// ----------
    38 // Added fIsSaturated, boolean variable set to kTRUE whenever one or more of
    39 // the low gain FADC slices of the pixel is in saturation.
     41//  - added fIsSaturated
    4042//
    4143////////////////////////////////////////////////////////////////////////////
     
    6769    gLog << (fRing>0?"   Used ":" Unused ");
    6870    gLog << (fIsCore?" Core ":"      ");
    69     gLog << (fIsSaturated?" Saturated ":"Not Saturated");
    70     gLog << "Nphot= " << fPhot << " Error(Nphot)=" << fErrPhot << endl;
     71    gLog << (fIsSaturated?"   ":"Not") << " saturated";
     72    gLog << " Nphot= " << fPhot << " Error(Nphot)=" << fErrPhot << endl;
    7173}
  • trunk/MagicSoft/Mars/mbase/MAGIC.h

    r2711 r3183  
    4444const Double_t kRad2Deg = 180.0/3.1415926535897932384626433832795028841971693993751;
    4545
    46 //
    47 // This is the definition of a global output stream, which by
    48 // default pipes all output to the stdout
    49 //
    50 
    51 #ifdef __LINUX__
    52 class MLog;
    53 #else
    54 #include "MLog.h"
    5546#endif
    56 
    57 R__EXTERN MLog gLog;
    58 
    59 #endif
  • trunk/MagicSoft/Mars/mbase/MArgs.h

    r2728 r3183  
    11#ifndef MARS_MArgs
    22#define MARS_MArgs
    3 
    4 #ifndef MARS_MAGIC
    5 #include "MAGIC.h"
    6 #endif
    73
    84#ifndef ROOT_TNamed
  • trunk/MagicSoft/Mars/mbase/MLog.h

    r2784 r3183  
    201201};
    202202
    203 #endif
     203//
     204// This is the definition of a global output stream, which by
     205// default pipes all output to the stdout
     206//
     207R__EXTERN MLog gLog;
     208
     209#endif
  • trunk/MagicSoft/Mars/mbase/MParContainer.cc

    r2490 r3183  
    6060using namespace std;
    6161
     62MParContainer::MParContainer(const char *name, const char *title) :
     63    fName(name), fTitle(title), fLog(&gLog), fDisplay(NULL), fReadyToSave(kFALSE)
     64{
     65}
     66
     67MParContainer::MParContainer(const TString &name, const TString &title) :
     68    fName(name), fTitle(title), fLog(&gLog), fDisplay(NULL), fReadyToSave(kFALSE)
     69{
     70}
     71
    6272// --------------------------------------------------------------------------
    6373//
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r2772 r3183  
    1212#include "MAGIC.h"
    1313#endif
    14 
    1514#ifndef ROOT_TObject
    1615#include <TObject.h>
     
    2827class TDataMember;
    2928class TMethodCall;
     29
     30class MLog;
    3031class MStatusDisplay;
    3132
     
    6061    };
    6162
    62     MParContainer(const char *name="", const char *title="") : fName(name), fTitle(title), fLog(&gLog), fDisplay(NULL), fReadyToSave(kFALSE) {  }
    63     MParContainer(const TString &name, const TString &title) : fName(name), fTitle(title), fLog(&gLog), fDisplay(NULL), fReadyToSave(kFALSE) {  }
     63    MParContainer(const char *name="", const char *title="");
     64    MParContainer(const TString &name, const TString &title);
    6465    MParContainer(const MParContainer &named);
    6566    MParContainer& operator=(const MParContainer& rhs);
  • trunk/MagicSoft/Mars/mcalib/MCalibrate.cc

    r3116 r3183  
    1717!
    1818!   Author(s): Javier Lopez 12/2003 <mailto:jlopez@ifae.es>
    19 !   Modified by: Javier Rico  01/2004 <mailto:jrico@ifae.es>
     19!   Author(s): Javier Rico  01/2004 <mailto:jrico@ifae.es>
    2020!
    2121!   Copyright: MAGIC Software Development, 2000-2004
  • trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc

    r3140 r3183  
    1717!
    1818!   Author(s): Javier Lopez    12/2003 <mailto:jlopez@ifae.es>
    19 !   Modified by: Javier Rico   01/2004 <mailto:jrico@ifae.es>
    20 !             Wolfgang Wittek 02/2004 <mailto:wittek@mppmu.mpg.de>
     19!   Author(s): Javier Rico     01/2004 <mailto:jrico@ifae.es>
     20!   Author(s): Wolfgang Wittek 02/2004 <mailto:wittek@mppmu.mpg.de>
    2121!
    2222!   Copyright: MAGIC Software Development, 2000-2004
  • trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.cc

    r3004 r3183  
    1818!   Author(s): Abelardo Moralejo, 12/2003 <mailto:moralejo@pd.infn.it>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2003
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    6565MMcCalibrationCalc::MMcCalibrationCalc(const char *name, const char *title)
    6666{
    67   fName  = name  ? name  : "MMcCalibrationCalc";
    68   fTitle = title ? title : "Calculate and write conversion factors into MCalibrationCam Container";
    69 
    70   fADC2Phot = 0.;
    71   fEvents = 0;
    72 
    73   fHistRatio = new TH1F(AddSerialNumber("HistRatio"), "log10(fPassPhotCone/fSize)", 1500, -3., 3.);
    74   fHistRatio->GetXaxis()->SetTitle("log_{10}(fPassPhotCone / fSize) (in photons/ADC count)");
     67    fName  = name  ? name  : "MMcCalibrationCalc";
     68    fTitle = title ? title : "Calculate and write conversion factors into MCalibrationCam Container";
     69
     70    fHistRatio = new TH1F(AddSerialNumber("HistRatio"), "log10(fPassPhotCone/fSize)", 1500, -3., 3.);
     71    fHistRatio->SetXTitle("log_{10}(fPassPhotCone / fSize) [phot/ADC count]");
    7572}
    7673
     
    8380Bool_t MMcCalibrationCalc::CheckRunType(MParList *pList) const
    8481{
    85   const MRawRunHeader *run = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
    86   if (!run)
    87     {
    88       *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
    89       return kTRUE;
    90     }
    91 
    92   return  run->GetRunType() == kRTMonteCarlo;
     82    const MRawRunHeader *run = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     83    if (!run)
     84    {
     85        *fLog << warn << "Warning - cannot check file type, MRawRunHeader not found." << endl;
     86        return kTRUE;
     87    }
     88
     89    return  run->GetRunType() == kRTMonteCarlo;
    9390}
    9491
     
    9996Int_t MMcCalibrationCalc::PreProcess(MParList *pList)
    10097{
    101 
    102   fCalCam = (MCalibrationCam*) pList->FindObject(AddSerialNumber("MCalibrationCam"));
    103 
    104   if ( !fCalCam )
    105     {
    106       *fLog << err << dbginf << "Cannot find " << AddSerialNumber("MCalibrationCam") << "... aborting." << endl;
    107       return kFALSE;
    108     }
    109 
    110   fHillas = (MHillas*) pList->FindCreateObj(AddSerialNumber("MHillas"));
    111   if ( !fHillas)
    112     {
    113       *fLog << err << dbginf << "Cannot find " << AddSerialNumber("MHillas") << "... aborting." << endl;
    114       return kFALSE;
    115     }
    116 
    117   fNew = (MNewImagePar*) pList->FindCreateObj(AddSerialNumber("MNewImagePar"));
    118   if ( !fNew)
    119     {
    120       *fLog << err << dbginf << "Cannot find " << AddSerialNumber("MNewImagePar") << "... aborting." << endl;
    121       return kFALSE;
    122     }
    123 
    124   fMcEvt = (MMcEvt*) pList->FindCreateObj(AddSerialNumber("MMcEvt"));
    125   if ( !fMcEvt)
    126     {
    127       *fLog << err << dbginf << "Cannot find " << AddSerialNumber("MMcEvt") << "... aborting." << endl;
    128       return kFALSE;
    129     }
    130 
    131   return kTRUE;
    132 
     98    fHistRatio->Reset();
     99    fADC2Phot = 0;
     100
     101    fCalCam = (MCalibrationCam*) pList->FindObject(AddSerialNumber("MCalibrationCam"));
     102    if (!fCalCam)
     103    {
     104        *fLog << err << AddSerialNumber("MCalibrationCam") << "not found... aborting." << endl;
     105        return kFALSE;
     106    }
     107
     108    fHillas = (MHillas*) pList->FindObject(AddSerialNumber("MHillas"));
     109    if ( !fHillas)
     110    {
     111        *fLog << err << AddSerialNumber("MHillas") << "not found... aborting." << endl;
     112        return kFALSE;
     113    }
     114
     115    fNew = (MNewImagePar*)pList->FindObject(AddSerialNumber("MNewImagePar"));
     116    if (!fNew)
     117    {
     118        *fLog << err << AddSerialNumber("MNewImagePar") << "not found... aborting." << endl;
     119        return kFALSE;
     120    }
     121
     122    fMcEvt = (MMcEvt*) pList->FindObject(AddSerialNumber("MMcEvt"));
     123    if (!fMcEvt)
     124    {
     125        *fLog << err << AddSerialNumber("MMcEvt") << "not found... aborting." << endl;
     126        return kFALSE;
     127    }
     128
     129    return kTRUE;
    133130}
    134131
     
    144141  //
    145142  if (!CheckRunType(pList))
    146     {
    147       *fLog << err << dbginf << "This is no MC file... aborting." << endl;
     143  {
     144      *fLog << err << "MMcCalibrationCalc can only used with MC files... aborting." << endl;
    148145      return kFALSE;
    149     }
     146  }
    150147
    151148  //
    152149  // Now check the existence of all necessary containers.
    153150  //
    154 
    155151  fGeom = (MGeomCam*) pList->FindObject(AddSerialNumber("MGeomCam"));
    156   if ( ! fGeom )
    157     {
    158       *fLog << err << dbginf << "Cannot find " << AddSerialNumber("MGeomCam") << "... aborting." << endl;
     152  if (!fGeom)
     153  {
     154      *fLog << err << AddSerialNumber("MGeomCam") << " mot found... aborting." << endl;
    159155      return kFALSE;
    160     }
     156  }
    161157
    162158  fHeaderFadc = (MMcFadcHeader*)pList->FindObject(AddSerialNumber("MMcFadcHeader"));
    163159  if (!fHeaderFadc)
    164     {
    165       *fLog << err << dbginf << AddSerialNumber("MMcFadcHeader") << " not found... aborting." << endl;
     160  {
     161      *fLog << err << AddSerialNumber("MMcFadcHeader") << " not found... aborting." << endl;
    166162      return kFALSE;
    167     }
     163  }
    168164
    169165  for (UInt_t ipix = 0; ipix < fGeom->GetNumPixels(); ipix++)
    170     {
     166  {
    171167      if (fHeaderFadc->GetPedestalRmsHigh(ipix) > 0 ||
    172           fHeaderFadc->GetPedestalRmsLow(ipix) > 0 )
    173         {
    174           *fLog << err << endl << endl << dbginf << "You are trying to calibrate the data using a Camera file produced with added noise. Please use a noiseless file for calibration. Aborting..." << endl << endl;
     168          fHeaderFadc->GetPedestalRmsLow(ipix)  > 0 )
     169      {
     170          *fLog << err << "Trying to calibrate the data using a Camera file produced with added noise." << endl;
     171          *fLog << "Please use a noiseless file for calibration... aborting." << endl << endl;
    175172          return kFALSE;
    176         }
    177     }
     173      }
     174  }
    178175
    179176  return kTRUE;
     
    187184Int_t MMcCalibrationCalc::Process()
    188185{
    189 
    190   //
    191   // Exclude events with some saturated pixel
    192   //
    193   if ( fNew->GetNumSaturatedPixels() > 0 )
     186    //
     187    // Exclude events with some saturated pixel
     188    //
     189    if (fNew->GetNumSaturatedPixels()>0)
     190        return kTRUE;
     191
     192    //
     193    // Exclude events with low Size (larger fluctuations)
     194    // FIXME? The present cut (1000 "inner-pixel-counts") is somehow
     195    // arbitrary. Might it be optimized?
     196    //
     197    if (fHillas->GetSize()<1000)
     198        return kTRUE;
     199
     200    fADC2Phot += fMcEvt->GetPassPhotCone()/fHillas->GetSize();
     201
     202    fHistRatio->Fill(TMath::Log10(fMcEvt->GetPassPhotCone()/fHillas->GetSize()));
     203
    194204    return kTRUE;
    195 
    196   //
    197   // Exclude events with low Size (larger fluctuations)
    198   // FIXME? The present cut (1000 "inner-pixel-counts") is somehow arbitrary.
    199   // Might it be optimized?
    200   //
    201   if ( fHillas->GetSize() < 1000 )
     205}
     206
     207// --------------------------------------------------------------------------
     208//
     209// Fill the MCalibrationCam object
     210//
     211Int_t MMcCalibrationCalc::PostProcess()
     212{
     213    const Stat_t n = fHistRatio->GetEntries();
     214    if (n<1)
     215    {
     216        *fLog << err << "No events read... aborting." << endl;
     217        return kFALSE;
     218    }
     219
     220    fADC2Phot /= n;
     221
     222    //
     223    // For the calibration we no longer use the mean,
     224    // but the peak of the distribution:
     225    //
     226    const Int_t reach = 2;
     227
     228    Stat_t summax = 0;
     229    Int_t  mode   = 0;
     230
     231    // FIXME: Is this necessary? We could use GetMaximumBin instead..
     232    for (Int_t ibin = 1+reach; ibin <= fHistRatio->GetNbinsX()-reach; ibin++)
     233    {
     234        const Stat_t sum = fHistRatio->Integral(ibin-reach, ibin+reach);
     235
     236        if (sum <= summax)
     237            continue;
     238
     239        summax = sum;
     240        mode = ibin;
     241    }
     242
     243    fADC2Phot = TMath::Power(10, fHistRatio->GetBinCenter(mode));
     244
     245    const Int_t num = fCalCam->GetSize();
     246    for (int i=0; i<num; i++)
     247    {
     248        MCalibrationPix &calpix = (*fCalCam)[i];
     249
     250        const Float_t factor = fADC2Phot*calpix.GetMeanConversionBlindPixelMethod();
     251
     252        calpix.SetConversionBlindPixelMethod(factor, 0., 0.);
     253    }
     254
    202255    return kTRUE;
    203 
    204   fADC2Phot += fMcEvt->GetPassPhotCone() / fHillas->GetSize();
    205   fEvents ++;
    206 
    207   fHistRatio->Fill(log10(fMcEvt->GetPassPhotCone()/fHillas->GetSize()));
    208 
    209   return kTRUE;
    210 }
    211 
    212 // --------------------------------------------------------------------------
    213 //
    214 // Fill the MCalibrationCam object
    215 //
    216 Int_t MMcCalibrationCalc::PostProcess()
    217 {
    218 
    219   if (fEvents > 0)
    220     fADC2Phot /= fEvents;
    221   else
    222     {
    223       *fLog << err << dbginf << "No events were read! Aborting." << endl;
    224       return kFALSE;
    225     }
    226 
    227   //
    228   // For the calibration we no longer use the mean, but thepeak of the distribution:
    229   //
    230 
    231   Float_t summax = 0.;
    232   Int_t mode = 0;
    233   Int_t reach = 2;
    234   for (Int_t ibin = 1+reach; ibin <= fHistRatio->GetNbinsX()-reach; ibin++)
    235     {
    236       Float_t sum = 0;
    237       for(Int_t k = ibin-reach; k <= ibin+reach; k++)
    238         sum += fHistRatio->GetBinContent(k);
    239       if (sum > summax)
    240         {
    241           summax = sum;
    242           mode = ibin;
    243         }
    244     }
    245 
    246   fADC2Phot = pow(10., fHistRatio->GetXaxis()->GetBinCenter(mode));
    247 
    248   const int num = fCalCam->GetSize();
    249  
    250   for (int i=0; i<num; i++)
    251     {
    252       MCalibrationPix &calpix = (*fCalCam)[i];
    253 
    254       Float_t factor =  fADC2Phot*calpix.GetMeanConversionBlindPixelMethod();
    255 
    256       calpix.SetConversionBlindPixelMethod(factor, 0., 0.);
    257      
    258     }
    259 
    260   return kTRUE;
    261 
    262 }
     256}
  • trunk/MagicSoft/Mars/mfilter/MFCosmics.cc

    r3112 r3183  
    3333//   the outer pixels have some defect).
    3434//
    35 //   ProProcess:  Search for MPedestalCam, MExtractedSignalCam
    36 //               
    37 //   ReInit:      Initialize number of used FADC slices
    38 //
    39 //   Process:     if fMaxEmptyPixels pixels lower than 3 pedRMS,
    40 //                the event is supposed to
    41 //                be a cosmic and kContinue is returned
    42 //
    43 //
    4435//  Input Containers:
    4536//   MRawEvtData
     
    120111// --------------------------------------------------------------------------
    121112//
    122 // The ReInit searches the following input containers for information:
    123 //  - MExtractedSignalCam
     113// Initialize number of used FADC slices
    124114//
    125115Bool_t MFCosmics::ReInit(MParList *pList)
  • trunk/MagicSoft/Mars/mimage/MHillas.cc

    r2624 r3183  
    188188Int_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt)
    189189{
    190     const UInt_t npixevt = evt.GetNumPixels();
    191 
    192     //
    193     // sanity check
    194     //
    195     if (npixevt < 3)
     190    //
     191    // sanity check 1
     192    //
     193    if (evt.GetNumPixels()<3)
    196194        return 1;
    197195
     
    209207    fSize  = 0;
    210208
    211     Int_t numused = 0;
    212 
    213     for (UInt_t i=0; i<npixevt; i++)
     209    MCerPhotPix *pix = 0;
     210
     211    TIter Next(evt);
     212    UInt_t numused = 0;
     213    while ((pix=(MCerPhotPix*)Next()))
    214214    {
    215         const MCerPhotPix &pix = evt[i];
    216 
    217         if (!pix.IsPixelUsed())
    218             continue;
    219 
    220         const MGeomPix &gpix = geom[pix.GetPixId()];
    221 
    222         const Float_t nphot = pix.GetNumPhotons();
     215        const MGeomPix &gpix = geom[pix->GetPixId()];
     216
     217        const Float_t nphot = pix->GetNumPhotons();
    223218
    224219        fSize  += nphot;                             // [counter]
     
    230225
    231226    //
    232     // sanity checks
     227    // sanity check 2
    233228    //
    234229    if (fSize==0)
     
    238233    fMeanY /= fSize;                                 // [mm]
    239234
     235    //
     236    // sanity check 3
     237    //
    240238    if (numused<3)
    241239        return 3;
     
    254252    Double_t corryy=0;                               // [m^2]
    255253
    256     for (UInt_t i=0; i<npixevt; i++)
     254    Next.Reset();
     255    while ((pix=(MCerPhotPix*)Next()))
    257256    {
    258         const MCerPhotPix &pix = evt[i];
    259 
    260         if (!pix.IsPixelUsed())
    261             continue;
    262 
    263         const MGeomPix &gpix = geom[pix.GetPixId()];
     257        const MGeomPix &gpix = geom[pix->GetPixId()];
    264258
    265259        const Float_t dx = gpix.GetX() - fMeanX;     // [mm]
    266260        const Float_t dy = gpix.GetY() - fMeanY;     // [mm]
    267261
    268         const Float_t nphot = pix.GetNumPhotons();   // [#phot]
     262        const Float_t nphot = pix->GetNumPhotons();  // [#phot]
    269263
    270264        corrxx += nphot * dx*dx;                     // [mm^2]
     
    297291    const Double_t d0    = corryy - corrxx;
    298292    const Double_t d1    = corrxy*2;
    299     const Double_t d2    = d0 + sqrt(d0*d0 + d1*d1);
     293    const Double_t d2    = d0 + TMath::Sqrt(d0*d0 + d1*d1);
    300294    const Double_t tand  = d2 / d1;
    301295    const Double_t tand2 = tand*tand;
    302296
    303     fDelta = atan(tand);
     297    fDelta = TMath::ATan(tand);
    304298
    305299    const Double_t s2 = tand2+1;
    306     const Double_t s  = sqrt(s2);
     300    const Double_t s  = TMath::Sqrt(s2);
    307301
    308302    fCosDelta =  1.0/s;   // need these in derived classes
    309303    fSinDelta = tand/s;   // like MHillasExt
    310304
    311     Double_t axis1 = (tand2*corryy + d2 + corrxx)/s2/fSize;
    312     Double_t axis2 = (tand2*corrxx - d2 + corryy)/s2/fSize;
     305    const Double_t axis1 = (tand2*corryy + d2 + corrxx)/s2/fSize;
     306    const Double_t axis2 = (tand2*corrxx - d2 + corryy)/s2/fSize;
    313307
    314308    //
     
    320314    // very small numbers can get negative by rounding
    321315    //
    322     fLength = axis1<0 ? 0 : sqrt(axis1);  // [mm]
    323     fWidth  = axis2<0 ? 0 : sqrt(axis2);  // [mm]
     316    fLength = axis1<0 ? 0 : TMath::Sqrt(axis1);  // [mm]
     317    fWidth  = axis2<0 ? 0 : TMath::Sqrt(axis2);  // [mm]
    324318
    325319    SetReadyToSave();
  • trunk/MagicSoft/Mars/mimage/MImgCleanStd.cc

    r2781 r3183  
    329329void MImgCleanStd::CleanStep1()
    330330{
    331     const Int_t entries = fEvt->GetNumPixels();
    332331    const TArrayD &data = fData->GetData();
    333332
     
    335334    // check the number of all pixels against the noise level and
    336335    // set them to 'unused' state if necessary
    337     // 
    338     for (Int_t i=0; i<entries; i++ )
    339     {
    340         MCerPhotPix &pix = (*fEvt)[i];
    341 
    342         if (data[pix.GetPixId()] <= fCleanLvl1)
    343             pix.SetPixelUnused();
    344     }
     336    //
     337    MCerPhotPix *pix;
     338
     339    // Loop over all pixels
     340    MCerPhotEvtIter Next(fEvt, kFALSE);
     341    while ((pix=static_cast<MCerPhotPix*>(Next())))
     342        if (data[pix->GetPixId()] <= fCleanLvl1)
     343            pix->SetPixelUnused();
    345344}
    346345
     
    351350//  neighbors).
    352351//
    353 //  Takes the maximum pixel id from CleanStep1 as an argument
    354 //
    355352void MImgCleanStd::CleanStep2()
    356353{
    357     const Int_t entries = fEvt->GetNumPixels();
    358 
    359     //
    360     // In the worst case we have to loop 6 times 577 times, to
    361     // catch the behaviour of all next neighbors. Here we can gain
    362     // much by using an array instead of checking through all pixels
    363     // (MCerPhotEvt::IsPixelUsed) all the time.
    364     //
    365     // We allocate the array ourself because the TArrays always do
    366     // range check which slows down the access to the array
    367     // by 25-50%
    368     //
    369     Byte_t *ispixused = new Byte_t[fCam->GetNumPixels()];
    370     memset(ispixused, 0, sizeof(Byte_t)*fCam->GetNumPixels());
    371 
    372     for (Int_t i=0; i<entries; i++)
    373     {
    374         const MCerPhotPix &pix = (*fEvt)[i];
    375         ispixused[pix.GetPixId()] = pix.IsPixelUsed() ? 1 : 0 ;
    376    }
    377 
    378     for (Int_t i=0; i<entries; i++)
    379     {
    380         // get entry i from list
    381         MCerPhotPix &pix = (*fEvt)[i];
    382 
    383         // get pixel id of this entry
    384         const Int_t idx = pix.GetPixId();
    385 
    386         // check if pixel is in use, if not goto next pixel in list
    387         if (ispixused[idx] == 0)
    388             continue;
     354    MCerPhotPix *pix;
     355
     356    // Loop over used pixels only
     357    TIter Next(*fEvt);
     358    while ((pix=static_cast<MCerPhotPix*>(Next())))
     359    {
     360        // get pixel id of this entry
     361        const Int_t idx = pix->GetPixId();
    389362 
    390363        // check for 'used' neighbors of this pixel
     
    400373
    401374            // when you find an used neighbor, break the loop
    402             if (ispixused[idx2] == 1)
     375            if (fEvt->IsPixelUsed(idx2))
    403376            {
    404377                hasNeighbor = kTRUE;
     
    408381
    409382        if (hasNeighbor == kFALSE)
    410             pix.SetPixelUnused();
    411     }
    412 
    413     delete ispixused;
     383            pix->SetPixelUnused();
     384    }
    414385
    415386    //
    416387    // now we declare all pixels that survive as CorePixels
    417388    //
    418     for (Int_t i=0; i<entries; i++)
    419     {
    420         MCerPhotPix &pix = (*fEvt)[i];
    421 
    422         if (pix.IsPixelUsed())
    423             pix.SetPixelCore();
    424     }
     389    Next.Reset();
     390    while ((pix=static_cast<MCerPhotPix*>(Next())))
     391        pix->SetPixelCore();
    425392}
    426393
     
    440407        const Int_t idx2 = gpix.GetNeighbor(j);
    441408
    442         if (!fEvt->GetPixById(idx2) || !fEvt->IsPixelCore(idx2))
     409        if (!fEvt->IsPixelCore(idx2))
    443410            continue;
    444411
     
    459426void MImgCleanStd::CleanStep4(UShort_t r, MCerPhotPix &pix)
    460427{
    461   // Skip events that have already a defined status;
    462         if( pix.GetRing()!= 0)
    463           return;
     428    //
     429    // Skip events that have already a defined status;
     430    //
     431    if (pix.GetRing() != 0)
     432        return;
     433
    464434    //
    465435    // check if the pixel's next neighbor is a used pixel.
     
    478448
    479449        MCerPhotPix *npix = fEvt->GetPixById(idx2);
    480 
    481450        if (!npix || !npix->IsPixelUsed() || npix->GetRing()>r-1 )
    482         continue;
     451            continue;
    483452
    484453        pix.SetRing(r);
     
    495464void MImgCleanStd::CleanStep3()
    496465{
    497     const Int_t entries = fEvt->GetNumPixels();
    498466    const TArrayD &data = fData->GetData();
    499467
    500468    for (UShort_t r=1; r<fCleanRings+1; r++)
    501469    {
    502         for (Int_t i=0; i<entries; i++)
     470        MCerPhotPix *pix;
     471
     472        // Loop over all pixels
     473        MCerPhotEvtIter NextAll(fEvt, kFALSE);
     474        while ((pix=static_cast<MCerPhotPix*>(NextAll())))
    503475        {
    504             //
    505             // get pixel as entry il from list
    506             //
    507             MCerPhotPix &pix = (*fEvt)[i];
    508 
    509476            //
    510477            // if pixel is a core pixel go to the next pixel
    511478            //
    512             if (pix.IsPixelCore())
     479            if (pix->IsPixelCore())
    513480                continue;
    514481
    515             if (data[pix.GetPixId()] <= fCleanLvl2)
     482            if (data[pix->GetPixId()] <= fCleanLvl2)
    516483                continue;
    517484
    518485            if (r==1)
    519                 CleanStep3b(pix);
     486                CleanStep3b(*pix);
    520487            else
    521                 CleanStep4(r, pix);
     488                CleanStep4(r, *pix);
    522489        }
    523490    }
  • trunk/MagicSoft/Mars/mimage/MNewImagePar.cc

    r2849 r3183  
    1818!   Author(s): Wolfgang Wittek 03/2003 <mailto:wittek@mppmu.mpg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2003
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    3131// fLeakage1 ratio: (photons in most outer ring of pixels) over fSize
    3232// fLeakage2 ratio: (photons in the 2 outer rings of pixels) over fSize
     33// fNumSaturatedPixels: number of pixels in which at least one slice
     34//                      of the low gain FADC was saturated.
    3335//
    3436// Version 2:
    35 // Added fNumSaturatedPixels: number of pixels in which at least one slice
    36 // of the low gain FADC was saturated.
     37// ----------
     38//  - added fNumSaturatedPixels
    3739//
    3840/////////////////////////////////////////////////////////////////////////////
     
    106108        const MCerPhotPix &pix = evt[i];
    107109
     110        // count saturated pixels
    108111        if (pix.IsPixelSaturated())
    109           fNumSaturatedPixels++;
     112            fNumSaturatedPixels++;
    110113
     114        // skip unused pixels
    111115        if (!pix.IsPixelUsed())
    112116            continue;
     117
     118        // count used and core pixels
     119        if (pix.IsPixelCore())
     120            fNumCorePixels++;
     121
     122        // count used pixels
     123        fNumUsedPixels++;
    113124
    114125        const Int_t pixid = pix.GetPixId();
     
    125136        if (gpix.IsInOuterRing())
    126137           edgepix2 += nphot;
    127 
    128         //
    129         // count used and core pixels
    130         //
    131         if (pix.IsPixelCore())
    132             fNumCorePixels++;
    133 
    134         fNumUsedPixels++;
    135138
    136139        //
     
    172175    *fLog << " - Used Pixels    [#]   = " << fNumUsedPixels << " Pixels" << endl;
    173176    *fLog << " - Core Pixels    [#]   = " << fNumCorePixels << " Pixels" << endl;
     177    *fLog << " - Sat. Pixels    [#]   = " << fNumSaturatedPixels << " Pixels" << endl;
    174178}
  • trunk/MagicSoft/Mars/mimage/MNewImagePar.h

    r2849 r3183  
    1313{
    1414private:
    15     Float_t fLeakage1;      // (photons in most outer ring of pixels) over fSize
    16     Float_t fLeakage2;      // (photons in the 2 outer rings of pixels) over fSize
     15    Float_t fLeakage1;           // (photons in most outer ring of pixels) over fSize
     16    Float_t fLeakage2;           // (photons in the 2 outer rings of pixels) over fSize
    1717
    18     Float_t fConc;          // [ratio] concentration ratio: sum of the two highest pixels / fSize
    19     Float_t fConc1;         // [ratio] concentration ratio: sum of the highest pixel / fSize
     18    Float_t fConc;               // [ratio] concentration ratio: sum of the two highest pixels / fSize
     19    Float_t fConc1;              // [ratio] concentration ratio: sum of the highest pixel / fSize
    2020
    21     Short_t fNumUsedPixels; // Number of pixels which survived the image cleaning
    22     Short_t fNumCorePixels; // number of core pixels
    23 
    24     Short_t fNumSaturatedPixels; // number of saturated pixels
     21    Short_t fNumUsedPixels;      // Number of pixels which survived the image cleaning
     22    Short_t fNumCorePixels;      // number of core pixels
     23    Short_t fNumSaturatedPixels; // number of pixels with saturating lo-gains
    2524
    2625public:
     
    2928    void Reset();
    3029
    31     Float_t GetLeakage1() const    { return fLeakage1; }
    32     Float_t GetLeakage2() const    { return fLeakage2; }
     30    Float_t GetLeakage1() const { return fLeakage1; }
     31    Float_t GetLeakage2() const { return fLeakage2; }
    3332
    34     Float_t GetConc() const        { return fConc; }
    35     Float_t GetConc1() const       { return fConc1; }
     33    Float_t GetConc() const  { return fConc; }
     34    Float_t GetConc1() const { return fConc1; }
    3635
    37     Int_t GetNumUsedPixels() const { return fNumUsedPixels; }
    38     Int_t GetNumCorePixels() const { return fNumCorePixels; }
     36    Short_t GetNumUsedPixels() const { return fNumUsedPixels; }
     37    Short_t GetNumCorePixels() const { return fNumCorePixels; }
    3938
    4039    Short_t GetNumSaturatedPixels() const { return fNumSaturatedPixels; }
     
    4948
    5049#endif
    51 
    52 
    53 
    54 
    55 
    56 
    57 
    58 
    59 
    60 
    61 
    62 
    63 
    64 
    65 
    66 
    67 
    68 
    69 
    70 
    71 
    72 
    73 
    74 
    75 
    76 
    77 
  • trunk/MagicSoft/Mars/mraw/MRawCrateArray.cc

    r2645 r3183  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2001
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
  • trunk/MagicSoft/Mars/mraw/MRawCrateData.cc

    r2748 r3183  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2001
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
  • trunk/MagicSoft/Mars/mraw/MRawEvtData.cc

    r3047 r3183  
    1818!   Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2003
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
  • trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc

    r3139 r3183  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2001
     18!   Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
  • trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc

    r3018 r3183  
    1919!   Author(s): Markus Gaus 10/2002 <mailto:markus@ifae.es>
    2020!
    21 !   Copyright: MAGIC Software Development, 2000-2002
     21!   Copyright: MAGIC Software Development, 2000-2004
    2222!
    2323!
  • trunk/MagicSoft/Mars/mraw/MRawFileRead.cc

    r2984 r3183  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2001
     18!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    148148    // Read RUN HEADER (see specification) from input stream
    149149    //
    150     fRawRunHeader->ReadEvt(*fIn);
     150    if (!fRawRunHeader->ReadEvt(*fIn))
     151        return kFALSE;
     152
    151153    if (!(*fIn))
    152154    {
     
    154156        return kFALSE;
    155157    }
    156     if (fRawRunHeader->GetMagicNumber()!=kMagicNumber)
    157         return kFALSE;
     158    //if (fRawRunHeader->GetMagicNumber()!=kMagicNumber)
     159    //    return kFALSE;
    158160
    159161    fRawRunHeader->Print();
  • trunk/MagicSoft/Mars/mraw/MRawFileWrite.cc

    r2556 r3183  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2001
     18!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
  • trunk/MagicSoft/Mars/mraw/MRawRead.cc

    r3139 r3183  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2001
     18!   Author(s): Thomas Bretz 10/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc

    r3047 r3183  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2001
     18!   Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    101101// Read in one run header from the binary file
    102102//
    103 void MRawRunHeader::ReadEvt(istream& fin)
     103Bool_t MRawRunHeader::ReadEvt(istream& fin)
    104104{
    105105    //
     
    116116    {
    117117        *fLog << err << "Error: Wrong Magic Number (0x" << hex << fMagicNumber << "): Not a Magic File!" << endl;
    118         return;
     118        return kFALSE;
    119119    }
    120120
     
    125125
    126126    fin.read((char*)&fFormatVersion,    2);     // Total=4
    127     if (fFormatVersion>2)
    128         *fLog << warn << "WARNING - Format version V" << fFormatVersion << " unknown!" << endl;
     127    if (fFormatVersion>kMaxFormatVersion)
     128    {
     129        *fLog << err << "WARNING - File vormat V" << fFormatVersion << " not implemented!" << endl;
     130        return kFALSE;
     131    }
    129132
    130133    fin.read((char*)&fSoftVersion,      2);     // Total=6
     
    165168    fin.read((char*)fPixAssignment->GetArray(), nPixel*2);
    166169    fin.read((char*)&dummy, 16);
     170
     171    return kTRUE;
    167172}
    168173
  • trunk/MagicSoft/Mars/mraw/MRawRunHeader.h

    r3047 r3183  
    1717// Magic number to detect the magic file type
    1818//
    19 const UShort_t kMagicNumber = 0xc0c0;
     19const UShort_t kMagicNumber      = 0xc0c0;
     20const Byte_t   kMaxFormatVersion =      3;
    2021
    2122//
     
    106107    void Print(Option_t *t=NULL) const;
    107108
    108     void ReadEvt(istream& fin);
     109    Bool_t ReadEvt(istream& fin);
    109110
    110111    ClassDef(MRawRunHeader, 2)  // storage container for general info
  • trunk/MagicSoft/Mars/mraw/MRawSocketRead.cc

    r2748 r3183  
    1818!   Author(s): Thomas Bretz, 10/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2003
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    220220    //
    221221    fLog->SetNullOutput();
    222     fRawRunHeader->ReadEvt(*fIn);
     222    const Bool_t rc = fRawRunHeader->ReadEvt(*fIn);
    223223    fLog->SetNullOutput(kFALSE);
    224224
    225     if (fRawRunHeader->GetMagicNumber()!=kMagicNumber && fRawRunHeader->GetMagicNumber()!=kMagicNumber+1)
    226     {
    227         *fLog << err << "Error: Wrong Magic Number (0x" << hex << fRawRunHeader->GetMagicNumber() << "): Not a Magic File!" << endl;
    228         return kFALSE;
    229     }
     225    if (!rc)
     226        return kFALSE;
    230227
    231228    if (fRunNumber!=fRawRunHeader->GetRunNumber())
  • trunk/MagicSoft/Mars/star.cc

    r2623 r3183  
    7171}
    7272
     73class MJStar : public MParContainer
     74{
     75private:
     76    TString fInputFile;
     77    TString fOutputFile;
     78
     79    Bool_t fIsUpdate;
     80    Byte_t fComprLevel;
     81
     82    Byte_t fSerialIdx;
     83
     84    Bool_t CheckFiles()
     85    {
     86        if (fOutputFile.IsNull())
     87        {
     88            fOutputFile = fInputFile;
     89
     90            if (fOutputFile.EndsWith(".raw"))
     91                fOutputFile = fOutputFile(0, fOutputFile.Length()-4);
     92
     93            if (fOutputFile.EndsWith(".rep"))
     94                fOutputFile = fOutputFile(0, fOutputFile.Length()-4);
     95
     96            if (fOutputFile.EndsWith(".txt"))
     97                fOutputFile = fOutputFile(0, fOutputFile.Length()-4);
     98        }
     99
     100        if (fInputFile.IsNull())
     101        {
     102            *fLog << err << "Sorry, no input file." << endl;
     103            return kFALSE;
     104        }
     105
     106        if (fOutputFile.IsNull())
     107        {
     108            *fLog << err << "Sorry, no output file." << endl;
     109            return kFALSE;
     110        }
     111
     112        if (!fInputFile.EndsWith(".root"))
     113            fInputFile += ".root";
     114
     115        if (!fOutputFile.EndsWith(".root"))
     116            fOutputFile += ".root";
     117
     118        //
     119        // check whether the given files are OK.
     120        //
     121        if (gSystem->AccessPathName(fInputFile, kFileExists))
     122        {
     123            *fLog << err << "Sorry, the input file '" << fInputFile << "' doesn't exist." << endl;
     124            return kFALSE;
     125        }
     126
     127        if (!gSystem->AccessPathName(fOutputFile, kFileExists))
     128        {
     129            if (fIsUpdate)
     130                gLog << warn << "Warning: File doesn't '" << fOutputFile << "' exist... recreating." << endl;
     131        }
     132
     133        if (fIsUpdate || gSystem->AccessPathName(fOutputFile, kFileExists))
     134            if (!gSystem->AccessPathName(fOutputFile, kWritePermission))
     135        {
     136            gLog << err << "Sorry, you don't have write permission for '" << fOutputFile << "'." << endl;
     137            return kFALSE;
     138        }
     139        return kTRUE;
     140    }
     141
     142public:
     143    MJStar(const char *name=0, const char *title=0)
     144        : fIsUpdate(kFALSE), fComprLevel(1), fSerialIdx(0)
     145    {
     146        fName  = name;
     147        fTitle = title;
     148    }
     149
     150    void SetInputFile(const char *f)  { fInputFile  = f; }
     151    void SetOutputFile(const char *f) { fOutputFile = f; }
     152    void SetSerialIdx(Byte_t i)       { fSerialIdx  = i; }
     153    void SetComprLevel(Byte_t l)      { fComprLevel = l; }
     154    void SetUpdate(Bool_t u=kTRUE)    { fIsUpdate   = u; }
     155
     156    Bool_t Process()
     157    {
     158        if (!CheckFiles())
     159            return kFALSE;
     160
     161        //
     162        // Create a empty Parameter List and an empty Task List
     163        // The tasklist is identified in the eventloop by its name
     164        //
     165        MParList plist;
     166
     167        MTaskList tlist;
     168        plist.AddToList(&tlist);
     169
     170        // PRELIMINARY:
     171        /*
     172         MReportDrive rep;
     173         plist.AddToList(&rep);
     174         MPointingPos pos;
     175         plist.AddToList(&pos);
     176         */
     177
     178        //
     179        // Now setup the tasks and tasklist:
     180        // ---------------------------------
     181        //
     182        MReadMarsFile read("Events", fInputFile);
     183        read.DisableAutoScheme();
     184
     185        MGeomApply        apply;
     186        MMcPedestalCopy   pcopy;
     187        MMcPedestalNSBAdd pnsb;
     188
     189        //MPointingPosCalc  pcalc;
     190
     191        MCerPhotCalc      ncalc;
     192        MCerPhotAnal2     nanal;
     193
     194        MFDataMember f1("MRawRunHeader.fRunType", '>', 255.5);
     195        MFDataMember f2("MRawRunHeader.fRunType", '<', 255.5);
     196
     197        ncalc.SetFilter(&f1);
     198        nanal.SetFilter(&f2);
     199
     200        MBlindPixelCalc   blind;
     201        MSigmabarCalc     sgcal;
     202        //MFillH            fills("MHSigmaTheta",  "", "FillSigmaTheta");
     203        //MFillH            fillb("MHBlindPixels", "", "FillBlindPixels");
     204        MImgCleanStd      clean;
     205        MHillasCalc       hcalc;
     206        MHillasSrcCalc    scalc; // !!Preliminary!! Will be removed later!
     207        MWriteRootFile    write(fOutputFile, fIsUpdate?"UPDATE":"RECREATE", "Star output", fComprLevel);
     208
     209        tlist.AddToList(&read);
     210        tlist.AddToList(&f1);
     211        tlist.AddToList(&f2);
     212        tlist.AddToList(&apply);
     213        tlist.AddToList(&pcopy);
     214        tlist.AddToList(&pnsb);
     215        //tlist.AddToList(&pcalc);
     216        tlist.AddToList(&ncalc);
     217        tlist.AddToList(&nanal);
     218        tlist.AddToList(&blind);
     219        tlist.AddToList(&sgcal);
     220        //tlist.AddToList(&fills);
     221        //tlist.AddToList(&fillb);
     222        tlist.AddToList(&clean);
     223        tlist.AddToList(&hcalc);
     224        tlist.AddToList(&scalc);
     225        tlist.AddToList(&write);
     226
     227        //
     228        // Set the serial number for all tasks in the current tasklist
     229        //
     230        tlist.SetSerialNumber(fSerialIdx);
     231
     232        //
     233        // Setup tasks
     234        //
     235        blind.SetUseInterpolation();
     236
     237        write.AddContainer(write.AddSerialNumber("MMcEvt"),       "Events", kFALSE);
     238        write.AddContainer(write.AddSerialNumber("MSigmabar"),    "Events");
     239        write.AddContainer(write.AddSerialNumber("MHillas"),      "Events");
     240        write.AddContainer(write.AddSerialNumber("MHillasExt"),   "Events");
     241        write.AddContainer(write.AddSerialNumber("MHillasSrc"),   "Events");
     242        write.AddContainer(write.AddSerialNumber("MNewImagePar"), "Events");
     243        write.AddContainer(write.AddSerialNumber("MSrcPosCam"),   "RunHeaders");
     244        //write.AddContainer(write.AddSerialNumber("MHSigmaTheta"), "RunHeaders");
     245        if (!fIsUpdate)
     246        {
     247            write.AddContainer("MRawRunHeader", "RunHeaders");
     248            write.AddContainer("MMcRunHeader",  "RunHeaders", kFALSE);
     249        }
     250
     251        //
     252        // Create and set up the eventloop
     253        //
     254        MEvtLoop evtloop;
     255        evtloop.SetParList(&plist);
     256
     257        //
     258        // Execute your analysis
     259        //
     260        if (!evtloop.Eventloop())
     261        {
     262            gLog << err << "ERROR: Star eventloop failed!" << endl;
     263            return kFALSE;
     264        }
     265
     266        tlist.PrintStatistics();
     267
     268        //plist.FindObject("MHSigmaTheta")->Write();
     269        //plist.FindObject("MHBlindPixels")->Write();
     270
     271        gLog << all << "Star finished successfull!" << endl;
     272
     273        return kTRUE;
     274    }
     275//    ClassDef(MJStar, 0)
     276};
     277
     278//ClassImp(MJStar);
     279
     280
    73281int main(const int argc, char **argv)
    74282{
     
    102310
    103311    //
     312    // Initialize Non-GUI (batch) mode
     313    //
     314    gROOT->SetBatch();
     315
     316    MArray::Class()->IgnoreTObjectStreamer();
     317    MParContainer::Class()->IgnoreTObjectStreamer();
     318
     319    MJStar star;
     320    star.SetInputFile(arg.GetArgumentStr(0));
     321    star.SetOutputFile(arg.GetArgumentStr(1));
     322    star.SetComprLevel(kComprlvl);
     323    star.SetSerialIdx(kTelIndex);
     324    star.SetUpdate(kUpdate);
     325
     326    if (!star.Process())
     327    {
     328        gLog << err << "Star failed!" << endl;
     329        return -1;
     330    }
     331
     332    gLog << inf << "Star finished successfull!" << endl;
     333
     334    return 0;
     335/*
     336    //
    104337    // This is to make argv[i] more readable inside the code
    105338    //
     
    114347
    115348    //
    116     // Initialize Non-GUI (batch) mode
    117     //
    118     gROOT->SetBatch();
    119 
    120     //
    121349    // check whether the given files are OK.
    122350    //
     
    140368        }
    141369
    142     MArray::Class()->IgnoreTObjectStreamer();
    143     MParContainer::Class()->IgnoreTObjectStreamer();
    144 
    145370    //
    146371    // Create a empty Parameter List and an empty Task List
     
    153378
    154379    // PRELIMINARY:
    155     /*
    156      MReportDrive rep;
    157      plist.AddToList(&rep);
    158      MPointingPos pos;
    159      plist.AddToList(&pos);
    160      */
     380    // MReportDrive rep;
     381    // plist.AddToList(&rep);
     382    // MPointingPos pos;
     383    // plist.AddToList(&pos);
    161384
    162385    //
     
    255478    gLog << all << "Star finished successfull!" << endl;
    256479    return 0;
     480    */
    257481}
Note: See TracChangeset for help on using the changeset viewer.