| 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 (tbretz@uni-sw.gwdg.de)
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2001
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 | void threshold(char* filename="data/CrabNebula_dnsb_09_loop.root")
|
|---|
| 27 | {
|
|---|
| 28 | //
|
|---|
| 29 | // This macro fill the container MHMcEnergies using the task
|
|---|
| 30 | // MMcThresholdCalc and shows the results.
|
|---|
| 31 | //
|
|---|
| 32 | MParList parlist;
|
|---|
| 33 |
|
|---|
| 34 | MTaskList tasklist;
|
|---|
| 35 | parlist.AddToList(&tasklist);
|
|---|
| 36 |
|
|---|
| 37 | //
|
|---|
| 38 | // Setup the parameter list
|
|---|
| 39 | // - You need create the container MHMcEnergies.
|
|---|
| 40 | // + You need to put the number of trigger conditions when
|
|---|
| 41 | // you declarete the MHMcEnergies
|
|---|
| 42 | // + If you don't put any dimension to MHMcEnergies it works
|
|---|
| 43 | // taking only the trigger information from MMcTrig
|
|---|
| 44 | //
|
|---|
| 45 | const UInt_t numtriggerconditions = 4;
|
|---|
| 46 |
|
|---|
| 47 | //
|
|---|
| 48 | // Create numtriggerconditions histograms of type MHMcEnergy
|
|---|
| 49 | // and store the histograms in an TObjArray
|
|---|
| 50 | //
|
|---|
| 51 | TObjArray *hists = new TObjArray(MParList::CreateObjList("MHMcEnergy", numtriggerconditions));
|
|---|
| 52 |
|
|---|
| 53 | //
|
|---|
| 54 | // Check if the list really contains the right number of histograms
|
|---|
| 55 | //
|
|---|
| 56 | if (hists->GetEntriesFast() != numtriggerconditions)
|
|---|
| 57 | return;
|
|---|
| 58 |
|
|---|
| 59 | //
|
|---|
| 60 | // Add the histograms to the paramater list.
|
|---|
| 61 | //
|
|---|
| 62 | parlist.AddToList(hists);
|
|---|
| 63 |
|
|---|
| 64 | //
|
|---|
| 65 | // Setup the task list
|
|---|
| 66 | // - You need the read and the MMcThresholdCalc tasks
|
|---|
| 67 | // - You have to fill the histograms for the Energy threshold
|
|---|
| 68 | // + You need to put the number of trigger conditions when
|
|---|
| 69 | // you declarete the MMcThresholdCalc
|
|---|
| 70 | // + If you don't put any dimension to MMcThresholdCalc it works
|
|---|
| 71 | // like one dimension MMcThresholdCalc
|
|---|
| 72 | //
|
|---|
| 73 | MReadTree read("Events;7", filename);
|
|---|
| 74 | MMcThresholdCalc calc(numtriggerconditions);
|
|---|
| 75 |
|
|---|
| 76 | tasklist.AddToList(&read);
|
|---|
| 77 | tasklist.AddToList(&calc);
|
|---|
| 78 |
|
|---|
| 79 | MEvtLoop evtloop;
|
|---|
| 80 | evtloop.SetParList(&parlist);
|
|---|
| 81 |
|
|---|
| 82 | //
|
|---|
| 83 | // Begin the loop (if the loop wasn't succesfull
|
|---|
| 84 | // don't try to draw the results
|
|---|
| 85 | //
|
|---|
| 86 | if (!evtloop.Eventloop())
|
|---|
| 87 | return;
|
|---|
| 88 |
|
|---|
| 89 | //
|
|---|
| 90 | // Now you can display the results
|
|---|
| 91 | //
|
|---|
| 92 | for (UInt_t i=0; i<numtriggerconditions; i++)
|
|---|
| 93 | ((*hists)[i])->Draw();
|
|---|
| 94 | }
|
|---|