source: trunk/MagicSoft/Mars/mgeom/MGeomCamFact.cc@ 9464

Last change on this file since 9464 was 9464, checked in by tbretz, 15 years ago
*** empty log message ***
File size: 5.0 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of CheObs, the Modular 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 appears 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 06/2009 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2009
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MGeomCamFact
28//
29// This class stores the geometry information of the Fact camera.
30// MGeomCamFact cam;
31//
32// The idea is to have always four rectangular shaped pixels in
33// a rectangle, but the rectangles orderes such that the structure
34// is a closed package (hexagonal) structure. The rectangles are
35// created in width and hight such that this hexagonal structure can be
36// maintained.
37//
38////////////////////////////////////////////////////////////////////////////
39#include "MGeomCamFact.h"
40
41#include <iostream>
42
43#include <TMath.h>
44#include <TArrayI.h>
45
46#include "MGeomCamDwarf.h"
47#include "MGeomRectangle.h"
48#include "MGeomPix.h"
49
50ClassImp(MGeomCamFact);
51
52using namespace std;
53
54// --------------------------------------------------------------------------
55//
56// Default Fact camera
57//
58MGeomCamFact::MGeomCamFact(const char *name)
59 : MGeomCam(0, 4.8887, name, "Geometry information of Fact Camera")
60{
61 CreateGeometry(MGeomCamDwarf(209.5, 13.2, 4.8887));
62}
63
64// --------------------------------------------------------------------------
65//
66// Use this to create a camera with a roundish shape and a radius rad in
67// millimeter containing the four-pixel centers. The four-pixel will have
68// a diameter diameter in millimeters, and a distance dist in meters.
69//
70MGeomCamFact::MGeomCamFact(Double_t rad, Double_t diameter, Double_t dist, const char *name)
71 : MGeomCam(0, dist, name, "Geometry information for a FACT camera")
72{
73 CreateGeometry(MGeomCamDwarf(rad, diameter, dist));
74}
75
76// --------------------------------------------------------------------------
77//
78// Use this to create a camera with a hexagonal shape and rings rings.
79// The first ring around the central pixel is 1. The four-pixel will have a
80// diameter diameter in millimeters, and a distance dist in meters.
81//
82MGeomCamFact::MGeomCamFact(Int_t rings, Double_t diameter, Double_t dist, const char *name)
83 : MGeomCam(0, dist, name, "Geometry information for a FACT camera")
84{
85 CreateGeometry(MGeomCamDwarf(rings, diameter, dist));
86}
87
88// --------------------------------------------------------------------------
89//
90// Check if the photon which is flying along the trajectory u has passed
91// (or will pass) the frame of the camera (and consequently get
92// absorbed). The position p and direction u must be in the
93// telescope coordinate frame, which is z parallel to the focal plane,
94// x to the right and y upwards, looking from the mirror towards the camera.
95//
96// The units are cm.
97//
98Bool_t MGeomCamFact::HitFrame(MQuaternion p, const MQuaternion &u) const
99{
100 // z is defined from the mirror (0) to the camera (z>0).
101 // Thus we just propagate to the focal plane (z=fDist)
102 //p -= 1700./u.Z()*u;
103 p.PropagateZ(u, GetCameraDist()*100); // m->cm
104
105 // Add 10% to the max radius and convert from mm to cm
106 return p.R()<GetMaxRadius()*0.11;//TMath::Abs(p.X())<65 && TMath::Abs(p.Y())<65;
107}
108
109// --------------------------------------------------------------------------
110//
111// Creates four rectangular pixels within a pixel of a camera with
112// hexagonal pixels
113//
114void MGeomCamFact::CreateGeometry(const MGeomCam &hex)
115{
116 const Double_t dx = static_cast<MGeomPix&>(hex[0]).GetDx()/4;
117 const Double_t dy = static_cast<MGeomPix&>(hex[0]).GetDy()/4;
118
119 MGeomCam cam(hex.GetNumPixels()*4, hex.GetCameraDist());
120
121 for (UInt_t i=0; i<hex.GetNumPixels(); i++)
122 {
123 const MGeom &pix = hex[i];
124
125 for (int j=0; j<4; j++)
126 {
127 Double_t x = pix.GetX();
128 Double_t y = pix.GetY();
129
130 switch (j)
131 {
132 case 0:
133 x -= dx;
134 y -= dy;
135 break;
136 case 1:
137 x += dx;
138 y -= dy;
139 break;
140 case 2:
141 x -= dx;
142 y += dy;
143 break;
144 case 3:
145 x += dx;
146 y += dy;
147 break;
148 }
149
150 cam.SetAt(i*4+j, MGeomRectangle(x, y, dx*2, dy*2));
151 }
152 }
153
154 cam.InitGeometry();
155 cam.Copy(*this);
156}
Note: See TracBrowser for help on using the repository browser.