Changeset 4748 for trunk/MagicSoft


Ignore:
Timestamp:
08/26/04 16:40:23 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4746 r4748  
    7171   * mfileio/MReadReports.h:
    7272     - overwrote GetFileName - otherwise CINT refuses to create an object
     73
     74   * mbadpixels/MBadPixelsTreat.[h,cc]:
     75     - added an primitive interpolation of arrival times which
     76       tries to keep the random arrival time for pixels without
     77       signal
    7378
    7479
  • trunk/MagicSoft/Mars/callisto.cc

    r4746 r4748  
    119119
    120120    const TString kInpathD    = arg.GetStringAndRemove("--ind=",  "");
    121           TString kInpathY    = arg.GetStringAndRemove("--iny=",  ".");
    122           TString kOutpathY   = arg.GetStringAndRemove("--outy=", ".");
    123           TString kOutpathC   = arg.GetStringAndRemove("--outc=", ".");
     121          TString kInpathY    = arg.GetStringAndRemove("--iny=",  "");
     122          TString kOutpathY   = arg.GetStringAndRemove("--outy=", "");
     123          TString kOutpathC   = arg.GetStringAndRemove("--outc=", "");
    124124    const TString kOutpath    = arg.GetStringAndRemove("--out=",  "");
    125125    const TString kPath       = arg.GetStringAndRemove("--path=", "");
     
    139139        return 0;
    140140    }
     141
     142    if (kModeC && kOutpathC.IsNull())
     143        kOutpathC = ".";
     144    if (kModeY)
     145    {
     146        if (kInpathY.IsNull())
     147            kInpathY = ".";
     148        if (kOutpathY.IsNull())
     149            kOutpathY = ".";
     150    }
    141151    if (!kOutpath.IsNull())
    142152    {
     
    232242        else
    233243            gLog << err << "ERROR";
    234         gLog << " - " << n1 << " files in sequence defined, but " << n0 << "found in ";
     244        gLog << " - " << n1 << " files in sequence defined, but " << n0 << " found in ";
    235245        gLog << (kInpathD.IsNull() ? "<defaultpath>" : kInpathD.Data()) << endl;
    236246        if (!kForceExec)
     
    316326        }
    317327
    318         gLog << all << endl << endl;
     328        gLog << flush << all << endl << endl;
    319329    }
    320330
     
    371381        }
    372382
    373         gLog << all << endl << endl;
     383        gLog << flush << all << endl << endl;
    374384    }
    375385
  • trunk/MagicSoft/Mars/callisto.rc

    r4732 r4748  
    202202MJCalibrateSignal.MBadPixelsTreat.UseInterpolation: yes
    203203MJCalibrateSignal.MBadPixelsTreat.ProcessPedestal:  yes
     204MJCalibrateSignal.MBadPixelsTreat.ProcessTimes:     yes
    204205#MJCalibrateSignal.MBadPixelsTreat.UseCentralPixel:  no
    205206#MJCalibrateSignal.MBadPixelsTreat.HardTreatment:    no
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.cc

    r4698 r4748  
    5757
    5858#include <TEnv.h>
    59 #include <TArrayD.h>
     59
     60#include "MArrayD.h" // Used instead of TArrayD because operator[] has no range check
    6061
    6162#include "MLog.h"
     
    7677#include "MBadPixelsCam.h"
    7778
     79#include "MArrivalTime.h"
     80
    7881ClassImp(MBadPixelsTreat);
    7982
     
    8891//
    8992MBadPixelsTreat::MBadPixelsTreat(const char *name, const char *title)
    90   : fFlags(0), fNumMinNeighbors(3), fNamePedPhotContainer("MPedPhotCam")
     93  : fFlags(0), fNumMinNeighbors(3), fNamePedPhotCam("MPedPhotCam")
    9194{
    9295    fName  = name  ? name  : gsDefName.Data();
     
    118121    if (!fBadPixels)
    119122    {
    120         *fLog << err << "MBadPixelsCam not found... aborting." << endl;
     123        *fLog << err << AddSerialNumber("MBadPixelsCam") << " not found... aborting." << endl;
    121124        return kFALSE;
    122125    }
    123126
    124     fPedPhot = (MPedPhotCam*)pList->FindObject(AddSerialNumber(fNamePedPhotContainer), "MPedPhotCam");
    125     if (!fPedPhot)
    126     {
    127         *fLog << err << "MPedPhotCam not found... aborting." << endl;
    128         return kFALSE;
    129     }
    130    
    131127    fEvt = (MCerPhotEvt*)pList->FindObject(AddSerialNumber("MCerPhotEvt"));
    132128    if (!fEvt)
    133129    {
    134         *fLog << err << "MCerPhotEvt not found... aborting." << endl;
     130        *fLog << err << AddSerialNumber("MCerPhotEvt") << " not found... aborting." << endl;
    135131        return kFALSE;
    136132    }
     
    139135    if (!fGeomCam && TESTBIT(fFlags, kUseInterpolation))
    140136    {
    141         *fLog << err << "MGeomCam not found... can't use interpolation." << endl;
     137        *fLog << err << AddSerialNumber("MGeomCam") << " not found - can't use interpolation... abort." << endl;
    142138        return kFALSE;
     139    }
     140
     141    fPedPhot = 0;
     142    if (IsProcessPedestal())
     143    {
     144        fPedPhot = (MPedPhotCam*)pList->FindObject(AddSerialNumber(fNamePedPhotCam), "MPedPhotCam");
     145        if (!fPedPhot)
     146        {
     147            *fLog << err << AddSerialNumber("MPedPhotCam") << " not found... aborting." << endl;
     148            return kFALSE;
     149        }
     150        *fLog << inf << "Processing Pedestals..." << endl;
     151    }
     152
     153    fTimes = 0;
     154    if (IsProcessTimes())
     155    {
     156        fTimes = (MArrivalTime*)pList->FindObject(AddSerialNumber("MArrivalTime"));
     157        if (!fTimes)
     158        {
     159            *fLog << err << AddSerialNumber("MArrivalTime") << " not found... aborting." << endl;
     160            return kFALSE;
     161        }
     162        *fLog << inf << "Processing Times..." << endl;
    143163    }
    144164
     
    160180    // Create arrays (FIXME: Check if its possible to create it only once)
    161181    //
    162     TArrayD nphot(entries);
    163     TArrayD perr(entries);
     182    MArrayD nphot(entries);
     183    MArrayD perr(entries);
    164184 
    165185    //
     
    269289
    270290    // Create arrays (FIXME: Check if its possible to create it only once)
    271     TArrayD ped(entries);
    272     TArrayD rms(entries);
     291    MArrayD ped(entries);
     292    MArrayD rms(entries);
    273293
    274294    //
     
    354374
    355375        (*fPedPhot)[i].Set(ped[i], rms[i]);
     376    }
     377}
     378
     379// --------------------------------------------------------------------------
     380//
     381void MBadPixelsTreat::InterpolateTimes() const
     382{
     383    Int_t n = fTimes->GetSize();
     384
     385    for (int i=0; i<n; i++)
     386    {
     387        //
     388        // Check whether pixel with idx i is blind
     389        //
     390        if (!IsPixelBad(i))
     391            continue;
     392
     393        //
     394        // Get the corresponding geometry and pedestal
     395        //
     396        const MGeomPix &gpix = (*fGeomCam)[i];
     397
     398        const Int_t n0 = gpix.GetNumNeighbors();
     399
     400        MArrayD time(6);
     401        for (int j=0; j<n0; j++)
     402            time[j] = (*fTimes)[gpix.GetNeighbor(j)];
     403
     404        Int_t p0=0;
     405        Int_t p1=0;
     406
     407        Double_t min=FLT_MAX;
     408        for (int j=0; j<n0; j++)
     409            for (int k=1; k<j+1; k++)
     410            {
     411                const Double_t diff = TMath::Abs(time[n0-k] - time[n0-k-j]);
     412
     413                if (diff>=min && diff<250)
     414                    continue;
     415
     416                p0 = n0-k;
     417                p1 = n0-k-j;
     418                min = diff;
     419            }
     420
     421        if (TMath::Abs(time[p0] - time[p1])<250)
     422            fTimes->SetTime(i, (time[p0]+time[p1])/2);
    356423    }
    357424}
     
    557624        if (TESTBIT(fFlags, kProcessPedestal))
    558625            InterpolatePedestals();
     626        if (TESTBIT(fFlags, kProcessTimes))
     627            InterpolateTimes();
    559628    }
    560629    else
     
    582651    if (TESTBIT(fFlags, kProcessPedestal))
    583652        out << "   " << GetUniqueName() << ".SetProcessPedestal();" << endl;
     653    if (TESTBIT(fFlags, kProcessTimes))
     654        out << "   " << GetUniqueName() << ".SetProcessTimes();" << endl;
    584655    if (TESTBIT(fFlags, kHardTreatment))
    585656        out << "   " << GetUniqueName() << ".SetHardTreatment();" << endl;
     
    620691        SetProcessPedestal(GetEnvValue(env, prefix, "ProcessPedestal", IsProcessPedestal()));
    621692    }
     693    if (IsEnvDefined(env, prefix, "ProcessTimes", print))
     694    {
     695        rc = kTRUE;
     696        SetProcessTimes(GetEnvValue(env, prefix, "ProcessTimes", IsProcessTimes()));
     697    }
    622698    if (IsEnvDefined(env, prefix, "NumMinNeighbors", print))
    623699    {
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.h

    r4698 r4748  
    99class MCerPhotEvt;
    1010class MPedPhotCam;
     11class MArrivalTime;
    1112class MBadPixelsCam;
    1213
     
    1718    MPedPhotCam   *fPedPhot;   //!
    1819    MCerPhotEvt   *fEvt;       //!
     20    MArrivalTime  *fTimes;     //!
    1921    MBadPixelsCam *fBadPixels; //!
    2022
    2123    Byte_t fFlags;       // flag for the method which is used
    2224    Byte_t fNumMinNeighbors;
    23     TString fNamePedPhotContainer; // name of the 'MPedPhotCam' container
     25
     26    TString fNamePedPhotCam; // name of the 'MPedPhotCam' container
    2427
    2528    enum
     
    2831        kUseCentralPixel  = 2,
    2932        kProcessPedestal  = 3,
    30         kHardTreatment    = 4
     33        kProcessTimes     = 4,
     34        kHardTreatment    = 5
    3135    };
    3236
    3337    static Double_t Pow2(Double_t x) { return x*x; }
    3438
     39    void InterpolateTimes() const;
    3540    void InterpolateSignal() const;
    3641    void InterpolatePedestals() const;
     
    6065        b ? SETBIT(fFlags, kProcessPedestal) : CLRBIT(fFlags, kProcessPedestal);
    6166    }
     67    void SetProcessTimes(Bool_t b=kTRUE)
     68    {
     69        b ? SETBIT(fFlags, kProcessTimes) : CLRBIT(fFlags, kProcessTimes);
     70    }
    6271    void SetHardTreatment(Bool_t b=kTRUE)
    6372    {
     
    6776    Bool_t IsHardTreatment() const    { return TESTBIT(fFlags, kHardTreatment); }
    6877    Bool_t IsProcessPedestal() const  { return TESTBIT(fFlags, kProcessPedestal); }
     78    Bool_t IsProcessTimes() const     { return TESTBIT(fFlags, kProcessTimes); }
    6979    Bool_t IsUseCentralPixel() const  { return TESTBIT(fFlags, kUseCentralPixel); }
    7080    Bool_t IsUseInterpolation() const { return TESTBIT(fFlags, kUseInterpolation); }
    7181
    7282    void SetNumMinNeighbors(Byte_t num) { fNumMinNeighbors=num; }
    73     void SetNamePedPhotContainer(const char *name)    { fNamePedPhotContainer = name; }
    74 
     83    void SetNamePedPhotCam(const char *name)    { fNamePedPhotCam = name; }
    7584
    7685    ClassDef(MBadPixelsTreat, 1) // Task to treat bad pixels (interpolation, unmapping)
  • trunk/MagicSoft/Mars/mbase/MArrayB.cc

    r1080 r4748  
    1515! *
    1616!
    17 !   Author(s): Thomas Bretz  12/2000 (tbretz@uni-sw.gwdg.de)
     17!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1818!
    19 !   Copyright: MAGIC Software Development, 2000-2001
     19!   Copyright: MAGIC Software Development, 2000-2004
    2020!
    2121\* ======================================================================== */
     
    2323
    2424//////////////////////////////////////////////////////////////////////////////
    25 //                                                                          //
    26 // MArrayB                                                                  //
    27 //                                                                          //
    28 // Array of Byte_t. It is almost the same than TArrayC, but it containes    //
    29 // Byte_t instead of Char_t and it can be stored with splitlevel=1 to a     //
    30 // a root-file because of it's derivement from MArray (TObject)             //                                                                       //
    31 //                                                                          //
     25//
     26// MArrayB
     27//
     28// Array of Byte_t. It is almost the same than TArrayC, but it containes
     29// Byte_t instead of Char_t and it can be stored with splitlevel=1 to a
     30// a root-file because of it's derivement from MArray (TObject)                                                                                    //
     31//
     32// Another advantage is: operator[] has no range check!
     33//
    3234//////////////////////////////////////////////////////////////////////////////
    3335#include "MArrayB.h"
  • trunk/MagicSoft/Mars/mbase/MArrayS.cc

    r1080 r4748  
    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!
     
    2525
    2626//////////////////////////////////////////////////////////////////////////////
    27 //                                                                          //
    28 // MArrayS                                                                  //
    29 //                                                                          //
    30 // Array of UShort_t. It is almost the same than TArrayS, but it containes  //
    31 // UShort_t instead of Short_t and it can be stored with splitlevel=1 to a  //
    32 // a root-file because of it's derivement from MArray (TObject)             //                                                                       //
    33 //                                                                          //
     27//
     28// MArrayS
     29//
     30// Array of UShort_t. It is almost the same than TArrayS, but it containes
     31// UShort_t instead of Short_t and it can be stored with splitlevel=1 to a
     32// a root-file because of it's derivement from MArray (TObject)                                                                                    //
     33//
     34// Another advantage is: operator[] has no range check!
     35//
    3436//////////////////////////////////////////////////////////////////////////////
    3537#include "MArrayS.h"
  • trunk/MagicSoft/Mars/mbase/MGMap.cc

    r4108 r4748  
    135135MGMap::~MGMap()
    136136{
    137 //    fToolTip->Hide();
    138 //    delete fToolTip;
    139 
    140137    if (TestBit(kIsOwner))
    141138        Delete();
     
    164161    {
    165162        delete (TObject*)(key);
    166         if (!val)
    167             continue;
    168 
    169         delete (TString*)(val);
     163        if (val)
     164            delete (TString*)(val);
    170165        /*
    171166         Long_t key2, val2;
Note: See TracChangeset for help on using the changeset viewer.