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): Oscar Blanch 12/2001 <mailto:blanch@ifae.es>
|
---|
19 | ! Author(s): Thomas Bretz 08/2002 <mailto:tbretz@astro.uni.wuerzburg.de>
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 |
|
---|
26 | /////////////////////////////////////////////////////////////////////////////
|
---|
27 | //
|
---|
28 | // MMcBadPixelsSet
|
---|
29 | //
|
---|
30 | // This task tries to identify the starfield from the
|
---|
31 | // MMcRunHeader container and tries to identifies it. If it is known
|
---|
32 | // (eg. Crab) the fixed build in pixel numbers are used as blind
|
---|
33 | // pixels.
|
---|
34 | //
|
---|
35 | // Implemented star fields (for the MAGIC camera only):
|
---|
36 | // - Crab: 400, 401, 402, 437, 438, 439
|
---|
37 | //
|
---|
38 | // Input Containers:
|
---|
39 | // -/-
|
---|
40 | //
|
---|
41 | // Output Containers:
|
---|
42 | // MBadPixels
|
---|
43 | //
|
---|
44 | /////////////////////////////////////////////////////////////////////////////
|
---|
45 | #include "MMcBadPixelsSet.h"
|
---|
46 |
|
---|
47 | #include "MLog.h"
|
---|
48 | #include "MLogManip.h"
|
---|
49 |
|
---|
50 | #include "MParList.h"
|
---|
51 |
|
---|
52 | #include "MGeomCam.h"
|
---|
53 | #include "MMcRunHeader.hxx"
|
---|
54 |
|
---|
55 | #include "MBadPixelsCam.h"
|
---|
56 | #include "MBadPixelsPix.h"
|
---|
57 |
|
---|
58 | ClassImp(MMcBadPixelsSet);
|
---|
59 |
|
---|
60 | using namespace std;
|
---|
61 |
|
---|
62 | static const TString gsDefName = "MMcBadPixelsSet";
|
---|
63 | static const TString gsDefTitle = "Set predefined star fields";
|
---|
64 |
|
---|
65 | // --------------------------------------------------------------------------
|
---|
66 | //
|
---|
67 | // Default constructor.
|
---|
68 | //
|
---|
69 | MMcBadPixelsSet::MMcBadPixelsSet(const char *name, const char *title)
|
---|
70 | {
|
---|
71 | fName = name ? name : gsDefName.Data();
|
---|
72 | fTitle = title ? title : gsDefTitle.Data();
|
---|
73 | }
|
---|
74 |
|
---|
75 | // --------------------------------------------------------------------------
|
---|
76 | //
|
---|
77 | Int_t MMcBadPixelsSet::PreProcess (MParList *pList)
|
---|
78 | {
|
---|
79 | fBadPixels = (MBadPixelsCam*)pList->FindCreateObj(AddSerialNumber("MBadPixelsCam"));
|
---|
80 | if (!fBadPixels)
|
---|
81 | return kFALSE;
|
---|
82 |
|
---|
83 | fGeomCam = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam"));
|
---|
84 | if (!fGeomCam)
|
---|
85 | {
|
---|
86 | *fLog << err << dbginf << "MGeomCam not found... aborting." << endl;
|
---|
87 | return kFALSE;
|
---|
88 | }
|
---|
89 |
|
---|
90 | return kTRUE;
|
---|
91 | }
|
---|
92 |
|
---|
93 | // --------------------------------------------------------------------------
|
---|
94 | //
|
---|
95 | // - Check whether pixels to disable are available. If pixels are
|
---|
96 | // given by the user nothing more is done.
|
---|
97 | // - Otherwise try to determin the blind pixels from the starfield
|
---|
98 | // given in MMcRunHeader.
|
---|
99 | //
|
---|
100 | Bool_t MMcBadPixelsSet::ReInit(MParList *pList)
|
---|
101 | {
|
---|
102 | if (!fGeomCam->InheritsFrom("MGeomCamMagic"))
|
---|
103 | {
|
---|
104 | *fLog << warn << "MMcBadPixelsSet::ReInit: Warning - Starfield only implemented for Magic standard Camera... no action." << endl;
|
---|
105 | return kTRUE;
|
---|
106 | }
|
---|
107 |
|
---|
108 | //
|
---|
109 | // Set as blind some particular pixels because of a particular
|
---|
110 | // Star Field of View.
|
---|
111 | //
|
---|
112 | MMcRunHeader *mcrun = (MMcRunHeader*)pList->FindObject("MMcRunHeader");
|
---|
113 | if (!mcrun)
|
---|
114 | {
|
---|
115 | *fLog << warn << "MMcBadPixelsSet::ReInit: Warning - No run header available... no action." << endl;
|
---|
116 | return kTRUE;
|
---|
117 | }
|
---|
118 |
|
---|
119 | Int_t rah, ram, ras;
|
---|
120 | Int_t ded, dem, des;
|
---|
121 | mcrun->GetStarFieldRa(&rah, &ram, &ras);
|
---|
122 | mcrun->GetStarFieldDec(&ded, &dem, &des);
|
---|
123 |
|
---|
124 | if (rah!=5 || ram!=34 || ras!=32 || ded!=22 || dem!=0 || des!=55)
|
---|
125 | {
|
---|
126 | *fLog << warn << "Warning - Starfield unknown..." << endl;
|
---|
127 | return kTRUE;
|
---|
128 | }
|
---|
129 |
|
---|
130 | //
|
---|
131 | // Case for Crab Nebula FOV
|
---|
132 | //
|
---|
133 | (*fBadPixels)[400].SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
|
---|
134 | (*fBadPixels)[401].SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
|
---|
135 | (*fBadPixels)[402].SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
|
---|
136 | (*fBadPixels)[437].SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
|
---|
137 | (*fBadPixels)[438].SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
|
---|
138 | (*fBadPixels)[439].SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
|
---|
139 |
|
---|
140 | *fLog << inf;
|
---|
141 | *fLog << "FOV is centered at CRAB NEBULA: Setting 6 blind pixels" << endl;
|
---|
142 | *fLog << "to avoid bias values of analysis due to CRAB NEBULA:" << endl;
|
---|
143 | *fLog << " Pixels: 400, 401, 402, 437, 438, 439" << endl;
|
---|
144 |
|
---|
145 | return kTRUE;
|
---|
146 | }
|
---|
147 |
|
---|