| 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): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de)
|
|---|
| 19 | ! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)
|
|---|
| 20 | !
|
|---|
| 21 | ! Copyright: MAGIC Software Development, 2000-2001
|
|---|
| 22 | !
|
|---|
| 23 | !
|
|---|
| 24 | \* ======================================================================== */
|
|---|
| 25 |
|
|---|
| 26 | #include "MCollAreaTrigger.h"
|
|---|
| 27 |
|
|---|
| 28 | #include "MLog.h"
|
|---|
| 29 | #include "MLogManip.h"
|
|---|
| 30 | #include "MParList.h"
|
|---|
| 31 |
|
|---|
| 32 | #include "MCollArea.h"
|
|---|
| 33 | #include "MMcEvt.hxx"
|
|---|
| 34 | #include "MMcTrig.hxx"
|
|---|
| 35 |
|
|---|
| 36 | ClassImp(MCollAreaTrigger)
|
|---|
| 37 |
|
|---|
| 38 | MCollAreaTrigger::MCollAreaTrigger (const char *name, const char *title)
|
|---|
| 39 | {
|
|---|
| 40 | *fName = name ? name : "MCollAreaTrigger";
|
|---|
| 41 | *fTitle = title ? title : "Task to calc the collection area ";
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 | Bool_t MCollAreaTrigger::PreProcess (MParList *pList)
|
|---|
| 46 | {
|
|---|
| 47 | // connect the raw data with this task
|
|---|
| 48 |
|
|---|
| 49 | fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt") ;
|
|---|
| 50 | if (!fMcEvt) {
|
|---|
| 51 | *fLog << dbginf << "MMcEvt not found... exit." << endl;
|
|---|
| 52 | return kFALSE;
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | fMcTrig = (MMcTrig*)pList->FindObject("MMcTrig") ;
|
|---|
| 56 | if (!fMcTrig) {
|
|---|
| 57 | *fLog << dbginf << "MMcTrig not found... exit." << endl;
|
|---|
| 58 | return kFALSE;
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | fCollArea = (MCollArea*)pList->FindCreateObj("MCollArea") ;
|
|---|
| 62 | if (!fCollArea)
|
|---|
| 63 | return kFALSE;
|
|---|
| 64 |
|
|---|
| 65 | return kTRUE ;
|
|---|
| 66 |
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 | Bool_t MCollAreaTrigger::Process ()
|
|---|
| 71 | {
|
|---|
| 72 | const Float_t energy = log10(fMcEvt->GetEnergy());
|
|---|
| 73 | const Float_t impact = fMcEvt->GetImpact()/100.;
|
|---|
| 74 |
|
|---|
| 75 | fCollArea->FillAll(energy, impact);
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 | if (fMcTrig->GetFirstLevel() <= 0)
|
|---|
| 79 | return kTRUE;
|
|---|
| 80 |
|
|---|
| 81 | fCollArea->FillSel(energy, impact);
|
|---|
| 82 |
|
|---|
| 83 | return kTRUE ;
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|
| 86 | Bool_t MCollAreaTrigger::PostProcess ()
|
|---|
| 87 | {
|
|---|
| 88 | //
|
|---|
| 89 | // do the calculation of the effectiv area
|
|---|
| 90 | //
|
|---|
| 91 |
|
|---|
| 92 | fCollArea->CalcEfficiency() ;
|
|---|
| 93 |
|
|---|
| 94 | return kTRUE ;
|
|---|
| 95 | }
|
|---|