source: trunk/MagicSoft/Mars/manalysis/MGeomApply.cc@ 2419

Last change on this file since 2419 was 2380, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 3.9 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): Thomas Bretz, 09/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24
25//////////////////////////////////////////////////////////////////////////////
26//
27// MGeomApply
28//
29// Applies the geometry to geometry dependant containers.
30//
31// It changes the size of the arrays in the containers to a size
32// matching the number of pixels, eg:
33//
34// MPedestalCam
35// MBlindPixels
36//
37// It uses the geometry (MGeomCam) found in the parameter list.
38// If it is not found the task tries to create the geometry
39// specified in the constructor. The default geometry is
40// MGeomCamMagic.
41//
42// Input Containers:
43// [MGeomCam]
44//
45// Output Containers:
46// MPedestalCam, MBlindPixels
47//
48//////////////////////////////////////////////////////////////////////////////
49#include "MGeomApply.h"
50
51#include "MLog.h"
52#include "MLogManip.h"
53
54#include "MParList.h"
55
56#include "MGeomCam.h"
57#include "MPedestalCam.h"
58#include "MBlindPixels.h"
59
60ClassImp(MGeomApply);
61
62using namespace std;
63
64// --------------------------------------------------------------------------
65//
66// Default constructor. MGeomCamMagic is the default geometry.
67//
68MGeomApply::MGeomApply(const char *name, const char *title) : fGeomName("MGeomCamMagic")
69{
70 fName = name ? name : "MGeomApply";
71 fTitle = title ? title : "Task to apply geometry settings";
72}
73
74// --------------------------------------------------------------------------
75//
76// Give the name of the geometry you want to have, eg. MGeomCamCT1
77//
78MGeomApply::MGeomApply(const TString cam, const char *name, const char *title) : fGeomName(cam)
79{
80 fName = name ? name : "MGeomApply";
81 fTitle = title ? title : "Task to apply geometry settings";
82}
83
84// --------------------------------------------------------------------------
85//
86// Try to find 'MGeomCam' in the Parameter List. If it is not found,
87// try to create a fGeomName object.
88//
89Int_t MGeomApply::PreProcess(MParList *pList)
90{
91 MGeomCam *cam = (MGeomCam*)pList->FindObject("MGeomCam");
92 if (cam)
93 return kTRUE;
94
95 cam = (MGeomCam*)pList->FindCreateObj(fGeomName, "MGeomCam");
96
97 return cam ? kTRUE : kFALSE;
98}
99
100// --------------------------------------------------------------------------
101//
102// Try to find 'MGeomCam' in the Parameter List. If it is not found,
103// processing is stopped.
104//
105// The size of MPedestalCam and MBlindPixels is set accordingly.
106//
107Bool_t MGeomApply::ReInit(MParList *pList)
108{
109 MGeomCam *cam = (MGeomCam*)pList->FindObject("MGeomCam");
110 if (!cam)
111 {
112 *fLog << err << GetDescriptor() << ": No MGeomCam found... aborting." << endl;
113 return kFALSE;
114 }
115
116 MPedestalCam *ped = (MPedestalCam*)pList->FindObject("MPedestalCam");
117 if (ped)
118 ped->InitSize(cam->GetNumPixels());
119
120 MBlindPixels *bnd = (MBlindPixels*)pList->FindObject("MBlindPixels");
121 if (bnd)
122 bnd->InitSize(cam->GetNumPixels());
123
124 return kTRUE;
125}
Note: See TracBrowser for help on using the repository browser.