| 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/camera.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 numtrigcond = 0;
|
|---|
| 46 |
|
|---|
| 47 | UInt_t from = numtrigcond>0 ? 1 : -numtrigcond;
|
|---|
| 48 | UInt_t to = numtrigcond>0 ? numtrigcond : -numtrigcond;
|
|---|
| 49 |
|
|---|
| 50 | Int_t dim = to-from+1;
|
|---|
| 51 |
|
|---|
| 52 | //
|
|---|
| 53 | // Create numtriggerconditions histograms of type MHMcEnergy
|
|---|
| 54 | // and store the histograms in an TObjArray
|
|---|
| 55 | //
|
|---|
| 56 | TObjArray hists(MParList::CreateObjList("MHMcEnergy", from, to));
|
|---|
| 57 | hists.SetOwner();
|
|---|
| 58 |
|
|---|
| 59 | //
|
|---|
| 60 | // Check if the list really contains the right number of histograms
|
|---|
| 61 | //
|
|---|
| 62 | if (hists.GetEntriesFast() != dim)
|
|---|
| 63 | return;
|
|---|
| 64 |
|
|---|
| 65 | //
|
|---|
| 66 | // Add the histograms to the paramater list.
|
|---|
| 67 | //
|
|---|
| 68 | parlist.AddToList(&hists);
|
|---|
| 69 |
|
|---|
| 70 | //
|
|---|
| 71 | // Setup the task list
|
|---|
| 72 | // - You need the read and the MMcThresholdCalc tasks
|
|---|
| 73 | // - You have to fill the histograms for the Energy threshold
|
|---|
| 74 | // + You need to put the number of trigger conditions when
|
|---|
| 75 | // you declarete the MMcThresholdCalc
|
|---|
| 76 | // + If you don't put any dimension to MMcThresholdCalc it works
|
|---|
| 77 | // like one dimension MMcThresholdCalc
|
|---|
| 78 | //
|
|---|
| 79 | MReadTree read("Events", filename);
|
|---|
| 80 | MMcThresholdCalc calc(numtrigcond);
|
|---|
| 81 |
|
|---|
| 82 | tasklist.AddToList(&read);
|
|---|
| 83 | tasklist.AddToList(&calc);
|
|---|
| 84 |
|
|---|
| 85 | MEvtLoop evtloop;
|
|---|
| 86 | evtloop.SetParList(&parlist);
|
|---|
| 87 |
|
|---|
| 88 | //
|
|---|
| 89 | // Begin the loop (if the loop wasn't succesfull
|
|---|
| 90 | // don't try to draw the results
|
|---|
| 91 | //
|
|---|
| 92 | if (!evtloop.Eventloop())
|
|---|
| 93 | return;
|
|---|
| 94 |
|
|---|
| 95 | //
|
|---|
| 96 | // Now you can display the results
|
|---|
| 97 | //
|
|---|
| 98 | hists.Print();
|
|---|
| 99 |
|
|---|
| 100 | TIter Next(&hists);
|
|---|
| 101 | TObject *obj;
|
|---|
| 102 | while ((obj=Next()))
|
|---|
| 103 | obj->DrawClone();
|
|---|
| 104 | }
|
|---|