| 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): Christoph Kolodziejski, 12/2004 <mailto:>
|
|---|
| 19 | ! Author(s): Thomas Bretz, 12/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
|
|---|
| 20 | !
|
|---|
| 21 | ! Copyright: MAGIC Software Development, 2004-2008
|
|---|
| 22 | !
|
|---|
| 23 | !
|
|---|
| 24 | \* ======================================================================== */
|
|---|
| 25 |
|
|---|
| 26 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 27 | //
|
|---|
| 28 | // MGeomCamMagicXT
|
|---|
| 29 | //
|
|---|
| 30 | // This class stores the geometry information of the 'extended' Magic
|
|---|
| 31 | // camera. The extended geometry has also small pixels in the outer region.
|
|---|
| 32 | // To convert MCerPhotEvt from MGeomCamMagic to MGeomCamMagicXT use
|
|---|
| 33 | // MGeomCamMagicExtend.
|
|---|
| 34 | //
|
|---|
| 35 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 36 | #include "MGeomCamMagicXT.h"
|
|---|
| 37 |
|
|---|
| 38 | #include <TMath.h>
|
|---|
| 39 |
|
|---|
| 40 | #include "MGeomPix.h"
|
|---|
| 41 |
|
|---|
| 42 | ClassImp(MGeomCamMagicXT);
|
|---|
| 43 |
|
|---|
| 44 | // --------------------------------------------------------------------------
|
|---|
| 45 | //
|
|---|
| 46 | // Magic camera has 577 pixels. For geometry and Next Neighbor info see
|
|---|
| 47 | // CreateCam and CreateNN
|
|---|
| 48 | //
|
|---|
| 49 | MGeomCamMagicXT::MGeomCamMagicXT(const char *name)
|
|---|
| 50 | : MGeomCam(1141, 17, name, "Geometry information of Magic Camera")
|
|---|
| 51 | {
|
|---|
| 52 | CreateCam();
|
|---|
| 53 | CreateNN();
|
|---|
| 54 | InitGeometry();
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | // --------------------------------------------------------------------------
|
|---|
| 58 | //
|
|---|
| 59 | // This fills the geometry information from a table into the pixel objects.
|
|---|
| 60 | //
|
|---|
| 61 | void MGeomCamMagicXT::CreateCam()
|
|---|
| 62 | {
|
|---|
| 63 | //
|
|---|
| 64 | // fill the geometry class with the coordinates of the CT1 camera
|
|---|
| 65 | //
|
|---|
| 66 | //*fLog << inf << " Create CT1 geometry " << endl;
|
|---|
| 67 |
|
|---|
| 68 | //
|
|---|
| 69 | // this algorithm is from Martin Kestel originally
|
|---|
| 70 | // it was punt into a root/C++ context by Harald Kornmayer and Thomas Bretz
|
|---|
| 71 |
|
|---|
| 72 | const Float_t diameter = 30; // units are mm
|
|---|
| 73 | const Float_t kS32 = sqrt(3)/2;
|
|---|
| 74 |
|
|---|
| 75 | //
|
|---|
| 76 | // add the first pixel to the list
|
|---|
| 77 | //
|
|---|
| 78 | Int_t pixnum = 0;
|
|---|
| 79 |
|
|---|
| 80 | (*this)[pixnum++].Set(0, 0, diameter);
|
|---|
| 81 |
|
|---|
| 82 | for (Int_t ring=1; ring<20; ring++)
|
|---|
| 83 | {
|
|---|
| 84 | //
|
|---|
| 85 | // calc. coords for this ring counting from the
|
|---|
| 86 | // starting number to the ending number
|
|---|
| 87 | //
|
|---|
| 88 | for (int i=0; i<ring; i++)
|
|---|
| 89 | (*this)[pixnum++].Set((ring-i*0.5)*diameter,
|
|---|
| 90 | i*kS32*diameter,
|
|---|
| 91 | diameter);
|
|---|
| 92 |
|
|---|
| 93 | for (int i=0; i<ring; i++)
|
|---|
| 94 | (*this)[pixnum++].Set((ring*0.5-i)*diameter,
|
|---|
| 95 | ring*kS32 * diameter,
|
|---|
| 96 | diameter);
|
|---|
| 97 |
|
|---|
| 98 | for (int i=0; i<ring; i++)
|
|---|
| 99 | (*this)[pixnum++].Set(-(ring+i)*0.5*diameter,
|
|---|
| 100 | (ring-i)*kS32*diameter,
|
|---|
| 101 | diameter);
|
|---|
| 102 |
|
|---|
| 103 | for (int i=0; i<ring; i++)
|
|---|
| 104 | (*this)[pixnum++].Set((0.5*i-ring)*diameter,
|
|---|
| 105 | -i*kS32*diameter,
|
|---|
| 106 | diameter);
|
|---|
| 107 |
|
|---|
| 108 | for (int i=0; i<ring; i++)
|
|---|
| 109 | (*this)[pixnum++].Set((i-ring*0.5)*diameter,
|
|---|
| 110 | -ring*kS32 * diameter,
|
|---|
| 111 | diameter);
|
|---|
| 112 |
|
|---|
| 113 | for (int i=0; i<ring; i++)
|
|---|
| 114 | (*this)[pixnum++].Set((ring+i)*0.5*diameter,
|
|---|
| 115 | (-ring+i)*kS32*diameter,
|
|---|
| 116 | diameter);
|
|---|
| 117 | }
|
|---|
| 118 | }
|
|---|
| 119 |
|
|---|
| 120 | // --------------------------------------------------------------------------
|
|---|
| 121 | //
|
|---|
| 122 | // This fills the next neighbor information from a table into the pixel
|
|---|
| 123 | // objects.
|
|---|
| 124 | //
|
|---|
| 125 | void MGeomCamMagicXT::CreateNN()
|
|---|
| 126 | {
|
|---|
| 127 | Int_t pos = 0;
|
|---|
| 128 |
|
|---|
| 129 | const Short_t nn[7][6] = { // Neighbors of #
|
|---|
| 130 | { 1, 2, 3, 4, 5, 6}, // 0
|
|---|
| 131 | { 0, 2, 6, 7, 8, 18},
|
|---|
| 132 | { 0, 1, 3, 8, 9, 10},
|
|---|
| 133 | { 0, 2, 4, 10, 11, 12},
|
|---|
| 134 | { 0, 3, 5, 12, 13, 14},
|
|---|
| 135 | { 0, 4, 6, 14, 15, 16},
|
|---|
| 136 | { 0, 1, 5, 16, 17, 18}
|
|---|
| 137 | };
|
|---|
| 138 |
|
|---|
| 139 | for (Int_t i=0; i<7; i++)
|
|---|
| 140 | (*this)[pos++].SetNeighbors(nn[i][0], nn[i][1], nn[i][2],
|
|---|
| 141 | nn[i][3], nn[i][4], nn[i][5]);
|
|---|
| 142 |
|
|---|
| 143 | for (Int_t ring=2; ring<20; ring++)
|
|---|
| 144 | {
|
|---|
| 145 | for (Int_t s=0; s<6; s++)
|
|---|
| 146 | {
|
|---|
| 147 | for (int i=pos; i<ring+pos; i++)
|
|---|
| 148 | {
|
|---|
| 149 | Int_t n[6], idx[6];
|
|---|
| 150 |
|
|---|
| 151 | n[0] = i==pos&&s==0 ? i+6*ring : i-1; // vor
|
|---|
| 152 | n[1] = i==ring+pos-1&&s==5 ? i-12*(ring-1)-5 : i+1; // danach
|
|---|
| 153 | n[2] = i==pos ? i+6*ring-1+s : i-6*(ring-1)-s; // ring- groesser
|
|---|
| 154 | n[3] = i==pos ? i-6*(ring-1)-s : i-6*(ring-1)-1-s; // ring- kleiner
|
|---|
| 155 | n[4] = i==pos&&s==0 ? i+12*ring+5 : i+6*ring+s; // ring+ kleiner
|
|---|
| 156 | n[5] = i+6*ring+1+s; // ring+ groesser
|
|---|
| 157 |
|
|---|
| 158 | if (n[0]>1140)
|
|---|
| 159 | n[0] = -1;
|
|---|
| 160 | if (n[1]>1140)
|
|---|
| 161 | n[1] = -1;
|
|---|
| 162 | if (n[2]>1140)
|
|---|
| 163 | n[2] = -1;
|
|---|
| 164 | if (n[3]>1140)
|
|---|
| 165 | n[3] = -1;
|
|---|
| 166 | if (n[4]>1140)
|
|---|
| 167 | n[4] = -1;
|
|---|
| 168 | if (n[5]>1140)
|
|---|
| 169 | n[5] = -1;
|
|---|
| 170 |
|
|---|
| 171 | TMath::Sort(6, n, idx);
|
|---|
| 172 |
|
|---|
| 173 | (*this)[i].SetNeighbors(n[idx[0]],
|
|---|
| 174 | n[idx[1]],
|
|---|
| 175 | n[idx[2]],
|
|---|
| 176 | n[idx[3]],
|
|---|
| 177 | n[idx[4]],
|
|---|
| 178 | n[idx[5]]);
|
|---|
| 179 | }
|
|---|
| 180 |
|
|---|
| 181 | pos += ring;
|
|---|
| 182 | }
|
|---|
| 183 | }
|
|---|
| 184 | }
|
|---|