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

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