source: releases/Mars.2014.05.26/mbadpixels/MBadPixelsMerge.cc@ 20115

Last change on this file since 20115 was 4368, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 4.5 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// ToDo:
58// - Take a setup file (ReadEnv-implementation) as input
59//
60//
61// Input Containers:
62// MBadPixelsCam
63//
64// Output Containers:
65// MBadPixelsCam
66//
67/////////////////////////////////////////////////////////////////////////////
68#include "MBadPixelsMerge.h"
69
70#include "MLog.h"
71#include "MLogManip.h"
72
73#include "MParList.h"
74#include "MBadPixelsCam.h"
75
76ClassImp(MBadPixelsMerge);
77
78using namespace std;
79
80const TString MBadPixelsMerge::fgDefName = "MBadPixelsMerge";
81const TString MBadPixelsMerge::fgDefTitle = "Merge extra- and intra-loop pixels";
82
83// --------------------------------------------------------------------------
84//
85// Constructor. A copy of the given MBadPixelsCam is created. This copy
86// is - in ReInit - merged into the MBadPixelsCam which is found in the
87// parameter list. In addition the pointer is stored and all MBadPixelsCam
88// which are processed in ReInit are merged into this container.
89//
90MBadPixelsMerge::MBadPixelsMerge(MBadPixelsCam *bad, const char *name, const char *title)
91 : fDest(bad)
92{
93 fName = name ? name : fgDefName.Data();
94 fTitle = title ? title : fgDefTitle.Data();
95
96 fSource = new MBadPixelsCam(*bad);
97}
98
99// --------------------------------------------------------------------------
100//
101// Delete the copy of the primer MBadPixelsCam
102//
103MBadPixelsMerge::~MBadPixelsMerge()
104{
105 delete fSource;
106}
107
108// --------------------------------------------------------------------------
109//
110// 1) Get MBadPixelCam from the parameter list, if it doesn't yet exist,
111// it will be created.
112// 2) Merge MBasPixelsCam into the primer container given in the constructor
113// 3) Merge the primer container given in the constructor into MBadPixelsCam
114//
115Bool_t MBadPixelsMerge::ReInit(MParList *pList)
116{
117 MBadPixelsCam *cam = (MBadPixelsCam*)pList->FindCreateObj("MBadPixelsCam");
118 if (!cam)
119 return kFALSE;
120
121 fDest->Merge(*cam);
122 cam->Merge(*fSource);
123
124 return kTRUE;
125}
Note: See TracBrowser for help on using the repository browser.