Changeset 4710 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
08/23/04 14:15:49 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 added
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4708 r4710  
    4646
    4747
     48
    4849 2004/08/23: Thomas Bretz
    4950
     
    9091   * mmain/MEventDisplay.cc:
    9192     - added display of island index
     93
     94   * mhvstime/MHVsTime.[h,cc]:
     95     - implemented the possibility to set a maximum number of points
     96
     97   * mbase/MParContainer.h:
     98     - changed StreamPrimitive to public
     99
     100   * mcalib/MMcCalibrationCalc.[h,cc]:
     101     - added fPar data member (MImagePar) to get number of
     102       saturating hi gain pixels
     103
     104   * mimage/Makefile, mimage/ImageLinkDef.h:
     105     - added MImagePar
     106     - added MHImagePar
     107
     108   * mimage/MConcentration.[h,cc]:
     109     - removed obsolete destructor
     110
     111   * mimage/MHillas.[h,cc]:
     112     - added a check for island index to calculation
     113
     114   * mimage/MHillasCalc.cc:
     115     - added option kCalcImagePar
     116     - added option kCalcHillasSrc
     117     - added Print function
     118     - added StreamPrimitive function
     119     - added resource support (ReadEnv)
     120
     121   * mimage/MHillasExt.[h,cc]:
     122     - added a check for island index to calculation
     123     - replaced for-loop by iterator
     124
     125   * mimage/MHillasSrc.[h,cc]:
     126     - changed argument to Calc from pointer to reference
     127
     128   * mimage/MHillasSrcCalc.[h,cc]:
     129     - fixed StreamPrimitive
     130     - added some const-qualifiers to data members
     131     - adapted to change in MHillasSrc
     132
     133   * mimage/MNewImagePar.[h,cc]:
     134     - moved saturating pixels to new class MImagePar
     135     - added a check for island index to calculation
     136     - increased version number
     137
     138   * mpointing/MSrcPosCam.h:
     139     - made StreamPrimitive public
    92140
    93141
  • trunk/MagicSoft/Mars/NEWS

    r4702 r4710  
    2020     The index corresponds to the order of the islands in size.
    2121
     22   - Changed calculation of image parameters such, that it can be done
     23     for all used pixels or the pixels with a defined island index only
     24
     25   - implemented new image parameters displaying the number of islands,
     26     saturated hi-gain and lo-gain pixels (MImagePar, MHImagePar)
     27
    2228
    2329
     
    2531 
    2632   - new Signal Extractors: MExtractFixedWindowSpline
    27                          nd MExtractAmplitudeSpline
     33     and MExtractAmplitudeSpline
    2834
    2935   - implementes interleave in merpp to be able to merpp parts of a file
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r4601 r4710  
    5454    Bool_t  fReadyToSave; // should be set to true if the contents of the container is changed somehow
    5555
    56     // FIXME: Change to ostream!
    57     virtual void StreamPrimitive(ofstream &out) const;
    58 
    5956public:
    6057    enum {
     
    103100
    104101    virtual void SetDisplay(MStatusDisplay *d) { fDisplay = d; }
     102
     103    // FIXME: Change to ostream!
     104    virtual void StreamPrimitive(ofstream &out) const;
    105105
    106106    TMethodCall *GetterMethod(const char *name) const;
  • trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.cc

    r4296 r4710  
    6161
    6262#include "MHillas.h"
     63#include "MImagePar.h"
    6364#include "MNewImagePar.h"
    6465
     
    139140    {
    140141        *fLog << err << AddSerialNumber("MNewImagePar") << "not found... aborting." << endl;
     142        return kFALSE;
     143    }
     144
     145    fPar = (MImagePar*)pList->FindObject(AddSerialNumber("MImagePar"));
     146    if (!fPar)
     147    {
     148        *fLog << err << AddSerialNumber("MImagePar") << "not found... aborting." << endl;
    141149        return kFALSE;
    142150    }
     
    236244    // Exclude events with some saturated pixel
    237245    //
    238     if (fNew->GetNumSaturatedPixels()>0)
     246    if (fPar->GetNumSatPixelsHG()>0)
    239247        return kTRUE;
    240248
  • trunk/MagicSoft/Mars/mcalib/MMcCalibrationCalc.h

    r4296 r4710  
    1010class MGeomCam;
    1111class MHillas;
     12class MImagePar;
    1213class MNewImagePar;
    1314class MMcEvt;
     
    2425    MHillas                   *fHillas;
    2526    MNewImagePar              *fNew;
     27    MImagePar                 *fPar;
    2628    MMcEvt                    *fMcEvt;
    2729    MMcFadcHeader             *fHeaderFadc;
  • trunk/MagicSoft/Mars/mimage/ImageLinkDef.h

    r3526 r4710  
    1515#pragma link C++ class MHillasCalc+;
    1616
     17#pragma link C++ class MImagePar+;
    1718#pragma link C++ class MNewImagePar+;
    1819#pragma link C++ class MConcentration+;
     
    2122#pragma link C++ class MHHillasSrc+;
    2223#pragma link C++ class MHHillasExt+;
     24#pragma link C++ class MHImagePar+;
    2325#pragma link C++ class MHNewImagePar+;
    2426#pragma link C++ class MStereoPar+;
  • trunk/MagicSoft/Mars/mimage/MConcentration.cc

    r3568 r4710  
    7575// --------------------------------------------------------------------------
    7676//
    77 // Destructor.
    78 //
    79 MConcentration::~MConcentration()
    80 {
    81 }
    82 
    83 // --------------------------------------------------------------------------
    84 //
    8577// Initializes the values with defaults. For the default values see the
    8678// source code.
     
    111103// In case you don't call Calc from within an eventloop make sure, that
    112104// you call the Reset member function before.
     105//
    113106// Returns:
    114107//    Nothing.
    115 
     108//
    116109Int_t MConcentration::Calc(const MGeomCam &geom, const MCerPhotEvt &evt, const MHillas &hillas)
    117110{
  • trunk/MagicSoft/Mars/mimage/MConcentration.h

    r3542 r4710  
    1717public:
    1818    MConcentration(const char *name=NULL, const char *title=NULL);
    19     ~MConcentration();
    2019
    2120    void Reset();
  • trunk/MagicSoft/Mars/mimage/MHillas.cc

    r3540 r4710  
    188188//   4  CorrXY == 0
    189189//
    190 Int_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt)
     190Int_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt, Int_t island)
    191191{
    192192    //
     
    215215    while ((pix=(MCerPhotPix*)Next()))
    216216    {
     217        if (island>=0 && pix->GetIdxIsland()!=island)
     218            continue;
     219
    217220        const MGeomPix &gpix = geom[pix->GetPixId()];
    218221
     
    257260    while ((pix=(MCerPhotPix*)Next()))
    258261    {
     262        if (island>=0 && pix->GetIdxIsland()!=island)
     263            continue;
     264
    259265        const MGeomPix &gpix = geom[pix->GetPixId()];
    260266
  • trunk/MagicSoft/Mars/mimage/MHillas.h

    r3540 r4710  
    3131    void Reset();
    3232
    33     Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);
     33    Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix, Int_t island=-1);
    3434
    3535    void Print(const MGeomCam &geom) const;
  • trunk/MagicSoft/Mars/mimage/MHillasCalc.cc

    r4578 r4710  
    2727//
    2828//  MHillasCalc
     29//  ===========
    2930//
    3031//  This is a task to calculate the Hillas parameters from each event
    3132//
    32 //  By default MHillas, MHillasExt and MNewImagePar are calculated
    33 //  with the information from MCerPhotEvt and MGeomCam.
     33//
     34//   Flags
     35//  --------
     36//
     37//  By default all flags are set:
    3438//
    3539//  To switch of the calculation you may use:
     
    3741//   - Disable(MHillasCalc::kCalcHillasExt)
    3842//   - Disable(MHillasCalc::kCalcNewImagePar)
     43//   - Disable(MHillasCalc::kCalcImagePar)
     44//   - Disable(MHillasCalc::kCalcSrcPosCam)
     45//   - Disable(MHillasCalc::kCalcConc)
    3946//
    4047//  If the calculation of MHillas is switched off a container MHillas
    4148//  in the parameter list is nevertheless necessary for the calculation
    42 //  of MHillasExt and MNewImagePar.
     49//  of some other containers, see below.
     50//
     51//  If kCalcHillasSrc is set and no corresponding MSrcPosCam is found
     52//  in the parameter list an empty container (X=0, Y=0) is created.
     53//
     54//
     55//   Container names
     56//  -----------------
    4357//
    4458//  The names of the containers to be used can be set with:
     
    4660//   - SetNameHillasExt("NewName")
    4761//   - SetNameNewImgPar("NewName")
    48 //
    49 //  Input Containers:
    50 //   MCerPhotEvt
    51 //   MGeomCam
    52 //   [MHillas]
    53 //
    54 //  Output Containers:
    55 //   [MHillas]
    56 //   MHillasExt
    57 //   MNewImagePar
     62//   - SetNameImagePar("NewName")
     63//   - SetNameSrcPosCam("NewName")
     64//   - SetNameConc("NewName")
     65//   - SetNameHillasSrc("NewName")
     66//
     67//
     68//   Islands
     69//  ---------
     70//
     71//  You can change the islands for which the caluclations are done by:
     72//   - SetNumIsland()
     73//  The default is to use all used pixels (-1)
     74//
     75//  fIdxIslands effects the calculations:
     76//   - kCalcHillas
     77//   - kCalcHillasExt
     78//   - kCalcNewImgPar
     79//
     80//
     81//   Example
     82//  ---------
     83//
     84//   MHillasCalc calc0; // calculate all image parameters except source dep.
     85//   MHillasCalc calc1; // calculate source dependant image parameters for 'Source'
     86//   MHillasCalc calc2; // calculate source dependant image parameters for 'AntiSource'
     87//   MHillasCalc calc3; // calculate hillas parameters only for biggest island
     88//   MHillasCalc calc4; // calculate hillas parameter for 2nd biggest island
     89//   // setup names of input-/output-containers
     90//   calc1.SetNameSrcPosCam("Source");
     91//   calc2.SetNameSrcPosCam("AntiSource");
     92//   calc1.SetNameHillasSrc("MHillasSource");
     93//   calc2.SetNameHillasSrc("MHillasAntiSource");
     94//   calc3.SetNameHillas("MHillas0");
     95//   calc4.SetNameHillas("MHillas1");
     96//   // setup calculations to be done
     97//   calc0.Disable(MHillasCalc::kCalcHillasSrc);
     98//   calc1.SetFlags(MHillasCalc::kCalcHillasSrc);
     99//   calc2.SetFlags(MHillasCalc::kCalcHillasSrc);
     100//   calc3.SetFlags(MHillasCalc::kCalcHillas);
     101//   calc4.SetFlags(MHillasCalc::kCalcHillas);
     102//   // choode index of island
     103//   calc3.SetNumIsland(0);
     104//   calc4.SetNumIsland(1);
     105//
     106//   // setup tasklist
     107//   MTaskList list;
     108//   list.Add(&calc0);
     109//   list.Add(&calc1);
     110//   list.Add(&calc2);
     111//   list.Add(&calc3);
     112//   list.Add(&calc4);
     113//
     114//
     115//   Input/Output Containers
     116//  -------------------------
     117//
     118//    1) MGeomCam          5) MHillas         8) MImagePar
     119//    2) MCerPhotEvt       6) MHillasSrc      9) MNewImagePar
     120//    3) MSrcPosCam        7) MHillasExt     10) MConcentration
     121//    4) fIdxIslands
     122//
     123//     Flag           | Input Container | Output
     124//   -----------------+-----------------+--------
     125//    kCalcHillas     |  1  2     4     |    5
     126//    kCalcHillasSrc  |        3  4  5  |    6
     127//    kCalcHillasExt  |  1  2     4  5  |    7
     128//    kCalcImagePar   |     2           |    8
     129//    kCalcNewImgPar  |  1  2     4  5  |    9
     130//    kCalcConc       |  1  2        5  |   10
     131//   -----------------+-----------------+--------
    58132//
    59133/////////////////////////////////////////////////////////////////////////////
    60134#include "MHillasCalc.h"
    61135
     136#include <fstream> // StreamPrimitive
     137
    62138#include "MParList.h"
     139
     140#include "MCerPhotEvt.h"
    63141
    64142#include "MHillas.h"
    65143#include "MHillasExt.h"
     144#include "MHillasSrc.h"
     145#include "MImagePar.h"
    66146#include "MNewImagePar.h"
    67147#include "MConcentration.h"
    68 #include "MCerPhotEvt.h"
    69148
    70149#include "MLog.h"
     
    75154using namespace std;
    76155
     156const TString MHillasCalc::gsDefName         = "MHillasCalc";
     157const TString MHillasCalc::gsDefTitle        = "Calculate Hillas and other image parameters";
     158
     159const TString MHillasCalc::gsNameHillas      = "MHillas";        // default name of the 'MHillas' container
     160const TString MHillasCalc::gsNameHillasExt   = "MHillasExt";     // default name of the 'MHillasExt' container
     161const TString MHillasCalc::gsNameNewImagePar = "MNewImagePar";   // default name of the 'MNewImagePar' container
     162const TString MHillasCalc::gsNameConc        = "MConcentration"; // default name of the 'MConcentration' container
     163const TString MHillasCalc::gsNameImagePar    = "MImagePar";      // default name of the 'MImagePar' container
     164const TString MHillasCalc::gsNameHillasSrc   = "MHillasSrc";     // default name of the 'MHillasSrc' container
     165const TString MHillasCalc::gsNameSrcPosCam   = "MSrcPosCam";     // default name of the 'MSrcPosCam' container
     166
    77167// --------------------------------------------------------------------------
    78168//
     
    80170//
    81171MHillasCalc::MHillasCalc(const char *name, const char *title)
    82     : fNameHillas("MHillas"), fNameHillasExt("MHillasExt"),
    83     fNameNewImgPar("MNewImagePar"), fNameConc("MConcentration"),
    84     fFlags(0xff), fErrors(5)
    85 {
    86     fName  = name  ? name  : "MHillasCalc";
    87     fTitle = title ? title : "Calculate Hillas and other image parameters";
    88 }
    89 
    90 // --------------------------------------------------------------------------
    91 //
    92 // Check for a MCerPhotEvt object from which the Hillas are calculated.
    93 // Try to find the Geometry conatiner. Depending on the flags
    94 // try to find (and maybe create) the containers MHillas, MHillasExt,
    95 // MNewImagePar, too.
     172        : fNameHillas(gsNameHillas),       fNameHillasExt(gsNameHillasExt),
     173          fNameHillasSrc(gsNameHillasSrc), fNameSrcPosCam(gsNameSrcPosCam),
     174          fNameConc(gsNameConc),           fNameImagePar(gsNameImagePar),
     175          fNameNewImagePar(gsNameNewImagePar),
     176          fErrors(5), fFlags(0xff), fIdxIsland(-1)
     177{
     178    fName  = name  ? name  : gsDefName.Data();
     179    fTitle = title ? title : gsDefTitle.Data();
     180}
     181
     182// --------------------------------------------------------------------------
     183//
     184// Check for in-/output containers, see class description
    96185//
    97186Int_t MHillasCalc::PreProcess(MParList *pList)
    98187{
    99     // necessary
    100     fCerPhotEvt = (MCerPhotEvt*)pList->FindObject(AddSerialNumber("MCerPhotEvt"));
    101     if (!fCerPhotEvt)
    102     {
    103         *fLog << err << "MCerPhotEvt not found... aborting." << endl;
    104         return kFALSE;
    105     }
    106 
    107     // necessary
    108     fGeomCam = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam"));
    109     if (!fGeomCam)
    110     {
    111         *fLog << err << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
    112         return kFALSE;
     188    if (TestFlags(~kCalcHillasSrc))
     189    {
     190        fCerPhotEvt = (MCerPhotEvt*)pList->FindObject(AddSerialNumber("MCerPhotEvt"));
     191        if (!fCerPhotEvt)
     192        {
     193            *fLog << err << "MCerPhotEvt not found... aborting." << endl;
     194            return kFALSE;
     195        }
     196    }
     197
     198    if (TestFlags(kCalcHillas|kCalcHillasExt|kCalcNewImagePar|kCalcConc))
     199    {
     200        fGeomCam = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam"));
     201        if (!fGeomCam)
     202        {
     203            *fLog << err << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
     204            return kFALSE;
     205        }
    113206    }
    114207
    115208    // depend on whether MHillas is an in- or output container
    116209    if (TestFlag(kCalcHillas))
     210    {
    117211        fHillas = (MHillas*)pList->FindCreateObj("MHillas", AddSerialNumber(fNameHillas));
    118     else
     212        if (!fHillas)
     213            return kFALSE;
     214    }
     215
     216    if (TestFlags(kCalcHillasExt|kCalcNewImagePar|kCalcConc|kCalcHillasSrc))
    119217    {
    120218        fHillas = (MHillas*)pList->FindObject(AddSerialNumber(fNameHillas), "MHillas");
    121         *fLog << err << fNameHillas << " [MHillas] not found... aborting." << endl;
    122     }
    123     if (!fHillas)
    124         return kFALSE;
     219        if (!fHillas)
     220        {
     221            *fLog << err << fNameHillas << " [MHillas] not found... aborting." << endl;
     222            return kFALSE;
     223        }
     224    }
    125225
    126226    // if enabled
     
    133233
    134234    // if enabled
     235    if (TestFlag(kCalcHillasSrc))
     236    {
     237        const MSrcPosCam *src = (MSrcPosCam*)pList->FindObject(AddSerialNumber(fNameSrcPosCam), "MSrcPosCam");
     238        if (!src)
     239        {
     240            *fLog << warn << AddSerialNumber(fNameSrcPosCam) << " [MSrcPosCam] not found... creating default container." << endl;
     241            src = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam", AddSerialNumber(fNameSrcPosCam));
     242        }
     243        if (!src)
     244            return kFALSE;
     245
     246        fHillasSrc = (MHillasSrc*)pList->FindCreateObj("MHillasSrc", AddSerialNumber(fNameHillasSrc));
     247        if (!fHillasSrc)
     248            return kFALSE;
     249
     250        fHillasSrc->SetSrcPos(src);
     251    }
     252
     253    // if enabled
    135254    if (TestFlag(kCalcNewImagePar))
    136255    {
    137         fNewImgPar = (MNewImagePar*)pList->FindCreateObj("MNewImagePar", AddSerialNumber(fNameNewImgPar));
     256        fNewImgPar = (MNewImagePar*)pList->FindCreateObj("MNewImagePar", AddSerialNumber(fNameNewImagePar));
    138257        if (!fNewImgPar)
    139258            return kFALSE;
    140259    }
    141260
    142      // if enabled
     261    // if enabled
     262    if (TestFlag(kCalcImagePar))
     263    {
     264        fImagePar = (MImagePar*)pList->FindCreateObj("MImagePar", AddSerialNumber(fNameImagePar));
     265        if (!fImagePar)
     266            return kFALSE;
     267    }
     268
     269    // if enabled
    143270    if (TestFlag(kCalcConc))
    144271    {
     
    150277    memset(fErrors.GetArray(), 0, sizeof(Char_t)*fErrors.GetSize());
    151278
     279    Print();
     280
    152281    return kTRUE;
    153282}
     
    164293    if (TestFlag(kCalcHillas))
    165294    {
    166         Int_t rc = fHillas->Calc(*fGeomCam, *fCerPhotEvt);
     295        Int_t rc = fHillas->Calc(*fGeomCam, *fCerPhotEvt, fIdxIsland);
    167296        if (rc<0 || rc>4)
    168297        {
     
    175304    }
    176305
     306    if (TestBit(kCalcHillasSrc))
     307    {
     308        if (!fHillasSrc->Calc(*fHillas))
     309        {
     310            fErrors[5]++;
     311            return kCONTINUE;
     312        }
     313    }
     314
    177315    if (TestFlag(kCalcHillasExt))
    178         fHillasExt->Calc(*fGeomCam, *fCerPhotEvt, *fHillas);
     316        fHillasExt->Calc(*fGeomCam, *fCerPhotEvt, *fHillas, fIdxIsland);
     317
     318    if (TestFlag(kCalcImagePar))
     319        fImagePar->Calc(*fCerPhotEvt);
    179320
    180321    if (TestFlag(kCalcNewImagePar))
    181         fNewImgPar->Calc(*fGeomCam, *fCerPhotEvt, *fHillas);
     322        fNewImgPar->Calc(*fGeomCam, *fCerPhotEvt, *fHillas, fIdxIsland);
    182323
    183324    if (TestFlag(kCalcConc))
     
    209350        return kTRUE;
    210351
     352    if (!TestBit(kCalcHillas) && !TestBit(kCalcHillasSrc))
     353        return kTRUE;
     354
    211355    *fLog << inf << endl;
    212356    *fLog << GetDescriptor() << " execution statistics:" << endl;
    213357    *fLog << dec << setfill(' ');
    214     PrintSkipped(1, "Less than 3 pixels (before cleaning)");
    215     PrintSkipped(2, "Calculated Size == 0 (after cleaning)");
    216     PrintSkipped(3, "Number of used pixels < 3");
    217     PrintSkipped(4, "CorrXY==0");
     358    if (TestBit(kCalcHillas))
     359    {
     360        PrintSkipped(1, "Less than 3 pixels (before cleaning)");
     361        PrintSkipped(2, "Calculated Size == 0 (after cleaning)");
     362        PrintSkipped(3, "Number of used pixels < 3");
     363        PrintSkipped(4, "CorrXY==0");
     364    }
     365    if (TestBit(kCalcHillasSrc))
     366        PrintSkipped(5, "Dist==0");
    218367    *fLog << " " << (int)fErrors[0] << " (" << (int)(100.*fErrors[0]/GetNumExecutions()) << "%) Evts survived Hillas calculation!" << endl;
    219368    *fLog << endl;
     
    221370    return kTRUE;
    222371}
     372
     373// --------------------------------------------------------------------------
     374//
     375// Print 'Dataflow'
     376//
     377void MHillasCalc::Print(Option_t *o) const
     378{
     379    *fLog << inf << GetDescriptor() << ":" << endl;
     380    if (TestFlag(kCalcHillas))
     381        *fLog << " - Calculating " << fNameHillas << " from MGeomCam, MCerPhotEvt and fIdxIsland=" << fIdxIsland << endl;
     382    if (TestFlag(kCalcHillasSrc))
     383        *fLog << " - Calculating " << fNameHillasSrc << " from " << fNameSrcPosCam << ", " << fNameHillas << " and fIdxIsland=" << fIdxIsland << endl;
     384    if (TestFlag(kCalcHillasExt))
     385        *fLog << " - Calculating " << fNameHillasExt << " from MGeomCam, MCerPhotEvt, " << fNameHillas << " and fIdxIsland=" << fIdxIsland << endl;
     386    if (TestFlag(kCalcImagePar))
     387        *fLog << " - Calculating " << fNameImagePar << " from MCerPhotEvt" << endl;
     388    if (TestFlag(kCalcNewImagePar))
     389        *fLog << " - Calculating " << fNameNewImagePar << " from MGeomCam, MCerPhotEvt, " << fNameHillas << " and fIdxIsland=" << fIdxIsland << endl;
     390    if (TestFlag(kCalcConc))
     391        *fLog << " - Calculating " << fNameConc << " from MGeomCam, MCerPhotEvt and " << fNameHillas << endl;
     392}
     393
     394// --------------------------------------------------------------------------
     395//
     396// Implementation of SavePrimitive. Used to write the call to a constructor
     397// to a macro. In the original root implementation it is used to write
     398// gui elements to a macro-file.
     399//
     400void MHillasCalc::StreamPrimitive(ofstream &out) const
     401{
     402    out << "   MHillasCalc " << GetUniqueName() << "(";
     403    if (fName!=gsDefName || fTitle!=gsDefTitle)
     404    {
     405        out << ", \"" << fName << "\"";
     406        if (fTitle!=gsDefTitle)
     407            out << ", \"" << fTitle << "\"";
     408    }
     409    out << ");" << endl;
     410
     411    if (TestFlags(kCalcHillasExt|kCalcNewImagePar|kCalcConc|kCalcHillasSrc))
     412    {
     413        if (fNameHillas!=gsNameHillas)
     414            out << "   " << GetUniqueName() << ".SetNameHillas(\"" << fNameHillas << "\");" << endl;
     415    }
     416    if (TestFlag(kCalcHillasSrc) && fNameHillasSrc!=gsNameHillasSrc)
     417    {
     418        out << "   " << GetUniqueName() << ".SetNameHillasSrc(\"" << fNameHillasSrc << "\");" << endl;
     419        out << "   " << GetUniqueName() << ".SetNameSrcPosCam(\"" << fNameSrcPosCam << "\");" << endl;
     420    }
     421    if (TestFlag(kCalcHillasExt) && fNameHillasExt!=gsNameHillasExt)
     422        out << "   " << GetUniqueName() << ".SetNameHillasExt(\"" << fNameHillasExt << "\");" << endl;
     423    if (TestFlag(kCalcConc) && fNameConc!=gsNameConc)
     424        out << "   " << GetUniqueName() << ".SetNameConc(\"" << fNameConc << "\");" << endl;
     425    if (TestFlag(kCalcImagePar) && fNameImagePar!=gsNameImagePar)
     426        out << "   " << GetUniqueName() << ".SetNameImagePar(\"" << fNameImagePar << "\");" << endl;
     427    if (TestFlag(kCalcNewImagePar) && fNameNewImagePar!=gsNameNewImagePar)
     428        out << "   " << GetUniqueName() << ".SetNameNewImagePar(\"" << fNameNewImagePar << "\");" << endl;
     429
     430    if (!TestFlag(kCalcHillas))
     431        out << "   " << GetUniqueName() << ".Disable(MHilllasCalc::kCalcHillas);" << endl;
     432    if (!TestFlag(kCalcHillasExt))
     433        out << "   " << GetUniqueName() << ".Disable(MHilllasCalc::kCalcHillasExt);" << endl;
     434    if (!TestFlag(kCalcHillasSrc))
     435        out << "   " << GetUniqueName() << ".Disable(MHilllasCalc::kCalcHillasSrc);" << endl;
     436    if (!TestFlag(kCalcNewImagePar))
     437        out << "   " << GetUniqueName() << ".Disable(MHilllasCalc::kCalcNewImagePar);" << endl;
     438    if (!TestFlag(kCalcConc))
     439        out << "   " << GetUniqueName() << ".Disable(MHilllasCalc::kCalcConc);" << endl;
     440    if (!TestFlag(kCalcImagePar))
     441        out << "   " << GetUniqueName() << ".Disable(MHilllasCalc::kCalcImagePar);" << endl;
     442
     443    if (fIdxIsland>=0)
     444        out << "   " << GetUniqueName() << ".SetNumIsland(" << fIdxIsland << ");" << endl;
     445}
     446
  • trunk/MagicSoft/Mars/mimage/MHillasCalc.h

    r4578 r4710  
    2121class MHillas;
    2222class MHillasExt;
     23class MHillasSrc;
     24class MImagePar;
    2325class MNewImagePar;
    2426class MConcentration;
     27class MSrcPosCam;
    2528
    2629class MHillasCalc : public MTask
    2730{
    28     const MGeomCam    *fGeomCam;    //! Camera Geometry used to calculate Hillas
    29     const MCerPhotEvt *fCerPhotEvt; //! Cerenkov Photon Event used for calculation
     31    static const TString gsDefName;         // default name
     32    static const TString gsDefTitle;        // default title
    3033
    31     MHillas           *fHillas;     //! output container to store result
    32     MHillasExt        *fHillasExt;  //! output container to store result
    33     MNewImagePar      *fNewImgPar;  //! output container to store result
    34     MConcentration    *fConc;       //! output container to store result
     34    static const TString gsNameHillas;      // default name of the 'MHillas' container
     35    static const TString gsNameHillasExt;   // default name of the 'MHillasExt' container
     36    static const TString gsNameNewImagePar; // default name of the 'MNewImagePar' container
     37    static const TString gsNameConc;        // default name of the 'MConcentration' container
     38    static const TString gsNameImagePar;    // default name of the 'MImagePar' container
     39    static const TString gsNameHillasSrc;   // default name of the 'MHillasSrc' container
     40    static const TString gsNameSrcPosCam;   // default name of the 'MSrcPosCam' container
    3541
    36     TString            fNameHillas;    // name of the 'MHillas' container
    37     TString            fNameHillasExt; // name of the 'MHillasExt' container
    38     TString            fNameNewImgPar; // name of the 'MNewImagePar' container
    39     TString            fNameConc;      // name of the 'MConcentration' container
     42    const MGeomCam      *fGeomCam;          //! Camera Geometry used to calculate Hillas
     43    const MCerPhotEvt   *fCerPhotEvt;       //! Cerenkov Photon Event used for calculation
    4044
    41     Int_t              fFlags;      // Flags defining the behaviour of MHillasCalc
     45    MHillas             *fHillas;           //! output container to store result
     46    MHillasExt          *fHillasExt;        //! output container to store result
     47    MHillasSrc          *fHillasSrc;        //! output container to store result
     48    MImagePar           *fImagePar;         //! output container to store result
     49    MNewImagePar        *fNewImgPar;        //! output container to store result
     50    MConcentration      *fConc;             //! output container to store result
    4251
    43     TArrayL            fErrors;     //! Error counter. Do we have to change to Double?
     52    TString              fNameHillas;       // name of the 'MHillas' container
     53    TString              fNameHillasExt;    // name of the 'MHillasExt' container
     54    TString              fNameHillasSrc;    // name of the 'MHillasSrc' container
     55    TString              fNameSrcPosCam;    // name of the 'MSrcPosCam' container
     56    TString              fNameConc;         // name of the 'MConcentration' container
     57    TString              fNameImagePar;     // name of the 'MImagePar' container
     58    TString              fNameNewImagePar;  // name of the 'MNewImagePar' container
    4459
     60    TArrayL              fErrors;           //! Error counter. Do we have to change to Double?
     61
     62    Int_t                fFlags;            // Flags defining the behaviour of MHillasCalc
     63    Short_t              fIdxIsland;        // Number of island to use for calculation
     64
     65    // Helper
    4566    void  PrintSkipped(int i, const char *str) const;
    4667
     68    // MParContainer
     69    void StreamPrimitive(ofstream &out) const;
     70
     71    // MTask
    4772    Int_t PreProcess(MParList *pList);
    4873    Int_t Process();
     
    5075
    5176public:
     77    // Constructor
     78    MHillasCalc(const char *name=NULL, const char *title=NULL);
     79
     80    // Flags
    5281    enum CalcCont_t {
    5382        kCalcHillas      = BIT(0),
    5483        kCalcHillasExt   = BIT(1),
    55         //kCalcHillasSrc   = BIT(2),
     84        kCalcHillasSrc   = BIT(2),
    5685        kCalcNewImagePar = BIT(3),
    57         kCalcConc        = BIT(4)
     86        kCalcConc        = BIT(4),
     87        kCalcImagePar    = BIT(5)
    5888    };
    5989
    60     MHillasCalc(const char *name=NULL, const char *title=NULL);
     90    // Setup flags
     91    void SetFlags(Int_t f) { fFlags  =  f; }
     92    void Enable(Int_t f)   { fFlags |=  f; }
     93    void Disable(Int_t f)  { fFlags &= ~f; }
    6194
    62     void   SetNameHillas(const char *name)    { fNameHillas = name;    }
    63     void   SetNameHillasExt(const char *name) { fNameHillasExt = name; }
    64     void   SetNameNewImgPar(const char *name) { fNameNewImgPar = name; }
    65     void   SetNameConc(const char *name)      { fNameConc = name;      }
     95    Bool_t TestFlag(CalcCont_t i) const { return fFlags&i; }
     96    Bool_t TestFlags(Int_t i) const     { return fFlags&i; }
    6697
    67     void   SetFlags(Int_t f) { fFlags  =  f; }
    68     void   Enable(Int_t f)   { fFlags |=  f; }
    69     void   Disable(Int_t f)  { fFlags &= ~f; }
    70     Bool_t TestFlag(CalcCont_t i) const { return fFlags&i; }
     98    // Setup container names
     99    void SetNameHillas(const char *name)      { fNameHillas      = name; }
     100    void SetNameHillasExt(const char *name)   { fNameHillasExt   = name; }
     101    void SetNameHillasSrc(const char *name)   { fNameHillasSrc   = name; }
     102    void SetNameNewImagePar(const char *name) { fNameNewImagePar = name; }
     103    void SetNameConc(const char *name)        { fNameConc        = name; }
     104    void SetNameImagePar(const char *name)    { fNameImagePar    = name; }
     105    void SetNameSrcPosCam(const char *name)   { fNameSrcPosCam   = name; }
     106
     107    // Setup island number
     108    void SetIdxIsland(Short_t idx) { fIdxIsland = idx; }
     109
     110    // TObject
     111    void Print(Option_t *o="") const;
    71112
    72113    ClassDef(MHillasCalc, 0) // Task to calculate Hillas and other image parameters
  • trunk/MagicSoft/Mars/mimage/MHillasExt.cc

    r3682 r4710  
    138138// and the cerenkov photon event
    139139//
    140 Int_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt, const MHillas &hil)
     140Int_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt, const MHillas &hil, Int_t island)
    141141{
    142142    //
     
    151151    Double_t m3x = 0;
    152152    Double_t m3y = 0;
    153 
    154     const UInt_t npixevt = evt.GetNumPixels();
    155153
    156154    Int_t maxpixid  = 0;
     
    158156    Float_t maxdist = 0;
    159157
    160     for (UInt_t i=0; i<npixevt; i++)
     158    MCerPhotPix *pix = 0;
     159
     160    TIter Next(evt);
     161    while ((pix=(MCerPhotPix*)Next()))
    161162    {
    162         const MCerPhotPix &pix = evt[i];
    163         if (!pix.IsPixelUsed())
     163        if (island>=0 && pix->GetIdxIsland()!=island)
    164164            continue;
    165165
    166         const Int_t pixid = pix.GetPixId();
     166        const Int_t pixid = pix->GetPixId();
    167167
    168168        const MGeomPix &gpix = geom[pixid];
     
    170170        const Double_t dy = gpix.GetY() - hil.GetMeanY();      // [mm]
    171171
    172         Double_t nphot = pix.GetNumPhotons();                  // [1]
     172        Double_t nphot = pix->GetNumPhotons();                  // [1]
    173173
    174174        const Double_t dzx =  hil.GetCosDelta()*dx + hil.GetSinDelta()*dy; // [mm]
  • trunk/MagicSoft/Mars/mimage/MHillasExt.h

    r3666 r4710  
    3333    Float_t GetMaxDist() const { return fMaxDist; }
    3434
    35     Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix, const MHillas &hil);
     35    Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix,
     36               const MHillas &hil, Int_t island=-1);
    3637
    3738    void Print(Option_t *opt=NULL) const;
  • trunk/MagicSoft/Mars/mimage/MHillasSrc.cc

    r2624 r4710  
    9999//  you call the Reset member function before.
    100100//
    101 Bool_t MHillasSrc::Calc(const MHillas *hillas)
     101Bool_t MHillasSrc::Calc(const MHillas &hillas)
    102102{
    103     const Double_t mx = hillas->GetMeanX();     // [mm]
    104     const Double_t my = hillas->GetMeanY();     // [mm]
     103    const Double_t mx = hillas.GetMeanX();     // [mm]
     104    const Double_t my = hillas.GetMeanY();     // [mm]
    105105
    106106    const Double_t sx = mx - fSrcPos->GetX();   // [mm]
    107107    const Double_t sy = my - fSrcPos->GetY();   // [mm]
    108108
    109     const Double_t sd = hillas->GetSinDelta();  // [1]
    110     const Double_t cd = hillas->GetCosDelta();  // [1]
     109    const Double_t sd = hillas.GetSinDelta();  // [1]
     110    const Double_t cd = hillas.GetCosDelta();  // [1]
    111111
    112112    //
  • trunk/MagicSoft/Mars/mimage/MHillasSrc.h

    r2624 r4710  
    3232    void Print(const MGeomCam &geom) const;
    3333
    34     virtual Bool_t Calc(const MHillas *hillas);
     34    virtual Bool_t Calc(const MHillas &hillas);
    3535
    3636    void Set(const TArrayF &arr);
  • trunk/MagicSoft/Mars/mimage/MHillasSrcCalc.cc

    r3666 r4710  
    114114Int_t MHillasSrcCalc::Process()
    115115{
    116     if (!fHillasSrc->Calc(fHillas))
     116    if (!fHillasSrc->Calc(*fHillas))
    117117    {
    118118        fErrors++;
     
    150150void MHillasSrcCalc::StreamPrimitive(ofstream &out) const
    151151{
    152     if (fHillas)
    153         fHillas->SavePrimitive(out);
     152    if (fHillas && !fHillas->IsSavedAsPrimitive())
     153        fHillas->StreamPrimitive(out);
    154154
    155     if (fSrcPos)
    156         fSrcPos->SavePrimitive(out);
     155    if (fSrcPos && !fSrcPos->IsSavedAsPrimitive())
     156        fSrcPos->StreamPrimitive(out);
    157157
    158     if (fHillasSrc)
    159         fHillasSrc->SavePrimitive(out);
     158    if (fHillasSrc && !fHillasSrc->IsSavedAsPrimitive())
     159        fHillasSrc->StreamPrimitive(out);
    160160
    161161    out << "   MHillasSrcCalc " << GetUniqueName() << "(";
  • trunk/MagicSoft/Mars/mimage/MHillasSrcCalc.h

    r2209 r4710  
    1313{
    1414private:
    15     MHillas    *fHillas;     //! Pointer to the source independant hillas parameters
    16     MSrcPosCam *fSrcPos;     //! Pointer to the source position
    17     MHillasSrc *fHillasSrc;  //! Pointer to the output container for the source dependant parameters
     15    const MHillas    *fHillas;     //! Pointer to the source independant hillas parameters
     16    const MSrcPosCam *fSrcPos;     //! Pointer to the source position
     17          MHillasSrc *fHillasSrc;  //! Pointer to the output container for the source dependant parameters
    1818
    1919    TString     fSrcName;
  • trunk/MagicSoft/Mars/mimage/MNewImagePar.cc

    r4188 r4710  
    5959//  - added fCoreArea
    6060//
     61// Version 4:
     62// ----------
     63//  - moved cleaning/island independant parameters to MImagePar:
     64//    + removed fNumHGSaturatedPixels
     65//    + removed fNumSaturatedPixels
     66//
    6167//
    6268/////////////////////////////////////////////////////////////////////////////
     
    8894    fName  = name  ? name  : "MNewImagePar";
    8995    fTitle = title ? title : "New image parameters";
     96
     97    Reset();
    9098}
    9199
     
    109117    fUsedArea = -1;
    110118    fCoreArea = -1;
    111 
    112     fNumSaturatedPixels = -1;
    113     fNumHGSaturatedPixels = -1;
    114119}
    115120
     
    119124//
    120125void MNewImagePar::Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
    121                         const MHillas &hillas)
     126                        const MHillas &hillas, Int_t island)
    122127{
    123128    fNumUsedPixels = 0;
     
    127132    fCoreArea = 0;
    128133
    129     fNumSaturatedPixels = 0;
    130     fNumHGSaturatedPixels = 0;
    131 
    132134    fInnerSize = 0;
    133 
    134     const UInt_t npixevt = evt.GetNumPixels();
    135135
    136136    Double_t edgepix1 = 0;
     
    143143    Float_t maxpix2 = 0;                                 // [#phot]
    144144
    145     for (UInt_t i=0; i<npixevt; i++)
     145    MCerPhotPix *pix = 0;
     146
     147    TIter Next(evt);
     148    while ((pix=(MCerPhotPix*)Next()))
    146149    {
    147         const MCerPhotPix &pix = evt[i];
    148 
    149         // count saturated pixels
    150         if (pix.IsPixelHGSaturated())
    151             fNumHGSaturatedPixels++;
    152         if (pix.IsPixelSaturated())
    153             fNumSaturatedPixels++;
    154 
    155         // skip unused pixels
    156         if (!pix.IsPixelUsed())
     150        // Check for requested islands
     151        if (island>=0 && pix->GetIdxIsland()!=island)
    157152            continue;
    158153
    159154        // Get geometry of pixel
    160         const Int_t pixid = pix.GetPixId();
     155        const Int_t pixid = pix->GetPixId();
    161156        const MGeomPix &gpix = geom[pixid];
    162157
    163158        // count used and core pixels
    164         if (pix.IsPixelCore())
     159        if (pix->IsPixelCore())
    165160        {
    166161            fNumCorePixels++;
     
    172167        fUsedArea += gpix.GetA();
    173168
    174         Double_t nphot = pix.GetNumPhotons();
     169        Double_t nphot = pix->GetNumPhotons();
    175170
    176171        //
     
    239234    *fLog << " - Used Area     [mm^2] = " << fUsedArea             << endl;
    240235    *fLog << " - Core Area     [mm^2] = " << fCoreArea             << endl;
    241     *fLog << " - Sat.Pixels/HG  [#]   = " << fNumHGSaturatedPixels << " Pixels" << endl;
    242     *fLog << " - Sat.Pixels/LG  [#]   = " << fNumSaturatedPixels   << " Pixels" << endl;
    243236}
    244237
     
    263256    *fLog << " - Used Area    [deg^2] = " << fUsedArea*geom.GetConvMm2Deg()*geom.GetConvMm2Deg() << endl;
    264257    *fLog << " - Core Area    [deg^2] = " << fCoreArea*geom.GetConvMm2Deg()*geom.GetConvMm2Deg() << endl;
    265     *fLog << " - Sat.Pixels/HG  [#]   = " << fNumHGSaturatedPixels << " Pixels" << endl;
    266     *fLog << " - Sat.Pixels/LG  [#]   = " << fNumSaturatedPixels   << " Pixels" << endl;
    267 }
     258}
  • trunk/MagicSoft/Mars/mimage/MNewImagePar.h

    r4143 r4710  
    1313{
    1414private:
     15    // FIXME: MOVE ALL PARAMETRS WHICH DOES'T DEPEND ON THE IMAGE
     16    //        CLEANING TO A NEW CLASS!
    1517    Float_t fLeakage1;             // (photons in most outer ring of pixels) over fSize
    1618    Float_t fLeakage2;             // (photons in the 2 outer rings of pixels) over fSize
     
    2628    Short_t fNumUsedPixels;        // Number of pixels which survived the image cleaning
    2729    Short_t fNumCorePixels;        // number of core pixels
    28     Short_t fNumHGSaturatedPixels; // number of pixels with saturating hi-gains
    29     Short_t fNumSaturatedPixels;   // number of pixels with saturating lo-gains
    3030
    3131public:
     
    5050    Float_t GetCoreArea() const { return fCoreArea; }
    5151
    52     Short_t GetNumSaturatedPixels() const { return fNumSaturatedPixels; }
    53     Short_t GetNumHGSaturatedPixels() const { return fNumHGSaturatedPixels; }
    54 
    5552    void Print(Option_t *opt=NULL) const;
    5653    void Print(const MGeomCam &geom) const;
    5754
    5855    void Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
    59               const MHillas &hillas);
     56              const MHillas &hillas, Int_t island=-1);
    6057
    61     ClassDef(MNewImagePar, 3) // Container to hold new image parameters
     58    ClassDef(MNewImagePar, 4) // Container to hold new image parameters
    6259};
    6360
  • trunk/MagicSoft/Mars/mimage/Makefile

    r4702 r4710  
    3434           MHillasCalc.cc \
    3535           MHillasSrcCalc.cc \
     36           MImagePar.cc \
    3637           MNewImagePar.cc \
    3738           MConcentration.cc \
     
    3940           MHHillasSrc.cc \
    4041           MHHillasExt.cc \
     42           MHImagePar.cc \
    4143           MHNewImagePar.cc \
    4244           MStereoPar.cc \
  • trunk/MagicSoft/Mars/mpointing/MSrcPosCam.h

    r3568 r4710  
    1313    Float_t fX; // [mm] x position of source in camera
    1414    Float_t fY; // [mm] y position of source in camera
    15 
    16     void StreamPrimitive(ofstream &out) const;
    1715
    1816public:
     
    3129
    3230    void Print(Option_t *opt=NULL) const;
     31    void StreamPrimitive(ofstream &out) const;
    3332
    3433    //void AsciiRead(ifstream &fin);
Note: See TracChangeset for help on using the changeset viewer.