| 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 | ! Author(s): Abelardo Moralejo 4/2003 <mailto:moralejo@pd.infn.it>
|
|---|
| 20 | !
|
|---|
| 21 | ! Copyright: MAGIC Software Development, 2000-2001
|
|---|
| 22 | !
|
|---|
| 23 | !
|
|---|
| 24 | \* ======================================================================== */
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 | void CT1collarea(TString filename="MC1.root", TString outname="")
|
|---|
| 28 | {
|
|---|
| 29 | //
|
|---|
| 30 | // first we have to create our empty lists
|
|---|
| 31 | //
|
|---|
| 32 | MParList parlist;
|
|---|
| 33 | MTaskList tasklist;
|
|---|
| 34 |
|
|---|
| 35 | parlist.AddToList(&tasklist);
|
|---|
| 36 |
|
|---|
| 37 | //
|
|---|
| 38 | // Setup out tasks:
|
|---|
| 39 | // - First we have to read the events
|
|---|
| 40 | // - Then we can fill the efficiency histograms
|
|---|
| 41 | //
|
|---|
| 42 | MReadMarsFile reader("Events", filename);
|
|---|
| 43 | reader.DisableAutoScheme();
|
|---|
| 44 |
|
|---|
| 45 | MHMcCT1CollectionArea* collarea = new MHMcCT1CollectionArea();
|
|---|
| 46 |
|
|---|
| 47 | MBinning binsx("BinningE");
|
|---|
| 48 | // binsx.SetEdges(30,2.,5.);
|
|---|
| 49 |
|
|---|
| 50 | Double_t xedge[10] =
|
|---|
| 51 | {2.50515, 2.69897, 2.89763, 3.09691, 3.30103, 3.49969, 3.69984, 3.89982, 4.10003, 4.29994};
|
|---|
| 52 | const TArrayD xed;
|
|---|
| 53 | xed.Set(10,xedge);
|
|---|
| 54 | binsx.SetEdges(xed);
|
|---|
| 55 |
|
|---|
| 56 | MBinning binsy("BinningTheta");
|
|---|
| 57 | const Double_t yedge[7] = {0.0, 17.5, 23.5, 29.5, 35.5, 42., 50.};
|
|---|
| 58 | const TArrayD yed;
|
|---|
| 59 | yed.Set(7,yedge);
|
|---|
| 60 | binsy.SetEdges(yed);
|
|---|
| 61 |
|
|---|
| 62 | parlist.AddToList(collarea);
|
|---|
| 63 | parlist.AddToList(&binsx);
|
|---|
| 64 | parlist.AddToList(&binsy);
|
|---|
| 65 |
|
|---|
| 66 | tasklist.AddToList(&reader);
|
|---|
| 67 |
|
|---|
| 68 | /*
|
|---|
| 69 | MF filterhadrons("HadNN.fHadronness<0.25");
|
|---|
| 70 | tasklist.AddToList(&filterhadrons);
|
|---|
| 71 | */
|
|---|
| 72 |
|
|---|
| 73 | MFillH filler("MHMcCT1CollectionArea","MMcEvt");
|
|---|
| 74 | // filler.SetFilter(&filterhadrons);
|
|---|
| 75 | tasklist.AddToList(&filler);
|
|---|
| 76 |
|
|---|
| 77 | //
|
|---|
| 78 | // set up the loop for the processing
|
|---|
| 79 | //
|
|---|
| 80 | MEvtLoop magic;
|
|---|
| 81 | magic.SetParList(&parlist);
|
|---|
| 82 |
|
|---|
| 83 | //
|
|---|
| 84 | // Start to loop over all events
|
|---|
| 85 | //
|
|---|
| 86 | MProgressBar bar;
|
|---|
| 87 | magic.SetProgressBar(&bar);
|
|---|
| 88 | if (!magic.Eventloop())
|
|---|
| 89 | return;
|
|---|
| 90 |
|
|---|
| 91 | tasklist.PrintStatistics();
|
|---|
| 92 |
|
|---|
| 93 | collarea->CalcEfficiency();
|
|---|
| 94 |
|
|---|
| 95 | //
|
|---|
| 96 | // Now the histogram we wanted to get out of the data is
|
|---|
| 97 | // filled and can be displayed
|
|---|
| 98 | //
|
|---|
| 99 | collarea->DrawClone();
|
|---|
| 100 |
|
|---|
| 101 | //
|
|---|
| 102 | // Write histogram to a file in case an output
|
|---|
| 103 | // filename has been supplied
|
|---|
| 104 | //
|
|---|
| 105 | if (outname.IsNull())
|
|---|
| 106 | return;
|
|---|
| 107 |
|
|---|
| 108 | TFile f(outname,"recreate");
|
|---|
| 109 | collarea->GetHist()->Write();
|
|---|
| 110 | collarea->GetHAll()->Write();
|
|---|
| 111 | collarea->GetHSel()->Write();
|
|---|
| 112 | f.Close();
|
|---|
| 113 | }
|
|---|
| 114 |
|
|---|