Changeset 2377


Ignore:
Timestamp:
10/04/03 12:47:13 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
42 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/macros/MagicHillas.C

    r2359 r2377  
    4141
    4242    //
    43     // The geometry container must be created by yourself to make sure
    44     // that you don't choos a wrong geometry by chance
    45     //
    46     MGeomCamMagic geomcam;
    47     plist.AddToList(&geomcam);
    48 
    49     //
    5043    // Use this if you want to change the binning of one of
    5144    // the histograms. You can use:
     
    8679    MReadMarsFile read("Events", filename);
    8780    read.DisableAutoScheme();
     81
     82    MGeomApply geomapl;
    8883
    8984    MMcPedestalCopy pcopy;
     
    127122
    128123    tlist.AddToList(&read);
     124    tlist.AddToList(&geomapl);
    129125    tlist.AddToList(&pcopy);
    130126    tlist.AddToList(&pnsb);
  • trunk/MagicSoft/Mars/macros/pedestalvstime.C

    r2252 r2377  
    3939    //
    4040
    41     MGeomCamMagic geom;
    42     plist.AddToList(&geom);
    43 
    4441    // First Task: Read file with image parameters
    4542    // (created with the star.C macro)
     
    4845    read.DisableAutoScheme();
    4946
     47    MGeomApply geomapl;
     48
    5049    MCerPhotAnal2 ncalc;
    5150
    5251    tlist.AddToList(&read);
     52    tlist.AddToList(&geomapl);
    5353    tlist.AddToList(&ncalc);
    5454
  • trunk/MagicSoft/Mars/macros/pixfirerate.C

    r2251 r2377  
    6161    plist.AddToList(&tlist);
    6262
    63     // The geometry container must be created by yourself to make sure
    64     // that you don't choose a wrong geometry by mistake
    65     //
    66     MGeomCamMagic geomcam;
    67     plist.AddToList(&geomcam);
    68 
    6963    //
    7064    // Now setup the tasks and tasklist:
     
    7569    read.AddFile(filename);
    7670    tlist.AddToList(&read);
     71
     72    MGeomApply geomapl;
     73    tlist.AddToList(&geomapl);
    7774
    7875    Double_t threshold[] = { 10, 20, 100, 200, -1 };
  • trunk/MagicSoft/Mars/macros/pixsatrate.C

    r2265 r2377  
    6161    plist.AddToList(&tlist);
    6262
    63     // The geometry container must be created by yourself to make sure
    64     // that you don't choose a wrong geometry by mistake
    65     //
    66     MGeomCamMagic geomcam;
    67     plist.AddToList(&geomcam);
    68 
    6963    //
    7064    // Now setup the tasks and tasklist:
     
    7569    read.AddFile(filename);
    7670    tlist.AddToList(&read);
     71
     72    MGeomApply geomapl;
     73    tlist.AddToList(&geomapl);
    7774
    7875    MHTriggerLvl0 trighi(254, "SaturationHi", "Saturation Rate of Hi Gains");
  • trunk/MagicSoft/Mars/macros/plot.C

    r1966 r2377  
    2323!
    2424\* ======================================================================== */
    25 #include <MH.h>
     25
    2626// -------------------------------------------------------------------------
    2727//
  • trunk/MagicSoft/Mars/macros/readCT1.C

    r2220 r2377  
    6262
    6363    MCT1ReadAscii read(fname);
     64    MGeomApply    geomapl;
    6465    MClone        clone("MCerPhotEvt");
    6566    MImgCleanStd  clean;
  • trunk/MagicSoft/Mars/macros/readMagic.C

    r2221 r2377  
    5050    MParList plist;
    5151
    52     MGeomCamMagic geomcam;
    5352    MHillas       hillas;
    5453    MHillasExt    hillasext;
     
    5655    MTaskList     tlist;
    5756
    58     plist.AddToList(&geomcam);
    5957    plist.AddToList(&hillas);
    6058    plist.AddToList(&hillasext);
     
    6563    read.DisableAutoScheme();
    6664
     65    MGeomApply geomapl;
    6766    MPrint print1("MMcEvt");
    6867    MPrint print2("MRawEvtHeader");
     
    8079
    8180    tlist.AddToList(&read);
     81    tlist.AddToList(&geomapl);
    8282    tlist.AddToList(&print1);
    8383    tlist.AddToList(&print2);
  • trunk/MagicSoft/Mars/macros/starplot.C

    r1633 r2377  
    4242
    4343    //
    44     // The geometry container must be created by yourself to make sure
    45     // that you don't choos a wrong geometry by chance
    46     //
    47     MGeomCamMagic geomcam;
    48     plist.AddToList(&geomcam);
    49 
    50     //
    5144    // Use this if you want to change the binning of one of
    5245    // the histograms. You can use:
     
    7972    read.DisableAutoScheme();
    8073
     74    MGeomApply geomapl;
     75
    8176    MFillH hfill1("MHHillas", "MHillas");
    8277    MFillH hfill2("MHHillasExt");
     
    8681
    8782    tlist.AddToList(&read);
     83    tlist.AddToList(&geomapl);
    8884    tlist.AddToList(&hfill1);
    8985    tlist.AddToList(&hfill2);
  • trunk/MagicSoft/Mars/macros/status.C

    r2274 r2377  
    5757    plist.AddToList(&tlist);
    5858
    59     //
    60     // The geometry container must be created by yourself to make sure
    61     // that you don't choose a wrong geometry by mistake
    62     //
    63     MGeomCamMagic geomcam;
    64     plist.AddToList(&geomcam);
    65 
    6659    /*
    6760     MSrcPosCam src;
     
    7972    // ------------- user change -----------------
    8073    read.AddFile(fname);
     74
     75    MGeomApply        geomapl;
    8176
    8277    MMcPedestalCopy   pcopy;
     
    117112
    118113    tlist.AddToList(&read);
     114    tlist.AddToList(&geomapl);
    119115    tlist.AddToList(&pcopy);
    120116    tlist.AddToList(&pnsb);
  • trunk/MagicSoft/Mars/macros/sumevents.C

    r2274 r2377  
    3939    //
    4040
    41     MGeomCamMagic geom;
    42     plist.AddToList(&geom);
    43 
    4441    // First Task: Read file with image parameters
    4542    // (created with the star.C macro)
     
    4845    read.DisableAutoScheme();
    4946
     47    MGeomApply geomapl;
    5048    MCerPhotAnal2 ncalc;
    5149
    5250    tlist.AddToList(&read);
     51    tlist.AddToList(&geomapl);
    5352    tlist.AddToList(&ncalc);
    5453
  • trunk/MagicSoft/Mars/macros/sumeventserr.C

    r2274 r2377  
    3939    //
    4040
    41     MGeomCamMagic geom;
    42     plist.AddToList(&geom);
    43 
    4441    // First Task: Read file with image parameters
    4542    // (created with the star.C macro)
     
    5148    //MCerPhotCalc  ncalc;
    5249    //MCerPhotAnal  ncalc;
     50    MGeomApply geomapl;
    5351    MCerPhotAnal2 ncalc;
    5452
    5553    tlist.AddToList(&read);
     54    tlist.AddToList(&geomapl);
    5655    tlist.AddToList(&ncalc);
    5756
  • trunk/MagicSoft/Mars/macros/sumeventsrms.C

    r2274 r2377  
    3939    //
    4040
    41     MGeomCamMagic geom;
    42     plist.AddToList(&geom);
    43 
    4441    // First Task: Read file with image parameters
    4542    // (created with the star.C macro)
     
    4845    read.DisableAutoScheme();
    4946
     47    MGeomApply geomapl;
    5048    MPedestalSum  ncalc;
    5149    //MCerPhotCalc  ncalc;
     
    5452
    5553    tlist.AddToList(&read);
     54    tlist.AddToList(&geomapl);
    5655    tlist.AddToList(&ncalc);
    5756
  • trunk/MagicSoft/Mars/macros/sumpedestalrms.C

    r2274 r2377  
    3939    //
    4040
    41     MGeomCamMagic geom;
    42     plist.AddToList(&geom);
    43 
    4441    // First Task: Read file with image parameters
    4542    // (created with the star.C macro)
     
    4845    read.DisableAutoScheme();
    4946
     47    MGeomApply geomapl;
    5048    MCerPhotAnal2 ncalc;
    5149
    5250    tlist.AddToList(&read);
     51    tlist.AddToList(&geomapl);
    5352    tlist.AddToList(&ncalc);
    5453
  • trunk/MagicSoft/Mars/macros/sumpedestals.C

    r2274 r2377  
    3939    //
    4040
    41     MGeomCamMagic geom;
    42     plist.AddToList(&geom);
    43 
    4441    // First Task: Read file with image parameters
    4542    // (created with the star.C macro)
     
    4845    read.DisableAutoScheme();
    4946
     47    MGeomApply geomapl;
    5048    MCerPhotAnal2 ncalc;
    5149
    5250    tlist.AddToList(&read);
     51    tlist.AddToList(&geomapl);
    5352    tlist.AddToList(&ncalc);
    5453
  • trunk/MagicSoft/Mars/macros/threshold.C

    r1666 r2377  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 (tbretz@uni-sw.gwdg.de)
     18!   Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2001
     20!   Copyright: MAGIC Software Development, 2000-2003
    2121!
    2222!
  • trunk/MagicSoft/Mars/macros/trigrate.C

    r1800 r2377  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 (tbretz@uni-sw.gwdg.de)
     18!   Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    2020!   Copyright: MAGIC Software Development, 2000-2001
    2121!
    22 !   Modified 4/7/2002, Abelardo Moralejo:
    23 !   Added one optional input parameter: a camera .root file containing
    24 !   pure NSB events. One such file is generated running the camera over an
    25 !   "empty" reflector file, with the NSB option on, and asking the camera
    26 !   program (see camera program manual) to do the simulation even if no
    27 !   photoelectron from the shower arrives at the camera. One also needs to
    28 !   write to the output file all the events, both triggered and untriggered
    29 !   (see again camera manual). These nsb camera files must contain the same
    30 !   trigger conditions as the proton file.
    31 !
    32 !   If no nsb file is supplied, the macro will assume no triggers from
    33 !   pure NSB fluctuations.
    34 !
    3522\* ======================================================================== */
    3623
    37 
     24/*
     25 !   Modified 4/7/2002, Abelardo Moralejo:
     26 !   Added one optional input parameter: a camera .root file containing
     27 !   pure NSB events. One such file is generated running the camera over an
     28 !   "empty" reflector file, with the NSB option on, and asking the camera
     29 !   program (see camera program manual) to do the simulation even if no
     30 !   photoelectron from the shower arrives at the camera. One also needs to
     31 !   write to the output file all the events, both triggered and untriggered
     32 !   (see again camera manual). These nsb camera files must contain the same
     33 !   trigger conditions as the proton file.
     34 !
     35 !   If no nsb file is supplied, the macro will assume no triggers from
     36 !   pure NSB fluctuations.
     37 */
    3838
    3939Float_t GetNSBEvents(TString name, Float_t *BgR, int dim)
     
    138138    if (dim < 0)
    139139      ((MHMcRate*)(hists[0]))->SetTriggerCondNum((Short_t)(-dim));
    140     else if (dim > 0)
     140    if (dim > 0)
    141141      for (Short_t i = from ; i <= to; i++)
    142142        ((MHMcRate*)(hists[i-1]))->SetTriggerCondNum(i);
  • trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h

    r2300 r2377  
    1919#pragma link C++ class MMcPedestalCopy+;
    2020#pragma link C++ class MMcPedestalNSBAdd+;
     21#pragma link C++ class MGeomApply+;
    2122
    2223#pragma link C++ class MHadronness+;
  • trunk/MagicSoft/Mars/manalysis/MBlindPixelCalc.cc

    r2298 r2377  
    303303    fPixels->Clear();
    304304
     305    if (!fGeomCam->InheritsFrom("MGeomCamMagic"))
     306    {
     307        *fLog << warn << "MBlindPixelCalc::ReInit: Warning - Starfield only implemented for Magic standard Camera... no action." << endl;
     308        return kTRUE;
     309    }
     310
    305311    //
    306312    // Set as blind some particular pixels because of a particular
  • trunk/MagicSoft/Mars/manalysis/MBlindPixels.h

    r1967 r2377  
    2121    void AdoptPixels(Char_t pixels[577]) { fPixels.Adopt(577, pixels); }
    2222
     23    void AdoptPixels(const TArrayC &pixels) { fPixels = pixels; }
     24
    2325    void Clear(Option_t *o="")  { fPixels.Reset(); }
    2426
    2527    Bool_t IsBlind(UShort_t id) const { return fPixels.GetSize() && ((TArrayC)fPixels)[id]; }
     28
     29    void InitSize(UShort_t i) { fPixels.Set(i); }
    2630
    2731    ClassDef(MBlindPixels, 1) // container to store blind pixels
  • trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc

    r2350 r2377  
    4848#include "MLogManip.h"
    4949
     50#include "MGeomCam.h"
    5051#include "MMcRunHeader.hxx"
    5152
     
    174175void MCerPhotCalc::ScalePedestals()
    175176{
    176     Int_t n = 577; //FIXME: fPedestals->GetNumPixel();
     177    const Int_t n = fPedestals->GetSize();
    177178
    178179    for (int idx=0; idx<n; idx++)
     
    186187        const Double_t offset = fEnableFix ? ped.GetPedestal()-0.5 : ped.GetPedestal();
    187188
    188         ped.Set(offset*fSumWeights,
    189                 ped.GetPedestalRms()*fSumQuadWeights);
     189        ped.Set(offset*fSumWeights, ped.GetPedestalRms()*fSumQuadWeights);
    190190    }
    191191
     
    205205//        ScalePedestals();
    206206
     207    const Int_t n = fWeight.GetSize();
     208
    207209    MRawEvtPixelIter pixel(fRawEvt);
    208210
    209     Int_t SaturatedPixels = 0;
     211    Int_t saturatedpixels = 0;
    210212
    211213    while (pixel.Next())
    212214    {
    213215        const UInt_t idx = pixel.GetPixelId();
    214         MPedestalPix &ped = (*fPedestals)[idx];
    215 
    216216        //
    217217        // sanity check (old MC files sometimes have pixids>577)
     
    219219        if (!fPedestals->CheckBounds(idx))
    220220        {
    221             *fLog << inf << "Pixel Index larger than camera... skipping event." << endl;
     221            *fLog << inf << "Pixel Index out of MPedestalCam bounds... skipping event." << endl;
    222222            return kCONTINUE;
    223         }
     223        }
     224
     225        MPedestalPix &ped = (*fPedestals)[idx];
    224226
    225227        //
     
    230232        Int_t i;
    231233        Double_t nphot = 0;
    232         for (i=0; i<fWeight.GetSize(); i++)
     234        for (i=0; i<n; i++)
    233235        {
    234236            if (ptr[i]==0xff)
     
    237239        }
    238240
    239         Bool_t SaturatedLG = kFALSE;
    240 
    241         if (i<fWeight.GetSize())
     241        Bool_t saturatedlg = kFALSE;
     242
     243        if (i<n)
    242244        {
    243245            nphot = 0;
     
    250252            }
    251253
    252             for (i=0; i<fWeight.GetSize(); i++)
     254            for (i=0; i<n; i++)
    253255            {
    254               if (ptr[i]==0xff)
    255                 SaturatedLG = kTRUE;
    256 
    257               nphot += ptr[i]*fWeight[i];
     256                if (ptr[i]==0xff)
     257                    saturatedlg = kTRUE;
     258
     259                nphot += ptr[i]*fWeight[i];
    258260            }
    259261
     
    266268        fCerPhotEvt->AddPixel(idx, nphot, 0);
    267269
    268         if (SaturatedLG)
    269           SaturatedPixels ++;
    270     }
    271 
    272     switch(SaturatedPixels)
    273       {
    274       case 0:
    275         break;
    276       case 1:
    277         *fLog << warn << "WARNING: 1 pixel had saturating low gains..." << endl;
    278         break;
    279       default:
    280         *fLog << warn << "WARNING: " << SaturatedPixels << " pixels had saturating low gains..." << endl;
    281         break;
    282       }
    283 
     270        if (saturatedlg)
     271          saturatedpixels++;
     272    }
     273
     274    if (saturatedpixels>0)
     275        *fLog << warn << "WARNING: " << saturatedpixels << " pixel(s) had saturating low gains..." << endl;
    284276
    285277    fCerPhotEvt->FixSize();
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc

    r2237 r2377  
    126126        return kFALSE;
    127127
    128     const int num = fMcPed->GetNumPixel();
    129 
    130     fPedCam->InitSize(num);
     128    const int num = fPedCam->GetSize();
    131129
    132130    for (int i=0; i<num; i++)
  • trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc

    r2237 r2377  
    207207        return kFALSE;
    208208
    209     const int num = fFadc->GetNumPixel();
    210    
    211     fPedCam->InitSize(num);
     209    const int num = fPedCam->GetSize();
    212210
    213211    for (int i=0; i<num; i++)
  • trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc

    r2244 r2377  
    5353    fTitle = title ? title : "Storage container for all Pedestal Information in the camera";
    5454
    55     fArray = new TClonesArray("MPedestalPix", 577);
     55    fArray = new TClonesArray("MPedestalPix", 1);
    5656
    57     for (int i=0; i<577; i++)
    58         new ((*fArray)[i]) MPedestalPix;
     57//    for (int i=0; i<577; i++)
     58//        new ((*fArray)[i]) MPedestalPix;
    5959}
    6060
  • trunk/MagicSoft/Mars/manalysis/Makefile

    r2300 r2377  
    3535           MMcPedestalCopy.cc \
    3636           MMcPedestalNSBAdd.cc \
     37           MGeomApply.cc \
    3738           MCurrents.cc \
    3839           MEnergyEst.cc \
  • trunk/MagicSoft/Mars/mbase/MArgs.cc

    r2296 r2377  
    2828// MArgs
    2929//
     30// This is a helper class for executables to parse command line arguments
     31//
    3032//////////////////////////////////////////////////////////////////////////////
    3133#include "MArgs.h"
     
    4648}
    4749
     50// --------------------------------------------------------------------------
     51//
     52// Initializes:
     53//  fName: The name of the executable
     54//  fArgv: A TList containing all other command line arguments
     55//
    4856MArgs::MArgs(int argc, const char **argv) : fArgc(argc)
    4957{
     
    6169}
    6270
     71// --------------------------------------------------------------------------
     72//
     73// Deletes fArgv.
     74//
    6375MArgs::~MArgs()
    6476{
     
    6678}
    6779
     80// --------------------------------------------------------------------------
     81//
     82// Print all arguments parsed.
     83//
    6884void MArgs::Print(const Option_t *o) const
    6985{
     
    7288}
    7389
     90// --------------------------------------------------------------------------
     91//
     92// Return the Integer corresponding to the command line argument 'name'
     93//  eg. executable -argument 5
     94//      GetInt("argument") will return 5
     95//
    7496Int_t MArgs::GetInt(const TString name) const
    7597{
     
    7799}
    78100
     101// --------------------------------------------------------------------------
     102//
     103// Return the floating point value corresponding to the command line argument
     104// 'name'
     105//  eg. executable -argument 5.7
     106//      GetFloat("argument") will return 5.7
     107//
    79108Double_t MArgs::GetFloat(const TString name) const
    80109{
     
    82111}
    83112
     113// --------------------------------------------------------------------------
     114//
     115// Return the TString corresponding to the command line argument 'name'
     116//  eg. executable -argument=last
     117//      GetString("-argument=") will return "last"
     118//
    84119TString MArgs::GetString(const TString name) const
    85120{
     
    92127}
    93128
     129// --------------------------------------------------------------------------
     130//
     131// Return the Integer corresponding to the command line argument 'name'
     132//  eg. executable -argument5
     133//      GetIntAndRemove("-argument") will return 5
     134// and removes the argument from the internal list.
     135//
    94136Int_t MArgs::GetIntAndRemove(const TString name)
    95137{
     
    97139}
    98140
     141// --------------------------------------------------------------------------
     142//
     143// Return the floating point value corresponding to the command line argument
     144// 'name'
     145//  eg. executable -argument5.7
     146//      GetFloatAndRemove("-argument") will return 5.7
     147// and removes the argument from the internal list.
     148//
    99149Double_t MArgs::GetFloatAndRemove(const TString name)
    100150{
     
    102152}
    103153
     154// --------------------------------------------------------------------------
     155//
     156// Return the TString corresponding to the command line argument 'name'
     157//  eg. executable -argument=last
     158//      GetStringAndRemove("-argument=") will return "last"
     159// and removes the argument from the internal list.
     160//
    104161TString MArgs::GetStringAndRemove(const TString n)
    105162{
     
    118175}
    119176
     177// --------------------------------------------------------------------------
     178//
     179// Return the Integer corresponding to the i-th argument. This is ment
     180// for enumerations like
     181//  executable 1 7 2
     182//  GetArgumentInt(1) will return 7
     183//
    120184Int_t MArgs::GetArgumentInt(Int_t i) const
    121185{
     
    123187}
    124188
     189// --------------------------------------------------------------------------
     190//
     191// Return the floating point value corresponding to the i-th argument.
     192// This is ment for enumerations like
     193//  executable 1.7 7.5 2.3
     194//  GetArgumentFloat(1) will return 7.5
     195//
    125196Float_t MArgs::GetArgumentFloat(Int_t i) const
    126197{
     
    128199}
    129200
     201// --------------------------------------------------------------------------
     202//
     203// Return the TString corresponding to the i-th argument.
     204// This is ment for enumerations like
     205//  executable file1 file2 file3
     206//  GetArgumentStr(1) will return "file2"
     207// Only arguments without a trailing '-' are considered
     208//
    130209TString MArgs::GetArgumentStr(Int_t i) const
    131210{
     
    146225}
    147226
     227// --------------------------------------------------------------------------
     228//
     229// return the number of arguments without a trainling '-'
     230//
    148231Int_t MArgs::GetNumArguments() const
    149232{
     
    159242}
    160243
     244// --------------------------------------------------------------------------
     245//
     246// Checks whether an argument beginning with 'n' is existing, eg:
     247//  executable -value5
     248//  executable -value
     249//  HasOption("-value") will return true in both cases
     250//
    161251Bool_t MArgs::Has(const TString n) const
    162252{
     
    171261}
    172262
     263// --------------------------------------------------------------------------
     264//
     265// Checks whether an argument beginning with 'n' is exists and a
     266// corresponding option is available, eg.
     267//  executable -value5
     268//  HasOption("-value") will return true
     269// but:
     270//  executable -value
     271//  HasOption("-value") will return false
     272//
    173273Bool_t MArgs::HasOption(const TString n) const
    174274{
  • trunk/MagicSoft/Mars/mbase/MDirIter.cc

    r2180 r2377  
    179179}
    180180
     181// --------------------------------------------------------------------------
     182//
     183//  Returns the concatenation of 'dir' and 'name'
     184//
    181185TString MDirIter::ConcatFileName(const char *dir, const char *name) const
    182186{
  • trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.cc

    r2173 r2377  
    9999    fSlider = new TGVSlider(mid, 250, kSlider1|kScaleBoth, M_VSId1);
    100100    fSlider->Associate(this);
    101     fSlider->SetRange(1, 577);
    102101
    103102    fList->Add(fSlider);
     
    258257
    259258    //
    260     // Here the initial display is set to hitogram 0
     259    // Here the initial display is set to entry with id 1
    261260    //
    262261    fHistoList->Select(1);
     
    305304    const Int_t nhi = fHists->GetEntries();
    306305
     306    Int_t n=1;
    307307    for (Int_t i=0; i<nhi; i++)
    308308        if (fHists->HasHi(i))
    309             fHistoList->AddEntry(fHists->GetHistHi(i)->GetName(), i+1);
     309            fHistoList->AddEntry(fHists->GetHistHi(i)->GetName(), n++);
     310
     311    fSlider->SetRange(1, n);
    310312
    311313    fHistoList->MapSubwindows();
     
    329331    fCanvas->Clear();
    330332
    331     const Int_t idx = selected-1;
     333    const Int_t idx = fHistoList->GetSelectedEntry()->EntryId(); //selected-1;
    332334
    333335    if (!fHists->HasHi(idx))
     
    414416
    415417                    if ((parm1==M_BUTTON_PREV && selected==1) ||
    416                         (parm1==M_BUTTON_NEXT && selected==577))
     418                        (parm1==M_BUTTON_NEXT && selected==fHistoList->GetNumberOfEntries()))
    417419                        return kTRUE;
    418420
     
    448450
    449451        // Check for the slider movement and synchronise with TGListBox
    450         if (parm2<1 || parm2>577)
     452        if (parm2<1 || parm2>fHistoList->GetNumberOfEntries())
    451453            return kTRUE;
    452454
  • trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc

    r2275 r2377  
    3838#include "MTaskList.h"           // MTaskList::AddToList
    3939#include "MHCamera.h"            // MHCamera
     40#include "MGeomApply.h"          // MGeomApply
    4041#include "MHillasCalc.h"         // MHillasCalc
    4142#include "MHillasSrcCalc.h"      // MHillasSrcCalc
     
    4344#include "MPedestalCam.h"        // MPedestalCam
    4445#include "MCerPhotEvt.h"         // MCerPhotEvt::GetPixById
    45 #include "MCerPhotCalc.h"       // MCerPhotCalc
     46#include "MCerPhotCalc.h"        // MCerPhotCalc
    4647#include "MMcPedestalCopy.h"     // MMcPedestalCopy
    4748#include "MMcPedestalNSBAdd.h"   // MMcPedestalNSBAdd
    4849#include "MBlindPixelCalc.h"     // MBlindPixelCalc
    4950#include "MImgCleanStd.h"        // MImgCleanStd
    50 #include "MGeomCamMagic.h"       // MGeomMagicCam
     51//#include "MGeomCamMagic.h"       // MGeomMagicCam
    5152#include "MRawEvtData.h"         // MRawEvtData
    5253
     
    116117//  preprocess tasks and read in first event (process)
    117118//
    118 MGeomCam *MGCamDisplay::SetupTaskList()
     119void /*MGeomCam */MGCamDisplay::SetupTaskList()
    119120{
    120121    MTaskList *tlist = GetTaskList();
    121122    MParList  *plist = GetParList();
    122123
     124    MGeomApply        *apply = new MGeomApply;
    123125    MMcPedestalCopy   *pcopy = new MMcPedestalCopy;
    124126    MMcPedestalNSBAdd *pdnsb = new MMcPedestalNSBAdd;
     
    130132    MHillasSrcCalc    *scalc = new MHillasSrcCalc;
    131133
     134    tlist->AddToList(apply);
    132135    tlist->AddToList(pcopy);
    133136    tlist->AddToList(pdnsb);
     
    139142    tlist->AddToList(scalc);
    140143
    141     MGeomCamMagic *geom   = new MGeomCamMagic;
     144    // MGeomCamMagic *geom   = new MGeomCamMagic;
    142145    MPedestalCam  *pedest = new MPedestalCam;
    143146    MRawEvtData   *event  = new MRawEvtData;
    144147
    145     plist->AddToList(geom);
     148    // plist->AddToList(geom);
    146149    plist->AddToList(pedest);
    147150    plist->AddToList(event);
    148151
    149     return geom;
     152    // return NULL;
    150153}
    151154
     
    161164    // Setup Task list for hillas calculation
    162165    //
    163     MGeomCam *geom = SetupTaskList();
     166    /*MGeomCam *geom = */SetupTaskList();
    164167
    165168    //
     
    181184    {
    182185        fCanvas2[i]->cd();
    183         fDisplay[i] = new MHCamera(*geom);
     186        fDisplay[i] = new MHCamera;//(*geom);
    184187        fDisplay[i]->Draw();
    185188        fDisplay[i]->AddNotify(*(MCamEvent*)GetParList()->FindObject("MRawEvtData"));
     
    221224//  together with the hillas ellipse or not.
    222225//
     226#include <iostream.h>
    223227void MGCamDisplay::UpdateDisplay()
    224228{
     
    227231
    228232    const MParList *plist = fEvtLoop->GetParList();
     233
     234    if (!fDisplay[0]->GetGeometry())
     235    {
     236        MGeomCam *cam = (MGeomCam*)plist->FindObject("MGeomCam");
     237        for (int i=0; i<5; i++)
     238        {
     239            fDisplay[i]->SetGeometry(*cam);
     240            cout << "---> Setting geometry for: " << fDisplay[i]->GetName() << endl;
     241        }
     242    }
    229243
    230244    //
     
    257271    const MPedestalCam *ped   = (MPedestalCam*)plist->FindObject("MPedestalCam");
    258272
     273    const Int_t n = ped->GetSize();
     274
    259275    // FIXME: Make this publicly available
    260     TArrayD val(577);
    261     TArrayC use(577);
    262     for (int i=0; i<577;i++)
     276    TArrayD val(n);
     277    TArrayC use(n);
     278    for (int i=0; i<n;i++)
    263279    {
    264280        // FIXME: photon event first!
  • trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.h

    r2210 r2377  
    2525    void UpdateDisplay();
    2626
    27     MGeomCam *SetupTaskList();
     27    void /*MGeomCam */SetupTaskList();
    2828
    2929public:
  • trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc

    r2275 r2377  
    278278
    279279    AddTab("Geometry");
     280
    280281    MGeomCamMagic geom;
    281282    MHCamera *display = new MHCamera(geom);
  • trunk/MagicSoft/Mars/mfileio/MReadCurrents.cc

    r2206 r2377  
    2424
    2525/////////////////////////////////////////////////////////////////////////////
    26 //                                                                         //
    27 // MReadCurrents                                                         //
    28 //                                                                         //
    29 //  Input Containers:                                                      //
    30 //   -/-                                                                   //
    31 //                                                                         //
    32 //  Output Containers:                                                     //
    33 //   MCerPhotEvt                                                           //
    34 //                                                                         //
     26//
     27// MReadCurrents
     28//
     29//  Input Containers:
     30//   -/-
     31//
     32//  Output Containers:
     33//   MCerPhotEvt
     34//
    3535/////////////////////////////////////////////////////////////////////////////
    3636#include "MReadCurrents.h"
     
    6363                             const char *name,
    6464                             const char *title)
    65     : fIn(NULL)
     65    : fIn(NULL), fNumPixel(577)
    6666{
    6767    fName  = name  ? name  : "MReadCurrents";
     
    225225    fTime->SetTime(h, m, s, ms*1000000);
    226226
    227     for (int i=0; i<577; i++)
     227    for (int i=0; i<fNumPixel; i++)
    228228        *fIn >> (*fCurrents)[i];
    229229
  • trunk/MagicSoft/Mars/mfileio/MReadCurrents.h

    r2206 r2377  
    1818    TList     *fFileNames;   // Array which stores the \0-terminated filenames
    1919
     20    Int_t      fNumPixel;
     21
    2022    Bool_t OpenNextFile();
    2123
     
    3234    Int_t Process();
    3335
     36    void SetNumPixel(Int_t i) { fNumPixel=i; }
     37
    3438    ClassDef(MReadCurrents, 0)  // Reads a Central Control currents file
    3539};
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc

    r2173 r2377  
    9696    //fTrees.SetOwner();
    9797
     98    TString str(fname);
     99    if (!str.EndsWith(".root", TString::kIgnoreCase))
     100        str += ".root";
     101
    98102    //
    99103    // Open the rootfile
    100104    //
    101     fOut = new TFile(fname, opt, ftitle, comp);
     105    fOut = new TFile(str, opt, ftitle, comp);
    102106}
    103107
  • trunk/MagicSoft/Mars/mgeom/GeomLinkDef.h

    r2283 r2377  
    55#pragma link off all functions;
    66
     7#pragma link C++ class MGeomPix+;
     8#pragma link C++ class MGeomCam+;
    79#pragma link C++ class MGeomPMT+;
    810#pragma link C++ class MGeomMirror+;
    911#pragma link C++ class MGeomCorsikaCT+;
    10 #pragma link C++ class MGeomPix+;
    11 #pragma link C++ class MGeomCam+;
     12
    1213#pragma link C++ class MGeomCamCT1+;
    1314#pragma link C++ class MGeomCamCT1Daniel+;
     15
    1416#pragma link C++ class MGeomCamMagic+;
    1517#pragma link C++ class MGeomCamMagicHG+;
    1618#pragma link C++ class MGeomCamMagic919+;
     19
    1720#pragma link C++ class MGeomCamECO1000+;
    1821#pragma link C++ class MGeomCamECO1000HG+;
  • trunk/MagicSoft/Mars/mhist/MHCamera.cc

    r2327 r2377  
    7878using namespace std;
    7979
    80 // ------------------------------------------------------------------------
    81 //
    82 //  Default Constructor. To be used by the root system ONLY.
    83 //
    84 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend)
     80void MHCamera::Init()
    8581{
    8682    SetDirectory(NULL);
    8783
    88     fNotify  = NULL;
     84    SetLineColor(kGreen);
     85    SetMarkerStyle(kFullDotMedium);
     86    SetXTitle("Pixel Index");
     87
     88    fNotify  = new TList;
    8989
    9090#if ROOT_VERSION_CODE < ROOT_VERSION(3,01,06)
     
    9797// ------------------------------------------------------------------------
    9898//
     99//  Default Constructor. To be used by the root system ONLY.
     100//
     101MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend)
     102{
     103    Init();
     104}
     105
     106// ------------------------------------------------------------------------
     107//
    99108//  Constructor. Makes a clone of MGeomCam. Removed the TH1D from the
    100109// current directory. Calls Sumw2(). Set the histogram line color
     
    102111//
    103112MHCamera::MHCamera(const MGeomCam &geom, const char *name, const char *title)
    104 : TH1D(name, title, geom.GetNumPixels(), -0.5, geom.GetNumPixels()-0.5),
    105 fUsed(geom.GetNumPixels()), fColors(kItemsLegend)
    106 {
    107     fGeomCam = (MGeomCam*)geom.Clone();
    108 
    109     SetDirectory(NULL);
    110     Sumw2();
    111 
    112     SetLineColor(kGreen);
    113     SetMarkerStyle(kFullDotMedium);
    114     SetXTitle("Pixel Index");
    115 
    116     fNotify = new TList;
    117 
    118     //
    119     //  create the hexagons of the display
     113: fGeomCam(NULL), /*TH1D(name, title, geom.GetNumPixels(), -0.5, geom.GetNumPixels()-0.5),
     114fUsed(geom.GetNumPixels()),*/ fColors(kItemsLegend)
     115{
     116    //fGeomCam = (MGeomCam*)geom.Clone();
     117    SetGeometry(geom, name, title);
     118    Init();
     119
    120120    //
    121121    // root 3.02
     
    123123    //    register BIT(8) as kNoContextMenu. If an object has this bit set it will
    124124    //    not get an automatic context menu when clicked with the right mouse button.
    125 
    126     //
    127     // Construct all hexagons. Use new-operator with placement
    128     //
     125}
     126
     127void MHCamera::SetGeometry(const MGeomCam &geom, const char *name, const char *title)
     128{
     129    SetNameTitle(name, title);
     130
     131    TAxis &x = *GetXaxis();
     132
     133    SetBins(geom.GetNumPixels(), 0, 1);
     134    x.Set(geom.GetNumPixels(), -0.5, geom.GetNumPixels()-0.5);
     135
     136    //SetBins(geom.GetNumPixels(), -0.5, geom.GetNumPixels()-0.5);
     137    //Rebuild();
     138
     139    Sumw2(); // necessary?
     140
     141    if (fGeomCam)
     142        delete fGeomCam;
     143    fGeomCam = (MGeomCam*)geom.Clone();
     144
     145    fUsed.Set(geom.GetNumPixels());
    129146    for (Int_t i=0; i<fNcells-2; i++)
    130147        ResetUsed(i);
    131148
    132 #if ROOT_VERSION_CODE < ROOT_VERSION(3,01,06)
    133     SetPalette(1, 0);
    134 #else
    135     SetPalette(51, 0);
    136 #endif
    137149}
    138150
     
    229241Int_t MHCamera::Fill(Axis_t x, Axis_t y, Stat_t w)
    230242{
     243    if (fNcells<=1)
     244        return -1;
     245
    231246    for (Int_t idx=0; idx<fNcells-2; idx++)
    232247    {
     
    243258Stat_t MHCamera::GetMean(Int_t axis) const
    244259{
     260    if (fNcells<=1)
     261        return 0;
     262
    245263    Stat_t mean = 0;
    246264    for (int i=1; i<fNcells-1; i++)
     
    252270Stat_t MHCamera::GetRMS(Int_t axis) const
    253271{
     272    if (fNcells<=1)
     273        return -1;
     274
    254275    const Int_t n = fNcells-2;
    255276
     
    278299        return fMinimum;
    279300
     301    if (fNcells<=1)
     302        return 0;
     303
    280304    Double_t minimum=FLT_MAX;
    281305
     
    304328    if (fMaximum != -1111)
    305329        return fMaximum;
     330
     331    if (fNcells<=1)
     332        return 1;
    306333
    307334    Double_t maximum=-FLT_MAX;
     
    491518void MHCamera::Paint(Option_t *o)
    492519{
     520    if (fNcells<=1)
     521        return;
     522
    493523    TString opt(o);
    494524    opt.ToLower();
     
    585615void MHCamera::DrawPixelIndices()
    586616{
     617    if (fNcells<=1)
     618        return;
     619
    587620    // FIXME: Is this correct?
    588621    for (int i=0; i<kItemsLegend; i++)
     
    609642void MHCamera::DrawSectorIndices()
    610643{
     644    if (fNcells<=1)
     645        return;
     646
    611647    for (int i=0; i<kItemsLegend; i++)
    612648        fColors[i] = 16;
     
    637673void MHCamera::AddCamContent(const MCamEvent &event, Int_t type)
    638674{
     675    if (fNcells<=1)
     676        return;
     677
    639678    // FIXME: Security check missing!
    640679    for (Int_t idx=0; idx<fNcells-2; idx++)
     
    717756void MHCamera::CntCamContent(const MCamEvent &event, Double_t threshold, Int_t type)
    718757{
     758    if (fNcells<=1)
     759        return;
     760
    719761    // FIXME: Security check missing!
    720762    for (Int_t idx=0; idx<fNcells-2; idx++)
     
    757799void MHCamera::FillRandom()
    758800{
     801    if (fNcells<=1)
     802        return;
     803
    759804    Reset();
    760805
     
    775820void MHCamera::FillLevels(const MCerPhotEvt &event, Float_t lvl1, Float_t lvl2)
    776821{
     822    if (fNcells<=1)
     823        return;
     824
    777825    SetCamContent(event, 2);
    778826
     
    807855void MHCamera::Reset(Option_t *opt)
    808856{
     857    if (fNcells<=1)
     858        return;
     859
    809860    TH1::Reset(opt);
    810861
     
    9651016Int_t MHCamera::DistancetoPrimitive(Int_t px, Int_t py)
    9661017{
     1018    if (fNcells<=1)
     1019        return 999999;
     1020
    9671021    const Int_t kMaxDiff = 7;
    9681022
     
    10141068Int_t MHCamera::GetPixelIndex(Int_t px, Int_t py) const
    10151069{
     1070    if (fNcells<=1)
     1071        return -1;
     1072
    10161073    Int_t i;
    10171074    for (i=0; i<fNcells-2; i++)
  • trunk/MagicSoft/Mars/mhist/MHCamera.h

    r2298 r2377  
    3838
    3939    //TGStatusBar   *fStatusBar;
     40    void Init();
    4041
    4142    Int_t GetColor(Float_t val, Float_t min, Float_t max, Bool_t islog);
     
    7273    MHCamera(const MGeomCam &geom, const char *name="", const char *title="");
    7374    ~MHCamera();
     75
     76    void SetGeometry(const MGeomCam &geom, const char *name="", const char *title="");
     77    const MGeomCam* GetGeometry() const { return fGeomCam; }
    7478
    7579    Bool_t IsUsed(Int_t idx) const { return TESTBIT(const_cast<TArrayC&>(fUsed)[idx], kIsUsed); }
  • trunk/MagicSoft/Mars/mhist/MHCurrents.cc

    r2191 r2377  
    5353void MHCurrents::Clear(const Option_t *)
    5454{
     55    const Int_t n = fCam ? fCam->GetNumPixels() : 577;
     56
    5557    // FIXME: Implement a clear function with setmem
    56     for (int i=0; i<577; i++)
     58    fSum.Set(n); // also clears memory
     59    fRms.Set(n);
     60/*    for (int i=0; i<577; i++)
    5761    {
    5862        fSum[i] = 0;
    5963        fRms[i] = 0;
    60     }
     64    }*/
    6165
    6266    fEntries = 0;
     
    6973//
    7074MHCurrents::MHCurrents(const char *name, const char *title)
    71     : fSum(577), fRms(577), fCam(NULL), fEvt(NULL), fDispl(NULL)
     75    : /*fSum(577), fRms(577), */fCam(NULL), fEvt(NULL), fDispl(NULL)
    7276{
    7377    //
     
    113117
    114118    fCam = (MGeomCam*)plist->FindObject("MGeomCam");
    115     if (!fCam)
    116         *fLog << warn << GetDescriptor() << ": No MGeomCam found." << endl;
     119    /*
     120    if (!fCam)
     121        *fLog << warn << GetDescriptor() << ": No MGeomCam found... assuming Magic geometry!" << endl;
     122    */
     123    if (!fCam)
     124    {
     125        *fLog << err << GetDescriptor() << ": No MGeomCam found... aborting." << endl;
     126        return kFALSE;
     127    }
    117128
    118129    Clear();
    119130
     131    const Int_t n = fSum.GetSize();
     132
    120133    MBinning bins;
    121     bins.SetEdges(577, -0.5, 576.5);
     134    bins.SetEdges(n, -0.5, n-0.5);
    122135    bins.Apply(fHist);
    123136
     
    138151    }
    139152
    140     for (UInt_t idx=0; idx<577; idx++)
     153    const Int_t n = fSum.GetSize();
     154    for (UInt_t idx=0; idx<n; idx++)
    141155    {
    142156        Float_t val;
     
    166180    }
    167181
    168     for (UInt_t i=0; i<577; i++)
     182    const Int_t n = fSum.GetSize();
     183    for (UInt_t i=0; i<n; i++)
    169184    {
    170185        // calc sdev^2 for pixel index i
  • trunk/MagicSoft/Mars/mhist/MHFadcCam.cc

    r2333 r2377  
    3737#include "MLogManip.h"
    3838
     39#include "MParList.h"
     40#include "MGeomCam.h"
     41
    3942#include "MRawEvtData.h"
    4043#include "MRawEvtPixelIter.h"
     
    4952//  creates an a list of histograms for all pixels and both gain channels
    5053//
    51 MHFadcCam::MHFadcCam(const Int_t n, MHFadcPix::Type_t t, const char *name, const char *title)
     54MHFadcCam::MHFadcCam(/*const Int_t n,*/ MHFadcPix::Type_t t, const char *name, const char *title)
    5255    : fNumHiGains(-1), fNumLoGains(-1), fType(t)
    5356{
     
    6366    // connect all the histogram with the container fHist
    6467    //
    65     fArray = new TObjArray(n);
     68    fArray = new TObjArray;
     69    fArray->SetOwner();
    6670
    67     for (Int_t i=0; i<n; i++)
    68         (*fArray)[i] = new MHFadcPix(i, fType);
     71    //    for (Int_t i=0; i<n; i++)
     72    //        (*fArray)[i] = new MHFadcPix(i, fType);
    6973}
    7074
     
    8791    // FIXME, this might be done faster and more elegant, by direct copy.
    8892    //
    89     MHFadcCam *cam = new MHFadcCam(n);
     93    MHFadcCam *cam = new MHFadcCam(fType);
     94
     95    cam->fArray->Expand(n);
    9096
    9197    for (int i=0; i<n; i++)
     
    95101    }
    96102    return cam;
     103}
     104
     105// --------------------------------------------------------------------------
     106//
     107// To setup the object we get the number of pixels from a MGeomCam object
     108// in the Parameter list.
     109//
     110Bool_t MHFadcCam::SetupFill(const MParList *pList)
     111{
     112    MGeomCam *cam = (MGeomCam*)pList->FindObject("MGeomCam");
     113    if (!cam)
     114    {
     115        *fLog << err << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
     116        return kFALSE;
     117    }
     118
     119    const Int_t n = cam->GetNumPixels();
     120
     121    fArray->Delete();
     122    fArray->Expand(n);
     123
     124    for (Int_t i=0; i<n; i++)
     125        (*fArray)[i] = new MHFadcPix(i, fType);
     126
     127    return kTRUE;
    97128}
    98129
  • trunk/MagicSoft/Mars/mhist/MHFadcCam.h

    r2333 r2377  
    3333
    3434public:
    35     MHFadcCam(const Int_t n=577, MHFadcPix::Type_t t=MHFadcPix::kValue, const char *name=NULL, const char *title=NULL);
     35    MHFadcCam(/*const Int_t n=577,*/ MHFadcPix::Type_t t=MHFadcPix::kValue, const char *name=NULL, const char *title=NULL);
    3636    ~MHFadcCam();
    3737
     
    4545    const TH1F *GetHistLo(UInt_t i) const { return (*this)[i].GetHistLo(); }
    4646
     47    Bool_t SetupFill(const MParList *pList);
    4748    Bool_t Fill(const MParContainer *par, const Stat_t w=1);
    4849    Bool_t Fill(const MRawEvtData *par);
  • trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.cc

    r2298 r2377  
    100100    MGeomCam *cam = (MGeomCam*)plist->FindObject("MGeomCam");
    101101    if (!cam)
    102         *fLog << warn << GetDescriptor() << ": No MGeomCam found." << endl;
     102    {
     103        *fLog << err << GetDescriptor() << ": No MGeomCam found... aborting." << endl;
     104        return kFALSE;
     105    }
    103106
    104107    if (fSum)
  • trunk/MagicSoft/Mars/mimage/MImgCleanTGB.cc

    r2296 r2377  
    257257#include <TGFrame.h>      // TGFrame
    258258#include <TGLabel.h>      // TGLabel
     259#include <TArrayC.h>      // TArrayC
    259260#include <TGTextEntry.h>  // TGTextEntry
    260261
     
    481482    Double_t sdev = sqrt(sq/w2 - mean*mean);
    482483
    483     Byte_t *nb = new Byte_t[1000];
    484     memset(nb, 0, 577);
     484    TArrayC n(fCam->GetNumPixels());
     485    Byte_t *nb = (Byte_t*)n.GetArray();
     486    //Byte_t *nb = new Byte_t[1000];
     487    //memset(nb, 0, 577);
    485488
    486489    for (Int_t i=0; i<entries; i++)
     
    512515    //CleanStep3(nb, 2, 3);
    513516
    514     delete nb;
    515 
    516517    return kTRUE;
    517518}
  • trunk/MagicSoft/Mars/mmain/MDataCheck.cc

    r2333 r2377  
    2323!
    2424\* ======================================================================== */
    25 
    2625#include "MDataCheck.h"
    2726
     
    3534#include "MTaskList.h"
    3635#include "MReadTree.h"
     36#include "MGeomApply.h"
    3737#include "MGDisplayAdc.h"
    3838
     39#include "MLog.h"
     40#include "MLogManip.h"
     41
     42ClassImp(MDataCheck);
     43
     44using namespace std;
     45
    3946// ---
    40 
    41 ClassImp(MDataCheck)
    4247
    4348enum {
     
    120125    read.DisableAutoScheme();
    121126
    122     MHFadcCam hist(577, t);
     127    MGeomApply geomapl;
     128
     129    MHFadcCam hist(t);
    123130    plist.AddToList(&hist);
    124131
     
    126133
    127134    tasks.AddToList(&read);
     135    tasks.AddToList(&geomapl);
    128136    tasks.AddToList(&fill);
    129137
Note: See TracChangeset for help on using the changeset viewer.