| 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): Robert Wagner 10/2002 <mailto:magicsoft@rwagner.de>
|
|---|
| 19 | ! Copyright: MAGIC Software Development, 2000-2002
|
|---|
| 20 | !
|
|---|
| 21 | !
|
|---|
| 22 | \* ======================================================================== */
|
|---|
| 23 |
|
|---|
| 24 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 25 | // //
|
|---|
| 26 | // MHSigmabarTheta //
|
|---|
| 27 | // //
|
|---|
| 28 | // 2D-Histogram in Sigmabar and Theta //
|
|---|
| 29 | // //
|
|---|
| 30 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 31 |
|
|---|
| 32 | #include "MHSigmabarTheta.h"
|
|---|
| 33 |
|
|---|
| 34 | #include <TCanvas.h>
|
|---|
| 35 |
|
|---|
| 36 | #include <math.h>
|
|---|
| 37 |
|
|---|
| 38 | #include "MMcEvt.hxx"
|
|---|
| 39 | #include "MSigmabar.h"
|
|---|
| 40 |
|
|---|
| 41 | #include "MBinning.h"
|
|---|
| 42 | #include "MParList.h"
|
|---|
| 43 |
|
|---|
| 44 | #include "MLog.h"
|
|---|
| 45 | #include "MLogManip.h"
|
|---|
| 46 |
|
|---|
| 47 | ClassImp(MHSigmabarTheta);
|
|---|
| 48 |
|
|---|
| 49 | // --------------------------------------------------------------------------
|
|---|
| 50 | //
|
|---|
| 51 | // Default Constructor. It sets name and title of the histogram.
|
|---|
| 52 | //
|
|---|
| 53 | MHSigmabarTheta::MHSigmabarTheta(const char *name, const char *title)
|
|---|
| 54 | {
|
|---|
| 55 | //
|
|---|
| 56 | // set the name and title of this object
|
|---|
| 57 | //
|
|---|
| 58 | fName = name ? name : "MHSigmabarTheta";
|
|---|
| 59 | fTitle = title ? title : "3-D histogram in sigmabar and theta";
|
|---|
| 60 |
|
|---|
| 61 | fHist.SetDirectory(NULL);
|
|---|
| 62 |
|
|---|
| 63 | fHist.SetTitle("3D-plot of sigmabar and theta");
|
|---|
| 64 | fHist.SetXTitle("\\theta [\\circ]");
|
|---|
| 65 | fHist.SetYTitle("\\bar{\\sigma}");
|
|---|
| 66 | fHist.SetZTitle("N");
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 | // --------------------------------------------------------------------------
|
|---|
| 70 | //
|
|---|
| 71 | // Set binnings and prepare filling of the histogram
|
|---|
| 72 | //
|
|---|
| 73 | Bool_t MHSigmabarTheta::SetupFill(const MParList *plist)
|
|---|
| 74 | {
|
|---|
| 75 | fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt");
|
|---|
| 76 | if (!fMcEvt)
|
|---|
| 77 | {
|
|---|
| 78 | *fLog << err << "MMcEvt not found... aborting." << endl;
|
|---|
| 79 | return kFALSE;
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| 82 | fSigmabar = (MSigmabar*)plist->FindObject("MSigmabar");
|
|---|
| 83 | if (!fSigmabar)
|
|---|
| 84 | {
|
|---|
| 85 | *fLog << err << "MSigmabar not found... aborting." << endl;
|
|---|
| 86 | return kFALSE;
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| 89 | MBinning* binstheta = (MBinning*)plist->FindObject("BinningTheta");
|
|---|
| 90 | if (!binstheta)
|
|---|
| 91 | {
|
|---|
| 92 | *fLog << err << "BinningTheta [MBinning] not found... aborting." << endl;
|
|---|
| 93 | return kFALSE;
|
|---|
| 94 | }
|
|---|
| 95 | MBinning* binssigmabar = (MBinning*)plist->FindObject("BinningSigmabar");
|
|---|
| 96 | if (!binssigmabar)
|
|---|
| 97 | {
|
|---|
| 98 | *fLog << err << "BinningSigmabar [MBinning] not found... aborting." << endl;
|
|---|
| 99 | return kFALSE;
|
|---|
| 100 | }
|
|---|
| 101 |
|
|---|
| 102 | SetBinning(&fHist, binstheta, binssigmabar);
|
|---|
| 103 |
|
|---|
| 104 | fHist.Sumw2();
|
|---|
| 105 |
|
|---|
| 106 | return kTRUE;
|
|---|
| 107 | }
|
|---|
| 108 |
|
|---|
| 109 | // --------------------------------------------------------------------------
|
|---|
| 110 | //
|
|---|
| 111 | // Fill the histogram
|
|---|
| 112 | //
|
|---|
| 113 | Bool_t MHSigmabarTheta::Fill(const MParContainer *par, Double_t w)
|
|---|
| 114 | {
|
|---|
| 115 | fHist.Fill(fMcEvt->GetTheta()*kRad2Deg, fSigmabar->GetSigmabar());
|
|---|
| 116 | return kTRUE;
|
|---|
| 117 | }
|
|---|
| 118 |
|
|---|
| 119 | // --------------------------------------------------------------------------
|
|---|
| 120 | //
|
|---|
| 121 | // Draw the histogram
|
|---|
| 122 | //
|
|---|
| 123 | void MHSigmabarTheta::Draw(Option_t *opt)
|
|---|
| 124 | {
|
|---|
| 125 | TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
|
|---|
| 126 | pad->SetBorderMode(0);
|
|---|
| 127 |
|
|---|
| 128 | AppendPad("");
|
|---|
| 129 |
|
|---|
| 130 | fHist.Draw(opt);
|
|---|
| 131 |
|
|---|
| 132 | pad->Modified();
|
|---|
| 133 | pad->Update();
|
|---|
| 134 | }
|
|---|
| 135 |
|
|---|