source: trunk/Mars/mgeom/MGeomCamFact.cc@ 18548

Last change on this file since 18548 was 9863, checked in by tbretz, 14 years ago
Moved MGeomCamDwarf::CalcXY to MGeomPix::CalcXY. Removed some obsolete includes.
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
42#include <TMath.h>
43
44#include "MGeomCamDwarf.h"
45#include "MGeomRectangle.h"
46#include "MGeomPix.h"
47
48ClassImp(MGeomCamFact);
49
50using namespace std;
51
52// --------------------------------------------------------------------------
53//
54// Default Fact camera
55//
56MGeomCamFact::MGeomCamFact(const char *name)
57 : MGeomCam(0, 4.8887, name, "Geometry information of Fact Camera")
58{
59 CreateGeometry(MGeomCamDwarf(209.5, 13.2, 4.8887));
60}
61
62// --------------------------------------------------------------------------
63//
64// Use this to create a camera with a roundish shape and a radius rad in
65// millimeter containing the four-pixel centers. The four-pixel will have
66// a diameter diameter in millimeters, and a distance dist in meters.
67//
68MGeomCamFact::MGeomCamFact(Double_t rad, Double_t diameter, Double_t dist, const char *name)
69 : MGeomCam(0, dist, name, "Geometry information for a FACT camera")
70{
71 CreateGeometry(MGeomCamDwarf(rad, diameter, dist));
72}
73
74// --------------------------------------------------------------------------
75//
76// Use this to create a camera with a hexagonal shape and rings rings.
77// The first ring around the central pixel is 1. The four-pixel will have a
78// diameter diameter in millimeters, and a distance dist in meters.
79//
80MGeomCamFact::MGeomCamFact(Int_t rings, Double_t diameter, Double_t dist, const char *name)
81 : MGeomCam(0, dist, name, "Geometry information for a FACT camera")
82{
83 CreateGeometry(MGeomCamDwarf(rings, diameter, dist));
84}
85
86// --------------------------------------------------------------------------
87//
88// Check if the photon which is flying along the trajectory u has passed
89// (or will pass) the frame of the camera (and consequently get
90// absorbed). The position p and direction u must be in the
91// telescope coordinate frame, which is z parallel to the focal plane,
92// x to the right and y upwards, looking from the mirror towards the camera.
93//
94// The units are cm.
95//
96Bool_t MGeomCamFact::HitFrame(MQuaternion p, const MQuaternion &u) const
97{
98 // z is defined from the mirror (0) to the camera (z>0).
99 // Thus we just propagate to the focal plane (z=fDist)
100 //p -= 1700./u.Z()*u;
101 p.PropagateZ(u, GetCameraDist()*100); // m->cm
102
103 // Add 10% to the max radius and convert from mm to cm
104 return p.R()<GetMaxRadius()*0.11;//TMath::Abs(p.X())<65 && TMath::Abs(p.Y())<65;
105}
106
107// --------------------------------------------------------------------------
108//
109// Creates four rectangular pixels within a pixel of a camera with
110// hexagonal pixels
111//
112void MGeomCamFact::CreateGeometry(const MGeomCam &hex)
113{
114 const Double_t dx = static_cast<MGeomPix&>(hex[0]).GetDx()/4;
115 const Double_t dy = static_cast<MGeomPix&>(hex[0]).GetDy()/4;
116
117 MGeomCam cam(hex.GetNumPixels()*4, hex.GetCameraDist());
118
119 for (UInt_t i=0; i<hex.GetNumPixels(); i++)
120 {
121 const MGeom &pix = hex[i];
122
123 for (int j=0; j<4; j++)
124 {
125 Double_t x = pix.GetX();
126 Double_t y = pix.GetY();
127
128 switch (j)
129 {
130 case 0:
131 x -= dx;
132 y -= dy;
133 break;
134 case 1:
135 x += dx;
136 y -= dy;
137 break;
138 case 2:
139 x -= dx;
140 y += dy;
141 break;
142 case 3:
143 x += dx;
144 y += dy;
145 break;
146 }
147
148 cam.SetAt(i*4+j, MGeomRectangle(x, y, dx*2, dy*2));
149 }
150 }
151
152 cam.InitGeometry();
153 cam.Copy(*this);
154}
Note: See TracBrowser for help on using the repository browser.