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

Last change on this file since 972 was 967, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 2.6 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 fObjName = input ? input : "MMcTrig";
47}
48
49Bool_t MMcCollectionAreaCalc::PreProcess (MParList *pList)
50{
51 // connect the raw data with this task
52
53 fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
54 if (!fMcEvt)
55 {
56 *fLog << dbginf << "MMcEvt not found... exit." << endl;
57 return kFALSE;
58 }
59
60 fMcTrig = (MMcTrig*)pList->FindObject(fObjName);
61 if (!fMcTrig)
62 {
63 *fLog << dbginf << fObjName << " [MMcTrig] not found... exit." << endl;
64 return kFALSE;
65 }
66
67 fCollArea = (MHMcCollectionArea*)pList->FindCreateObj("MHMcCollectionArea");
68 if (!fCollArea)
69 return kFALSE;
70
71 return kTRUE;
72}
73
74Bool_t MMcCollectionAreaCalc::Process ()
75{
76 const Float_t energy = log10(fMcEvt->GetEnergy());
77 const Float_t impact = fMcEvt->GetImpact()/100.;
78
79 fCollArea->FillAll(energy, impact);
80
81 if (fMcTrig->GetFirstLevel() <= 0)
82 return kTRUE;
83
84 fCollArea->FillSel(energy, impact);
85
86 return kTRUE;
87}
88
89Bool_t MMcCollectionAreaCalc::PostProcess()
90{
91 //
92 // do the calculation of the effectiv area
93 //
94 fCollArea->CalcEfficiency();
95
96 return kTRUE;
97}
Note: See TracBrowser for help on using the repository browser.