source: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsMerge.cc@ 4262

Last change on this file since 4262 was 3734, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 4.4 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 02/2004 <mailto:tbretz@astro.uni.wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MBadPixelsMerge
28// ===============
29//
30// Merges in ReInit two bad pixel containers together:
31// 1) The contents of the container given in the constructor is in ReInit
32// merged into MBadPixelsCam from the parameter list (aka run-headers)
33// 2) MBadPixelsCam from the parameter list (aka run-headers) is merged
34// into the container given in the constructor. While the contents
35// to which 1) refers are still untouched.
36//
37//
38// An explanation taken from Mantis:
39// --------------------------------
40// In my eyes everything works a supposed to do. We have different sources
41// for bad-pixels, eg from Pedestal calculation, from the calibration
42// constant calculation, manual setting and so on. If processing data we
43// have to take care of all this different sources. Therefor we have to
44// store the bad pixels from this sources (eg. from calibration). In
45// addition MBadPixelsCam is read from the file containing the data (once
46// per file). Now always after a new (data-)file has been opened the bad
47// pixels from (for example) the calibration file have to be merged into
48// the container loaded from the (data-)file which is stored in the
49// parameter list. Copying the pointer would totally overwrite the pixels
50// loaded (automatically by MReadMarsFile) from the data-file. All this is
51// done using a copy of the original MBadPixelsCam (fSource). In addition
52// fDest is initialized to the pointer given as argument to the
53// constructor. To keep track of all bad pixels the instance this pointer
54// is pointing to is used to collect all bad pixels used so far.
55//
56//
57// Input Containers:
58// MBadPixelsCam
59//
60// Output Containers:
61// MBadPixelsCam
62//
63/////////////////////////////////////////////////////////////////////////////
64#include "MBadPixelsMerge.h"
65
66#include "MLog.h"
67#include "MLogManip.h"
68
69#include "MParList.h"
70#include "MBadPixelsCam.h"
71
72ClassImp(MBadPixelsMerge);
73
74using namespace std;
75
76const TString MBadPixelsMerge::fgDefName = "MBadPixelsMerge";
77const TString MBadPixelsMerge::fgDefTitle = "Merge extra- and intra-loop pixels";
78
79// --------------------------------------------------------------------------
80//
81// Constructor. A copy of the given MBadPixelsCam is created. This copy
82// is - in ReInit - merged into the MBadPixelsCam which is found in the
83// parameter list. In addition the pointer is stored and all MBadPixelsCam
84// which are processed in ReInit are merged into this container.
85//
86MBadPixelsMerge::MBadPixelsMerge(MBadPixelsCam *bad, const char *name, const char *title)
87 : fDest(bad)
88{
89 fName = name ? name : fgDefName.Data();
90 fTitle = title ? title : fgDefTitle.Data();
91
92 fSource = new MBadPixelsCam(*bad);
93}
94
95// --------------------------------------------------------------------------
96//
97// Delete the copy of the primer MBadPixelsCam
98//
99MBadPixelsMerge::~MBadPixelsMerge()
100{
101 delete fSource;
102}
103
104// --------------------------------------------------------------------------
105//
106// 1) Get MBadPixelCam from the parameter list, if it doesn't yet exist,
107// it will be created.
108// 2) Merge MBasPixelsCam into the primer container given in the constructor
109// 3) Merge the primer container given in the constructor into MBadPixelsCam
110//
111Bool_t MBadPixelsMerge::ReInit(MParList *pList)
112{
113 MBadPixelsCam *cam = (MBadPixelsCam*)pList->FindCreateObj("MBadPixelsCam");
114 if (!cam)
115 return kFALSE;
116
117 fDest->Merge(*cam);
118 cam->Merge(*fSource);
119
120 return kTRUE;
121}
Note: See TracBrowser for help on using the repository browser.