| 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 | // Merges in ReInit two bad pixel containers together:
|
|---|
| 30 | // 1) The contents of the container given in the constructor is in ReInit
|
|---|
| 31 | // merged into MBadPixelsCam from the parameter list (aka run-headers)
|
|---|
| 32 | // 2) MBadPixelsCam from the parameter list (aka run-headers) is merged
|
|---|
| 33 | // into the container given in the constructor. While the contents
|
|---|
| 34 | // to which 1) refers are still untouched.
|
|---|
| 35 | //
|
|---|
| 36 | // Input Containers:
|
|---|
| 37 | // MBadPixelsCam
|
|---|
| 38 | //
|
|---|
| 39 | // Output Containers:
|
|---|
| 40 | // MBadPixelsCam
|
|---|
| 41 | //
|
|---|
| 42 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 43 | #include "MBadPixelsMerge.h"
|
|---|
| 44 |
|
|---|
| 45 | #include "MLog.h"
|
|---|
| 46 | #include "MLogManip.h"
|
|---|
| 47 |
|
|---|
| 48 | #include "MParList.h"
|
|---|
| 49 | #include "MBadPixelsCam.h"
|
|---|
| 50 |
|
|---|
| 51 | ClassImp(MBadPixelsMerge);
|
|---|
| 52 |
|
|---|
| 53 | using namespace std;
|
|---|
| 54 |
|
|---|
| 55 | const TString MBadPixelsMerge::fgDefName = "MBadPixelsMerge";
|
|---|
| 56 | const TString MBadPixelsMerge::fgDefTitle = "Merge extra- and intra-loop pixels";
|
|---|
| 57 |
|
|---|
| 58 | // --------------------------------------------------------------------------
|
|---|
| 59 | //
|
|---|
| 60 | // Constructor. A copy of the given MBadPixelsCam is created. This copy
|
|---|
| 61 | // is - in ReInit - merged into the MBadPixelsCam which is found in the
|
|---|
| 62 | // parameter list. In addition the pointer is stored and all MBadPixelsCam
|
|---|
| 63 | // which are processed in ReInit are merged into this container.
|
|---|
| 64 | //
|
|---|
| 65 | MBadPixelsMerge::MBadPixelsMerge(MBadPixelsCam *bad, const char *name, const char *title)
|
|---|
| 66 | : fDest(bad)
|
|---|
| 67 | {
|
|---|
| 68 | fName = name ? name : fgDefName.Data();
|
|---|
| 69 | fTitle = title ? title : fgDefTitle.Data();
|
|---|
| 70 |
|
|---|
| 71 | fSource = new MBadPixelsCam;
|
|---|
| 72 | bad->Copy(*fSource);
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 | // --------------------------------------------------------------------------
|
|---|
| 76 | //
|
|---|
| 77 | // Delete the copy of the primer MBadPixelsCam
|
|---|
| 78 | //
|
|---|
| 79 | MBadPixelsMerge::~MBadPixelsMerge()
|
|---|
| 80 | {
|
|---|
| 81 | delete fSource;
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | // --------------------------------------------------------------------------
|
|---|
| 85 | //
|
|---|
| 86 | // 1) Get MBadPixelCam from the parameter list, if it doesn't yet exist,
|
|---|
| 87 | // it will be created.
|
|---|
| 88 | // 2) Merge MBasPixelsCam into the primer container given in the constructor
|
|---|
| 89 | // 3) Merge the primer container given in the constructor into MBadPixelsCam
|
|---|
| 90 | //
|
|---|
| 91 | Bool_t MBadPixelsMerge::ReInit(MParList *pList)
|
|---|
| 92 | {
|
|---|
| 93 | MBadPixelsCam *cam = (MBadPixelsCam*)pList->FindCreateObj("MBadPixelsCam");
|
|---|
| 94 | if (!cam)
|
|---|
| 95 | return kFALSE;
|
|---|
| 96 |
|
|---|
| 97 | fDest->Merge(*cam);
|
|---|
| 98 | cam->Merge(*fSource);
|
|---|
| 99 |
|
|---|
| 100 | return kTRUE;
|
|---|
| 101 | }
|
|---|