Ignore:
Timestamp:
05/04/04 15:27:25 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.