source: trunk/MagicSoft/Mars/mmontecarlo/MMcCollectionAreaCalc.cc@ 1038

Last change on this file since 1038 was 1007, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 2.8 KB
Line 
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! Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)
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
38ClassImp(MMcCollectionAreaCalc);
39
40MMcCollectionAreaCalc::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 if (input)
47 {
48 fObjName = input;
49 AddToBranchList(Form("%s.fNumFirstLevel", input));
50 }
51 else
52 {
53 fObjName = "MMcTrig";
54 AddToBranchList("fNumFirstLevel");
55 }
56
57 AddToBranchList("fEnergy");
58 AddToBranchList("fImpact");
59}
60
61Bool_t MMcCollectionAreaCalc::PreProcess (MParList *pList)
62{
63 // connect the raw data with this task
64
65 fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
66 if (!fMcEvt)
67 {
68 *fLog << dbginf << "MMcEvt not found... exit." << endl;
69 return kFALSE;
70 }
71
72 fMcTrig = (MMcTrig*)pList->FindObject(fObjName);
73 if (!fMcTrig)
74 {
75 *fLog << dbginf << fObjName << " [MMcTrig] not found... exit." << endl;
76 return kFALSE;
77 }
78
79 fCollArea = (MHMcCollectionArea*)pList->FindCreateObj("MHMcCollectionArea");
80 if (!fCollArea)
81 return kFALSE;
82
83 return kTRUE;
84}
85
86Bool_t MMcCollectionAreaCalc::Process()
87{
88 const Float_t energy = fMcEvt->GetEnergy();
89 const Float_t impact = fMcEvt->GetImpact()/100.;
90
91 fCollArea->FillAll(energy, impact);
92
93 if (fMcTrig->GetFirstLevel() <= 0)
94 return kTRUE;
95
96 fCollArea->FillSel(energy, impact);
97
98 return kTRUE;
99}
100
101Bool_t MMcCollectionAreaCalc::PostProcess()
102{
103 //
104 // do the calculation of the effectiv area
105 //
106 fCollArea->CalcEfficiency();
107
108 return kTRUE;
109}
Note: See TracBrowser for help on using the repository browser.