| 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/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
|
|---|
| 19 | ! Author(s): Rudy Bock, 5/2002 <mailto:rkb@mppmu.mpg.de>
|
|---|
| 20 | !
|
|---|
| 21 | ! Copyright: MAGIC Software Development, 2000-2002
|
|---|
| 22 | !
|
|---|
| 23 | !
|
|---|
| 24 | \* ======================================================================== */
|
|---|
| 25 |
|
|---|
| 26 | void multidimdist()
|
|---|
| 27 | {
|
|---|
| 28 | //
|
|---|
| 29 | // This is a demonstration program which calculates the Hillas
|
|---|
| 30 | // parameter out of a Magic root file.
|
|---|
| 31 |
|
|---|
| 32 | //
|
|---|
| 33 | // Create a empty Parameter List and an empty Task List
|
|---|
| 34 | // The tasklist is identified in the eventloop by its name
|
|---|
| 35 | //
|
|---|
| 36 | MParList plist;
|
|---|
| 37 |
|
|---|
| 38 | MTaskList tlist;
|
|---|
| 39 | plist.AddToList(&tlist);
|
|---|
| 40 |
|
|---|
| 41 | //
|
|---|
| 42 | // Now setup the tasks and tasklist:
|
|---|
| 43 | // ---------------------------------
|
|---|
| 44 | //
|
|---|
| 45 | // The first argument is the tree you want to read.
|
|---|
| 46 | // Events: Cosmic ray events
|
|---|
| 47 | // PedEvents: Pedestal Events
|
|---|
| 48 | // CalEvents: Calibration Events
|
|---|
| 49 | //
|
|---|
| 50 | MReadMarsFile read("Events", "~/Mars/star.root");
|
|---|
| 51 | read.DisableAutoScheme();
|
|---|
| 52 | tlist.AddToList(&read);
|
|---|
| 53 |
|
|---|
| 54 | MFParticleId fgamma("MMcEvt", '=', kGAMMA);
|
|---|
| 55 | tlist.AddToList(&fgamma);
|
|---|
| 56 |
|
|---|
| 57 | MFParticleId fhadrons("MMcEvt", '!', kGAMMA);
|
|---|
| 58 | tlist.AddToList(&fhadrons);
|
|---|
| 59 |
|
|---|
| 60 | MHMatrix matrix("MatrixGammas");
|
|---|
| 61 | matrix.AddColumn("MHillas.fWidth");
|
|---|
| 62 | matrix.AddColumn("MHillas.fLength");
|
|---|
| 63 | matrix.AddColumn("MHillas.fWidth*MHillas.fLength/MHillas.fSize");
|
|---|
| 64 | matrix.AddColumn("abs(MHillas.fAsym)");
|
|---|
| 65 | matrix.AddColumn("abs(MHillas.fM3Long)");
|
|---|
| 66 | matrix.AddColumn("abs(MHillas.fM3Trans)");
|
|---|
| 67 | matrix.AddColumn("abs(HillasSource.fHeadTail)");
|
|---|
| 68 | matrix.AddColumn("MHillas.fConc");
|
|---|
| 69 | matrix.AddColumn("MHillas.fConc1");
|
|---|
| 70 | matrix.AddColumn("HillasSource.fDist");
|
|---|
| 71 | matrix.AddColumn("log10(MHillas.fSize)");
|
|---|
| 72 | plist.AddToList(&matrix);
|
|---|
| 73 |
|
|---|
| 74 | MHMatrix matrix2("MatrixHadrons");
|
|---|
| 75 | matrix2.AddColumns(matrix.GetColumns());
|
|---|
| 76 | plist.AddToList(&matrix2);
|
|---|
| 77 |
|
|---|
| 78 | MFillH fillmat("MatrixGammas");
|
|---|
| 79 | fillmat.SetFilter(&fgamma);
|
|---|
| 80 | tlist.AddToList(&fillmat);
|
|---|
| 81 |
|
|---|
| 82 | MFillH fillmat2("MatrixHadrons");
|
|---|
| 83 | fillmat2.SetFilter(&fhadrons);
|
|---|
| 84 | tlist.AddToList(&fillmat2);
|
|---|
| 85 |
|
|---|
| 86 | //
|
|---|
| 87 | // Create and setup the eventloop
|
|---|
| 88 | //
|
|---|
| 89 | MEvtLoop evtloop;
|
|---|
| 90 | evtloop.SetParList(&plist);
|
|---|
| 91 |
|
|---|
| 92 | //
|
|---|
| 93 | // Execute your analysis
|
|---|
| 94 | //
|
|---|
| 95 | if (!evtloop.Eventloop())
|
|---|
| 96 | return;
|
|---|
| 97 |
|
|---|
| 98 | tlist.PrintStatistics();
|
|---|
| 99 |
|
|---|
| 100 | matrix.Print("size");
|
|---|
| 101 | matrix2.Print("size");
|
|---|
| 102 |
|
|---|
| 103 | // ---------------------------------------------------------
|
|---|
| 104 |
|
|---|
| 105 | MTaskList tlist2;
|
|---|
| 106 |
|
|---|
| 107 | plist.Replace(&tlist2);
|
|---|
| 108 |
|
|---|
| 109 | MReadMarsFile read2("Events", "~/Mars/star.root");
|
|---|
| 110 | // read2.AddFile("~/Mars/star2.root");
|
|---|
| 111 | read2.DisableAutoScheme();
|
|---|
| 112 | tlist2.AddToList(&read2);
|
|---|
| 113 |
|
|---|
| 114 | MMultiDimDistCalc calc;
|
|---|
| 115 | calc.SetUseNumRows(15);
|
|---|
| 116 | //calc.SetUseKernelMethod(kTRUE);
|
|---|
| 117 | tlist2.AddToList(&calc);
|
|---|
| 118 |
|
|---|
| 119 | MFillH fillh("MHHadronness");
|
|---|
| 120 |
|
|---|
| 121 | /*
|
|---|
| 122 | MF filter("MMcEvt.fEnergy < 100");
|
|---|
| 123 | fillh.SetFilter(&filter);
|
|---|
| 124 | tlist2.AddToList(&filter);
|
|---|
| 125 | */
|
|---|
| 126 |
|
|---|
| 127 | tlist2.AddToList(&fillh);
|
|---|
| 128 |
|
|---|
| 129 | //
|
|---|
| 130 | // Execute your analysis
|
|---|
| 131 | //
|
|---|
| 132 | if (!evtloop.Eventloop())
|
|---|
| 133 | return;
|
|---|
| 134 |
|
|---|
| 135 | tlist2.PrintStatistics();
|
|---|
| 136 |
|
|---|
| 137 | plist.FindObject("MHHadronness")->DrawClone();
|
|---|
| 138 | plist.FindObject("MHHadronness")->Print();
|
|---|
| 139 | }
|
|---|