source: trunk/MagicSoft/Mars/manalysis/MSigmabarCalc.cc@ 1957

Last change on this file since 1957 was 1951, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 5.2 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): Robert Wagner, 10/2002 <rwagner@mppmu.mpg.de>
19! Author(s): Thomas Bretz, 4/2003 <tbretz@astro.uni-wuerzburg.de>
20!
21! Copyright: MAGIC Software Development, 2000-2003
22!
23!
24\* ======================================================================== */
25
26/////////////////////////////////////////////////////////////////////////////
27// //
28// MSigmabarCalc //
29// //
30// This task calculates Sigmabar using the MSigmabar container and stores //
31// its extremal values together with the corresponding Theta values //
32// in MSigmabarParam. For the time being, Theta is taken from a Monte //
33// Carlo container. This is preliminary and to be changed ASAP. //
34// //
35/////////////////////////////////////////////////////////////////////////////
36#include "MSigmabarCalc.h"
37
38#include "MLog.h"
39#include "MLogManip.h"
40
41#include "MParList.h"
42
43#include "MGeomCam.h"
44#include "MPedestalCam.h"
45
46#include "MSigmabar.h"
47#include "MSigmabarParam.h"
48
49#include "MMcEvt.hxx"
50
51ClassImp(MSigmabarCalc);
52
53// --------------------------------------------------------------------------
54//
55// Default constructor.
56//
57MSigmabarCalc::MSigmabarCalc(const char *name, const char *title)
58{
59 fName = name ? name : "MSigmabarCalc";
60 fTitle = title ? title : "Task to calculate Sigmabar";
61
62 Reset();
63}
64
65MSigmabarCalc::~MSigmabarCalc()
66{
67 // nothing special yet.
68}
69
70// --------------------------------------------------------------------------
71//
72// check if necessary containers exists in the Parameter list already.
73// if not create one and add them to the list
74//
75Bool_t MSigmabarCalc::PreProcess(MParList *pList)
76{
77 fCam = (MGeomCam*)pList->FindObject("MGeomCam");
78 if (!fCam)
79 {
80 *fLog << err << "MGeomCam not found (no geometry information available)... aborting." << endl;
81 return kFALSE;
82 }
83
84 fPed = (MPedestalCam*)pList->FindObject("MPedestalCam");
85 if (!fPed)
86 {
87 *fLog << err << "MPedestalCam not found... aborting." << endl;
88 return kFALSE;
89 }
90
91 fSig = (MSigmabar*)pList->FindCreateObj("MSigmabar");
92 if (!fSig)
93 {
94 *fLog << err << "MSigmabar not found... aborting." << endl;
95 return kFALSE;
96 }
97
98 fSigParam = (MSigmabarParam*)pList->FindCreateObj("MSigmabarParam");
99 if (!fSigParam)
100 {
101 *fLog << err << "MSigmabarParam not found... aborting." << endl;
102 return kFALSE;
103 }
104
105 fRun = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
106 if (!fRun)
107 {
108 *fLog << err << "MRawRunHeader not found... aborting." << endl;
109 return kFALSE;
110 }
111
112 // This is needed for determining min/max Theta
113 fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
114 if (!fMcEvt)
115 {
116 *fLog << err << "MMcEvt not found... aborting." << endl;
117 return kFALSE;
118 }
119
120 fEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
121 if (!fEvt)
122 {
123 *fLog << err << "MCerPhotEvt not found... aborting." << endl;
124 return kFALSE;
125 }
126
127 return kTRUE;
128}
129
130// --------------------------------------------------------------------------
131//
132// Calculating a new Sigmabar is not necessary on event basis as long as
133// we deal with CT1 data. Therefore, the real calculation is done in
134// the ReInit function. Process just takes care for finding the extremal
135// values. Preliminary.
136//
137Bool_t MSigmabarCalc::Process()
138{
139 const Double_t rc = fSig->Calc(*fCam, *fPed, *fEvt);
140
141 fSigmabarMax = TMath::Max(rc, fSigmabarMax);
142 fSigmabarMin = TMath::Min(rc, fSigmabarMin);
143
144 const Double_t theta = fMcEvt->GetTelescopeTheta()*kRad2Deg;
145
146 fThetaMax = TMath::Max(theta, fThetaMax);
147 fThetaMin = TMath::Min(theta, fThetaMin);
148
149 return kTRUE;
150}
151
152// --------------------------------------------------------------------------
153//
154// Calculates Sigmabar (for CT1 only needed at Reinit, i.e. when reading
155// a new file)
156//
157Bool_t MSigmabarCalc::ReInit(MParList *pList)
158{
159 fSigParam->SetParams(1, fSigmabarMin, fSigmabarMax, fThetaMin, fThetaMax);
160 fSigParam->SetRunNumber(fRun->GetRunNumber());
161
162 Reset();
163
164 return kTRUE;
165}
166
167void MSigmabarCalc::Reset()
168{
169 fThetaMin = 200; // there must be a function which gives me the hightest
170 fThetaMax = 0; // value allowed for a certain type!
171 fSigmabarMin = 200;
172 fSigmabarMax = 0;
173}
174
Note: See TracBrowser for help on using the repository browser.