| 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): Thomas Bretz 08/2010 <mailto:thomas.bretz@epfl.ch>
 | 
|---|
| 19 | !
 | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2010
 | 
|---|
| 21 | !
 | 
|---|
| 22 | !
 | 
|---|
| 23 | \* ======================================================================== */
 | 
|---|
| 24 | 
 | 
|---|
| 25 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
| 26 | //
 | 
|---|
| 27 | // MGeomCamFACT
 | 
|---|
| 28 | //
 | 
|---|
| 29 | // This class stores the geometry information of the final FACT camera.
 | 
|---|
| 30 | //    MGeomCamFACT cam;        // Creates the final FACT camera
 | 
|---|
| 31 | //
 | 
|---|
| 32 | ////////////////////////////////////////////////////////////////////////////
 | 
|---|
| 33 | #include "MGeomCamFACT.h"
 | 
|---|
| 34 | 
 | 
|---|
| 35 | #include <TMath.h>
 | 
|---|
| 36 | 
 | 
|---|
| 37 | #include "MGeomPix.h"
 | 
|---|
| 38 | 
 | 
|---|
| 39 | ClassImp(MGeomCamFACT);
 | 
|---|
| 40 | 
 | 
|---|
| 41 | using namespace std;
 | 
|---|
| 42 | 
 | 
|---|
| 43 | // --------------------------------------------------------------------------
 | 
|---|
| 44 | //
 | 
|---|
| 45 | MGeomCamFACT::MGeomCamFACT(const char *name)
 | 
|---|
| 46 |     : MGeomCam(1438, 4.90, name, "Geometry information of the final FACT Camera")
 | 
|---|
| 47 | {
 | 
|---|
| 48 |     CreateCam();
 | 
|---|
| 49 |     InitGeometry();
 | 
|---|
| 50 | }
 | 
|---|
| 51 | 
 | 
|---|
| 52 | // --------------------------------------------------------------------------
 | 
|---|
| 53 | //
 | 
|---|
| 54 | MGeomCamFACT::MGeomCamFACT(Double_t dist, const char *name)
 | 
|---|
| 55 |     : MGeomCam(1438, dist, name, "Geometry information of the final FACT Camera")
 | 
|---|
| 56 | {
 | 
|---|
| 57 |     CreateCam();
 | 
|---|
| 58 |     InitGeometry();
 | 
|---|
| 59 | }
 | 
|---|
| 60 | 
 | 
|---|
| 61 | // --------------------------------------------------------------------------
 | 
|---|
| 62 | //
 | 
|---|
| 63 | // Check if the photon which is flying along the trajectory u has passed
 | 
|---|
| 64 | // (or will pass) the frame of the camera (and consequently get
 | 
|---|
| 65 | // absorbed). The position p and direction u must be in the
 | 
|---|
| 66 | // telescope coordinate frame, which is z parallel to the focal plane,
 | 
|---|
| 67 | // x to the right and y upwards, looking from the mirror towards the camera.
 | 
|---|
| 68 | //
 | 
|---|
| 69 | // The units are cm.
 | 
|---|
| 70 | //
 | 
|---|
| 71 | Bool_t MGeomCamFACT::HitFrame(MQuaternion p, const MQuaternion &u) const
 | 
|---|
| 72 | {
 | 
|---|
| 73 |     // z is defined from the mirror (0) to the camera (z>0).
 | 
|---|
| 74 |     // Thus we just propagate to the focal plane (z=fDist)
 | 
|---|
| 75 |     //p -= 1700./u.Z()*u;
 | 
|---|
| 76 |     p.PropagateZ(u, GetCameraDist()*100); // m->cm
 | 
|---|
| 77 | 
 | 
|---|
| 78 |     // Add 10% to the max radius and convert from mm to cm
 | 
|---|
| 79 |     return p.R()<GetMaxRadius()*0.11;//TMath::Abs(p.X())<65 && TMath::Abs(p.Y())<65;
 | 
|---|
| 80 | }
 | 
|---|
| 81 | 
 | 
|---|
| 82 | // --------------------------------------------------------------------------
 | 
|---|
| 83 | //
 | 
|---|
| 84 | void MGeomCamFACT::CreateCam()
 | 
|---|
| 85 | {
 | 
|---|
| 86 |     const static Int_t dir[6] =
 | 
|---|
| 87 |     {
 | 
|---|
| 88 |         MGeomPix::kDirSE,
 | 
|---|
| 89 |         MGeomPix::kDirNE,
 | 
|---|
| 90 |         MGeomPix::kDirN,
 | 
|---|
| 91 |         MGeomPix::kDirNW,
 | 
|---|
| 92 |         MGeomPix::kDirSW,
 | 
|---|
| 93 |         MGeomPix::kDirS
 | 
|---|
| 94 |     };
 | 
|---|
| 95 | 
 | 
|---|
| 96 |     const Int_t    rings    = 23;
 | 
|---|
| 97 |     const Double_t diameter = 9.5;
 | 
|---|
| 98 | 
 | 
|---|
| 99 |     //  add the first pixel to the list
 | 
|---|
| 100 |     //
 | 
|---|
| 101 |     MGeomPix pix0(0, -0.5*diameter, diameter);
 | 
|---|
| 102 |     pix0.SetPhi(TMath::Pi()/2);
 | 
|---|
| 103 |     SetAt(0, pix0);
 | 
|---|
| 104 | 
 | 
|---|
| 105 |     Int_t cnt  = 1;
 | 
|---|
| 106 |     for (int ring=1; ring<=rings; ring++)
 | 
|---|
| 107 |     {
 | 
|---|
| 108 |         for (Int_t s=0; s<6; s++)
 | 
|---|
| 109 |         {
 | 
|---|
| 110 |             for (int i=1; i<=ring; i++)
 | 
|---|
| 111 |             {
 | 
|---|
| 112 |                 Double_t x, y;
 | 
|---|
| 113 |                 const Double_t d2 = MGeomPix::CalcXY(dir[s], ring, i, x, y);
 | 
|---|
| 114 |                 if (d2 - x > 395.75)
 | 
|---|
| 115 |                     continue;
 | 
|---|
| 116 | 
 | 
|---|
| 117 |                 MGeomPix pix(y*diameter, (x-0.5)*diameter, diameter);
 | 
|---|
| 118 |                 pix.SetPhi(TMath::Pi()/2);
 | 
|---|
| 119 |                 SetAt(cnt++, pix);
 | 
|---|
| 120 |             }
 | 
|---|
| 121 |         }
 | 
|---|
| 122 |     }
 | 
|---|
| 123 | }
 | 
|---|