Ignore:
Timestamp:
03/21/05 10:39:58 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mimage
Files:
4 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mimage/ImageLinkDef.h

    r6855 r6869  
    1515#pragma link C++ class MImagePar+;
    1616#pragma link C++ class MNewImagePar+;
     17#pragma link C++ class MNewImagePar2+;
    1718#pragma link C++ class MConcentration+;
    1819
     
    2223#pragma link C++ class MHImagePar+;
    2324#pragma link C++ class MHNewImagePar+;
     25#pragma link C++ class MHNewImagePar2+;
    2426#pragma link C++ class MStereoPar+;
    2527#pragma link C++ class MStereoCalc+;
  • trunk/MagicSoft/Mars/mimage/MHImagePar.cc

    r6489 r6869  
    252252    pad->cd(2);
    253253    gPad->SetBorderMode(0);
    254     pad->GetPad(2)->Divide(1,2,0,0);
     254    pad->GetPad(2)->Divide(1,2,1e-10,1e-10);
    255255    pad->GetPad(2)->cd(1);
    256256    gPad->SetBorderMode(0);
  • trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc

    r5142 r6869  
    5656//
    5757MHNewImagePar::MHNewImagePar(const char *name, const char *title)
     58    : fMm2Deg(1), fUseMmScale(kTRUE)
    5859{
    5960    fName  = name  ? name  : "MHNewImagePar";
     
    142143    bins.Apply(fHistCorePix);
    143144
    144     bins.SetEdges(75, 0, 0.249);
    145     bins.Apply(fHistUsedArea);
    146     bins.Apply(fHistCoreArea);
     145    //bins.SetEdges(75, 0, 0.249);
     146    //bins.Apply(fHistUsedArea);
     147    //bins.Apply(fHistCoreArea);
    147148}
    148149
     
    154155Bool_t MHNewImagePar::SetupFill(const MParList *plist)
    155156{
     157    MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
     158    if (!geom)
     159        *fLog << warn << GetDescriptor() << ": No Camera Geometry available. Using mm-scale for histograms." << endl;
     160    else
     161    {
     162        fMm2Deg = geom->GetConvMm2Deg();
     163        SetMmScale(kFALSE);
     164    }
     165
     166    const MBinning *bins = (MBinning*)plist->FindObject("BinningArea");
     167    if (!bins)
     168    {
     169        float r = geom ? 1.5 : 0.133;
     170
     171        MBinning b;
     172        b.SetEdges(50, 0, r);
     173        b.Apply(fHistUsedArea);
     174        b.Apply(fHistCoreArea);
     175    }
     176    else
     177    {
     178        bins->Apply(fHistUsedArea);
     179        bins->Apply(fHistCoreArea);
     180    }
     181
    156182    ApplyBinning(*plist, "Leakage", &fHistLeakage1);
    157183    ApplyBinning(*plist, "Leakage", &fHistLeakage2);
     
    160186    ApplyBinning(*plist, "Pixels",  &fHistCorePix);
    161187
    162     ApplyBinning(*plist, "Area",    &fHistUsedArea);
    163     ApplyBinning(*plist, "Area",    &fHistCoreArea);
     188    //ApplyBinning(*plist, "Area",    &fHistUsedArea);
     189    //ApplyBinning(*plist, "Area",    &fHistCoreArea);
    164190
    165191    ApplyBinning(*plist, "Conc",    &fHistConc);
     
    182208    }
    183209
     210    const Double_t scale = fUseMmScale ? 1e-6 : fMm2Deg*fMm2Deg;
     211
    184212    const MNewImagePar &h = *(MNewImagePar*)par;
    185213
     
    190218    fHistCorePix.Fill(h.GetNumCorePixels(), w);
    191219
    192     fHistUsedArea.Fill(h.GetUsedArea()/1000000, w);
    193     fHistCoreArea.Fill(h.GetCoreArea()/1000000, w);
     220    fHistUsedArea.Fill(h.GetUsedArea()*scale, w);
     221    fHistCoreArea.Fill(h.GetCoreArea()*scale, w);
    194222
    195223    fHistConc.Fill(h.GetConc(), w);
     
    197225
    198226    return kTRUE;
     227}
     228
     229// --------------------------------------------------------------------------
     230//
     231// With this function you can convert the histogram ('on the fly') between
     232// degrees and millimeters.
     233//
     234void MHNewImagePar::SetMmScale(Bool_t mmscale)
     235{
     236    if (fUseMmScale == mmscale)
     237        return;
     238
     239    if (fMm2Deg<0)
     240    {
     241        *fLog << warn << dbginf << "Warning - Sorry, no conversion factor for conversion available." << endl;
     242        return;
     243    }
     244
     245    const Double_t scale = mmscale ? 1./(fMm2Deg*fMm2Deg) : (fMm2Deg*fMm2Deg);
     246    MH::ScaleAxis(&fHistUsedArea,  scale);
     247    MH::ScaleAxis(&fHistCoreArea,  scale);
     248
     249    if (mmscale)
     250    {
     251        fHistUsedArea.SetXTitle("A [m^{2}]");
     252        fHistCoreArea.SetXTitle("A [m^{2}]");
     253    }
     254    else
     255    {
     256        fHistUsedArea.SetXTitle("A [deg^{2}]");
     257        fHistCoreArea.SetXTitle("A [deg^{2}]");
     258    }
     259
     260    fUseMmScale = mmscale;
     261}
     262
     263// --------------------------------------------------------------------------
     264//
     265// Use this function to setup your own conversion factor between degrees
     266// and millimeters. The conversion factor should be the one calculated in
     267// MGeomCam. Use this function with Caution: You could create wrong values
     268// by setting up your own scale factor.
     269//
     270void MHNewImagePar::SetMm2Deg(Float_t mmdeg)
     271{
     272    if (mmdeg<0)
     273    {
     274        *fLog << warn << dbginf << "Warning - Conversion factor < 0 - nonsense. Ignored." << endl;
     275        return;
     276    }
     277
     278    if (fMm2Deg>=0)
     279        *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl;
     280
     281    fMm2Deg = mmdeg;
    199282}
    200283
  • trunk/MagicSoft/Mars/mimage/MHNewImagePar.h

    r4833 r6869  
    2626    TH1F fHistConc1;     // [ratio] concentration ratio: sum of the highest pixel / fSize
    2727
     28    Float_t fMm2Deg;
     29    Bool_t  fUseMmScale;
     30
    2831public:
    2932    MHNewImagePar(const char *name=NULL, const char *title=NULL);
     
    4649    TH1F &GetHistConc1()     { return fHistConc1; }
    4750
     51    void SetMmScale(Bool_t mmscale=kTRUE);
     52    virtual void SetMm2Deg(Float_t mmdeg);
     53
    4854    void Draw(Option_t *opt="");
    4955    void Paint(Option_t *opt="");
  • trunk/MagicSoft/Mars/mimage/MHillas.cc

    r6855 r6869  
    128128
    129129    *fLog << all;
    130     *fLog << "Basic Image Parameters (" << GetName() << ")" << endl;
     130    *fLog << GetDescriptor() << endl;
    131131    *fLog << " - Length         [mm]  = " << fLength << endl;
    132132    *fLog << " - Width          [mm]  = " << fWidth  << endl;
     
    151151
    152152    *fLog << all;
    153     *fLog << "Basic Image Parameters (" << GetName() << ")" << endl;
     153    *fLog << GetDescriptor() << endl;
    154154    *fLog << " - Length         [deg] = " << fLength*geom.GetConvMm2Deg() << endl;
    155155    *fLog << " - Width          [deg] = " << fWidth *geom.GetConvMm2Deg() << endl;
     
    240240    {
    241241        MSignalPix &pix = evt[i];
    242         if (!pix.IsPixelUsed())
    243             continue;
     242        //if (!pix.IsPixelUsed())
     243        //    continue;
    244244
    245245        if (island>=0 && pix.GetIdxIsland()!=island)
     
    290290    for (UInt_t i=0; i<numpix; i++)
    291291    {
    292         MSignalPix &pix = evt[i];
     292        const MSignalPix &pix = evt[i];
    293293        if (!pix.IsPixelUsed())
    294294            continue;
  • trunk/MagicSoft/Mars/mimage/MHillasCalc.cc

    r6855 r6869  
    4242//   - Disable(MHillasCalc::kCalcNewImagePar)
    4343//   - Disable(MHillasCalc::kCalcImagePar)
     44//   - Disable(MHillasCalc::kCalcImagePar2)
    4445//   - Disable(MHillasCalc::kCalcSrcPosCam)
    4546//   - Disable(MHillasCalc::kCalcConc)
     
    6162//   - SetNameNewImgPar("NewName")
    6263//   - SetNameImagePar("NewName")
     64//   - SetNameImagePar2("NewName")
    6365//   - SetNameSrcPosCam("NewName")
    6466//   - SetNameConc("NewName")
     
    7779//   - kCalcHillasExt
    7880//   - kCalcNewImgPar
     81//   - kCalcNewImgPar2
    7982//
    8083//
     
    117120//
    118121//    1) MGeomCam          5) MHillas         8) MImagePar
    119 //    2) MSignalCam       6) MHillasSrc      9) MNewImagePar
    120 //    3) MSrcPosCam        7) MHillasExt     10) MConcentration
    121 //    4) fIdxIslands
     122//    2) MSignalCam        6) MHillasSrc      9) MNewImagePar
     123//    3) MSrcPosCam        7) MHillasExt     10) MNewImagePar2
     124//    4) fIdxIslands      11) MConcentration
    122125//
    123126//     Flag           | Input Container | Output
     
    128131//    kCalcImagePar   |     2           |    8
    129132//    kCalcNewImgPar  |  1  2     4  5  |    9
    130 //    kCalcConc       |  1  2        5  |   10
     133//    kCalcNewImgPar2 |  1  2     4     |   10
     134//    kCalcConc       |  1  2        5  |   11
    131135//   -----------------+-----------------+--------
    132136//
     
    145149#include "MImagePar.h"
    146150#include "MNewImagePar.h"
     151#include "MNewImagePar2.h"
    147152#include "MConcentration.h"
    148153
     
    160165const TString MHillasCalc::gsNameHillasExt   = "MHillasExt";     // default name of the 'MHillasExt' container
    161166const TString MHillasCalc::gsNameNewImagePar = "MNewImagePar";   // default name of the 'MNewImagePar' container
     167const TString MHillasCalc::gsNameNewImagePar2= "MNewImagePar2";  // default name of the 'MNewImagePar2' container
    162168const TString MHillasCalc::gsNameConc        = "MConcentration"; // default name of the 'MConcentration' container
    163169const TString MHillasCalc::gsNameImagePar    = "MImagePar";      // default name of the 'MImagePar' container
     
    174180          fNameConc(gsNameConc),           fNameImagePar(gsNameImagePar),
    175181          fNameNewImagePar(gsNameNewImagePar),
     182          fNameNewImagePar2(gsNameNewImagePar2),
    176183          fErrors(7), fFlags(0xff), fIdxIsland(-1)
    177184{
     
    197204    }
    198205
    199     if (TestFlags(kCalcHillas|kCalcHillasExt|kCalcNewImagePar|kCalcConc))
     206    if (TestFlags(kCalcHillas|kCalcHillasExt|kCalcNewImagePar|kCalcNewImagePar2|kCalcConc))
    200207    {
    201208        fGeomCam = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam"));
     
    261268
    262269    // if enabled
     270    if (TestFlag(kCalcNewImagePar2))
     271    {
     272        fNewImgPar2 = (MNewImagePar2*)pList->FindCreateObj("MNewImagePar2", AddSerialNumber(fNameNewImagePar2));
     273        if (!fNewImgPar2)
     274            return kFALSE;
     275    }
     276
     277    // if enabled
    263278    if (TestFlag(kCalcImagePar))
    264279    {
     
    331346    if (TestFlag(kCalcNewImagePar))
    332347        fNewImgPar->Calc(*fGeomCam, *fCerPhotEvt, *fHillas, fIdxIsland);
     348
     349    if (TestFlag(kCalcNewImagePar2))
     350        fNewImgPar2->Calc(*fGeomCam, *fCerPhotEvt, fIdxIsland);
    333351
    334352    if (TestFlag(kCalcConc))
     
    388406    if (TestFlag(kCalcNewImagePar))
    389407        *fLog << " - " << fNameNewImagePar << " from MGeomCam, MSignalCam, " << fNameHillas << " and fIdxIsland=" << fIdxIsland << endl;
     408    if (TestFlag(kCalcNewImagePar2))
     409        *fLog << " - " << fNameNewImagePar2 << " from MGeomCam, MSignalCam, " << fNameHillas << " and fIdxIsland=" << fIdxIsland << endl;
    390410    if (TestFlag(kCalcConc))
    391411        *fLog << " - " << fNameConc << " from MGeomCam, MSignalCam and " << fNameHillas << endl;
     
    427447    if (TestFlag(kCalcNewImagePar) && fNameNewImagePar!=gsNameNewImagePar)
    428448        out << "   " << GetUniqueName() << ".SetNameNewImagePar(\"" << fNameNewImagePar << "\");" << endl;
     449    if (TestFlag(kCalcNewImagePar2) && fNameNewImagePar2!=gsNameNewImagePar2)
     450        out << "   " << GetUniqueName() << ".SetNameNewImagePar2(\"" << fNameNewImagePar2 << "\");" << endl;
    429451
    430452    if (!TestFlag(kCalcHillas))
     
    436458    if (!TestFlag(kCalcNewImagePar))
    437459        out << "   " << GetUniqueName() << ".Disable(MHilllasCalc::kCalcNewImagePar);" << endl;
     460    if (!TestFlag(kCalcNewImagePar2))
     461        out << "   " << GetUniqueName() << ".Disable(MHilllasCalc::kCalcNewImagePar2);" << endl;
    438462    if (!TestFlag(kCalcConc))
    439463        out << "   " << GetUniqueName() << ".Disable(MHilllasCalc::kCalcConc);" << endl;
  • trunk/MagicSoft/Mars/mimage/MHillasCalc.h

    r6855 r6869  
    2424class MImagePar;
    2525class MNewImagePar;
     26class MNewImagePar2;
    2627class MConcentration;
    2728class MSrcPosCam;
     
    3536    static const TString gsNameHillasExt;   // default name of the 'MHillasExt' container
    3637    static const TString gsNameNewImagePar; // default name of the 'MNewImagePar' container
     38    static const TString gsNameNewImagePar2; // default name of the 'MNewImagePar' container
    3739    static const TString gsNameConc;        // default name of the 'MConcentration' container
    3840    static const TString gsNameImagePar;    // default name of the 'MImagePar' container
     
    4850    MImagePar           *fImagePar;         //! output container to store result
    4951    MNewImagePar        *fNewImgPar;        //! output container to store result
     52    MNewImagePar2       *fNewImgPar2;       //! output container to store result
    5053    MConcentration      *fConc;             //! output container to store result
    5154
     
    5760    TString              fNameImagePar;     // name of the 'MImagePar' container
    5861    TString              fNameNewImagePar;  // name of the 'MNewImagePar' container
     62    TString              fNameNewImagePar2; // name of the 'MNewImagePar' container
    5963
    6064    TArrayL              fErrors;           //! Error counter. Do we have to change to Double?
     
    7781    // Flags
    7882    enum CalcCont_t {
    79         kCalcHillas      = BIT(0),
    80         kCalcHillasExt   = BIT(1),
    81         kCalcHillasSrc   = BIT(2),
    82         kCalcNewImagePar = BIT(3),
    83         kCalcConc        = BIT(4),
    84         kCalcImagePar    = BIT(5)
     83        kCalcHillas       = BIT(0),
     84        kCalcHillasExt    = BIT(1),
     85        kCalcHillasSrc    = BIT(2),
     86        kCalcNewImagePar  = BIT(3),
     87        kCalcNewImagePar2 = BIT(4),
     88        kCalcConc         = BIT(5),
     89        kCalcImagePar     = BIT(6)
    8590    };
    8691
     
    98103    void SetNameHillasSrc(const char *name)   { fNameHillasSrc   = name; }
    99104    void SetNameNewImagePar(const char *name) { fNameNewImagePar = name; }
     105    void SetNameNewImagePar2(const char *name){ fNameNewImagePar2 = name; }
    100106    void SetNameConc(const char *name)        { fNameConc        = name; }
    101107    void SetNameImagePar(const char *name)    { fNameImagePar    = name; }
  • trunk/MagicSoft/Mars/mimage/MHillasExt.cc

    r6855 r6869  
    105105// -------------------------------------------------------------------------
    106106//
    107 // Print contents of MHillasExt to *fLog.
    108 //
    109 void MHillasExt::Print(Option_t *) const
    110 {
    111     *fLog << all;
    112     *fLog << "Extended Image Parameters (" << GetName() << ")" << endl;
    113     *fLog << " - Asymmetry            = " << fAsym    << endl;
    114     *fLog << " - 3.Moment Long  [mm]  = " << fM3Long  << endl;
    115     *fLog << " - 3.Moment Trans [mm]  = " << fM3Trans << endl;
    116     *fLog << " - Max.Dist       [mm]  = " << fMaxDist << endl;
    117 }
    118 
    119 // -------------------------------------------------------------------------
    120 //
    121 // Print contents of MHillasExt to *fLog, depending on the geometry in
    122 // units of deg.
    123 //
    124 void MHillasExt::Print(const MGeomCam &geom) const
    125 {
    126     *fLog << all;
    127     *fLog << "Extended Image Parameters (" << GetName() << ")" << endl;
    128     *fLog << " - Asymmetry            = " << fAsym   *geom.GetConvMm2Deg() << endl;
    129     *fLog << " - 3.Moment Long  [deg] = " << fM3Long *geom.GetConvMm2Deg() << endl;
    130     *fLog << " - 3.Moment Trans [deg] = " << fM3Trans*geom.GetConvMm2Deg() << endl;
    131     *fLog << " - Max.Dist       [deg] = " << fMaxDist*geom.GetConvMm2Deg() << endl;
    132 }
    133 
    134 // -------------------------------------------------------------------------
    135 //
    136107// calculation of additional parameters based on the camera geometry
    137108// and the cerenkov photon event
     
    238209    fMaxDist = arr.At(3);
    239210}
     211
     212// -------------------------------------------------------------------------
     213//
     214// Print contents of MHillasExt to *fLog.
     215//
     216void MHillasExt::Print(Option_t *) const
     217{
     218    *fLog << all;
     219    *fLog << GetDescriptor() << endl;
     220    *fLog << " - Asymmetry            = " << fAsym    << endl;
     221    *fLog << " - 3.Moment Long  [mm]  = " << fM3Long  << endl;
     222    *fLog << " - 3.Moment Trans [mm]  = " << fM3Trans << endl;
     223    *fLog << " - Max.Dist       [mm]  = " << fMaxDist << endl;
     224}
     225
     226// -------------------------------------------------------------------------
     227//
     228// Print contents of MHillasExt to *fLog, depending on the geometry in
     229// units of deg.
     230//
     231void MHillasExt::Print(const MGeomCam &geom) const
     232{
     233    *fLog << all;
     234    *fLog << GetDescriptor() << endl;
     235    *fLog << " - Asymmetry            = " << fAsym   *geom.GetConvMm2Deg() << endl;
     236    *fLog << " - 3.Moment Long  [deg] = " << fM3Long *geom.GetConvMm2Deg() << endl;
     237    *fLog << " - 3.Moment Trans [deg] = " << fM3Trans*geom.GetConvMm2Deg() << endl;
     238    *fLog << " - Max.Dist       [deg] = " << fMaxDist*geom.GetConvMm2Deg() << endl;
     239}
  • trunk/MagicSoft/Mars/mimage/MHillasSrc.cc

    r5080 r6869  
    217217{
    218218    *fLog << all;
    219     *fLog << "Source dependant Image Parameters (" << GetName() << ")" << endl;
     219    *fLog << GetDescriptor() << endl;
    220220    *fLog << " - Dist           [mm]  = " << fDist << endl;
    221221    *fLog << " - Alpha          [deg] = " << fAlpha << endl;
     
    233233{
    234234    *fLog << all;
    235     *fLog << "Source dependant Image Parameters (" << GetName() << ")" << endl;
     235    *fLog << GetDescriptor() << endl;
    236236    *fLog << " - Dist           [deg] = " << fDist*geom.GetConvMm2Deg() << endl;
    237237    *fLog << " - Alpha          [deg] = " << fAlpha << endl;
  • trunk/MagicSoft/Mars/mimage/MImagePar.cc

    r6855 r6869  
    106106{
    107107    *fLog << all;
    108     *fLog << "Image Parameters (" << GetName() << ")" << endl;
     108    *fLog << GetDescriptor() << endl;
    109109    *fLog << " - Num Islands      [#] = " << fNumIslands       << " Islands" << endl;
    110110    *fLog << " - Sat.Pixels (HG)  [#] = " << fNumSatPixelsHG   << " Pixels" << endl;
  • trunk/MagicSoft/Mars/mimage/MNewImagePar.cc

    r6855 r6869  
    227227{
    228228    *fLog << all;
    229     *fLog << "New Image Parameters (" << GetName() << ")" << endl;
     229    *fLog << GetDescriptor() << endl;
    230230    *fLog << " - Leakage1       [1]   = " << fLeakage1             << endl;
    231231    *fLog << " - Leakage2       [1]   = " << fLeakage2             << endl;
     
    249249{
    250250    *fLog << all;
    251     *fLog << "New Image Parameters (" << GetName() << ")" << endl;
     251    *fLog << GetDescriptor() << endl;
    252252    *fLog << " - Leakage1       [1]   = " << fLeakage1             << endl;
    253253    *fLog << " - Leakage2       [1]   = " << fLeakage2             << endl;
  • trunk/MagicSoft/Mars/mimage/Makefile

    r6855 r6869  
    3434           MImagePar.cc \
    3535           MNewImagePar.cc \
     36           MNewImagePar2.cc \
    3637           MConcentration.cc \
    3738           MHHillas.cc \
     
    4041           MHImagePar.cc \
    4142           MHNewImagePar.cc \
     43           MHNewImagePar2.cc \
    4244           MStereoPar.cc \
    4345           MStereoCalc.cc
Note: See TracChangeset for help on using the changeset viewer.