| 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): Wolfgang Wittek 04/2003 <mailto:wittek@mppmu.mpg.de>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2003
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | // //
|
|---|
| 27 | // MFCT1SelFinal //
|
|---|
| 28 | // //
|
|---|
| 29 | // This is a class to evaluate the Final Cuts //
|
|---|
| 30 | // (these cuts define the final sample of gammas; //
|
|---|
| 31 | // relevant for the calculation of the effective collection areas) //
|
|---|
| 32 | // //
|
|---|
| 33 | // to be called after the calculation of the hadroness //
|
|---|
| 34 | // //
|
|---|
| 35 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 36 |
|
|---|
| 37 | #include "math.h"
|
|---|
| 38 | #include "MFCT1SelFinal.h"
|
|---|
| 39 |
|
|---|
| 40 | #include "MParList.h"
|
|---|
| 41 |
|
|---|
| 42 | #include "MHillas.h"
|
|---|
| 43 | #include "MHillasExt.h"
|
|---|
| 44 | #include "MHillasSrc.h"
|
|---|
| 45 | #include "MCerPhotEvt.h"
|
|---|
| 46 | #include "MMcEvt.hxx"
|
|---|
| 47 | #include "MGeomCam.h"
|
|---|
| 48 | #include "MGeomPix.h"
|
|---|
| 49 | #include "MHadronness.h"
|
|---|
| 50 |
|
|---|
| 51 | #include "MLog.h"
|
|---|
| 52 | #include "MLogManip.h"
|
|---|
| 53 |
|
|---|
| 54 | ClassImp(MFCT1SelFinal);
|
|---|
| 55 |
|
|---|
| 56 | // --------------------------------------------------------------------------
|
|---|
| 57 | //
|
|---|
| 58 | // Default constructor.
|
|---|
| 59 | //
|
|---|
| 60 | MFCT1SelFinal::MFCT1SelFinal(const char *HilName, const char *HilSrcName,
|
|---|
| 61 | const char *name, const char *title)
|
|---|
| 62 | {
|
|---|
| 63 | fName = name ? name : "MFCT1SelFinal";
|
|---|
| 64 | fTitle = title ? title : "Class to evaluate the Final Cuts";
|
|---|
| 65 |
|
|---|
| 66 | fHilName = HilName;
|
|---|
| 67 | fHilSrcName = HilSrcName;
|
|---|
| 68 | fHadronnessName = "MHadronness";
|
|---|
| 69 |
|
|---|
| 70 | // default values of cuts
|
|---|
| 71 | SetCuts(1.0, 100.0);
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | // --------------------------------------------------------------------------
|
|---|
| 75 | //
|
|---|
| 76 | // Set cut values
|
|---|
| 77 | //
|
|---|
| 78 | //
|
|---|
| 79 | void MFCT1SelFinal::SetCuts(Float_t hadmax, Float_t alphamax)
|
|---|
| 80 | {
|
|---|
| 81 | fHadronnessMax = hadmax;
|
|---|
| 82 | fAlphaMax = alphamax;
|
|---|
| 83 |
|
|---|
| 84 | *fLog << inf << "MFCT1SelFinal cut values : fHadronnessMax, fAlphaMax = "
|
|---|
| 85 | << fHadronnessMax << ", " << fAlphaMax << endl;
|
|---|
| 86 | }
|
|---|
| 87 |
|
|---|
| 88 | // --------------------------------------------------------------------------
|
|---|
| 89 | //
|
|---|
| 90 | // Set the pointers
|
|---|
| 91 | //
|
|---|
| 92 | //
|
|---|
| 93 | Bool_t MFCT1SelFinal::PreProcess(MParList *pList)
|
|---|
| 94 | {
|
|---|
| 95 | fHil = (MHillasExt*)pList->FindObject(fHilName, "MHillasExt");
|
|---|
| 96 | if (!fHil)
|
|---|
| 97 | {
|
|---|
| 98 | *fLog << dbginf << "MHillasExt object " << fHilName << " not found... aborting." << endl;
|
|---|
| 99 | return kFALSE;
|
|---|
| 100 | }
|
|---|
| 101 |
|
|---|
| 102 | fHilSrc = (MHillasSrc*)pList->FindObject(fHilSrcName, "MHillasSrc");
|
|---|
| 103 | if (!fHilSrc)
|
|---|
| 104 | {
|
|---|
| 105 | *fLog << dbginf << "MHillasSrc object " << fHilSrcName << " not found... aborting." << endl;
|
|---|
| 106 | return kFALSE;
|
|---|
| 107 | }
|
|---|
| 108 |
|
|---|
| 109 | fHadronness = (MHadronness*)pList->FindObject(fHadronnessName, "MHadronness");
|
|---|
| 110 | if (!fHadronness)
|
|---|
| 111 | {
|
|---|
| 112 | *fLog << dbginf << "MHadronness not found... aborting." << endl;
|
|---|
| 113 | return kFALSE;
|
|---|
| 114 | }
|
|---|
| 115 |
|
|---|
| 116 | fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
|
|---|
| 117 | if (!fMcEvt)
|
|---|
| 118 | {
|
|---|
| 119 | *fLog << dbginf << "MMcEvt not found... aborting." << endl;
|
|---|
| 120 | return kFALSE;
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | memset(fCut, 0, sizeof(fCut));
|
|---|
| 124 |
|
|---|
| 125 | return kTRUE;
|
|---|
| 126 | }
|
|---|
| 127 |
|
|---|
| 128 | // --------------------------------------------------------------------------
|
|---|
| 129 | //
|
|---|
| 130 | // Evaluate final cuts
|
|---|
| 131 | //
|
|---|
| 132 | // if cuts are fulfilled set fResult = kTRUE
|
|---|
| 133 | //
|
|---|
| 134 | Bool_t MFCT1SelFinal::Process()
|
|---|
| 135 | {
|
|---|
| 136 | Int_t rc = 0;
|
|---|
| 137 | fResult = kFALSE;
|
|---|
| 138 |
|
|---|
| 139 | Double_t modalpha = fabs( fHilSrc->GetAlpha() );
|
|---|
| 140 |
|
|---|
| 141 | Double_t h = fHadronness->GetHadronness();
|
|---|
| 142 |
|
|---|
| 143 | if ( h>fHadronnessMax )
|
|---|
| 144 | {
|
|---|
| 145 | rc = 1;
|
|---|
| 146 | fResult = kTRUE;
|
|---|
| 147 | }
|
|---|
| 148 |
|
|---|
| 149 | else if ( modalpha > fAlphaMax )
|
|---|
| 150 | {
|
|---|
| 151 | rc = 2;
|
|---|
| 152 | fResult = kTRUE;
|
|---|
| 153 | }
|
|---|
| 154 |
|
|---|
| 155 | fCut[rc]++;
|
|---|
| 156 |
|
|---|
| 157 | return kTRUE;
|
|---|
| 158 | }
|
|---|
| 159 |
|
|---|
| 160 | // --------------------------------------------------------------------------
|
|---|
| 161 | //
|
|---|
| 162 | // Prints some statistics about the Final selections.
|
|---|
| 163 | //
|
|---|
| 164 | Bool_t MFCT1SelFinal::PostProcess()
|
|---|
| 165 | {
|
|---|
| 166 | if (GetNumExecutions()==0)
|
|---|
| 167 | return kTRUE;
|
|---|
| 168 |
|
|---|
| 169 | *fLog << inf << endl;
|
|---|
| 170 | *fLog << GetDescriptor() << " execution statistics:" << endl;
|
|---|
| 171 | *fLog << dec << setfill(' ');
|
|---|
| 172 | *fLog << " " << setw(7) << fCut[1] << " (" << setw(3)
|
|---|
| 173 | << (int)(fCut[1]*100/GetNumExecutions())
|
|---|
| 174 | << "%) Evts skipped due to: hadronness > "<< fHadronnessMax
|
|---|
| 175 | << " (hadronness from '" << fHadronnessName << "')" << endl;
|
|---|
| 176 |
|
|---|
| 177 | *fLog << " " << setw(7) << fCut[2] << " (" << setw(3)
|
|---|
| 178 | << (int)(fCut[2]*100/GetNumExecutions())
|
|---|
| 179 | << "%) Evts skipped due to: |ALPHA| > " << fAlphaMax
|
|---|
| 180 | << " [degrees]" << endl;
|
|---|
| 181 |
|
|---|
| 182 | *fLog << " " << fCut[0] << " ("
|
|---|
| 183 | << (int)(fCut[0]*100/GetNumExecutions())
|
|---|
| 184 | << "%) Evts survived Final selections!" << endl;
|
|---|
| 185 | *fLog << endl;
|
|---|
| 186 |
|
|---|
| 187 | return kTRUE;
|
|---|
| 188 | }
|
|---|