Changeset 2026 for trunk/MagicSoft


Ignore:
Timestamp:
04/28/03 15:39:40 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2021 r2026  
    11                                                 -*-*- END OF LINE -*-*-
     2 2003/04/27: Thomas Bretz
     3
     4   * NEWS:
     5     - updated
     6     
     7   * manalysis/MBlindPixelCalc.cc:
     8     - use Are of pixles while interpolating
     9     
     10   * mbase/MEvtLoop.cc:
     11     - output speed in Evts/s to fDisplay
     12     
     13   * mbase/MGGroupFrame.h:
     14     - fixed a typo
     15     
     16   * mbase/MTask.[h,cc]:
     17     - Added OverwritesProcess
     18     
     19   * mbase/MTaskList.[h,cc]:
     20     - removed CheckClassForProcess
     21     - replaced by MTask::OverwritesProcess
     22     
     23   * mhist/MFillH.cc:
     24     - only draw something if the class overwrites the Draw function
     25   
     26   * mhist/MH.[h,cc]:
     27     - added OverwritesDraw
     28     - added a higher maximum, lower minimum to Draw(TH1, TH1)
     29     - changed default size
     30   
     31   * mhist/MHMatrix.cc:
     32     - mini change
     33     
     34   * mimage/MHHillas.[h,cc]:
     35     - removed fUsedPix
     36     - removed fCorePix
     37     
     38   * mimage/MHHillasExt.[h,cc]:
     39     - removed fHConc
     40     - removed fHConc1
     41     - changed default name to MHillasExt
     42     
     43   * mimage/MHNewImagePar.[h,cc]:
     44     - added fHistConc
     45     - added fHistConc1
     46     - added fHistUsedPix
     47     - added fHistCorePix
     48     
     49   * mimage/MHillas.cc:
     50     - removed fNumCorePixels
     51     - removed fNumUsedPixels
     52     - made fCosDelta writable
     53     - made fSinDelta writable
     54     - made GetSinDelta() public
     55     - made GetCosDelta() public
     56     
     57   * mimage/MHillasExt.[h,cc]:
     58     - removed fConc
     59     - removed fConc1
     60     - changed default name to MHillasExt
     61     - derives from MParContainer now instead of MHillas
     62     
     63   * mimage/MNewImagePar.[h,cc]:
     64     - added fNumCorePixels
     65     - added fNumUsedPixels
     66     - added fConc
     67     - added fConc1
     68   
     69   * mimage/MNewImageParCalc.[h,cc]:
     70     - removed
     71
     72   * mimage/MHillasCalc.[h,cc]:
     73     - changed so, that it can calc MHillas, MHillasExt and MNewImagePar
     74
     75   * mimage/MHillasSrc.cc:
     76     - sqrt(tand*tand+1) replaced by 1/CosDelta   
     77
     78   * mmain/MStatusDisplay.[h,cc]:
     79     - added second argument to SetLogStream
     80
     81   * mhist/MHAlphaEnergyTheta.[h,cc], mhist/MHAlphaEnergyTime.[h,cc],
     82     mhist/MHCerPhotEvt.[h,cc], mhist/MHEffOnTime.[h,cc],
     83     mhist/MHEffOnTimeTheta.[h,cc], mhist/MHEffOnTimeTime.[h,cc],
     84     mhist/MHEnergyTheta.[h,cc], mhist/MHEnergyTime.[h,cc],
     85     mhist/MHFlux.[h,cc], mhist/MHMatrix.[h,cc],
     86     mhist/MHSigmaTheta.[h,cc], mhistmc/MHMcCollectionArea.[h,cc],
     87     mhistmc/MHMcDifRate.[h,cc], mhistmc/MHMcEfficiency.[h,cc],
     88     mhistmc/MHMcEfficiencyEnergy.[h,cc], mhistmc/MHMcEfficiencyImpact.[h,cc],
     89     mhistmc/MHMcEnergy.[h,cc], mhistmc/MHMcEnergyImpact.[h,cc],
     90     mhistmc/MHMcEnergyMigration.[h,cc], mhistmc/MHMcRate.[h,cc]:
     91     - removed DrawClone
     92     - fixed Draw
     93
     94   * macros/MagicHillas.C, macros/star.C:
     95     - removed MHillasExt (not necessary anymore)
     96     - added MNewImagePar
     97     
     98   * macros/readCT1.C, macros/readMagic.C, meventdisp/MGCamDisplay.cc,
     99     mmain/MAnalysis.cc:
     100     - added MHillasExt to be displayed
     101     - added MNewImagePar to be displayed
     102
    2103
    3104
  • trunk/MagicSoft/Mars/macros/MagicHillas.C

    r1646 r2026  
    3636    //
    3737    MParList plist;
    38 
    3938
    4039    MTaskList tlist;
     
    112111    MHillasSrcCalc csrc1;
    113112
    114     //
    115     // To use MHillasExt instead of MHillas
    116     //
    117     MHillasExt hext;
    118     plist.AddToList(&hext);
    119 
    120113    MFillH hfill1("MHHillas", "MHillas");
    121114    MFillH hfill2("MHHillasExt");
     
    123116    MFillH hfill4("HistExtSource [MHHillasExt]", "MHillasSrc");
    124117    MFillH hfill5("HistSource [MHHillasSrc]", "MHillasSrc");
     118    MFillH hfill6("MHNewImagePar");
    125119
    126120    MWriteRootFile write("hillas.root");
     
    130124    write.AddContainer("HistSource");
    131125    write.AddContainer("HistExtSource");
     126    write.AddContainer("MHNewImagePar");
    132127
    133128    tlist.AddToList(&read);
     
    146141    tlist.AddToList(&hfill4);
    147142    tlist.AddToList(&hfill5);
     143    tlist.AddToList(&hfill6);
    148144    tlist.AddToList(&write);
    149145
     
    172168    plist.FindObject("HistSource")->DrawClone();
    173169    plist.FindObject("HistExtSource")->DrawClone();
     170    plist.FindObject("MHNewImagePar")->DrawClone();
    174171}
    175172
  • trunk/MagicSoft/Mars/macros/readCT1.C

    r1325 r2026  
    4949    MParList plist;
    5050
    51     MGeomCamCT1 geomcam;
    52     MHillas     hillas;
    53     MTaskList   tlist;
     51    MGeomCamCT1  geomcam;
     52    MHillas      hillas;
     53    MHillasExt   hillasext;
     54    MNewImagePar newimgpar;
     55    MTaskList    tlist;
    5456
    5557    plist.AddToList(&geomcam);
    5658    plist.AddToList(&hillas);
     59    plist.AddToList(&hillasext);
     60    plist.AddToList(&newimagepar);
    5761    plist.AddToList(&tlist);
    5862
     
    7781    display.Draw();
    7882
    79     while (tlist.Process())
     83    while ((rc=tlist.Process()))
    8084    {
    8185        cout << "Event #" << icount++ << endl;
    8286
    8387        MCerPhotEvt *evt = (MCerPhotEvt*)clone.GetClone();
    84 
    85         if (!evt)
     88        if (!evt)      // If skipped due to MInputStreamId
    8689            continue;
    8790
    88         display.DrawPhotNum(evt);
     91        display.FillPhotNum(*evt);
     92        display.Update();
    8993
    9094        if (!HandleInput())
    9195            break;
    9296
     97        hillas.Draw();
    9398        hillas.Print();
    94         hillas.Draw();
    95         display.DrawPhotNum((MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));
     99        hillasext.Print();
     100        newimgpar.Print();
     101
     102        display.FillPhotNum(*(MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));
     103        display.Update();
    96104
    97105        if (!HandleInput())
  • trunk/MagicSoft/Mars/macros/readMagic.C

    r1965 r2026  
    5151
    5252    MGeomCamMagic geomcam;
    53     MHillasExt    hillas;
     53    MHillas       hillas;
     54    MHillasExt    hillasext;
     55    MNewImagePar  newimgpar;
    5456    MTaskList     tlist;
    5557
    5658    plist.AddToList(&geomcam);
    5759    plist.AddToList(&hillas);
     60    plist.AddToList(&hillasext);
     61    plist.AddToList(&newimgpar);
    5862    plist.AddToList(&tlist);
    5963
     
    107111            break;
    108112
     113        hillas.Draw();
    109114        hillas.Print();
    110         hillas.Draw();
     115        hillasext.Print();
     116        newimgpar.Print();
    111117
    112118        display.FillPhotNum(*(MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));
  • trunk/MagicSoft/Mars/macros/star.C

    r1847 r2026  
    5252
    5353    //
    54     // Uncomment this two line if you want to use MHillasExt instead
    55     // of MHillas
    56     //
    57     MHillasExt hext;
    58     plist.AddToList(&hext);
    59 
    60     //
    6154    // The geometry container must be created by yourself to make sure
    6255    // that you don't choose a wrong geometry by mistake
     
    7366
    7467    // ------------- user change -----------------
    75     read.AddFile("Pro*.root");
     68    read.AddFile("data/Gamma_z*.root");
    7669    //read.AddFile("Gam*.root");
    7770
     
    9083    MWriteRootFile write("data/star_protons.root");
    9184    write.AddContainer("MHillas",       "Events");
     85    write.AddContainer("MHillasExt",    "Events");
     86    write.AddContainer("MNewImagePar",  "Events");
    9287    write.AddContainer("MMcEvt",        "Events");
    9388    write.AddContainer("MHillasSrc",    "Events");
  • trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc

    r1966 r2026  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  10/2001 <mailto:tbretz@uni-sw.gwdg.de>
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2001
     18!   Author(s): Thomas Bretz, 10/2001 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2003
    2121!
    2222!
     
    3232#include "MGTask.h"              // MGTask::CreateGui
    3333#include "MClone.h"              // MClone
    34 #include "MHillasExt.h"          // MHillasExt
     34#include "MHillas.h"             // MHillas
    3535#include "MParList.h"            // MParList::AddToList
    3636#include "MEvtLoop.h"            // MEvtLoop::GetParList
     
    134134    MGeomCamMagic *geom   = new MGeomCamMagic;
    135135    MPedestalCam  *pedest = new MPedestalCam;
    136     MHillasExt    *hext   = new MHillasExt;
    137136
    138137    plist->AddToList(geom);
    139138    plist->AddToList(pedest);
    140     plist->AddToList(hext);
    141139
    142140    return geom;
     
    147145//  Constructor.
    148146//
    149 MGCamDisplay::MGCamDisplay(const char *filename,
    150                            const TGWindow *p, /*const TGWindow *main,*/
     147MGCamDisplay::MGCamDisplay(const char *filename, const TGWindow *p,
    151148                           UInt_t w, UInt_t h)
    152 : MGEvtDisplay(filename, "Events", p, /*main,*/ w, h)
     149: MGEvtDisplay(filename, "Events", p, w, h)
    153150{
    154151    //
     
    212209    //
    213210    MHillas *hillas = (MHillas*)plist->FindObject("MHillas");
     211
     212    plist->FindObject("MHillasExt")->Print();
     213    plist->FindObject("MNewImagePar")->Print();
    214214
    215215    hillas->Print();
  • trunk/MagicSoft/Mars/mimage/ImageLinkDef.h

    r1940 r2026  
    1515
    1616#pragma link C++ class MNewImagePar+;
    17 #pragma link C++ class MNewImageParCalc+;
    1817
    1918#pragma link C++ class MHHillas+;
  • trunk/MagicSoft/Mars/mimage/MHHillas.cc

    r1992 r2026  
    7070    fDistC   = new TH1F("DistC",   "Distance from center of camera",  100,   0, 445);
    7171    fDelta   = new TH1F("Delta",   "Angle (Main axis - x-axis)",      101, -90,  90);
    72     fUsedPix = new TH1F("UsedPix", "Number of used pixels",           150,   0, 150);
    73     fCorePix = new TH1F("CorePix", "Number of core pixels",           150,   0, 150);
    7472
    7573    fLength->SetLineColor(kBlue);
    76     fCorePix->SetLineColor(kRed);
    77     fUsedPix->SetLineColor(kGreen);
    7874
    7975    fLength->SetDirectory(NULL);
     
    8177    fDistC->SetDirectory(NULL);
    8278    fDelta->SetDirectory(NULL);
    83     fUsedPix->SetDirectory(NULL);
    84     fCorePix->SetDirectory(NULL);
    8579
    8680    fLength->SetXTitle("Length [mm]");
     
    8882    fDistC->SetXTitle("Distance [mm]");
    8983    fDelta->SetXTitle("Delta [\\circ]");
    90     fUsedPix->SetXTitle("Number of Pixels");
    91     fCorePix->SetXTitle("Number of Pixels");
    9284
    9385    fLength->SetYTitle("Counts");
     
    9587    fDistC->SetYTitle("Counts");
    9688    fDelta->SetYTitle("Counts");
    97     fUsedPix->SetYTitle("Counts");
    98     fCorePix->SetYTitle("Counts");
    9989
    10090    MBinning bins;
     
    134124    delete fSize;
    135125    delete fCenter;
    136 
    137     delete fUsedPix;
    138     delete fCorePix;
    139126}
    140127
     
    165152    ApplyBinning(*plist, "Delta",  fDelta);
    166153    ApplyBinning(*plist, "Size",   fSize);
    167     ApplyBinning(*plist, "Pixels", fUsedPix);
    168     ApplyBinning(*plist, "Pixels", fCorePix);
    169154
    170155    const MBinning *bins = (MBinning*)plist->FindObject("BinningCamera");
     
    262247    const Double_t scale = fUseMmScale ? 1 : fMm2Deg;
    263248
    264     fLength ->Fill(scale*h.GetLength());
    265     fWidth  ->Fill(scale*h.GetWidth());
    266     fDistC  ->Fill(scale*d);
    267     fCenter ->Fill(scale*h.GetMeanX(), scale*h.GetMeanY());
    268     fDelta  ->Fill(kRad2Deg*h.GetDelta());
    269     fSize   ->Fill(h.GetSize());
    270     fUsedPix->Fill(h.GetNumUsedPixels());
    271     fCorePix->Fill(h.GetNumCorePixels());
     249    fLength ->Fill(scale*h.GetLength(), w);
     250    fWidth  ->Fill(scale*h.GetWidth(), w);
     251    fDistC  ->Fill(scale*d, w);
     252    fCenter ->Fill(scale*h.GetMeanX(), scale*h.GetMeanY(), w);
     253    fDelta  ->Fill(kRad2Deg*h.GetDelta(), w);
     254    fSize   ->Fill(h.GetSize(), w);
    272255
    273256    return kTRUE;
     
    289272// --------------------------------------------------------------------------
    290273//
    291 // Draw clones of four histograms. So that the object can be deleted
    292 // and the histograms are still visible in the canvas.
    293 // The cloned object are deleted together with the canvas if the canvas is
    294 // destroyed. If you want to handle dostroying the canvas you can get a
    295 // pointer to it from this function
    296 //
    297 TObject *MHHillas::DrawClone(Option_t *opt) const
    298 {
    299     return MH::DrawClone(opt, 720, 810);
    300 }
    301 
    302 // --------------------------------------------------------------------------
    303 //
    304274// Creates a new canvas and draws the four histograms into it.
    305275// Be careful: The histograms belongs to this object and won't get deleted
     
    308278void MHHillas::Draw(Option_t *)
    309279{
    310     TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this, 720, 810);
     280    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
    311281    pad->SetBorderMode(0);
    312282
     
    320290
    321291    pad->cd(2);
     292    gPad->SetBorderMode(0);
     293    fDistC->Draw();
     294
     295    pad->cd(3);
    322296    gPad->SetBorderMode(0);
    323297    gPad->SetLogx();
    324298    fSize->Draw();
    325299
    326     pad->cd(3);
    327     gPad->SetBorderMode(0);
    328     MH::Draw(*fCorePix, *fUsedPix, "Number of core/used Pixels");
    329 
    330300    pad->cd(4);
    331301    gPad->SetBorderMode(0);
    332     fDelta->Draw();
    333 
    334     pad->cd(5);
    335     gPad->SetBorderMode(0);
    336     fDistC->Draw();
    337 
    338     pad->cd(6);
    339     gPad->SetBorderMode(0);
     302    gPad->SetPad(0.51, 0.01, 0.99, 0.65);
    340303    SetColors();
    341304    fCenter->Draw("colz");
     305
     306    pad->cd(5);
     307    gPad->SetBorderMode(0);
     308    fDelta->Draw();
     309
     310    pad->cd(6);
     311    delete gPad;
    342312
    343313    pad->Modified();
     
    353323    if (name.Contains("Size", TString::kIgnoreCase))
    354324        return fSize;
    355     if (name.Contains("Core", TString::kIgnoreCase))
    356         return fCorePix;
    357     if (name.Contains("Used", TString::kIgnoreCase))
    358         return fUsedPix;
    359325    if (name.Contains("Delta", TString::kIgnoreCase))
    360326        return fDelta;
  • trunk/MagicSoft/Mars/mimage/MHHillas.h

    r1992 r2026  
    2222    TH1F *fSize;    //-> Sum of used pixels
    2323    TH2F *fCenter;  //-> Center
    24 
    25     TH1F *fUsedPix; //-> Number of used pixels
    26     TH1F *fCorePix; //-> Number of core pixels
    2724
    2825    void SetColors() const;
     
    5552
    5653    void Draw(Option_t *opt=NULL);
    57     TObject *DrawClone(Option_t *opt=NULL) const;
    5854
    5955    //Int_t DistancetoPrimitive(Int_t px, Int_t py) { return 0; }
  • trunk/MagicSoft/Mars/mimage/MHHillasExt.cc

    r1992 r2026  
    5757//
    5858MHHillasExt::MHHillasExt(const char *name, const char *title)
    59     : fMm2Deg(1), fUseMmScale(kTRUE), fHilName("MHillas")
     59    : fMm2Deg(1), fUseMmScale(kTRUE), fHilName("MHillasExt")
    6060{
    6161    //
     
    7070    // connect all the histogram with the container fHist
    7171    //
    72     fHConc1.SetLineColor(kBlue);
    73     fHConc.SetFillStyle(0);
    74 
    75     fHConc.SetDirectory(NULL);
    76     fHConc1.SetDirectory(NULL);
    7772    fHAsym.SetDirectory(NULL);
    7873    fHM3Long.SetDirectory(NULL);
    7974    fHM3Trans.SetDirectory(NULL);
    8075
    81     fHConc.SetName("Conc2");
    82     fHConc1.SetName("Conc1");
    8376    fHAsym.SetName("Asymmetry");
    8477    fHM3Long.SetName("3rd Mom Long");
    8578    fHM3Trans.SetName("3rd Mom Trans");
    8679
    87     fHConc.SetTitle("Ratio: Conc");
    88     fHConc1.SetTitle("Ratio: Conc1");
    8980    fHAsym.SetTitle("Asymmetry");
    9081    fHM3Long.SetTitle("3^{rd} Moment Longitudinal");
    9182    fHM3Trans.SetTitle("3^{rd} Moment Transverse");
    9283
    93     fHConc.SetXTitle("Ratio");
    94     fHConc1.SetXTitle("Ratio");
    9584    fHAsym.SetXTitle("Asym [mm]");
    9685    fHM3Long.SetXTitle("3^{rd} M_{l} [mm]");
    9786    fHM3Trans.SetXTitle("3^{rd} M_{t} [mm]");
    9887
    99     fHConc.SetYTitle("Counts");
    100     fHConc1.SetYTitle("Counts");
    10188    fHAsym.SetYTitle("Counts");
    10289    fHM3Long.SetYTitle("Counts");
    10390    fHM3Trans.SetYTitle("Counts");
    10491
    105     fHConc.SetFillStyle(4000);
    106     fHConc1.SetFillStyle(4000);
    10792    fHAsym.SetFillStyle(4000);
    10893    fHM3Long.SetFillStyle(4000);
    10994    fHM3Trans.SetFillStyle(4000);
    11095
     96    fHM3Trans.SetLineColor(kBlue);
     97
    11198    MBinning bins;
    112 
    113     bins.SetEdges(100, 0, 1);
    114     bins.Apply(fHConc);
    115     bins.Apply(fHConc1);
    11699
    117100    bins.SetEdges(101, -326, 326);
     
    151134    }
    152135
    153     ApplyBinning(*plist, "Conc",    &fHConc);
    154     ApplyBinning(*plist, "Conc1",   &fHConc1);
    155136    ApplyBinning(*plist, "Asym",    &fHAsym);
    156137    ApplyBinning(*plist, "M3Long",  &fHM3Long);
     
    171152    const Double_t scale = TMath::Sign(fUseMmScale?1:fMm2Deg, (src ? src->GetCosDeltaAlpha() : 1));
    172153
    173     fHConc.Fill(fHillasExt->GetConc());
    174     fHConc1.Fill(fHillasExt->GetConc1());
    175 
    176     fHAsym.Fill(scale*fHillasExt->GetAsym());
    177     fHM3Long.Fill(scale*fHillasExt->GetM3Long());
    178     fHM3Trans.Fill(scale*fHillasExt->GetM3Trans());
     154    fHAsym.Fill(scale*fHillasExt->GetAsym(), w);
     155    fHM3Long.Fill(scale*fHillasExt->GetM3Long(), w);
     156    fHM3Trans.Fill(scale*fHillasExt->GetM3Trans(), w);
    179157    //fHAsymna.Fill(scale*ext.GetAsymna());
    180158    //fHAsym0.Fill(scale*ext.GetAsym0());
     
    243221// --------------------------------------------------------------------------
    244222//
    245 // Draw clones of all four histograms. So that the object can be deleted
    246 // and the histograms are still visible in the canvas.
    247 // The cloned object are deleted together with the canvas if the canvas is
    248 // destroyed. If you want to handle dostroying the canvas you can get a
    249 // pointer to it from this function
    250 //
    251 TObject *MHHillasExt::DrawClone(Option_t *opt) const
    252 {
    253     return MH::DrawClone(opt, 720, 540);
    254 }
    255 
    256 // --------------------------------------------------------------------------
    257 //
    258223// Creates a new canvas and draws the four histograms into it.
    259224// Be careful: The histograms belongs to this object and won't get deleted
     
    262227void MHHillasExt::Draw(Option_t *)
    263228{
    264     TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this, 720, 540);
     229    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
    265230    pad->SetBorderMode(0);
    266231
    267232    AppendPad("");
    268233
    269     pad->Divide(2, 2);
     234    pad->Divide(1, 2);
    270235
    271236    pad->cd(1);
    272237    gPad->SetBorderMode(0);
    273     MH::Draw(fHConc1, fHConc, "Concentrations");
     238    MH::Draw(fHM3Long, fHM3Trans, "3^{rd} Moments");
    274239
    275240    pad->cd(2);
     
    277242    fHAsym.Draw();
    278243
    279     pad->cd(3);
    280     gPad->SetBorderMode(0);
    281     fHM3Long.Draw();
    282 
    283     pad->cd(4);
    284     gPad->SetBorderMode(0);
    285     fHM3Trans.Draw();
    286 
    287244    pad->Modified();
    288245    pad->Update();
     
    291248TH1 *MHHillasExt::GetHistByName(const TString name)
    292249{
    293     if (name.Contains("Conc", TString::kIgnoreCase))
    294         return &fHConc;
    295     if (name.Contains("Conc1", TString::kIgnoreCase))
    296         return &fHConc1;
    297250    if (name.Contains("Asym", TString::kIgnoreCase))
    298251        return &fHAsym;
  • trunk/MagicSoft/Mars/mimage/MHHillasExt.h

    r1992 r2026  
    1616    MHillasExt *fHillasExt; //! Pointer to the MHillasExt container
    1717
    18     TH1F fHConc;    // [ratio] concentration ratio: sum of the two highest pixels / fSize
    19     TH1F fHConc1;   // [ratio] concentration ratio: sum of the highest pixel / fSize
    2018    TH1F fHAsym;    // [mm]    fDist minus dist: center of ellipse, highest pixel
    2119    TH1F fHM3Long;  // [mm]    3rd moment (e-weighted) along major axis
     
    4139
    4240    void Draw(Option_t *opt=NULL);
    43     TObject *DrawClone(Option_t *opt=NULL) const;
    4441
    4542    ClassDef(MHHillasExt, 1) // Container which holds histograms for the extended hillas parameters
  • trunk/MagicSoft/Mars/mimage/MHHillasSrc.cc

    r2004 r2026  
    132132    const MHillasSrc &h = *(MHillasSrc*)par;
    133133
    134     fAlpha->Fill(h.GetAlpha());
    135     fDist ->Fill(fUseMmScale ? h.GetDist() : fMm2Deg*h.GetDist());
    136     fCosDA->Fill(h.GetCosDeltaAlpha());
     134    fAlpha->Fill(h.GetAlpha(), w);
     135    fDist ->Fill(fUseMmScale ? h.GetDist() : fMm2Deg*h.GetDist(), w);
     136    fCosDA->Fill(h.GetCosDeltaAlpha(), w);
    137137
    138138    return kTRUE;
     
    186186// --------------------------------------------------------------------------
    187187//
    188 // Draw clones of all two histograms. So that the object can be deleted
    189 // and the histograms are still visible in the canvas.
    190 // The cloned object are deleted together with the canvas if the canvas is
    191 // destroyed. If you want to handle dostroying the canvas you can get a
    192 // pointer to it from this function
    193 //
    194 TObject *MHHillasSrc::DrawClone(Option_t *opt) const
    195 {
    196     return MH::DrawClone(opt, 700, 500);
    197 }
    198 
    199 // --------------------------------------------------------------------------
    200 //
    201188// Creates a new canvas and draws the two histograms into it.
    202189// Be careful: The histograms belongs to this object and won't get deleted
     
    205192void MHHillasSrc::Draw(Option_t *)
    206193{
    207     TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this, 700, 500);
     194    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
    208195    pad->SetBorderMode(0);
    209196
  • trunk/MagicSoft/Mars/mimage/MHHillasSrc.h

    r2004 r2026  
    3636
    3737    void Draw(Option_t *opt=NULL);
    38     TObject *DrawClone(Option_t *opt=NULL) const;
    3938
    4039    ClassDef(MHHillasSrc, 1) // Container which holds histograms for the source dependant parameters
  • trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc

    r1992 r2026  
    1616!
    1717!
    18 !   Author(s): Wolfgang Wittek  03/2003   <mailto:wittek@mppmu.mpg.de>
     18!   Author(s): Wolfgang Wittek, 03/2003 <mailto:wittek@mppmu.mpg.de>
     19!   Author(s): Thomas Bretz, 04/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
    1920!
    2021!   Copyright: MAGIC Software Development, 2000-2003
     
    2324\* ======================================================================== */
    2425
    25 ///////////////////////////////////////////////////////////////////////
     26/////////////////////////////////////////////////////////////////////////////
    2627//
    2728// MHNewImagePar
    2829//
    29 // This class contains histograms for every Hillas parameter
    30 //
    31 ///////////////////////////////////////////////////////////////////////
     30////////////////////////////////////////////////////////////////////////////
    3231#include "MHNewImagePar.h"
    3332
     
    4241
    4342#include "MGeomCam.h"
    44 
     43#include "MBinning.h"
    4544#include "MParList.h"
    4645
     
    5958    fTitle = title ? title : "Histograms of new image parameters";
    6059
    61     fLeakage1 = new TH1F("Leakage1", "Leakage_{1}", 100, 0.0, 1.0);
    62     fLeakage1->SetDirectory(NULL);
    63     fLeakage1->SetXTitle("Leakage");
    64     fLeakage1->SetYTitle("Counts");
    65 
    66     fLeakage2 = new TH1F("Leakage2", "Leakage_{2}", 100, 0.0, 1.0);
    67     fLeakage2->SetDirectory(NULL);
    68     fLeakage2->SetXTitle("Leakage");
    69     fLeakage2->SetYTitle("Counts");
    70     fLeakage2->SetLineColor(kBlue);
    71 }
    72 
    73 // --------------------------------------------------------------------------
    74 //
    75 // Delete the four histograms
    76 //
    77 MHNewImagePar::~MHNewImagePar()
    78 {
    79     delete fLeakage1;
    80     delete fLeakage2;
    81 }
     60    fHistLeakage1.SetName("Leakage1");
     61    fHistLeakage1.SetTitle("Leakage_{1}");
     62    fHistLeakage1.SetXTitle("Leakage");
     63    fHistLeakage1.SetYTitle("Counts");
     64    fHistLeakage1.SetDirectory(NULL);
     65    fHistLeakage1.SetFillStyle(4000);
     66
     67    fHistLeakage2.SetName("Leakage2");
     68    fHistLeakage2.SetTitle("Leakage_{2}");
     69    fHistLeakage2.SetXTitle("Leakage");
     70    fHistLeakage2.SetYTitle("Counts");
     71    fHistLeakage2.SetDirectory(NULL);
     72    fHistLeakage2.SetLineColor(kBlue);
     73    fHistLeakage2.SetFillStyle(4000);
     74 
     75    fHistUsedPix.SetName("UsedPix");
     76    fHistUsedPix.SetTitle("Number of used pixels");
     77    fHistUsedPix.SetXTitle("Number of Pixels");
     78    fHistUsedPix.SetYTitle("Counts");
     79    fHistUsedPix.SetDirectory(NULL);
     80    fHistUsedPix.SetLineColor(kGreen);
     81    fHistUsedPix.SetFillStyle(4000);
     82
     83    fHistCorePix.SetName("CorePix");
     84    fHistCorePix.SetTitle("Number of core pixels");
     85    fHistCorePix.SetXTitle("Number of Pixels");
     86    fHistCorePix.SetYTitle("Counts");
     87    fHistCorePix.SetDirectory(NULL);
     88    fHistCorePix.SetLineColor(kRed);
     89    fHistCorePix.SetFillStyle(4000);
     90
     91    fHistConc.SetDirectory(NULL);
     92    fHistConc1.SetDirectory(NULL);
     93    fHistConc.SetName("Conc2");
     94    fHistConc1.SetName("Conc1");
     95    fHistConc.SetTitle("Ratio: Conc");
     96    fHistConc1.SetTitle("Ratio: Conc1");
     97    fHistConc.SetXTitle("Ratio");
     98    fHistConc1.SetXTitle("Ratio");
     99    fHistConc.SetYTitle("Counts");
     100    fHistConc1.SetYTitle("Counts");
     101    fHistConc.SetFillStyle(4000);
     102    fHistConc1.SetFillStyle(4000);
     103    fHistConc1.SetLineColor(kBlue);
     104    fHistConc.SetFillStyle(0);
     105
     106
     107    MBinning bins;
     108
     109    bins.SetEdges(100, 0, 1);
     110    bins.Apply(fHistLeakage1);
     111    bins.Apply(fHistLeakage2);
     112    bins.Apply(fHistConc);
     113    bins.Apply(fHistConc1);
     114
     115    bins.SetEdges(150, 0, 150);
     116    bins.Apply(fHistUsedPix);
     117    bins.Apply(fHistCorePix);
     118}
     119
     120// --------------------------------------------------------------------------
     121//
     122// Setup the Binning for the histograms automatically if the correct
     123// instances of MBinning
     124//
     125Bool_t MHNewImagePar::SetupFill(const MParList *plist)
     126{
     127    ApplyBinning(*plist, "Leakage", &fHistLeakage1);
     128    ApplyBinning(*plist, "Leakage", &fHistLeakage2);
     129
     130    ApplyBinning(*plist, "Pixels", &fHistUsedPix);
     131    ApplyBinning(*plist, "Pixels", &fHistCorePix);
     132
     133    ApplyBinning(*plist, "Conc",   &fHistConc);
     134    ApplyBinning(*plist, "Conc1",  &fHistConc1);
     135
     136    return kTRUE;
     137}
     138
    82139
    83140// --------------------------------------------------------------------------
     
    89146    const MNewImagePar &h = *(MNewImagePar*)par;
    90147
    91     fLeakage1->Fill(h.GetLeakage1());
    92     fLeakage2->Fill(h.GetLeakage2());
     148    fHistLeakage1.Fill(h.GetLeakage1(), w);
     149    fHistLeakage2.Fill(h.GetLeakage2(), w);
     150
     151    fHistUsedPix.Fill(h.GetNumUsedPixels(), w);
     152    fHistCorePix.Fill(h.GetNumCorePixels(), w);
     153
     154    fHistConc.Fill(h.GetConc(), w);
     155    fHistConc1.Fill(h.GetConc1(), w);
    93156
    94157    return kTRUE;
     
    108171    AppendPad("");
    109172
    110     MH::Draw(*fLeakage1, *fLeakage2, "Leakage1 and Leakage2");
     173    pad->Divide(2,2);
     174
     175    pad->cd(1);
     176    gPad->SetBorderMode(0);
     177    TAxis &x = *fHistLeakage1.GetXaxis();
     178    x.SetRangeUser(0.01, x.GetXmax());
     179    MH::Draw(fHistLeakage1, fHistLeakage2, "Leakage1 and Leakage2");
     180
     181    pad->cd(2);
     182    gPad->SetBorderMode(0);
     183    MH::Draw(fHistCorePix, fHistUsedPix, "Number of core/used Pixels");
     184
     185    pad->cd(3);
     186    gPad->SetBorderMode(0);
     187    MH::Draw(fHistConc1, fHistConc, "Concentrations");
     188
     189    pad->cd(4);
     190    gPad->SetBorderMode(0);
    111191
    112192    pad->Modified();
     
    117197{
    118198    if (name.Contains("Leakage1", TString::kIgnoreCase))
    119         return fLeakage1;
    120 
     199        return &fHistLeakage1;
    121200    if (name.Contains("Leakage2", TString::kIgnoreCase))
    122         return fLeakage2;
     201        return &fHistLeakage2;
     202    if (name.Contains("Conc", TString::kIgnoreCase))
     203        return &fHistConc;
     204    if (name.Contains("Conc1", TString::kIgnoreCase))
     205        return &fHistConc1;
     206    if (name.Contains("UsedPix", TString::kIgnoreCase))
     207        return &fHistUsedPix;
     208    if (name.Contains("CorePix", TString::kIgnoreCase))
     209        return &fHistCorePix;
    123210
    124211    return NULL;
  • trunk/MagicSoft/Mars/mimage/MHNewImagePar.h

    r1992 r2026  
    55#include "MH.h"
    66#endif
     7#ifndef ROOT_TH1
     8#include <TH1.h>
     9#endif
    710
    8 class TH1F;
    911class MHillas;
    1012
     
    1214{
    1315private:
    14     TH1F *fLeakage1;     //->
    15     TH1F *fLeakage2;     //->
     16    TH1F fHistLeakage1; //
     17    TH1F fHistLeakage2; //
     18
     19    TH1F fHistUsedPix;  // Number of used pixels
     20    TH1F fHistCorePix;  // Number of core pixels
     21
     22    TH1F fHistConc;     // [ratio] concentration ratio: sum of the two highest pixels / fSize
     23    TH1F fHistConc1;    // [ratio] concentration ratio: sum of the highest pixel / fSize
    1624
    1725public:
    1826    MHNewImagePar(const char *name=NULL, const char *title=NULL);
    19     ~MHNewImagePar();
    2027
     28    Bool_t SetupFill(const MParList *plist);
    2129    Bool_t Fill(const MParContainer *par, Double_t w=1);
    2230
    2331    TH1 *GetHistByName(const TString name);
    2432
    25     TH1F *GetHistLeakage1()         { return fLeakage1; }
    26     TH1F *GetHistLeakage2()         { return fLeakage2; }
     33    TH1F &GetHistLeakage1() { return fHistLeakage1; }
     34    TH1F &GetHistLeakage2() { return fHistLeakage2; }
     35
     36    TH1F &GetHistUsedPix()  { return fHistUsedPix; }
     37    TH1F &GetHistCorePix()  { return fHistCorePix; }
     38
     39    TH1F &GetHistConc()     { return fHistConc; }
     40    TH1F &GetHistConc1()    { return fHistConc1; }
    2741
    2842    void Draw(Option_t *opt=NULL);
  • trunk/MagicSoft/Mars/mimage/MHillas.cc

    r1940 r2026  
    2121!   Author(s): Wolfgang Wittek  6/2002 <mailto:wittek@mppmu.mpg.de>
    2222!
    23 !   Copyright: MAGIC Software Development, 2000-2002
     23!   Copyright: MAGIC Software Development, 2000-2003
    2424!
    2525!
     
    5050// fNumUsedPixels  number of pixels which survived the cleaning
    5151//
     52// Version 3:
     53// ----------
     54// fNumCorePixels  moved to MNewImagePar
     55// fNumUsedPixels  moved to MNewImagePar
     56// fCosDelta       added
     57// fSinDelte       added
     58//
    5259/////////////////////////////////////////////////////////////////////////////
    5360#include "MHillas.h"
     
    106113    fMeanX  = -1;
    107114    fMeanY  = -1;
    108 
    109     fNumUsedPixels = -1;
    110     fNumCorePixels = -1;
    111115
    112116    Clear();
     
    133137    *fLog << " - Meany       [mm]  = " << fMeanY  << endl;
    134138    *fLog << " - atg(y/x)    [deg] = " << atg     << endl;
    135     *fLog << " - Used Pixels [#]   = " << fNumUsedPixels << " Pixels" << endl;
    136     *fLog << " - Core Pixels [#]   = " << fNumCorePixels << " Pixels" << endl;
    137 }
    138 
    139 /*
    140 // -----------------------------------------------------------
    141 //
    142 // call the Paint function of the Ellipse if a TEllipse exists
    143 //
    144 void MHillas::Paint(Option_t *)
    145 {
    146      fEllipse->SetLineWidth(2);
    147      fEllipse->PaintEllipse(fMeanX, fMeanY, fLength, fWidth,
    148                             0, 360, fDelta*kRad2Deg+180);
    149 }
    150 */
    151 
    152 // --------------------------------------------------------------------------
    153 //
    154 // Instead of adding MHillas itself to the Pad
    155 // (s. AppendPad in TObject) we create an ellipse,
    156 // which is added to the Pad by its Draw function
    157 // You can remove it by deleting the Ellipse Object
    158 // (s. Clear() )
     139}
     140
     141// --------------------------------------------------------------------------
     142//
     143// Instead of adding MHillas itself to the Pad (s. AppendPad in TObject)
     144// we create an ellipse, which is added to the Pad by its Draw function
     145// You can remove it by deleting the Ellipse Object (s. Clear())
    159146//
    160147void MHillas::Draw(Option_t *opt)
    161148{
    162 
    163149    Clear();
    164150
     
    171157    fEllipse->SetLineWidth(2);
    172158    fEllipse->Draw();
    173 
    174     /*
    175      fEllipse->SetPhimin();
    176      fEllipse->SetPhimax();
    177      fEllipse->SetR1(fLength);
    178      fEllipse->SetR2(fWidth);
    179      fEllipse->SetTheta(fDelta*kRad2Deg+180);
    180      fEllipse->SetX1(fMeanX);
    181      fEllipse->SetY1(fMeanY);
    182 
    183      fEllipse->SetLineWidth(2);
    184      fEllipse->PaintEllipse(fMeanX, fMeanY, fLength, fWidth,
    185                             0, 360, fDelta*kRad2Deg+180);
    186 
    187       AppendPad(opt);
    188 
    189      // This is from TH1
    190      TString opt = option;
    191      opt.ToLower();
    192      if (gPad && !opt.Contains("same")) {
    193         //the following statement is necessary in case one attempts to draw
    194         //a temporary histogram already in the current pad
    195       if (TestBit(kCanDelete)) gPad->GetListOfPrimitives()->Remove(this);
    196       gPad->Clear();
    197       }
    198       */
    199159}
    200160
     
    235195    //
    236196    if (npixevt < 3)
    237     {
    238         //*fLog << warn << "MHillas::Calc: Event has less than three pixels... skipped." << endl;
    239197        return 1;
    240     }
    241198
    242199    //
     
    253210    fSize  = 0;
    254211
    255     fNumUsedPixels = 0;
    256     fNumCorePixels = 0;
     212    Int_t numused = 0;
    257213
    258214    for (UInt_t i=0; i<npixevt; i++)
     
    267223        const Float_t nphot = pix.GetNumPhotons();
    268224
    269         //if (nphot==0)
    270         //    *fLog << warn << GetDescriptor() << ": Pixel #" << pix.GetPixId() << " has no photons." << endl;
    271 
    272225        fSize  += nphot;                             // [counter]
    273226        fMeanX += nphot * gpix.GetX();               // [mm]
    274227        fMeanY += nphot * gpix.GetY();               // [mm]
    275228
    276         if (pix.IsPixelCore())
    277             fNumCorePixels++;
    278 
    279         fNumUsedPixels++;
     229        numused++;
    280230    }
    281231
     
    284234    //
    285235    if (fSize==0)
    286     {
    287         //*fLog << inf << GetDescriptor() << ": Event has zero cerenkov photons... skipped." << endl;
    288236        return 2;
    289     }
    290237
    291238    fMeanX /= fSize;                                 // [mm]
    292239    fMeanY /= fSize;                                 // [mm]
    293240
    294     if (fNumUsedPixels<3)
    295     {
    296         //*fLog << inf << GetDescriptor() << ": Event has less than 3 used pixels... skipped." << endl;
     241    if (numused<3)
    297242        return 3;
    298     }
    299243
    300244    //
     
    339283    //
    340284    if (corrxy==0)
    341     {
    342         //*fLog << inf << GetDescriptor() << ": Event has CorrXY==0... skipped." << endl;
    343285        return 4;
    344     }
    345286
    346287    //
     
    352293    //  in the camera it has values between -pi/2 and pi/2 degrees
    353294    //
    354     const Double_t d0   = corryy - corrxx;
    355     const Double_t d1   = corrxy*2;
    356     const Double_t d2   = d0 + sqrt(d0*d0 + d1*d1);
    357     const Double_t tand = d2 / d1;
     295    const Double_t d0    = corryy - corrxx;
     296    const Double_t d1    = corrxy*2;
     297    const Double_t d2    = d0 + sqrt(d0*d0 + d1*d1);
     298    const Double_t tand  = d2 / d1;
     299    const Double_t tand2 = tand*tand;
    358300
    359301    fDelta = atan(tand);
    360302
    361     const Double_t s2 = tand*tand+1;
     303    const Double_t s2 = tand2+1;
    362304    const Double_t s  = sqrt(s2);
    363305
     
    365307    fSinDelta = tand/s;   // like MHillasExt
    366308
    367     Double_t axis1 = (tand*tand*corryy + d2 + corrxx)/s2/fSize;
    368     Double_t axis2 = (tand*tand*corrxx - d2 + corryy)/s2/fSize;
     309    Double_t axis1 = (tand2*corryy + d2 + corrxx)/s2/fSize;
     310    Double_t axis2 = (tand2*corrxx - d2 + corryy)/s2/fSize;
    369311
    370312    //
     
    391333void MHillas::Set(const TArrayF &arr)
    392334{
    393     if (arr.GetSize() != 8)
     335    if (arr.GetSize() != 6)
    394336        return;
    395337
     
    400342    fMeanX  = arr.At(4);  // [mm]        x-coordinate of center of ellipse
    401343    fMeanY  = arr.At(5);  // [mm]        y-coordinate of center of ellipse
    402 
    403     fNumUsedPixels = (Short_t)arr.At(6); // Number of pixels which survived the image cleaning
    404     fNumCorePixels = (Short_t)arr.At(7); // number of core pixels
    405 }
    406 
    407 
    408 // --------------------------------------------------------------------------
    409 //
    410 /*
    411 void MHillas::AsciiRead(ifstream &fin)
    412 {
    413     fin >> fLength;
    414     fin >> fWidth;
    415     fin >> fDelta;
    416     fin >> fSize;
    417     fin >> fMeanX;
    418     fin >> fMeanY;
    419 }
    420 */
    421 // --------------------------------------------------------------------------
    422 /*
    423 void MHillas::AsciiWrite(ofstream &fout) const
    424 {
    425     fout << fLength << " ";
    426     fout << fWidth  << " ";
    427     fout << fDelta  << " ";
    428     fout << fSize   << " ";
    429     fout << fMeanX  << " ";
    430     fout << fMeanY;
    431 }
    432 */
     344}
  • trunk/MagicSoft/Mars/mimage/MHillas.h

    r1940 r2026  
    2323    Float_t fMeanY;         // [mm]        y-coordinate of center of ellipse
    2424
    25     Short_t fNumUsedPixels; // Number of pixels which survived the image cleaning
    26     Short_t fNumCorePixels; // number of core pixels
    27 
    28     Float_t fSinDelta;      //! [1] sin of Delta (to be used in derived classes)
    29     Float_t fCosDelta;      //! [1] cos of Delta (to be used in derived classes)
     25    Float_t fSinDelta;      // [1] sin of Delta (to be used in derived classes)
     26    Float_t fCosDelta;      // [1] cos of Delta (to be used in derived classes)
    3027
    3128    TEllipse *fEllipse;     //! Graphical Object to Display Ellipse
    32 
    33 protected:
    34     //
    35     // This is only for calculations in derived classes because
    36     // we don't want to read/write this data members
    37     //
    38     Float_t GetCosDelta() const { return fCosDelta; }
    39     Float_t GetSinDelta() const { return fSinDelta; }
    4029
    4130public:
     
    4534    void Reset();
    4635
    47     virtual Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);
     36    Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);
    4837
    49     virtual void Print(Option_t *opt=NULL) const;
    50     virtual void Draw(Option_t *opt=NULL);
    51     //virtual void Paint(Option_t *);
     38    void Print(Option_t *opt=NULL) const;
     39    void Draw(Option_t *opt=NULL);
    5240
    53     virtual void Clear(Option_t *opt=NULL);
     41    void Clear(Option_t *opt=NULL);
    5442
    5543    Float_t GetLength() const { return fLength; }
     
    6048    Float_t GetMeanY() const  { return fMeanY; }
    6149
    62     Int_t GetNumUsedPixels() const { return fNumUsedPixels; }
    63     Int_t GetNumCorePixels() const { return fNumCorePixels; }
     50    Float_t GetCosDelta() const { return fCosDelta; }
     51    Float_t GetSinDelta() const { return fSinDelta; }
    6452
    65     virtual void Set(const TArrayF &arr);
     53    void Set(const TArrayF &arr);
    6654
    67     //virtual void AsciiRead(ifstream &fin);
    68     //virtual void AsciiWrite(ofstream &fout) const;
    69 
    70     ClassDef(MHillas, 2) // Storage Container for Hillas Parameter
     55    ClassDef(MHillas, 3) // Storage Container for Hillas Parameter
    7156};
    7257
  • trunk/MagicSoft/Mars/mimage/MHillasCalc.cc

    r1965 r2026  
    2525
    2626/////////////////////////////////////////////////////////////////////////////
    27 //                                                                         //
    28 //  MHillasCalc                                                            //
    29 //                                                                         //
    30 //  This is a task to calculate the Hillas parameters from each event      //
    31 //                                                                         //
    32 //  Input Containers:                                                      //
    33 //   MCerPhotEvt, MGeomCam                                                 //
    34 //                                                                         //
    35 //  Output Containers:                                                     //
    36 //   MHillas                                                               //
    37 //                                                                         //
     27//
     28//  MHillasCalc
     29//
     30//  This is a task to calculate the Hillas parameters from each event
     31//
     32//  Input Containers:
     33//   MCerPhotEvt, MGeomCam
     34//
     35//  Output Containers:
     36//   MHillas, MHillasExt
     37//
    3838/////////////////////////////////////////////////////////////////////////////
    3939
     
    4343
    4444#include "MHillas.h"
     45#include "MHillasExt.h"
     46#include "MNewImagePar.h"
     47
    4548#include "MCerPhotEvt.h"
    4649
     
    5457// Default constructor.
    5558//
    56 MHillasCalc::MHillasCalc(const char *hil, const char *name, const char *title)
     59MHillasCalc::MHillasCalc(const char *name, const char *title)
    5760{
    5861    fName  = name  ? name  : "MHillasCalc";
    5962    fTitle = title ? title : "Calculate Hillas parameters";
    6063
    61     fHilName = hil;
     64    fHilName    = "MHillas";
     65    fHilExtName = "MHillasExt";
     66    fImgParName = "MNewImagePar";
     67
     68    fFlags = 0xff;
    6269}
    6370
     
    7077Bool_t MHillasCalc::PreProcess(MParList *pList)
    7178{
     79    // necessary
    7280    fCerPhotEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
    7381    if (!fCerPhotEvt)
    7482    {
    75         *fLog << dbginf << "MCerPhotEvt not found... aborting." << endl;
     83        *fLog << err << "MCerPhotEvt not found... aborting." << endl;
    7684        return kFALSE;
    7785    }
    7886
     87    // necessary
    7988    fGeomCam = (MGeomCam*)pList->FindObject("MGeomCam");
    8089    if (!fGeomCam)
    8190    {
    82         *fLog << dbginf << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
     91        *fLog << err << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
    8392        return kFALSE;
    8493    }
    8594
    86     fHillas = (MHillas*)pList->FindCreateObj("MHillas",fHilName);
     95    // sometimes necessary
     96    if (TestFlag(kCalcHillas))
     97        fHillas = (MHillas*)pList->FindCreateObj("MHillas", fHilName);
     98    else
     99    {
     100        fHillas = (MHillas*)pList->FindObject(fHilName, "MHillas");
     101        *fLog << err << fHilName << " [MHillas] not found... aborting." << endl;
     102    }
    87103    if (!fHillas)
    88104        return kFALSE;
     105
     106    if (TestFlag(kCalcHillasExt))
     107    {
     108        fHillasExt = (MHillasExt*)pList->FindCreateObj("MHillasExt", fHilExtName);
     109        if (!fHillasExt)
     110            return kFALSE;
     111    }
     112
     113    if (TestFlag(kCalcNewImagePar))
     114    {
     115        fNewImgPar = (MNewImagePar*)pList->FindCreateObj("MNewImagePar", fImgParName);
     116        if (!fNewImgPar)
     117            return kFALSE;
     118    }
    89119
    90120    memset(fErrors, 0, sizeof(fErrors));
     
    102132Bool_t MHillasCalc::Process()
    103133{
    104     const Int_t rc = fHillas->Calc(*fGeomCam, *fCerPhotEvt);
    105     if (rc<0 || rc>4)
     134    if (TestFlag(kCalcHillas))
    106135    {
    107         *fLog << err << dbginf << "MHillas::Calc returned unknown error code!" << endl;
    108         return kFALSE;
     136        Int_t rc = fHillas->Calc(*fGeomCam, *fCerPhotEvt);
     137        if (rc<0 || rc>4)
     138        {
     139            *fLog << err << dbginf << "MHillas::Calc returned unknown error code!" << endl;
     140            return kFALSE;
     141        }
     142        fErrors[rc]++;
     143        if (rc>0)
     144            return kCONTINUE;
    109145    }
    110     fErrors[rc]++;
    111146
    112     return rc==0 ? kTRUE : kCONTINUE;
     147    if (TestFlag(kCalcHillasExt))
     148        fHillasExt->Calc(*fGeomCam, *fCerPhotEvt, *fHillas);
     149
     150    if (TestFlag(kCalcNewImagePar))
     151        fNewImgPar->Calc(*fGeomCam, *fCerPhotEvt, *fHillas);
     152
     153    return kTRUE;
    113154}
    114155
  • trunk/MagicSoft/Mars/mimage/MHillasCalc.h

    r1940 r2026  
    1717class MCerPhotEvt;
    1818class MHillas;
     19class MHillasExt;
     20class MNewImagePar;
    1921
    2022class MHillasCalc : public MTask
     
    2224    const MGeomCam    *fGeomCam;    // Camera Geometry used to calculate Hillas
    2325    const MCerPhotEvt *fCerPhotEvt; // Cerenkov Photon Event used for calculation
    24           MHillas     *fHillas;     // ouput container to store result
    2526
    26           TString      fHilName;
    27           Int_t        fErrors[5];
     27    MHillas      *fHillas;     // output container to store result
     28    MHillasExt   *fHillasExt;
     29    MNewImagePar *fNewImgPar;
     30
     31    TString      fHilName;
     32    TString      fHilExtName;
     33    TString      fImgParName;
     34
     35    Int_t        fErrors[5];
     36
     37    Int_t        fFlags;
    2838
    2939    Bool_t PreProcess(MParList *pList);
     
    3141    Bool_t PostProcess();
    3242
     43    enum CalcCont_t {
     44        kCalcHillas      = BIT(0),
     45        kCalcHillasExt   = BIT(1),
     46        //kCalcHillasSrc   = BIT(2),
     47        kCalcNewImagePar = BIT(3)
     48    };
     49
    3350public:
    34     MHillasCalc(const char *hil="MHillas", const char *name=NULL, const char *title=NULL);
     51    MHillasCalc(const char *name=NULL, const char *title=NULL);
     52
     53    void SetNameHillas(const char *name)    { fHilName = name;    }
     54    void SetNameHillasExt(const char *name) { fHilExtName = name; }
     55    void SetNameNewImgPar(const char *name) { fImgParName = name; }
     56
     57    void SetFlags(Int_t f) { fFlags  =  f; }
     58    void Enable(Int_t f)   { fFlags |=  f; }
     59    void Disable(Int_t f)  { fFlags &= ~f; }
     60    Bool_t TestFlag(CalcCont_t i) const { return fFlags&i; }
    3561
    3662    ClassDef(MHillasCalc, 0)   // Task to calculate Hillas parameters
  • trunk/MagicSoft/Mars/mimage/MHillasExt.cc

    r1940 r2026  
    6464#include "MLogManip.h"
    6565
     66#include "MHillas.h"
     67
    6668ClassImp(MHillasExt);
    6769
     
    7274MHillasExt::MHillasExt(const char *name, const char *title)
    7375{
    74     fName  = name  ? name  : "MHillas";
     76    fName  = name  ? name  : "MHillasExt";
    7577    fTitle = title ? title : "Storage container for extended parameter set of one event";
    7678
    7779    Reset();
    78       // FIXME: (intelligent) initialization of values missing
    7980}
    8081
     
    8384void MHillasExt::Reset()
    8485{
    85     MHillas::Reset();
    86 
    87     fConc    = -1;
    88     fConc1   = -1;
    8986    fAsym    =  0;
    9087    fM3Long  =  0;
     
    9693void MHillasExt::Print(Option_t *) const
    9794{
    98     MHillas::Print();
    99 
    10095    *fLog << "Extended Image Parameters (" << GetName() << ")" << endl;
    101     *fLog << " - Conc      = "        << fConc    << " (ratio)" << endl;
    102     *fLog << " - Conc1     = "        << fConc1   << " (ratio)" << endl;
    103     *fLog << " - Asymmetry = "        << fAsym    << " mm" << endl;
     96    *fLog << " - Asymmetry        = " << fAsym    << " mm" << endl;
    10497    *fLog << " - 3rd Moment Long  = " << fM3Long  << " mm" << endl;
    10598    *fLog << " - 3rd Moment Trans = " << fM3Trans << " mm" << endl;
     
    108101// -------------------------------------------------------------------------
    109102//
    110 //  calculation of additional parameters based on the camera geometry
     103// calculation of additional parameters based on the camera geometry
    111104// and the cerenkov photon event
    112105//
    113 Int_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt)
    114 {
    115     const Int_t rc = MHillas::Calc(geom, evt);
    116     if (rc>0)
    117         return rc;
    118 
     106Int_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt, const MHillas &hil)
     107{
    119108    //
    120109    //   calculate the additional image parameters
     
    129118    Double_t m3y = 0;
    130119
    131     Float_t maxpix1 = 0;                                               // [#phot]
    132     Float_t maxpix2 = 0;                                               // [#phot]
     120    const UInt_t npixevt = evt.GetNumPixels();
    133121
    134122    Int_t maxpixid = 0;
    135 
    136     const UInt_t npixevt = evt.GetNumPixels();
    137 
    138     const Float_t A0 = geom[0].GetA();
     123    Float_t maxpix = 0;
    139124
    140125    for (UInt_t i=0; i<npixevt; i++)
     
    144129            continue;
    145130
    146         const MGeomPix &gpix = geom[pix.GetPixId()];
    147         const Double_t dx = gpix.GetX() - GetMeanX();                // [mm]
    148         const Double_t dy = gpix.GetY() - GetMeanY();                // [mm]
    149 
    150         Double_t nphot = pix.GetNumPhotons();                        // [1]
    151 
    152         const Double_t dzx =  GetCosDelta()*dx + GetSinDelta()*dy;   // [mm]
    153         const Double_t dzy = -GetSinDelta()*dx + GetCosDelta()*dy;   // [mm]
    154 
    155         m3x += nphot * dzx*dzx*dzx;                                  // [mm^3]
    156         m3y += nphot * dzy*dzy*dzy;                                  // [mm^3]
    157 
    158         /*
    159          //
    160          // count number of photons in pixels at the edge of the camera
    161          //
    162          if (gpix.IsInOutermostRing())
    163             edgepix1 += nphot;
    164          if (gpix.IsInOuterRing())
    165             edgepix2 += nphot;
    166          */
     131        const Int_t pixid = pix.GetPixId();
     132
     133        const MGeomPix &gpix = geom[pixid];
     134        const Double_t dx = gpix.GetX() - hil.GetMeanX();      // [mm]
     135        const Double_t dy = gpix.GetY() - hil.GetMeanY();      // [mm]
     136
     137        Double_t nphot = pix.GetNumPhotons();                  // [1]
     138
     139        const Double_t dzx =  hil.GetCosDelta()*dx + hil.GetSinDelta()*dy; // [mm]
     140        const Double_t dzy = -hil.GetSinDelta()*dx + hil.GetCosDelta()*dy; // [mm]
     141
     142        m3x += nphot * dzx*dzx*dzx;                            // [mm^3]
     143        m3y += nphot * dzy*dzy*dzy;                            // [mm^3]
    167144
    168145        //
     
    170147        // must take pixel size into account
    171148        //
    172         const Double_t r = A0/gpix.GetA();
    173         nphot *= r;
    174 
    175         if (nphot>maxpix1)
     149        nphot *= geom.GetPixRatio(pixid);
     150
     151        if (nphot>maxpix)
    176152        {
    177             maxpix2  = maxpix1;
    178             maxpix1  = nphot;                                        // [1]
    179             maxpixid = pix.GetPixId();
    180             continue;                                                // [1]
     153            maxpix   = nphot;                                  // [1]
     154            maxpixid = pixid;
     155            continue;                                          // [1]
    181156        }
    182157
    183         if (nphot>maxpix2)
    184             maxpix2 = nphot;                                         // [1]
    185 
    186158        /*
    187159         //
    188          // power na for calculating fAsymna;
    189          // the value 1.5 was suggested by Thomas Schweizer
     160         //  power na for calculating fAsymna;
     161         //  the value 1.5 was suggested by Thomas Schweizer
    190162         //
    191163         Double_t na = 1.5;
     
    211183    }
    212184
    213     const MGeomPix &maxpix = geom[maxpixid];
    214 
    215     fAsym  = (GetMeanX()-maxpix.GetX())*GetCosDelta() +
    216              (GetMeanY()-maxpix.GetY())*GetSinDelta();               // [mm]
    217 
    218     fConc  = (maxpix1+maxpix2)/GetSize();                            // [ratio]
    219     fConc1 = maxpix1/GetSize();                                      // [ratio]
     185    const MGeomPix &maxp = geom[maxpixid];
     186
     187    fAsym = (hil.GetMeanX()-maxp.GetX())*hil.GetCosDelta() +
     188            (hil.GetMeanY()-maxp.GetY())*hil.GetSinDelta();    // [mm]
    220189
    221190    /*
    222      fLeakage1 = edgepix1 / GetSize();
    223      fLeakage2 = edgepix2 / GetSize();
    224191     fAsym0    =       fb / GetSize();
    225 
    226192     fAsymna   = na * (sna*xna1 - sna1*xna) / (sna*sna);
    227193     */
     
    230196    // Third moments along axes get normalized
    231197    //
    232     m3x /= GetSize();
    233     m3y /= GetSize();
    234 
    235     fM3Long  = m3x<0 ? -pow(-m3x, 1./3) : pow(m3x, 1./3);          // [mm]
    236     fM3Trans = m3y<0 ? -pow(-m3y, 1./3) : pow(m3y, 1./3);          // [mm]
     198    m3x /= hil.GetSize();
     199    m3y /= hil.GetSize();
     200
     201    fM3Long  = m3x<0 ? -pow(-m3x, 1./3) : pow(m3x, 1./3);      // [mm]
     202    fM3Trans = m3y<0 ? -pow(-m3y, 1./3) : pow(m3y, 1./3);      // [mm]
    237203
    238204    SetReadyToSave();
     
    248214void MHillasExt::Set(const TArrayF &arr)
    249215{
    250     if (arr.GetSize() != 13)
     216    if (arr.GetSize() != 3)
    251217        return;
    252218
    253     fConc    = arr.At(8);  // [ratio] concentration ratio: sum of the two highest pixels / fSize
    254     fConc1   = arr.At(9);  // [ratio] concentration ratio: sum of the highest pixel / fSize
    255     fAsym    = arr.At(10); // [mm]    fDist minus dist: center of ellipse, highest pixel
    256     fM3Long  = arr.At(11); // [mm]    3rd moment (e-weighted) along major axis
    257     fM3Trans = arr.At(12); // [mm]    3rd moment (e-weighted) along minor axis
    258 
    259     TArrayF n(arr);
    260     n.Set(8);
    261     MHillas::Set(n);
    262 }
    263 
    264 /*
    265 // -------------------------------------------------------------------------
    266 //
    267 void MHillasExt::AsciiRead(ifstream &fin)
    268 {
    269     MHillas::AsciiRead(fin);
    270 
    271     fin >> fConc;
    272     fin >> fConc1;
    273     fin >> fAsym;
    274     fin >> fM3Long;
    275     fin >> fM3Trans;
    276 }
    277 */
    278 // -------------------------------------------------------------------------
    279 /*
    280 void MHillasExt::AsciiWrite(ofstream &fout) const
    281 {
    282     MHillas::AsciiWrite(fout);
    283 
    284     fout << " ";
    285     fout << fConc   << " ";
    286     fout << fConc1  << " ";
    287     fout << fAsym   << " ";
    288     fout << fM3Long << " ";
    289     fout << fM3Trans;
    290 }
    291 */
     219    fAsym    = arr.At(0); // [mm] fDist minus dist: center of ellipse, highest pixel
     220    fM3Long  = arr.At(1); // [mm] 3rd moment (e-weighted) along major axis
     221    fM3Trans = arr.At(2); // [mm] 3rd moment (e-weighted) along minor axis
     222}
  • trunk/MagicSoft/Mars/mimage/MHillasExt.h

    r1940 r2026  
    22#define MARS_MHillasExt
    33
    4 #ifndef MARS_MHillas
    5 #include "MHillas.h"
     4#ifndef MARS_MParContainer
     5#include "MParContainer.h"
    66#endif
    77
     8class TArrayF;
     9
     10class MHillas;
    811class MGeomCam;
    912class MCerPhotEvt;
    1013
    11 class MHillasExt : public MHillas
     14class MHillasExt : public MParContainer
    1215{
    1316private:
    1417    // for description see MExtHillas.cc
    15     Float_t fConc;    // [ratio] concentration ratio: sum of the two highest pixels / fSize
    16     Float_t fConc1;   // [ratio] concentration ratio: sum of the highest pixel / fSize
    17     Float_t fAsym;    // [mm]    fDist minus dist: center of ellipse, highest pixel
    18     Float_t fM3Long;  // [mm]    3rd moment (e-weighted) along major axis
    19     Float_t fM3Trans; // [mm]    3rd moment (e-weighted) along minor axis
     18    Float_t fAsym;    // [mm] fDist minus dist: center of ellipse, highest pixel
     19    Float_t fM3Long;  // [mm] 3rd moment (e-weighted) along major axis
     20    Float_t fM3Trans; // [mm] 3rd moment (e-weighted) along minor axis
    2021
    2122public:
     
    2425    void Reset();
    2526
    26     Float_t GetConc() const    { return fConc; }
    27     Float_t GetConc1() const   { return fConc1; }
    2827    Float_t GetAsym() const    { return fAsym; }
    2928    Float_t GetM3Long() const  { return fM3Long; }
    3029    Float_t GetM3Trans() const { return fM3Trans; }
    3130
    32     Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);
     31    Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix, const MHillas &hil);
    3332
    3433    void Print(Option_t *opt=NULL) const;
     
    3635    void Set(const TArrayF &arr);
    3736
    38     //void AsciiRead(ifstream &fin);
    39     //void AsciiWrite(ofstream &fout) const;
    40 
    4137    ClassDef(MHillasExt, 1) // Storage Container for extended Hillas Parameter
    4238};
  • trunk/MagicSoft/Mars/mimage/MHillasSrc.cc

    r2004 r2026  
    3434//    source-dependent image parameters
    3535//
     36//
    3637// Version 1:
    3738// ----------
     
    3940//  fDist           distance from source to center of ellipse
    4041//
     42//
    4143// Version 2:
    4244// ----------
    43 //  fHeadTail
     45//  fHeadTail       added
     46//
    4447//
    4548// Version 3:
     
    5154//                     defined with positive x-component
    5255//
     56//
    5357// Version 4:
    5458// ----------
    5559//
    5660// fHeadTail        removed
    57 //
    5861//
    5962/////////////////////////////////////////////////////////////////////////////
     
    9598Bool_t MHillasSrc::Calc(const MHillas *hillas)
    9699{
    97     fHillas = hillas;
     100    const Double_t mx   = hillas->GetMeanX();       // [mm]
     101    const Double_t my   = hillas->GetMeanY();       // [mm]
    98102
    99     const Double_t mx   = GetMeanX();            // [mm]
    100     const Double_t my   = GetMeanY();            // [mm]
     103    const Double_t sx   = mx - fSrcPos->GetX();     // [mm]
     104    const Double_t sy   = my - fSrcPos->GetY();     // [mm]
    101105
    102     const Double_t sx   = mx - fSrcPos->GetX();  // [mm]
    103     const Double_t sy   = my - fSrcPos->GetY();  // [mm]
    104 
    105     const Double_t sd   = sin(GetDelta());       // [1]
    106     const Double_t cd   = cos(GetDelta());       // [1]
    107 
    108     const Double_t tand = tan(GetDelta());       // [1]
    109 
    110     const Double_t headtail = cd*sx + sd*sy;     // [mm]
     106    const Double_t sd   = hillas->GetSinDelta();    // [1]
     107    const Double_t cd   = hillas->GetCosDelta();    // [1]
    111108
    112109    //
     
    115112    // The calculation has failed and returnes kFALSE.
    116113    //
    117     Double_t dist = sqrt(sx*sx + sy*sy);         // [mm]
    118 
     114    const Double_t dist = sqrt(sx*sx + sy*sy);      // [mm]
    119115    if (dist==0)
    120     {
    121         //*fLog << warn << GetDescriptor() << ": Event has Dist==0... skipped." << endl;
    122116        return kFALSE;
    123     }
    124117
    125118    //
     
    128121    // a head-tail information
    129122    //
    130     const Double_t arg = (sy-tand*sx) / (dist*sqrt(tand*tand+1));
     123    // *OLD* const Double_t arg = (sy-tand*sx) / (dist*sqrt(tand*tand+1));
     124    // *OLD* fAlpha = asin(arg)*kRad2Deg;
    131125
    132     fAlpha         = asin(arg)*kRad2Deg;        // [deg]
    133     fCosDeltaAlpha = headtail/dist;             // [1]
    134     fDist          = dist;                      // [mm]
     126    const Double_t arg1 = cd*sy-sd*sx;              // [mm]
     127    const Double_t arg2 = cd*sx+sd*sy;              // [mm]
     128
     129    fAlpha         = asin(arg1/dist)*kRad2Deg;      // [deg]
     130    fCosDeltaAlpha = arg2/dist;                     // [1]
     131    fDist          = dist;                          // [mm]
    135132
    136133    SetReadyToSave();
     
    161158    fCosDeltaAlpha = arr.At(2); // [1]    cosine of angle between d and a
    162159}
    163 
    164 // -----------------------------------------------------------------------
    165 //
    166 // overloaded MParContainer to read MHillasSrc from an ascii file
    167 //
    168 /*
    169 void MHillasSrc::AsciiRead(ifstream &fin)
    170 {
    171     fin >> fAlpha;
    172     fin >> fDist;
    173     fin >> fHeadTail;
    174 }
    175 */
    176 // -----------------------------------------------------------------------
    177 //
    178 // overloaded MParContainer to write MHillasSrc to an ascii file
    179 /*
    180 void MHillasSrc::AsciiWrite(ofstream &fout) const
    181 {
    182     fout << fAlpha << " " << fDist;
    183 }
    184 */
  • trunk/MagicSoft/Mars/mimage/MHillasSrc.h

    r2004 r2026  
    1111{
    1212private:
    13     const MHillas    *fHillas; //! Input parameters
    1413    const MSrcPosCam *fSrcPos; //! Source position in the camere
    1514
     
    2625    void Reset();
    2726
    28     Float_t GetLength()        const { return fHillas->GetLength(); }
    29     Float_t GetWidth()         const { return fHillas->GetWidth(); }
    30     Float_t GetDelta()         const { return fHillas->GetDelta(); }
    31     Float_t GetSize()          const { return fHillas->GetSize(); }
    32     Float_t GetMeanX()         const { return fHillas->GetMeanX(); }
    33     Float_t GetMeanY()         const { return fHillas->GetMeanY(); }
    3427    Float_t GetAlpha()         const { return fAlpha; }
    3528    Float_t GetDist()          const { return fDist; }
     
    4235    void Set(const TArrayF &arr);
    4336
    44     //virtual void AsciiRead(ifstream &fin);
    45     //virtual void AsciiWrite(ofstream &fout) const;
    46 
    4737    ClassDef(MHillasSrc, 4) // Container to hold source position dependant parameters
    4838};
  • trunk/MagicSoft/Mars/mimage/MNewImagePar.cc

    r1966 r2026  
    3333
    3434#include <fstream.h>
    35 #include <TArrayF.h>
    3635
    3736#include "MLog.h"
    3837#include "MLogManip.h"
    3938
     39#include "MHillas.h"
     40
    4041#include "MGeomCam.h"
    4142#include "MGeomPix.h"
     43
    4244#include "MCerPhotEvt.h"
    4345#include "MCerPhotPix.h"
    44 #include "MSrcPosCam.h"
     46
    4547
    4648ClassImp(MNewImagePar);
     
    6062void MNewImagePar::Reset()
    6163{
    62     fLeakage1 = 0;
    63     fLeakage2 = 0;
     64    fLeakage1 = -1;
     65    fLeakage2 = -1;
     66
     67    fConc  = -1;
     68    fConc1 = -1;
     69
     70    fNumUsedPixels = -1;
     71    fNumCorePixels = -1;
    6472}
    6573
     
    6876//  Calculation of new image parameters
    6977//
    70 //
    71 Bool_t MNewImagePar::Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
    72                           const MHillas *hillas)
     78void MNewImagePar::Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
     79                        const MHillas &hillas)
    7380{
     81    fNumUsedPixels = 0;
     82    fNumCorePixels = 0;
     83
    7484    const UInt_t npixevt = evt.GetNumPixels();
    7585
    7686    Double_t edgepix1 = 0;
    7787    Double_t edgepix2 = 0;
     88
     89    Float_t maxpix1 = 0;                                 // [#phot]
     90    Float_t maxpix2 = 0;                                 // [#phot]
     91
     92    Int_t maxpixid = 0;
     93
    7894
    7995    for (UInt_t i=0; i<npixevt; i++)
     
    8399            continue;
    84100
    85         const MGeomPix &gpix = geom[pix.GetPixId()];
     101        const Int_t pixid = pix.GetPixId();
    86102
    87         const Double_t nphot = pix.GetNumPhotons();
     103        const MGeomPix &gpix = geom[pixid];
    88104
     105        Double_t nphot = pix.GetNumPhotons();
     106
     107        //
    89108        // count photons in outer rings of camera
     109        //
    90110        if (gpix.IsInOutermostRing())
    91111           edgepix1 += nphot;
    92112        if (gpix.IsInOuterRing())
    93113           edgepix2 += nphot;
     114
     115        //
     116        // count used and core pixels
     117        //
     118        if (pix.IsPixelCore())
     119            fNumCorePixels++;
     120
     121        fNumUsedPixels++;
     122
     123        //
     124        // Now we are working on absolute values of nphot, which
     125        // must take pixel size into account
     126        //
     127        nphot *= geom.GetPixRatio(pixid);
     128
     129        if (nphot>maxpix1)
     130        {
     131            maxpix2  = maxpix1;
     132            maxpix1  = nphot;                            // [1]
     133            maxpixid = pixid;
     134            continue;                                    // [1]
     135        }
     136
     137        if (nphot>maxpix2)
     138            maxpix2 = nphot;                             // [1]
    94139    }
    95140
    96     fLeakage1 = edgepix1 / hillas->GetSize();
    97     fLeakage2 = edgepix2 / hillas->GetSize();
     141    fLeakage1 = edgepix1 / hillas.GetSize();
     142    fLeakage2 = edgepix2 / hillas.GetSize();
     143
     144    fConc  = (maxpix1+maxpix2)/hillas.GetSize();         // [ratio]
     145    fConc1 = maxpix1/hillas.GetSize();                   // [ratio]
    98146
    99147    SetReadyToSave();
    100 
    101     return kTRUE;
    102148}
    103149
     
    108154    *fLog << all;
    109155    *fLog << "New Image Parameters (" << GetName() << ")" << endl;
    110     *fLog << " - Leakage1            = " << fLeakage1     << endl;
    111     *fLog << " - Leakage2            = " << fLeakage2     << endl;
     156    *fLog << " - Leakage1        = " << fLeakage1      << endl;
     157    *fLog << " - Leakage2        = " << fLeakage2      << endl;
     158    *fLog << " - Conc            = " << fConc          << " (ratio)" << endl;
     159    *fLog << " - Conc1           = " << fConc1         << " (ratio)" << endl;
     160    *fLog << " - Used Pixels [#] = " << fNumUsedPixels << " Pixels" << endl;
     161    *fLog << " - Core Pixels [#] = " << fNumCorePixels << " Pixels" << endl;
    112162}
  • trunk/MagicSoft/Mars/mimage/MNewImagePar.h

    r1940 r2026  
    22#define MARS_MNewImagePar
    33
    4 #ifndef MARS_MHillas
    5 #include "MHillas.h"
     4#ifndef MARS_MParContainer
     5#include "MParContainer.h"
    66#endif
    77
    8 class MSrcPosCam;
     8class MHillas;
     9class MGeomCam;
     10class MCerPhotEvt;
    911
    1012class MNewImagePar : public MParContainer
    1113{
    1214private:
    13     Float_t fLeakage1;   // (photons in most outer ring of pixels) over fSize
    14     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
     17
     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
     20
     21    Short_t fNumUsedPixels; // Number of pixels which survived the image cleaning
     22    Short_t fNumCorePixels; // number of core pixels
    1523
    1624public:
    1725    MNewImagePar(const char *name=NULL, const char *title=NULL);
    1826
    19     //    void SetSrcPos(MSrcPosCam *pos) { fSrcPos = pos; }
    20     //    const MSrcPosCam *GetSrcPos() const   { return fSrcPos; }
    21 
    2227    void Reset();
    2328
    24     Float_t GetLeakage1()        const { return fLeakage1; }
    25     Float_t GetLeakage2()        const { return fLeakage2; }
     29    Float_t GetLeakage1() const    { return fLeakage1; }
     30    Float_t GetLeakage2() const    { return fLeakage2; }
     31
     32    Float_t GetConc() const        { return fConc; }
     33    Float_t GetConc1() const       { return fConc1; }
     34
     35    Int_t GetNumUsedPixels() const { return fNumUsedPixels; }
     36    Int_t GetNumCorePixels() const { return fNumCorePixels; }
    2637
    2738    void Print(Option_t *opt=NULL) const;
    2839
    29     virtual Bool_t Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
    30                         const MHillas *hillas);
    31 
    32     //virtual void AsciiRead(ifstream &fin);
    33     //virtual void AsciiWrite(ofstream &fout) const;
     40    void Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
     41              const MHillas &hillas);
    3442
    3543    ClassDef(MNewImagePar, 1) // Container to hold new image parameters
  • trunk/MagicSoft/Mars/mimage/MNewImageParCalc.cc

    r1940 r2026  
    6565    fTitle = title ? title : gsDefTitle.Data();
    6666
    67     fSrcName     =       src;
    68     fNewParName  =    newpar;
     67    fSrcName     = src;
     68    fNewParName  = newpar;
    6969    fHillasInput = "MHillas";
    7070}
     
    102102    }
    103103
    104 
    105104    fNewImagePar = (MNewImagePar*)pList->FindCreateObj("MNewImagePar", fNewParName);
    106105    if (!fNewImagePar)
    107106        return kFALSE;
    108107
    109     fErrors = 0;
     108    //fErrors = 0;
    110109
    111110    return kTRUE;
     
    117116{
    118117
    119     if (!fNewImagePar->Calc(*fGeomCam, *fCerPhotEvt, fHillas))
     118    /*if (!*/fNewImagePar->Calc(*fGeomCam, *fCerPhotEvt, *fHillas);/*)
    120119    {
    121120        fErrors++;
    122121        return kCONTINUE;
    123122
    124     }
     123    }*/
    125124    return kTRUE;
    126125}
     
    131130//  is calculated with respect to the number of executions of this task.
    132131//
     132/*
    133133Bool_t MNewImageParCalc::PostProcess()
    134134{
     
    144144    return kTRUE;
    145145}
    146 
    147 // --------------------------------------------------------------------------
    148 
    149 
    150 
    151 
    152 
    153 
    154 
    155 
    156 
    157 
    158 
    159 
     146*/
  • trunk/MagicSoft/Mars/mimage/MNewImageParCalc.h

    r1940 r2026  
    2222    MNewImagePar *fNewImagePar;  //! Pointer to the output container for the new image parameters
    2323
    24     TString     fSrcName;
    25     TString     fNewParName;
    26     TString     fHillasInput;
     24    TString fSrcName;
     25    TString fNewParName;
     26    TString fHillasInput;
    2727
    28     Int_t       fErrors;
     28    //Int_t       fErrors;
    2929
    3030    Bool_t PreProcess(MParList *plist);
    3131    Bool_t Process();
    32     Bool_t PostProcess();
     32    //Bool_t PostProcess();
    3333
    3434public:
     
    3838    void SetInput(TString hilname) { fHillasInput = hilname; }
    3939
    40     ClassDef(MNewImageParCalc, 1) // task to calculate new image parameters
     40    ClassDef(MNewImageParCalc, 0) // task to calculate new image parameters
    4141};
    4242
  • trunk/MagicSoft/Mars/mimage/Makefile

    r1947 r2026  
    3636           MHillasSrcCalc.cc \
    3737           MNewImagePar.cc \
    38            MNewImageParCalc.cc \
    3938           MHHillas.cc \
    4039           MHHillasSrc.cc \
  • trunk/MagicSoft/Mars/mmain/MAnalysis.cc

    r1668 r2026  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  9/2001 <mailto:tbretz@uni-sw.gwdg.de>
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2002
     18!   Author(s): Thomas Bretz, 9/2001 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2003
    2121!
    2222!
    2323\* ======================================================================== */
    24 
    2524#include "MAnalysis.h"
    2625
     
    205204
    206205    MFillH hfill("MHHillas",      "MHillas");
     206    MFillH hfill2("MHHillasExt",  "MHillasSrc");
     207    MFillH hfill2s("MHHillasSrc", "MHillasSrc");
     208    MFillH hfill3("MHNewImagePar");
    207209    MFillH sfill("MHStarMap",     "MHillas");
    208     MFillH hfill2s("MHHillasSrc", "MHillasSrc");
    209210    /*
    210211     MFillH hfill2s("HistSource  [MHHillasSrc]", "HillasSource");
     
    225226    {
    226227        tlist.AddToList(&hfill);
     228        tlist.AddToList(&hfill2);
    227229        tlist.AddToList(&hfill2s);
    228         //tlist.AddToList(&hfill2a);
     230        tlist.AddToList(&hfill3);
    229231    }
    230232
     
    263265    {
    264266        plist.FindObject("MHHillas")->DrawClone();
     267        plist.FindObject("MHHillasExt")->DrawClone();
    265268        plist.FindObject("MHHillasSrc")->DrawClone();
     269        plist.FindObject("MHNewImagePar")->DrawClone();
    266270        /*
    267271         plist.FindObject("HistSource")->DrawClone();
Note: See TracChangeset for help on using the changeset viewer.