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