source: tags/Mars-V2.3/mgeom/MGeomCamSquare.cc

Last change on this file was 9385, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 3.2 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, 1/2009 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: CheObs Software Development, 2000-2009
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MGeomCamSquare
28//
29// This class stores the geometry information of a camera with square
30// pixels
31//
32////////////////////////////////////////////////////////////////////////////
33#include "MGeomCamSquare.h"
34
35#include "MMath.h"
36
37#include "MGeomRectangle.h"
38
39ClassImp(MGeomCamSquare);
40
41// --------------------------------------------------------------------------
42//
43// Square camera with 144 pixels in a distance of 4.96m with a
44// layout of 12x12
45//
46MGeomCamSquare::MGeomCamSquare(const char *name)
47 : MGeomCam(144, 4.96, name, "Geometry information of a square camera")
48{
49 CreateCam(12, 12, 7);
50 InitGeometry();
51}
52
53// --------------------------------------------------------------------------
54//
55// For geometry and Next Neighbor info see
56// CreateCam
57//
58MGeomCamSquare::MGeomCamSquare(Short_t x, Short_t y, Double_t diameter, Double_t dist, const char *name)
59 : MGeomCam(x*y, dist, name, "Geometry information of a square camera")
60{
61 CreateCam(x, y, diameter);
62 InitGeometry();
63}
64
65// --------------------------------------------------------------------------
66//
67// Check if the photon which is flying along the trajectory u has passed
68// (or will pass) the frame of the camera (and consequently get
69// absorbed). The position p and direction u must be in the
70// telescope coordinate frame, which is z parallel to the focal plane,
71// x to the right and y upwards, looking from the mirror towards the camera.
72//
73Bool_t MGeomCamSquare::HitFrame(MQuaternion p, const MQuaternion &u) const
74{
75 // z is defined from the mirror (0) to the camera (z>0).
76 // Thus we just propagate to the focal plane (z=fDist)
77 //p -= 1700./u.Z()*u;
78 p.PropagateZ(u, GetCameraDist()*100);
79
80 return TMath::Abs(p.X())*10<GetMaxRadius() && TMath::Abs(p.Y())*10<GetMaxRadius();
81}
82
83// --------------------------------------------------------------------------
84//
85// This fills the geometry information from a table into the pixel objects.
86//
87void MGeomCamSquare::CreateCam(Short_t nx, Short_t ny, Double_t diameter)
88{
89 for (Short_t x=0; x<nx; x++)
90 for (Short_t y=0; y<ny; y++)
91 SetAt(x*ny+y, MGeomRectangle((0.5*nx-x)*diameter, (0.5*ny-y)*diameter, diameter));
92}
Note: See TracBrowser for help on using the repository browser.