Changeset 1465


Ignore:
Timestamp:
08/01/02 09:31:18 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1463 r1465  
    11                                                                  -*-*- END -*-*-
     2
     3 2002/08/01: Thomas Bretz
     4
     5   * manalysis/MHillas.[h,cc]:
     6     - don't draw ellipse if values are invalid
     7     - add used and core pixels to Print-output
     8
     9   * manalysis/MHillasExt.cc:
     10     - reordered some comments
     11
     12   * mdata/MDataChain.[h,cc]:
     13     - fixed a bug causing usage of '-' sometime not to work
     14     - added handling of '+' sign
     15
     16   * mfileio/MReadTree.h:
     17     - changed some comments
     18
     19   * mhist/MBinning.[h,cc]:
     20     - added Apply
     21
     22   * mhist/MHHillas.[h,cc], mhist/MHHillasSrc.[h,cc],
     23     mhist/MHHillasExt.[h,cc]:
     24     - added default binning (usefull for the Magic Camera)
     25     - some changes to the layout
     26     - added support for the sign in MHHillasExt
     27
     28
    229
    330 2002/07/31: Thomas Bretz
  • trunk/MagicSoft/Mars/manalysis/MHillas.cc

    r1434 r1465  
    126126    *fLog << all;
    127127    *fLog << "Basic Image Parameters (" << GetName() << ")" << endl;
    128     *fLog << " - Length   [mm]  = " << fLength << endl;
    129     *fLog << " - Width    [mm]  = " << fWidth  << endl;
    130     *fLog << " - Delta    [deg] = " << fDelta*kRad2Deg << endl;
    131     *fLog << " - Size     [1]   = " << fSize   << " #CherPhot"   << endl;
    132     *fLog << " - Meanx    [mm]  = " << fMeanX  << endl;
    133     *fLog << " - Meany    [mm]  = " << fMeanY  << endl;
    134     *fLog << " - atg(y/x) [deg] = " << atg     << endl;
     128    *fLog << " - Length      [mm]  = " << fLength << endl;
     129    *fLog << " - Width       [mm]  = " << fWidth  << endl;
     130    *fLog << " - Delta       [deg] = " << fDelta*kRad2Deg << endl;
     131    *fLog << " - Size        [1]   = " << fSize   << " #CherPhot"   << endl;
     132    *fLog << " - Meanx       [mm]  = " << fMeanX  << endl;
     133    *fLog << " - Meany       [mm]  = " << fMeanY  << endl;
     134    *fLog << " - atg(y/x)    [deg] = " << atg     << endl;
     135    *fLog << " - Used Pixels [#]   = " << fNumUsedPixels << " Pixels" << endl;
     136    *fLog << " - Core Pixels [#]   = " << fNumCorePixels << " Pixels" << endl;
    135137}
    136138
     
    160162
    161163    Clear();
     164
     165    if (fLength<0 || fWidth<0)
     166        return;
    162167
    163168    fEllipse = new TEllipse(fMeanX, fMeanY, fLength, fWidth,
  • trunk/MagicSoft/Mars/manalysis/MHillas.h

    r1434 r1465  
    2222    Float_t fMeanY;         // [mm]        y-coordinate of center of ellipse
    2323
     24    Short_t fNumUsedPixels; // Number of pixels which survived the image cleaning
     25    Short_t fNumCorePixels; // number of core pixels
     26
    2427    Float_t fSinDelta;      //! [1] sin of Delta (to be used in derived classes)
    2528    Float_t fCosDelta;      //! [1] cos of Delta (to be used in derived classes)
    26 
    27     Short_t fNumUsedPixels; // Number of pixels which survived the image cleaning
    28     Short_t fNumCorePixels; // number of core pixels
    2929
    3030    TEllipse *fEllipse;     //! Graphical Object to Display Ellipse
  • trunk/MagicSoft/Mars/manalysis/MHillasExt.cc

    r1460 r1465  
    1818!   Author(s): Thomas Bretz    12/2000 <mailto:tbretz@uni-sw.gwdg.de>
    1919!   Author(s): Rudolf Bock     10/2001 <mailto:Rudolf.Bock@cern.ch>
     20!   Author(s): Wolfgang Wittek 06/2002 <mailto:wittek@mppmu.mpg.de>
    2021!
    2122!   Copyright: MAGIC Software Development, 2000-2002
     
    3637// fM3Long   third moment along major axis
    3738// fM3Trans  third moment along minor axis
     39// fLeakage1 ratio : (photons in most outer ring of pixels) over fSize
     40// fLeakage2 ratio : (photons in the 2 outer rings of pixels) over fSize
     41//
     42// WARNING: Before you can use fAsym, fM3Long and fM3Trans you must
     43//          multiply by the sign of MHillasSrc::fCosAlphaDelta
    3844//
    3945////////////////////////////////////////////////////////////////////////////
     46/*
     47 // fAsymna   d/(d na) of ( sum(x*q^na)/sum(q^na), sum(y*q^na)/sum(q^na) )
     48 //           projected onto the major axis
     49 // fAsym0    (F-B)/(F+B) along the major axis
     50 */
    4051#include "MHillasExt.h"
    4152
     
    172183        /*
    173184         //
     185         // power na for calculating fAsymna;
     186         // the value 1.5 was suggested by Thomas Schweizer
     187         //
     188         Double_t na = 1.5;
     189
     190         //
    174191         // get sums for calculating fAsymna
    175192         // the outer pixels are 4 times as big (in area)
     
    201218
    202219    /*
    203 
    204      //
    205      // power na for calculating fAsymna;
    206      // the value 1.5 was suggested by Thomas Schweizer
    207      //
    208      Double_t na = 1.5;
    209 
    210220     fLeakage1 = edgepix1 / GetSize();
    211221     fLeakage2 = edgepix2 / GetSize();
  • trunk/MagicSoft/Mars/mdata/MDataChain.cc

    r1353 r1465  
    162162{
    163163    int l = txt.Length();
    164     for (int i = 0; i<l; i++)
    165         if (!isalnum(txt[i]) && txt[i]!='.' && txt[i]!='-')
     164    for (int i=0; i<l; i++)
     165    {
     166        if (!isalnum(txt[i]) && txt[i]!='.' &&
     167            ((txt[i]!='-' && txt[i]!='+') || i!=0))
    166168            return i;
     169    }
    167170
    168171    return l;
     
    210213    if (txt=="sgn")   return kESgn;
    211214    if (txt[0]=='-')  return kENegative;
     215    if (txt[0]=='+')  return kEPositive;
    212216
    213217    return kENoop;
     
    324328        case '8':
    325329        case '9':
    326             if (txt[0]!='-' || isdigit(txt[1]) || txt[1]=='.')
     330            if ((txt[0]!='-' && txt[0]!='+') || isdigit(txt[1]) || txt[1]=='.')
    327331            {
    328332                char *end;
     
    360364            txt = txt.Strip(TString::kBoth);
    361365
    362             if (txt.IsNull() || txt[0]!='(')
     366            if ((txt.IsNull() || txt[0]!='(') && text[0]!='-' && text[0]!='+')
    363367            {
    364368                newmember = new MDataMember(text.Data());
     
    376380
    377381            Int_t first = GetBracket(txt);
    378             TString sub = op==kENegative ? text.Remove(0,1) + txt : txt(1, first-1);
     382            TString sub = op==kENegative || op==kEPositive ? text.Remove(0,1) + txt : txt(1, first-1);
    379383            txt.Remove(0, first+1);
    380384
     
    435439    case kESgn:      return val<0 ? -1 : 1;
    436440    case kENegative: return -val;
     441    case kEPositive: return val;
    437442    case kENoop:     return val;
    438443    }
     
    466471    case kESgn:      *fLog << "sgn"   << flush; break;
    467472    case kENegative: *fLog << "-" << flush; break;
     473    case kEPositive: *fLog << "+" << flush; break;
    468474    case kENoop:
    469475        break;
  • trunk/MagicSoft/Mars/mdata/MDataChain.h

    r1353 r1465  
    3737        kEExp,
    3838        kESgn,
     39        kEPositive,
    3940        kENegative
    4041    } OperatorType_t;
  • trunk/MagicSoft/Mars/mfileio/MReadTree.cc

    r1381 r1465  
    8989        // This is the code from TChain::LoadTree but skips the
    9090        // notification in LoadTree. If LoadTree raises the notification
    91         // a flag is set and the notification is done by hand. If it
    92         // has not been successfull -15 is returned.
     91        // a flag is set and the notification is done by hand. This
     92        // is done to be able to catch the return value from Notify. If
     93        // it has not been successfull -15 is returned.
    9394        // This is to support return values from Notify()/Reinit()
    9495        //
  • trunk/MagicSoft/Mars/mhist/MBinning.cc

    r1368 r1465  
    3131#include "MBinning.h"
    3232
     33#include "MH.h"
     34
    3335ClassImp(MBinning);
    3436
     
    4951}
    5052
     53
     54void MBinning::Apply(TH1 &h)
     55{
     56    MH::SetBinning(&h, this);
     57}
  • trunk/MagicSoft/Mars/mhist/MBinning.h

    r1215 r1465  
    1010#endif
    1111
     12class TH1;
     13
    1214class MBinning : public MParContainer
    1315{
     
    2022    void SetEdges(const TArrayD &arr)
    2123    {
    22         fEdges = arr;/*
    23         const Int_t nbins = arr.GetSize();
    24         fEdges.Set(nbins);
    25         for (int i=0; i<nbins; i++)
    26             fEdges[i] = (*(TArrayD*)(&arr))[i];*/
     24        fEdges = arr;
    2725    }
    2826
     
    5452    Double_t *GetEdges() const { return fEdges.GetArray(); }
    5553
     54    void Apply(TH1 &);
     55
    5656    ClassDef(MBinning, 1) //Container to store the binning of a histogram
    5757};
  • trunk/MagicSoft/Mars/mhist/MHHillas.cc

    r1463 r1465  
    9999    fSize->GetXaxis()->SetLabelOffset(-0.015);
    100100
    101     MH::SetBinning(fSize, &bins);
     101    bins.Apply(*fSize);
    102102
    103103    fCenter = new TH2F("Center", "Center of Ellipse", 51, -445, 445, 51, -445, 445);
     
    138138    const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
    139139    if (!geom)
    140         *fLog << warn << dbginf << "No Camera Geometry available. Using mm-scale for histograms." << endl;
     140        *fLog << warn << GetDescriptor() << ": No Camera Geometry available. Using mm-scale for histograms." << endl;
    141141    else
    142142    {
  • trunk/MagicSoft/Mars/mhist/MHHillasExt.cc

    r1283 r1465  
    4343
    4444#include "MGeomCam.h"
     45
    4546#include "MParList.h"
     47
     48#include "MBinning.h"
    4649#include "MHillasExt.h"
     50#include "MHillasSrc.h"
    4751
    4852ClassImp(MHHillasExt);
     
    8892    fHM3Long.SetYTitle("Counts");
    8993    fHM3Trans.SetYTitle("Counts");
     94
     95
     96    MBinning bins;
     97
     98    bins.SetEdges(100, 0, 1);
     99    bins.Apply(fHConc);
     100    bins.Apply(fHConc1);
     101
     102    bins.SetEdges(101, -326, 326);
     103    bins.Apply(fHM3Long);
     104    bins.Apply(fHM3Trans);
     105
     106    bins.SetEdges(89, -297, 593);
     107    bins.Apply(fHAsym);
    90108}
    91109
     
    110128Bool_t MHHillasExt::SetupFill(const MParList *plist)
    111129{
    112     const MBinning* binsc  = (MBinning*)plist->FindObject("BinningConc");
    113     const MBinning* binsc1 = (MBinning*)plist->FindObject("BinningConc1");
    114     const MBinning* binsa  = (MBinning*)plist->FindObject("BinningAsym");
    115     const MBinning* binsl  = (MBinning*)plist->FindObject("BinningM3Long");
    116     const MBinning* binst  = (MBinning*)plist->FindObject("BinningM3Trans");
    117     if (!binsc || !binsc1 || !binsa || !binsl || !binst)
    118     {
    119         *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;
    120         return kFALSE;
    121     }
    122 
    123     SetBinning(&fHConc,    binsc);
    124     SetBinning(&fHConc1,   binsc1);
    125     SetBinning(&fHAsym,    binsa);
    126     SetBinning(&fHM3Long,  binsl);
    127     SetBinning(&fHM3Trans, binst);
    128 
    129130    const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
    130131    if (!geom)
    131     {
    132         *fLog << warn << dbginf << "No Camera Geometry available. Using mm-scale for histograms." << endl;
    133         return kTRUE;
    134     }
    135 
    136     fHAsym.SetXTitle("Asym [\\circ]");
    137     fHM3Long.SetXTitle("3^{rd} M_{l} [\\circ]");
    138     fHM3Trans.SetXTitle("3^{rd} M_{t} [\\circ]");
     132        *fLog << warn << GetDescriptor() << ": No Camera Geometry available. Using mm-scale for histograms." << endl;
     133    else
     134    {
     135        fMm2Deg = geom->GetConvMm2Deg();
     136        SetMmScale(kFALSE);
     137    }
     138
     139    ApplyBinning(*plist, "Conc",    &fHConc);
     140    ApplyBinning(*plist, "Conc1",   &fHConc1);
     141    ApplyBinning(*plist, "Asym",    &fHAsym);
     142    ApplyBinning(*plist, "M3Long",  &fHM3Long);
     143    ApplyBinning(*plist, "M3Trans", &fHM3Trans);
     144
     145    fHillasSrc = (MHillasSrc*)plist->FindObject("HillasSource");
     146    if (!fHillasSrc)
     147        *fLog << warn << dbginf << "Sorry 'HillasSource' [MHillasSrc] not found. Histograms will be source independant." << endl;
    139148
    140149    return MHHillas::SetupFill(plist);
     
    148157Bool_t MHHillasExt::Fill(const MParContainer *par)
    149158{
    150     const MHillasExt &h = *(MHillasExt*)par;
    151 
    152     fHConc.Fill(h.GetConc());
    153     fHConc1.Fill(h.GetConc1());
    154 
    155     if (fUseMmScale)
    156     {
    157         fHAsym.Fill(h.GetAsym());
    158         fHM3Long.Fill(h.GetM3Long());
    159         fHM3Trans.Fill(h.GetM3Trans());
    160     }
    161     else
    162     {
    163         fHAsym.Fill(fMm2Deg*h.GetAsym());
    164         fHM3Long.Fill(fMm2Deg*h.GetM3Long());
    165         fHM3Trans.Fill(fMm2Deg*h.GetM3Trans());
    166     }
     159    const MHillasExt &ext = *(MHillasExt*)par;
     160
     161    const Double_t scale = fHillasSrc ? TMath::Sign(fUseMmScale?1:fMm2Deg, fHillasSrc->GetCosDeltaAlpha()) : 1;
     162
     163    fHConc.Fill(ext.GetConc());
     164    fHConc1.Fill(ext.GetConc1());
     165
     166    fHAsym.Fill(scale*ext.GetAsym());
     167    fHM3Long.Fill(scale*ext.GetM3Long());
     168    fHM3Trans.Fill(scale*ext.GetM3Trans());
     169    //fHAsymna.Fill(scale*ext.GetAsymna());
     170    //fHAsym0.Fill(scale*ext.GetAsym0());
    167171
    168172    return MHHillas::Fill(par);
     
    185189    }
    186190
    187     if (fUseMmScale)
     191    const Double_t scale = mmscale ? 1./fMm2Deg : fMm2Deg;
     192    MH::ScaleAxis(&fHAsym,    scale);
     193    MH::ScaleAxis(&fHM3Long,  scale);
     194    MH::ScaleAxis(&fHM3Trans, scale);
     195
     196    if (mmscale)
    188197    {
    189198        fHAsym.SetXTitle("Asym [mm]");
    190199        fHM3Long.SetXTitle("3^{rd} M_{l}[mm]");
    191200        fHM3Trans.SetXTitle("3^{rd} M_{t} [mm]");
    192 
    193         fHAsym.Scale(1./fMm2Deg);
    194         fHM3Long.Scale(1./fMm2Deg);
    195         fHM3Trans.Scale(1./fMm2Deg);
    196201    }
    197202    else
     
    200205        fHM3Long.SetXTitle("3^{rd} M_{l} [\\circ]");
    201206        fHM3Trans.SetXTitle("3^{rd} M_{t} [\\circ]");
    202 
    203         fHAsym.Scale(fMm2Deg);
    204         fHM3Long.Scale(fMm2Deg);
    205         fHM3Trans.Scale(fMm2Deg);
    206207    }
    207208
     
    220221{
    221222    TCanvas &c = *MakeDefCanvas("Hillas", "Histograms of Hillas Parameters",
    222                                3*350, 2*250);
    223     c.Divide(3, 2);
     223                                720, 810);
     224    c.Divide(2, 3);
    224225
    225226    gROOT->SetSelectedPad(NULL);
     
    231232    ((TH1F&)fHConc).DrawCopy();
    232233
    233     c.cd(4);
     234    c.cd(2);
    234235    ((TH1F&)fHConc1).DrawCopy();
    235236
    236     c.cd(2);
     237    c.cd(5);
    237238    ((TH1F&)fHAsym).DrawCopy();
    238239
     
    240241    ((TH1F&)fHM3Long).DrawCopy();
    241242
    242     c.cd(6);
     243    c.cd(4);
    243244    ((TH1F&)fHM3Trans).DrawCopy();
    244245
     
    260261{
    261262    if (!gPad)
    262         MakeDefCanvas("Hillas", "Histograms of Hillas Parameters", 350, 3*250);
    263 
    264     gPad->Divide(3, 2);
     263        MakeDefCanvas("Hillas", "Histograms of Hillas Parameters",
     264                      720, 810);
     265
     266    gPad->Divide(2, 3);
    265267
    266268    gPad->cd(1);
    267269    fHConc.DrawCopy();
    268270
    269     gPad->cd(4);
     271    gPad->cd(2);
    270272    fHConc1.DrawCopy();
    271273
    272     gPad->cd(2);
     274    gPad->cd(5);
    273275    fHAsym.DrawCopy();
    274276
     
    276278    fHM3Long.DrawCopy();
    277279
    278     gPad->cd(6);
     280    gPad->cd(4);
    279281    fHM3Trans.DrawCopy();
    280282
  • trunk/MagicSoft/Mars/mhist/MHHillasExt.h

    r1283 r1465  
    99#endif
    1010
     11class MHillasSrc;
     12
    1113class MHHillasExt : public MHHillas
    1214{
    1315private:
     16    MHillasSrc *fHillasSrc; //! Pointer to an MHillasSrc to be able to add sign to Asym, M3Long and M3Trans
     17
    1418    TH1F fHConc;    // [ratio] concentration ratio: sum of the two highest pixels / fSize
    1519    TH1F fHConc1;   // [ratio] concentration ratio: sum of the highest pixel / fSize
  • trunk/MagicSoft/Mars/mhist/MHHillasSrc.cc

    r1463 r1465  
    179179    if (fMm2Deg<0)
    180180    {
    181         *fLog << warn << dbginf << "Warning - Sorry, no conversion factor for conversion available." << endl;
     181        *fLog << warn << GetDescriptor() << ": Warning - Sorry, no conversion factor for conversion available." << endl;
    182182        return;
    183183    }
Note: See TracChangeset for help on using the changeset viewer.