Changeset 3957


Ignore:
Timestamp:
05/04/04 15:27:25 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3955 r3957  
    1919                                                 -*-*- END OF LINE -*-*-
    2020
     21 2004/05/04: Thomas Bretz
     22 
     23   * macros/MagicHillas.C, macros/comprob.C, macros/derotatedc.C,
     24     macros/dohtml.C, macros/evtrate.C, macros/merpp.C,
     25     macros/pixfirerate.C, macros/pixsatrate.C, macros/plot.C,
     26     macros/plot2.C, macros/pointing.C, macros/readMagic.C,
     27     macros/rootlogon.C, macros/runbook.C, macros/sectorvstime.C,
     28     macros/star.C, macros/sumcurrents.C, macros/tar.C,
     29     macros/testenv.C, macros/weights.C:
     30     - updated documentation
     31
     32   * mastro/MAstroCamera.[h,cc]:
     33     - added member function to read MC .def files for mirror geometry
     34     - added GetDiffZdAz
     35
     36   * mastro/MObservatory.[h,cc]:
     37     - added Copy-member function
     38
     39   * mbase/MLog.[h,cc]:
     40     - updated handling of mutices
     41     - added a new mutex to lock the stream
     42
     43   * mhist/MHCamera.[h,cc]:
     44     - added functionality to linear deform the camera display
     45       (to correct for abberation)
     46
     47   * mtools/MFFT.cc:
     48     - added more documentation
     49
     50
     51
    2152 2004/05/04: Markus Gaug
    2253 
     
    2455     - intialized the 2 vectors differently, now they don't give
    2556       warnings any more.
     57
    2658
    2759
  • trunk/MagicSoft/Mars/macros/MagicHillas.C

    r2377 r3957  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz et al, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
     18!   Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2002
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
    2323\* ======================================================================== */
    2424
     25///////////////////////////////////////////////////////////////////////////
     26//
     27// MagicHillas.C
     28// =============
     29//
     30// This is a demonstration program which calculates image (Hillas +)
     31// parameters using as input a Merpp output file (raw data).
     32// All parameters are written to an output file called hillas.root. Also
     33// filles histograms are displayed.
     34// For the calculation an arbitrary signal extractor (MCerPhotAnal2/Calc)
     35// is used.
     36//
     37///////////////////////////////////////////////////////////////////////////
    2538
    2639void MagicHillas(const char *filename="~/data/Gamma_20_N*.root")
    2740{
    28     //
    29     // This is a demonstration program which calculates the Hillas
    30     // parameter out of a Magic root file (raw data file).
    31     //
    32 
    3341    //
    3442    // Create a empty Parameter List and an empty Task List
     
    8088    read.DisableAutoScheme();
    8189
     90    // Setup a task which makes sure that all used arrays have
     91    // the correct size
    8292    MGeomApply geomapl;
    8393
     94    // tasks used if MC files are detected to calculate pedestals
    8495    MMcPedestalCopy pcopy;
    8596    MMcPedestalNSBAdd pnsb;
    8697
     98    // calculate the signal in a very simple way
     99    // for real adat files use MCerPhotAnal2 instead which also
     100    // calculates the pedestal.
    87101    MCerPhotCalc ncalc;
    88102    //
     
    95109    //
    96110
     111    // setup image cleaning and blind pixel treatment
    97112    MImgCleanStd    clean;
    98113    MBlindPixelCalc blind;
     114
    99115    //
    100     // Instead of unmapping the pixels you can also
     116    // Instead of unmapping the pixels you can also (The use of this
     117    // class is deprecated, it will be replaced by MBadPixels*)
    101118    //
    102119    // blind.SetUseInterpolation();
    103120    // blind.SetUseCetralPixel();
    104121    //
     122
     123    // setup tasks to calculate image parameters
    105124    MHillasCalc    hcalc;
    106125    MHillasSrcCalc csrc1;
    107126
     127    // setup tasks to fill histograms
    108128    MFillH hfill1("MHHillas", "MHillas");
    109129    MFillH hfill2("MHHillasExt");
     
    113133    MFillH hfill6("MHNewImagePar");
    114134
     135    // setup task to write containers to a file
    115136    MWriteRootFile write("hillas.root");
    116137    write.AddContainer("MHStarMap");
     
    121142    write.AddContainer("MHNewImagePar");
    122143
     144    // Setup the contents of zour tasklist
    123145    tlist.AddToList(&read);
    124146    tlist.AddToList(&geomapl);
  • trunk/MagicSoft/Mars/macros/comprob.C

    r1609 r3957  
    11/* ======================================================================== *\
    2  !
    3  ! *
    4  ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
    5  ! * Software. It is distributed to you in the hope that it can be a useful
    6  ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
    7  ! * It is distributed WITHOUT ANY WARRANTY.
    8  ! *
    9  ! * Permission to use, copy, modify and distribute this software and its
    10  ! * documentation for any purpose is hereby granted without fee,
    11  ! * provided that the above copyright notice appear in all copies and
    12  ! * that both that copyright notice and this permission notice appear
    13  ! * in supporting documentation. It is provided "as is" without express
    14  ! * or implied warranty.
    15  ! *
    16  !
    17  !   macro comprob.C
    18  !
    19  !   Author(s): Abelardo Moralejo
    20  !   Author(s): Thomas Bretz, 2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    21  !
    22  !   Copyright: MAGIC Software Development, 2000-2002
    23  !
    24  !
    25  \* ======================================================================== */
     2!
     3! *
     4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
     5! * Software. It is distributed to you in the hope that it can be a useful
     6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
     7! * It is distributed WITHOUT ANY WARRANTY.
     8! *
     9! * Permission to use, copy, modify and distribute this software and its
     10! * documentation for any purpose is hereby granted without fee,
     11! * provided that the above copyright notice appear in all copies and
     12! * that both that copyright notice and this permission notice appear
     13! * in supporting documentation. It is provided "as is" without express
     14! * or implied warranty.
     15! *
     16!
     17!   macro comprob.C
     18!
     19!   Author(s): Abelardo Moralejo
     20!   Author(s): Thomas Bretz, 2002 <mailto:tbretz@astro.uni-wuerzburg.de>
     21!
     22!   Copyright: MAGIC Software Development, 2000-2004
     23!
     24!
     25\* ======================================================================== */
    2626
    27 // -------------------------------------------------------------------------
     27///////////////////////////////////////////////////////////////////////////
    2828//
    2929//  This macro demonstrates one way of gamma hadron separation using the
     
    3131//  a file ouput by the star.C macro containing image parameters)
    3232//
     33///////////////////////////////////////////////////////////////////////////
    3334void comprob()
    3435{
  • trunk/MagicSoft/Mars/macros/derotatedc.C

    r3785 r3957  
    2525/////////////////////////////////////////////////////////////////////////////
    2626//
    27 //  derotate.C - STandard Analysis and Reconstruction (MC example)
     27// derotatedc.C
     28// ============
    2829//
    29 //  Derotate a MCamEvent and fill a histogram with derotated data
    30 //  (sky-plot)
     30// Derotate a MCamEvent and fill a histogram with derotated data
     31// (sky-plot).
     32//
     33// As an input you need a merpped root file conataining DC information
     34// from a camera report file. To be able to derotate you also need
     35// aproproitate time-stamps and the corresponding pointing information.
     36//
     37// All events are filled into a 2D histograms - derotated.
     38//
     39// The example shows the usage of MHCamEventRot. The output is the derotated
     40// sky-plot.
    3141//
    3242/////////////////////////////////////////////////////////////////////////////
  • trunk/MagicSoft/Mars/macros/dohtml.C

    r3930 r3957  
    2222!
    2323\* ======================================================================== */
     24
     25///////////////////////////////////////////////////////////////////////////
     26//
     27// dohtml.C
     28// ========
     29//
     30// This is a service macro used to create the html-documentation from
     31// source code (THtml)
     32//
     33// Add here all directories in which files are stored from which the
     34// documentation should be created an add all macros which should be
     35// converted to HTML.
     36//
     37///////////////////////////////////////////////////////////////////////////
    2438
    2539void dohtml()
  • trunk/MagicSoft/Mars/macros/evtrate.C

    r2626 r3957  
     1/* ======================================================================== *\
     2!
     3! *
     4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
     5! * Software. It is distributed to you in the hope that it can be a useful
     6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
     7! * It is distributed WITHOUT ANY WARRANTY.
     8! *
     9! * Permission to use, copy, modify and distribute this software and its
     10! * documentation for any purpose is hereby granted without fee,
     11! * provided that the above copyright notice appear in all copies and
     12! * that both that copyright notice and this permission notice appear
     13! * in supporting documentation. It is provided "as is" without express
     14! * or implied warranty.
     15! *
     16!
     17!
     18!   Author(s): Thomas Bretz, 12/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2004
     21!
     22!
     23\* ======================================================================== */
     24
     25///////////////////////////////////////////////////////////////////////////
     26//
     27// evtrate.C
     28// =========
     29//
     30// Example macro how to calulate the eventrate (per event) and display
     31// the result versus time.
     32//
     33// As an input you need a merpped raw-data file containing correct times.
     34// The output is the plot: Eventrate vs. time.
     35//
     36///////////////////////////////////////////////////////////////////////////
     37
    138void evtrate()
    239{
     40    // Setup parameter- and tasklist
    341    MParList plist;
    442    MTaskList tlist;
    543    plist.AddToList(&tlist);
    644
     45    // Setup reading task
    746    MReadMarsFile read("Events");
    847    read.DisableAutoScheme();
    948    read.AddFile("test-time.root");
    1049
     50    // Setup event rate calculator
    1151    MEventRateCalc calc;
     52    // Setup number of events to be averaged
    1253    calc.SetNumEvents(200);
    1354
     55    // Setup histogram to be filles with rate
    1456    MHVsTime rate("MEventRate.fRate");
    1557
     58    // Setup task to fill the histogram
    1659    MFillH fill(&rate, "MTime");
    1760
     61    // Setup tasklist
    1862    tlist.AddToList(&read);
    1963    tlist.AddToList(&calc);
    2064    tlist.AddToList(&fill);
    2165
     66    // Execute your eventloop
    2267    MEvtLoop loop;
    2368    loop.SetParList(&plist);
    2469
    25     loop.Eventloop();
     70    if (!loop.Eventloop())
     71        return;
    2672
     73    // print some execution statistics
     74    tlist.PrintStatistics();
     75
     76    // Draw result
    2777    rate.DrawClone();
    2878}
  • trunk/MagicSoft/Mars/macros/merpp.C

    r2222 r3957  
    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-2004
    2121!
    2222!
    2323\* ======================================================================== */
    2424
    25 
    2625/////////////////////////////////////////////////////////////////////////////
     26//
     27// merpp.C
     28// =======
    2729//
    2830// This is an easy implementation of the Merging process (as root Macro)
    2931//
    30 // at the moment it reads a binary file ("rawtest.bin") which was written
     32// at the moment it reads a binary file ("rawtest.raw") which was written
    3133// in the DAQ raw format.
    3234//
     
    3537//
    3638// This containers are written to a root file ("rawtest.root")
     39//
     40// It also demonstrates how you can loop over files in a single or more
     41// than one directory and process them. For details see MRunIter.
    3742//
    3843/////////////////////////////////////////////////////////////////////////////
  • trunk/MagicSoft/Mars/macros/pixfirerate.C

    r2377 r3957  
    1717!
    1818!   Author(s): Abelardo Moralejo <mailto:moralejo@pd.infn.it>
     19!   Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de>
    1920!
    20 !   Copyright: MAGIC Software Development, 2000-2003
     21!   Copyright: MAGIC Software Development, 2000-2004
    2122!
    2223!
     
    2627//
    2728// pixfirerate.C
     29// =============
    2830//
    2931// This macro can help to  find "hot" pixels firing too often
     
    7375    tlist.AddToList(&geomapl);
    7476
     77    // A list of threshold which should be displayed. The last entry
     78    // MUST be -1.
    7579    Double_t threshold[] = { 10, 20, 100, 200, -1 };
    7680
     
    7882    while (threshold[cnt]>0) cnt++;
    7983
     84    // Create the corresponding fill tasks and containers
    8085    for (int i=0; i<cnt; i++)
    8186    {
     
    95100    }
    96101
     102    // create the eventloop
    97103    MEvtLoop evtloop;
    98104    evtloop.SetParList(&plist);
  • trunk/MagicSoft/Mars/macros/pixsatrate.C

    r2377 r3957  
    1717!
    1818!   Author(s): Abelardo Moralejo <mailto:moralejo@pd.infn.it>
     19!   Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de>
    1920!
    20 !   Copyright: MAGIC Software Development, 2000-2003
     21!   Copyright: MAGIC Software Development, 2000-2004
    2122!
    2223!
     
    2627//
    2728// pixfirerate.C
     29// =============
    2830//
    2931// This macro can help to  find "hot" pixels firing too often
     
    7375    tlist.AddToList(&geomapl);
    7476
     77    // Create histograms with saturation limits at 254
    7578    MHTriggerLvl0 trighi(254, "SaturationHi", "Saturation Rate of Hi Gains");
    7679    MHTriggerLvl0 triglo(254, "SaturationLo", "Saturation Rate of Lo Gains");
     
    7881    triglo.SetType(2);
    7982
     83    // craete fill tasks to fill the histogarms
    8084    MFillH fillhi(&trighi, "MRawEvtData");
    8185    MFillH filllo(&triglo, "MRawEvtData");
     
    8387    tlist.AddToList(&filllo);
    8488
     89    // create eventloop
    8590    MEvtLoop evtloop;
    8691    evtloop.SetParList(&plist);
  • trunk/MagicSoft/Mars/macros/plot.C

    r2377 r3957  
    1919!   Author(s): Rudy Bock, 5/2002 <mailto:rkb@mppmu.mpg.de>
    2020!
    21 !   Copyright: MAGIC Software Development, 2000-2002
     21!   Copyright: MAGIC Software Development, 2000-2004
    2222!
    2323!
    2424\* ======================================================================== */
    2525
    26 // -------------------------------------------------------------------------
     26///////////////////////////////////////////////////////////////////////////
    2727//
    2828//  plot.C
     29//  ======
    2930//
    3031//  This macro shows how to fill and display a histogram using Mars
    3132//
     33//  The advantage of using Mars histograms instead of root-trees is that
     34//  you can fill values in your histogram which is calculated in the
     35//  eventloop.
     36//
     37//  In this particular sample we fill a histogram with the size parameter
     38//  of gammas and one with hadron's size. At the end we display both in a
     39//  single plot.
     40//
     41//  The input is a star-macro already conatining image parameters.
     42//
     43///////////////////////////////////////////////////////////////////////////
     44
    3245void plot()
    3346{
     47    // Create a status display for graphical output
    3448    MStatusDisplay *d = new MStatusDisplay;
    3549    d->SetLogStream(&gLog);
     
    5771
    5872    // Create a filter for Gammas
    59     MFParticleId fgamma("MMcEvt", '=', kGAMMA);
     73    MFParticleId fgamma("MMcEvt", '=', MMcEvt::kGAMMA);
    6074    tlist.AddToList(&fgamma);
    6175
    6276    // Create a filter for Non-Gammas
    63     MFParticleId fhadrons("MMcEvt", '!', kGAMMA);
     77    MFParticleId fhadrons("MMcEvt", '!', MMcEvt::kGAMMA);
    6478    tlist.AddToList(&fhadrons);
    6579
  • trunk/MagicSoft/Mars/macros/plot2.C

    r1543 r3957  
    1919!   Author(s): Rudy Bock, 5/2002 <mailto:rkb@mppmu.mpg.de>
    2020!
    21 !   Copyright: MAGIC Software Development, 2000-2002
     21!   Copyright: MAGIC Software Development, 2000-2004
    2222!
    2323!
    2424\* ======================================================================== */
    2525
    26 // -------------------------------------------------------------------------
     26///////////////////////////////////////////////////////////////////////////
    2727//
    28 //  plot.C
     28//  plot2.C
     29//  =======
    2930//
    30 //  This macro shows how to fill and display a 2D histogram using Mars
     31//  This macro shows how to fill and display a histogram using Mars
    3132//
     33//  The advantage of using Mars histograms instead of root-trees is that
     34//  you can fill values in your histogram which is calculated in the
     35//  eventloop.
     36//
     37//  In this particular sample we fill a histogram with width vs length
     38//  of gammas and hadrons. At the end we display both in a single plot.
     39//
     40//  The input is a star-macro already conatining image parameters.
     41//
     42///////////////////////////////////////////////////////////////////////////
     43
    3244void plot2()
    3345{
     
    5264
    5365    // Create a filter for the gamma events
    54     MFParticleId fgamma("MMcEvt", '=', kGAMMA);
     66    MFParticleId fgamma("MMcEvt", '=', MMcEvt::kGAMMA);
    5567    tlist.AddToList(&fgamma);
    5668
    5769    // Create a filter for the non-gamma events
    58     MFParticleId fhadrons("MMcEvt", '!', kGAMMA);
     70    MFParticleId fhadrons("MMcEvt", '!', MMcEvt::kGAMMA);
    5971    tlist.AddToList(&fhadrons);
    6072
     
    6678    plist.AddToList(&cam);
    6779
     80    // Set the variables (converted to deg)
    6881    TString vary("MHillas.fWidth*MGeomCam.fConvMm2Deg");
    6982    TString varx("MHillas.fLength*MGeomCam.fConvMm2Deg");
    7083
     84    // Set the binning
    7185    MBinning binsy("BinningMH3Y");
    7286    MBinning binsx("BinningMH3X");
  • trunk/MagicSoft/Mars/macros/pointing.C

    r3909 r3957  
     1/* ======================================================================== *\
     2!
     3! *
     4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
     5! * Software. It is distributed to you in the hope that it can be a useful
     6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
     7! * It is distributed WITHOUT ANY WARRANTY.
     8! *
     9! * Permission to use, copy, modify and distribute this software and its
     10! * documentation for any purpose is hereby granted without fee,
     11! * provided that the above copyright notice appear in all copies and
     12! * that both that copyright notice and this permission notice appear
     13! * in supporting documentation. It is provided "as is" without express
     14! * or implied warranty.
     15! *
     16!
     17!
     18!   Author(s): Thomas Bretz, 5/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2004
     21!
     22!
     23\* ======================================================================== */
     24
     25/////////////////////////////////////////////////////////////////////////////
     26//
     27// pointing.C
     28// ==========
     29//
     30// This macro is a demonstartion how check plots for a subsystem
     31// (here the drive) can be made using Mars.
     32//
     33// In this case a merpped (root-) cc-report file is read in. The data
     34// of the Drive branch is extracted using MReadReports and the
     35// Stream-Id feature of MTaskList (second argument in AddToList).
     36//
     37// The output are plots showing (hopefully) the peformance of the system.
     38//
     39/////////////////////////////////////////////////////////////////////////////
     40
    141/*
    242 class MGraph : public TGraph
  • trunk/MagicSoft/Mars/macros/readMagic.C

    r3682 r3957  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2001
     18!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
    2323\* ======================================================================== */
    2424
     25///////////////////////////////////////////////////////////////////////////
     26//
     27// readMagic.C
     28// ===========
     29//
     30// This is a demonstration program showing how to do particular processing
     31// on a single event basis. Here we simply display uncleand und cleand
     32// images.
     33// Therefor MInteractiveTask is used, which gives you the possibility
     34// to develop new tasks without the need of compilation.
     35// The input is a merpp raw-data file.
     36//
     37///////////////////////////////////////////////////////////////////////////
    2538
    2639Bool_t HandleInput()
    2740{
     41    // This must be there to get accesss to the GUI while the macro
     42    // is still running!
     43
    2844    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
    2945    while (1)
     
    4662}
    4763
     64//
     65// Setup the data-members of your 'virtual' class
     66//
    4867MHCamera display[4];
    4968
     
    5271MTaskList *fTaskList;
    5372
     73//
     74// Called like all PreProcess functions of tasks. Get the access to
     75// the containers necessary for you.
     76//
    5477Int_t PreProcess(MParList *plist)
    5578{
     79    // Get parameter and tasklist, see Process
    5680    fParList = plist;
    5781    fTaskList = (MTaskList*)plist->FindObject("MTaskList");
    5882
     83    // Get camera geoemtry
    5984    MGeomCam *geomcam = (MGeomCam*)plist->FindObject("MGeomCam");
    6085
     86    // setup canvas and camera-histograms
    6187    c = new TCanvas("Events", "Real Events", 600, 600);
    6288    c->SetBorderMode(0);
     
    7399}
    74100
     101//
     102// Called like all Process functions of tasks. Process a single
     103// event - here display it.
     104//
    75105Int_t Process()
    76106{
     107    // For simplicity we search in the Process function for the
     108    // objects. This is deprectaed! Store the pointers to the objects
     109    // as data member and get the pointers in PreProcess.
    77110    MReadMarsFile *read = (MReadMarsFile*)fTaskList->FindObject("MRead");
    78111    MClone *clone = (MClone*)fTaskList->FindObject("MClone");
     
    80113    MGeomCam *geom = (MGeomCam*)fParList->FindObject("MGeomCam");
    81114
     115    // Ouput event number
    82116    cout << "Event #" << read->GetNumEntry() << ":" << endl;
    83117
     118    // Fill the data into your camera-histograms
    84119    display[0].SetCamContent(*(MCerPhotEvt*)clone->GetClone());
    85120    display[1].SetCamContent(*(MCerPhotEvt*)fParList->FindObject("MCerPhotEvt"));
     
    87122    display[3].SetCamContent(*(MCameraData*)fParList->FindObject("MCameraData"));
    88123
     124    // Setup the cleaning level histogram
    89125    TArrayF lvl(2);
    90126    lvl[0] = clean->GetCleanLvl2();
     
    92128    display[3].SetLevels(lvl);
    93129
     130    // Update the display
    94131    for (int i=1; i<=4; i++)
    95132    {
     
    98135    }
    99136
     137    // print the data on the console
    100138    ((MHillas*)fParList->FindObject("MHillas"))->Print(*geom);
    101139    ((MHillasExt*)fParList->FindObject("MHillasExt"))->Print(*geom);
    102140    ((MNewImagePar*)fParList->FindObject("MNewImagePar"))->Print(*geom);
    103141
     142    // wait for 'return'
    104143    return HandleInput();
    105144}
    106145
     146//
     147// Called like all PostProcess functions of tasks. Delete
     148// instanciated objects.
     149//
    107150Int_t PostProcess()
    108151{
     
    111154
    112155void readMagic(const char *fname="../Proton*.root")
    113 {               
     156{
     157    // Setup parameter- and tasklist
    114158    MParList  plist;
    115159    MTaskList tlist;
     
    117161    plist.AddToList(&tlist);
    118162
     163    // setup reading task
    119164    MReadMarsFile read("Events", fname);
    120165    read.DisableAutoScheme();
    121166
     167    // setup a task making sure that all arrays are resized correctly
    122168    MGeomApply geomapl;
     169
     170    // Setup a print task calling TObject::Print
    123171    MPrint print1("MMcEvt");
    124172    MPrint print2("MRawEvtHeader");
     173    // Skip them if conatainers are not found
    125174    print1.EnableSkip();
    126175    print2.EnableSkip();
    127176
     177    // Copy MC pedestals to apropriate conatiners (if MC file)
    128178    MMcPedestalCopy   pcopy;
    129179    MMcPedestalNSBAdd pnsb;
     180
     181    // Calculate signal and pedestal from data (use MCerPhotCalc
     182    // in case of MC files)
    130183    MCerPhotAnal2     ncalc;
     184
     185    // Blind Pixel Treatment (deprecated, will be replaced by
     186    // MBadPixel*)
    131187    MBlindPixelCalc   blind;
    132188    blind.SetUseInterpolation();
     189
     190    // Clone MCerPhotEvt befor eimage cleaning
    133191    MClone            clone("MCerPhotEvt");
     192
     193    // Setup image cleaning
    134194    MImgCleanStd      clean;
     195
     196    // Setup calculation of Image parameters
    135197    MHillasCalc       hcalc;
     198
     199    // Setup intercative task calling the functions defined above
    136200    MTaskInteractive  mytask;
    137201
     
    139203    mytask.SetProcess(Process);
    140204
     205    // Setup your tasklist
    141206    tlist.AddToList(&read);
    142207    tlist.AddToList(&geomapl);
     
    152217    tlist.AddToList(&mytask);
    153218
     219    // Run your analysis
    154220    MEvtLoop evtloop;
    155221    evtloop.SetParList(&plist);
     
    158224        return;
    159225
     226    // Print statistics information about your loop
    160227    tlist.PrintStatistics();
    161228}
  • trunk/MagicSoft/Mars/macros/rootlogon.C

    r3927 r3957  
    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-2004
    2121!
    2222!
    2323\* ======================================================================== */
     24
     25///////////////////////////////////////////////////////////////////////////
     26//
     27// rootlogon.C
     28// ===========
     29//
     30// This file is the startup script ("autoexec.bat") executed when root is
     31// started. The definition which file to start is done in ".rootrc".
     32// There are three files which are automatically processed by root at
     33// startup: A systemwide .rootrc, one in your home directory and one
     34// in the current directory.
     35// So rootlogon.C is correctly executed if your start root from your
     36// Mars directory.
     37//
     38// The script setupts some small environmental things and makes
     39// sure that the Mars shared object (libmars.so) is loaded. This shared
     40// object gives you access to all Mars features from within the root
     41// interpreter.
     42//
     43// If libmars.so is not found in the current directory we search in the
     44// directory given in "MARSSYS" environment variable.
     45//
     46///////////////////////////////////////////////////////////////////////////
    2447
    2548Bool_t isloaded()
  • trunk/MagicSoft/Mars/macros/runbook.C

    r2197 r3957  
     1/* ======================================================================== *\
     2!
     3! *
     4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
     5! * Software. It is distributed to you in the hope that it can be a useful
     6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
     7! * It is distributed WITHOUT ANY WARRANTY.
     8! *
     9! * Permission to use, copy, modify and distribute this software and its
     10! * documentation for any purpose is hereby granted without fee,
     11! * provided that the above copyright notice appear in all copies and
     12! * that both that copyright notice and this permission notice appear
     13! * in supporting documentation. It is provided "as is" without express
     14! * or implied warranty.
     15! *
     16!
     17!
     18!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2004
     21!
     22!
     23\* ======================================================================== */
     24
     25///////////////////////////////////////////////////////////////////////////
     26//
     27// runbook.C
     28// =========
     29//
     30// This is an example macro how to extract the runbook information of
     31// a given date from the runbook files.
     32//
     33// The argument is a date in regexp format, eg.
     34//   .x runbook.C("2004-05-1[0-9]")
     35//
     36// With an MDirIter you can tell the macro which directories and files
     37// should be searched.
     38//
     39// The output are the runbook entries matching your query.
     40//
     41///////////////////////////////////////////////////////////////////////////
     42
    143void Wrap(TString &str)
    244{
     45    // Wrap lines to 80 chars
    346    while (str.Length()>80)
    447    {
     
    1558void ProcessFile(TString fname, TString date)
    1659{
     60    // File processed
    1761    cout << fname << endl;
    1862
     63    // Open file
    1964    ifstream fin(fname);
    2065
     
    3277    while (!fin.eof())
    3378    {
     79        // Read file line by line
    3480        char *txt=new char[i];
    3581        fin.getline(txt, i-1);
     
    58104        }
    59105
     106        // Check whether line matches regexp
    60107        if (!line(r0).IsNull())
    61108            print = !line(r1).IsNull();
    62109
     110        // Wrap lines to 80 chars
    63111        if (print)
    64112            Wrap(line);
     
    71119void runbook(const char *d="20[0-2][0-9]-[0-1][0-9]-[0-3][0-9]")
    72120{
     121    // Regexp to check for valid date
    73122    TString regexp = "20[0-2][0-9]-[0-1][0-9]-[0-3][0-9]";
    74123
     
    85134    }
    86135
     136    // Tell which dierctories and files to search
    87137    MDirIter Next;
    88138    Next.AddDirectory("/home/MAGIC/online_data/runbook", "CC_*.rbk");
    89139
     140    // Loop over files
    90141    TString name;
    91142    while (1)
  • trunk/MagicSoft/Mars/macros/sectorvstime.C

    r3393 r3957  
    1818!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2002
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    2525/////////////////////////////////////////////////////////////////////////////
    2626//
    27 //  This macro is an example of how to plot the value of a part of the
    28 // camera or the whole camera.
     27// sectorvstime.C
     28// ==============
     29//
     30// In this example we plot the mean content of the right and left half of
     31// camera. As an input we use a class derived from MCamEvent. Here this
     32// are dc currents read directly from a camera control report file.
     33//
     34// The output are two histograms one for each half.
    2935//
    3036/////////////////////////////////////////////////////////////////////////////
  • trunk/MagicSoft/Mars/macros/star.C

    r2621 r3957  
    1818!   Author(s): Thomas Bretz, 5/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2003
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    2727//  STAR - STandard Analysis and Reconstruction
    2828//
    29 //  This macro is the standard converter to convert raw data into image
    30 //  parameters
     29// This macro is the standard converter to convert raw data into image
     30// parameters. It is a demonstration how the star-executable implementation
     31// looks like.
     32//
     33// As an input you need a Merpp output file (raw data).
     34// All parameters are written to an output file called starfile.root.
     35// For the calculation an arbitrary signal extractor (MCerPhotAnal2/Calc)
     36// is used.
    3137//
    3238/////////////////////////////////////////////////////////////////////////////
     
    3440void star()
    3541{
    36     //
    37     // This is a demonstration program which calculates the image
    38     // parameters from a Magic raw data root file.
    39 
    4042    //
    4143    // Create a empty Parameter List and an empty Task List
     
    101103    //
    102104    // tlist.SetSerialNumber(1); // Serial number of telescope
    103 
    104105    write.AddContainer(write.AddSerialNumber("MMcEvt"),       "Events", kFALSE);
    105106    write.AddContainer(write.AddSerialNumber("MSigmabar"),    "Events");
  • trunk/MagicSoft/Mars/macros/sumcurrents.C

    r2633 r3957  
    1818!   Author(s): Thomas Bretz, 6/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2003
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
    2323\* ======================================================================== */
     24
     25///////////////////////////////////////////////////////////////////////////
     26//
     27// sumcurrents.C
     28// =============
     29//
     30// This is a demonstration macro to display mean DC currents for all pixels.
     31// The input is cc report file. The output are histograms and plots.
     32// Using the MDirIter functionality you can process more than one file
     33// in one or more directories. For more information see MDirIter.
     34//
     35///////////////////////////////////////////////////////////////////////////
    2436
    2537void ProcessFile(TString fname)
     
    3951    //
    4052
     53    // Create the magic geometry
    4154    MGeomCamMagic geom;
    4255    plist.AddToList(&geom);
     
    4962    tlist.AddToList(&read);
    5063
     64    // create a task to fill a histogram
    5165    MFillH fill("MHCamEvent", "MCameraDC");
    5266    tlist.AddToList(&fill);
     
    6680    tlist.PrintStatistics();
    6781
     82    //
     83    // Now display the result of the loop
     84    //
    6885    MHCamEvent &h2 = *(MHCamEvent*)plist->FindObject("MHCamEvent");
    6986    MHCamera &h = *(MHCamera*)h2.GetHistByName("sum");
     
    129146}
    130147
    131 // -------------------------------------------------------------------------
    132 //
    133 //  plot.C
    134 //
    135 //  This macro shows how to fill and display a histogram using Mars
    136 //
    137148void sumcurrents(const char *dirname=".")
    138149{
  • trunk/MagicSoft/Mars/macros/tar.C

    r2611 r3957  
     1/* ======================================================================== *\
     2!
     3! *
     4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
     5! * Software. It is distributed to you in the hope that it can be a useful
     6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
     7! * It is distributed WITHOUT ANY WARRANTY.
     8! *
     9! * Permission to use, copy, modify and distribute this software and its
     10! * documentation for any purpose is hereby granted without fee,
     11! * provided that the above copyright notice appear in all copies and
     12! * that both that copyright notice and this permission notice appear
     13! * in supporting documentation. It is provided "as is" without express
     14! * or implied warranty.
     15! *
     16!
     17!
     18!   Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2004
     21!
     22!
     23\* ======================================================================== */
     24
     25///////////////////////////////////////////////////////////////////////////
     26//
     27// tar.C
     28// =====
     29//
     30// Service script. used to create the tar archive for an release. It makes
     31// sure that the correct files are included and the name of the archive is
     32// the name of the current directory (+.tar.gz)
     33//
     34///////////////////////////////////////////////////////////////////////////
    135void tar()
    236{
  • trunk/MagicSoft/Mars/macros/testenv.C

    r1902 r3957  
     1/* ======================================================================== *\
     2!
     3! *
     4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
     5! * Software. It is distributed to you in the hope that it can be a useful
     6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
     7! * It is distributed WITHOUT ANY WARRANTY.
     8! *
     9! * Permission to use, copy, modify and distribute this software and its
     10! * documentation for any purpose is hereby granted without fee,
     11! * provided that the above copyright notice appear in all copies and
     12! * that both that copyright notice and this permission notice appear
     13! * in supporting documentation. It is provided "as is" without express
     14! * or implied warranty.
     15! *
     16!
     17!
     18!   Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2004
     21!
     22!
     23\* ======================================================================== */
     24
     25///////////////////////////////////////////////////////////////////////////
     26//
     27// testenv.C
     28// =========
     29//
     30// This example reads an config-file (steering card, input card, ...)
     31// The contents of the file a forwarded to the apropriate eventloop
     32// setup in your file.
     33//
     34// All tasks and containers in an eventloop should implement the
     35// ReadEnv/WriteEnv function (for an example see the tasks used below).
     36//
     37// The functions gets the corresponding setup data from the file as an
     38// argument and can change their behaviour and setup on this information.
     39//
     40///////////////////////////////////////////////////////////////////////////
     41
    142void testenv()
    243{
  • trunk/MagicSoft/Mars/macros/weights.C

    r2474 r3957  
    1818!   Author(s): Marcos Lopez, 10/2003 <mailto:marcos@gae.ucm.es>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2003
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
    2323\* ======================================================================== */
    2424
    25 
    2625//////////////////////////////////////////////////////////////////////////////
    27 //                                                                          //
    28 // This macro shows how to use the class MMcWeightEnergySpecCalc            //
    29 // to convert the energy spectrum of the MC showers generated with Corsika, //
    30 // to a different one.                                                      //
    31 //                                                                          //
     26//
     27// weights.C
     28// =========
     29//
     30// This macro shows how to use the class MMcWeightEnergySpecCalc
     31// to convert the energy spectrum of the MC showers generated with Corsika,
     32// to a different one.
     33//
    3234//////////////////////////////////////////////////////////////////////////////
    3335
    34 
    35 // --------------------------------------------------------------------------
    36 //
    37 //
    3836Double_t myfunction(Double_t *x, Double_t *par)
    3937{
     
    4341}
    4442
    45 
    46 
    47 // --------------------------------------------------------------------------
    48 //
    49 //
    5043void weights(TString filename="/up1/data/Magic-MC/CameraAll/Gammas/zbin0/Gamma_zbin0_0_7_1000to1009_w0-4:4:2.root")
    5144{
     
    109102    //-------------------------------------------------------------
    110103
    111 
    112104    MFillH hfill(&h1,"MMcEvt");
    113105    MFillH hfill2(&h2,"MMcEvt");
     
    118110    tasklist.AddToList(&hfill);
    119111    tasklist.AddToList(&hfill2);
    120 
    121112
    122113    //
     
    132123    parlist.Print();
    133124
    134 
    135     //
     125    //
    136126    // Draw the Results
    137127    //
     
    146136    hist1->DrawClone();
    147137    hist2->DrawClone("same");   
    148 
    149138}
    150 
    151 
    152 
    153 
    154 
    155 
    156 
    157 
    158 
    159 
    160 
    161 
    162 
  • trunk/MagicSoft/Mars/mastro/MAstroCamera.cc

    r3918 r3957  
    7070#include "MAstroCamera.h"
    7171
    72 #include <KeySymbols.h>       // kKey_*
    73 
    74 #include <TH2.h>              // TH2D
    75 #include <TMarker.h>          // TMarker
    76 #include <TVirtualPad.h>      // gPad
     72#include <errno.h>        // strerror
     73#include <fstream>        // ifstream
     74
     75#include <KeySymbols.h>   // kKey_*
     76
     77#include <TH2.h>          // TH2D
     78#include <TMarker.h>      // TMarker
     79#include <TVirtualPad.h>  // gPad
    7780
    7881#include "MLog.h"
     
    144147        memcpy((*fMirrors)[i], arr[i], sizeof(MGeomMirror));
    145148
     149}
     150
     151// --------------------------------------------------------------------------
     152//
     153// Read the mirror geometry from a MC .def file. The following
     154// structure is expected:
     155//
     156// #*  TYPE=1  (MAGIC)
     157// #*      i  f   sx   sy   x   y   z   thetan  phin
     158// #*
     159// #*       i : number of the mirror
     160// #*       f : focal distance of that mirror
     161// #*      sx : curvilinear coordinate of mirror's center in X[cm]
     162// #*      sy : curvilinear coordinate of mirror's center in X[cm]
     163// #*       x : x coordinate of the center of the mirror [cm]
     164// #*       y : y coordinate of the center of the mirror [cm]
     165// #*       z : z coordinate of the center of the mirror [cm]
     166// #*  thetan : polar theta angle of the direction where the mirror points to
     167// #*    phin : polar phi angle of the direction where the mirror points to
     168// #*      xn : xn coordinate of the normal vector in the center (normalized)
     169// #*      yn : yn coordinate of the normal vector in the center (normalized)
     170// #*      zn : zn coordinate of the normal vector in the center (normalized)
     171// #
     172// define_mirrors
     173//   1 1700.9200   25.0002   75.0061   25.0000   75.0000    0.9207 0.02328894 1.24904577 -0.00736394 -0.02209183 0.99972882
     174//   2 ...
     175//
     176void MAstroCamera::SetMirrors(const char *fname)
     177{
     178    ifstream fin(fname);
     179    if (!fin)
     180    {
     181        gLog << err << "Cannot open file " << fname << ": ";
     182        gLog << strerror(errno) << endl;
     183        return;
     184    }
     185
     186    TString line;
     187    while (1)
     188    {
     189        line.ReadLine(fin);
     190        if (!fin)
     191            return;
     192
     193        line = line.Strip(TString::kBoth);
     194
     195        if (line.BeginsWith("n_mirrors"))
     196        {
     197            Int_t n;
     198            sscanf(line.Data(), "%*s %d", &n);
     199
     200            if (!fMirrors)
     201                fMirrors = new TClonesArray(MGeomMirror::Class(), n);
     202
     203            fMirrors->ExpandCreate(n);
     204            continue;
     205        }
     206
     207
     208        Int_t id;
     209        Float_t f, sx, sy, x, y, z, thetan, phin, xn, yn, zn;
     210
     211        const Int_t n = sscanf(line.Data(), "%d %f %f %f %f %f %f %f %f %f %f %f",
     212                               &id, &f, &sx, &sy, &x, &y, &z, &thetan,
     213                               &phin, &xn, &yn, &zn);
     214        if (n!=12)
     215            continue;
     216
     217        new ((*fMirrors)[id-1]) MGeomMirror;
     218        ((MGeomMirror*)(*fMirrors)[id-1])->SetMirrorContent(id, f, sx, sy, x, y, z, thetan, phin, xn, yn, zn);
     219    }
    146220}
    147221
     
    287361    {
    288362        const Double_t mag = radec->Magnitude();
     363        if (mag>GetLimMag())
     364            continue;
    289365
    290366        TVector3 star(*radec);
     
    334410            const TVector3 spot = fMirror0->GetReflection(star, fGeom->GetCameraDist())*1000;
    335411            DrawStar(spot(0), spot(1), *radec, !hasmean, Form("x=%.1fmm y=%.1fmm", mean(0), mean(1)));
     412            //cout << TMath::Hypot(spot(0), spot(1)) << " " << TMath::Hypot(mean(0)-spot(0), mean(1)-spot(1)) << endl;
    336413        }
    337414    }
     
    362439    }
    363440
    364     // Get camera
    365     MHCamera *camera=(MHCamera*)FindObjectInPad("MHCamera", gPad);
    366     if (camera)
    367     {
    368         if (!camera->GetGeometry() || camera->GetGeometry()->IsA()!=fGeom->IsA())
    369             camera->SetGeometry(*fGeom);
    370     }
    371     else
    372     {
    373         camera = new MHCamera(*fGeom);
    374         camera->SetName("MHCamera");
    375         camera->SetStats(0);
    376         camera->SetInvDeepBlueSeaPalette();
    377         camera->SetBit(kCanDelete);
    378         camera->Draw();
    379     }
    380 
    381     const TRotation rot(GetGrid(kTRUE));
     441    const MAstroSky2Local s2l(*fTime, *fObservatory);
     442    const TRotation trans(AlignCoordinates(rot*fRaDec));
     443
     444    // Return the correct rotation matrix
     445    const TRotation rot = trans*s2l;
    382446
    383447    MVector3 *radec;
     
    397461        list->Add(starpos);
    398462    }
     463    // For MAGIC the distance of the mean of the light distribution
     464    // to the Mirror0 reflection of the star (Abberation) can be
     465    // expressed as:  dr = (0.0713 +/- 0.0002) * r = r/14.03
     466    // with r = hypot(mean(0), mean(1))
    399467}
    400468*/
     
    402470// ------------------------------------------------------------------------
    403471//
     472// Uses fRaDec as a reference point.
     473//
     474// Return dZd and dAz corresponding to the distance from x,y to fRaDec
     475//
     476// Before calling this function you should correct for abberation. In
     477// case of MAGIC you can do this by:
     478//    x /= 1.0713;
     479//    y /= 1.0713;
     480//
     481// x [mm]: x coordinate in the camera plane (assuming a perfect mirror)
     482// y [mm]: y coordinate in the camera plane (assuming a perfect mirror)
     483//
     484// dzd [deg]: Delta Zd
     485// daz [deg]: Delta Az
     486//
     487void MAstroCamera::GetDiffZdAz(Double_t x, Double_t y, Double_t &dzd, Double_t &daz)
     488{
     489    // Reflect the corrected pixel on a perfect mirror
     490    TVector3 v(x, y, fGeom->GetCameraDist()*1000);
     491    TVector3 spot = fMirror0->GetReflection(v);
     492   
     493    // Derotate into the local coordinate system
     494    const MAstroSky2Local rot(*fTime, *fObservatory);
     495    const TRotation align(AlignCoordinates(rot*fRaDec).Inverse());
     496    spot *= align;
     497
     498    cout << "Zd="<<spot.Theta()*TMath::RadToDeg() << " ";
     499    cout << "Az="<<spot.Phi()  *TMath::RadToDeg()+360 << endl;
     500
     501    // Derotatet the center of the camera
     502    TVector3 c(0, 0, 1);
     503    c *= align;
     504
     505    dzd = (spot.Theta()-c.Theta())*TMath::RadToDeg();
     506    daz = (spot.Phi()  -c.Phi())  *TMath::RadToDeg();
     507
     508    if (daz> 180) daz -= 360;
     509    if (daz<-180) daz += 360;
     510}
     511
     512// ------------------------------------------------------------------------
     513//
    404514// Execute a gui event on the camera
    405515//
    406516void MAstroCamera::ExecuteEvent(Int_t event, Int_t mp1, Int_t mp2)
    407517{
     518    // if (mp1>0 && mp2>0)
     519    // {
     520    //     // Calculate World coordinates from pixel
     521    //     Double_t x = gPad->AbsPixeltoX(mp1);
     522    //     Double_t y = gPad->AbsPixeltoY(mp2);
     523    //
     524    //     // Correct for abberation
     525    //     x /= 1.0713;
     526    //     y /= 1.0713;
     527    //
     528    //     Double_t dzd, daz;
     529    //     GetDiffZdAz(x, y, dzd, daz);
     530    //
     531    //     cout << "dZd="<< dzd << " " << "dAz="<< daz << endl;
     532    // }
     533    //
     534    // For MAGIC the distance of the mean of the light distribution
     535    // to the Mirror0 reflection of the star (Abberation) can be
     536    // expressed as:  dr = 0.0713*r = r/14.03
     537    //                   +-0.0002
     538
    408539    if (event==kKeyPress && fTime)
    409540        switch (mp2)
  • trunk/MagicSoft/Mars/mastro/MAstroCamera.h

    r3918 r3957  
    3232
    3333    void SetMirrors(TClonesArray &arr);
     34    void SetMirrors(const char *fname);
    3435    void SetGeom(const MGeomCam &cam);
     36
     37    void GetDiffZdAz(Double_t x, Double_t y, Double_t &dzd, Double_t &daz);
    3538
    3639    ClassDef(MAstroCamera, 1) // Display class to display stars on the camera
  • trunk/MagicSoft/Mars/mastro/MObservatory.h

    r3568 r3957  
    3636    MObservatory(LocationName_t key, const char *name=NULL, const char *title=NULL);
    3737
     38    void Copy(TObject &obj) const
     39    {
     40        MObservatory &obs = (MObservatory&)obj;
     41        obs.fObservatoryName = fObservatoryName;
     42        obs.fLongitude = fLongitude;
     43        obs.fLatitude = fLatitude;
     44        obs.fSinLatitude = fSinLatitude;
     45        obs.fCosLatitude = fCosLatitude;
     46        obs.fHeight = fHeight;
     47    }
     48
    3849    void SetLocation(LocationName_t name);
    3950
  • trunk/MagicSoft/Mars/mbase/MLog.cc

    r3927 r3957  
    149149    //
    150150#ifdef _REENTRANT
    151     fMuxGui = new TMutex;
     151    fMuxGui    = new TMutex;
     152    fMuxStream = new TMutex;
    152153#endif
    153154
     
    213214    delete fPlugins;
    214215#ifdef _REENTRANT
     216    delete fMuxStream;
    215217    delete fMuxGui;
    216218#endif
     
    359361
    360362    // lock mutex
    361     Lock("UpdateGui");
     363    LockUpdate("UpdateGui");
    362364
    363365    TGText &txt=*fGui->GetText();
     
    387389
    388390    // release mutex
    389     UnLock("UpdateGui");
     391    UnLockUpdate("UpdateGui");
     392}
     393
     394void MLog::LockUpdate(const char *msg)
     395{
     396#ifdef _REENTRANT
     397    if (fMuxGui->Lock()==13)
     398        Error("LockUpdate", "%s - mutex is already locked by this thread\n", msg);
     399#endif
     400}
     401
     402void MLog::UnLockUpdate(const char *msg)
     403{
     404#ifdef _REENTRANT
     405    if (fMuxGui->UnLock()==13)
     406        Error("UnLockUpdate", "%s - tried to unlock mutex locked by other thread\n", msg);
     407#endif
    390408}
    391409
     
    393411{
    394412#ifdef _REENTRANT
    395     if (fMuxGui->Lock()==13)
     413    if (fMuxStream->Lock()==13)
    396414        Error("Lock", "%s - mutex is already locked by this thread\n", msg);
    397415#endif
     
    401419{
    402420#ifdef _REENTRANT
    403     if (fMuxGui->UnLock()==13)
     421    if (fMuxStream->UnLock()==13)
    404422        Error("UnLock", "%s - tried to unlock mutex locked by other thread\n", msg);
    405423#endif
     
    412430int MLog::sync()
    413431{
    414     Lock("sync");
     432    LockUpdate("sync");
    415433    WriteBuffer();
    416     UnLock("sync");
     434    UnLockUpdate("sync");
    417435
    418436    if (fDevice&eStdout)
     
    448466    if (fOutputLevel <= fDebugLevel)
    449467    {
    450         Lock("overflow");
     468        LockUpdate("overflow");
    451469
    452470        *fPPtr++ = (char)i;
     
    455473            WriteBuffer();
    456474
    457         UnLock("overflow");
     475        UnLockUpdate("overflow");
    458476    }
    459477
  • trunk/MagicSoft/Mars/mbase/MLog.h

    r3927 r3957  
    7171#ifdef _REENTRANT
    7272    TMutex *fMuxGui;          //! Mutex locking access of TGListBox
     73    TMutex *fMuxStream;       //! Mutex locking access to streaming
    7374#endif
    7475
     
    102103    ~MLog();
    103104
    104     void Lock(const char *msg);
    105     void UnLock(const char *msg);
     105    void LockUpdate(const char *msg);
     106    void UnLockUpdate(const char *msg);
     107
     108    void Lock(const char *msg="");
     109    void UnLock(const char *msg="");
    106110
    107111    void EnableDirectGui()  { fIsDirectGui = kTRUE; }
  • trunk/MagicSoft/Mars/mhist/MHCamera.cc

    r3953 r3957  
    3434// To change the scale to a logarithmic scale SetLogy() of the Pad.
    3535//
     36// You can correct for the abberation. Assuming that the distance
     37// between the mean position of the light distribution and the position
     38// of a perfect reflection on a perfect mirror in the distance r on
     39// the camera plane is dr it is  d = a*dr  while a is the abberation
     40// constant (for the MAGIC mirror it is roughly 0.0713). You can
     41// set this constant by calling SetAbberation(a) which results in a
     42// 'corrected' display (all outer pixels are shifted towards the center
     43// of the camera to correct for this abberation)
     44//
    3645// Be carefull: Entries in this context means Entries/bin or Events
    3746//
     
    102111//  Default Constructor. To be used by the root system ONLY.
    103112//
    104 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend)
     113MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend), fAbberation(0)
    105114{
    106115    Init();
     
    114123//
    115124MHCamera::MHCamera(const MGeomCam &geom, const char *name, const char *title)
    116 : fGeomCam(NULL), fColors(kItemsLegend)
     125: fGeomCam(NULL), fColors(kItemsLegend), fAbberation(0)
    117126{
    118127    //fGeomCam = (MGeomCam*)geom.Clone();
     
    759768        const MGeomPix &pix = (*fGeomCam)[i];
    760769
    761         const Float_t x = pix.GetX()*conv;
    762         const Float_t y = pix.GetY()*conv;
    763         const Float_t d = pix.GetD()*conv;
     770        Float_t x = pix.GetX()*conv/(fAbberation+1);
     771        Float_t y = pix.GetY()*conv/(fAbberation+1);
     772        Float_t d = pix.GetD()*conv;
    764773
    765774        if (!isbox)
  • trunk/MagicSoft/Mars/mhist/MHCamera.h

    r3929 r3957  
    4747//#endif
    4848
     49    Float_t fAbberation;
     50
    4951    void Init();
    5052
     
    188190    void     Draw(Option_t *option="");
    189191    TObject *DrawClone(Option_t *option="") const;
    190     void     DrawProjection (Int_t fit=0) const;       
    191     void     DrawRadialProfile()           const;       
     192    void     DrawProjection (Int_t fit=0) const;
     193    void     DrawRadialProfile()           const;
    192194
    193195    void     SavePrimitive(ofstream &out, Option_t *);
     
    209211    Bool_t   IsFreezed() const { return TestBit(kFreezed); }
    210212    //void  SetOptStat(Int_t os=-1) { fOptStat = os; } // *MENU*
     213
     214    void     SetAbberation(Float_t f=0.0713) { fAbberation=f; } // *MENU*
    211215
    212216    void     AddNotify(TObject *event);
  • trunk/MagicSoft/Mars/mtools/MFFT.cc

    r3125 r3957  
    6363//     * If the PSD does NOT CONVERGE to 0 at the maximum bin,              //
    6464//       you HAVE TO sample your data finer!                                //
    65 //                                                                          //
     65//
     66// Fourier-Transformation:
     67// =======================
     68
     69// (taken from http://www.parasitaere-kapazitaeten.net/Pd/ft.htm)
     70//
     71//  The Fourier-Transformation is a mathematical function that breaks
     72// down a signal (like sound) into its frequency-spectrum as a set of
     73// sinusoidal components, converting it from the Time Domain to the
     74// Frequency Domain.
     75//
     76//  In the Time Domain the signal x[ ] consists of N samples, labeled
     77// from 0 to N-1. In the Frequency Domain the RFFT produces two signals
     78// (signalvectors), treated as complex numbers representing the Real Part:
     79// Re X[ ] and the Imaginary Part: Im X[ ]. They are seen as the Cosine-
     80// und Sine-Components of the base frequencies. Each of these two signals
     81// contains one more sample than the half of the original signal: N/2 + 1
     82// samples. (this results from the fact, that the sine-components of the
     83// first frequency (0) and the last (nyquist, N/2) are always 0). With the
     84// complex Fourier-Transformation N complexe values are transformed to N
     85// new complex values. For both it applies to: the Frequency Domain
     86// contains exactly the same information as the Time-Domain.
     87//
     88//  A Real FFT over 64 samples produces values for 33 cosine- and 33
     89// sine-wave-amplitudes with the frequencies 0, 1, 2, 3, ..., 30, 31, 32.
     90// The first value (frequency 0) is the DC (direct current), the other
     91// values have to be seen in practice as factors of a
     92// fundamental-frequency which can be calculated by dividing samplerate by
     93// windowsize. The highest frequency is the nyquist-frequency
     94// (samplerate/2).
     95//
    6696//////////////////////////////////////////////////////////////////////////////
    6797
Note: See TracChangeset for help on using the changeset viewer.