| 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): Oscar Blanch 11/2002 <mailto:blanch@ifae.es> | 
|---|
| 19 | ! | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2002 | 
|---|
| 21 | ! | 
|---|
| 22 | ! | 
|---|
| 23 | \* ======================================================================== */ | 
|---|
| 24 |  | 
|---|
| 25 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 26 | // | 
|---|
| 27 | // MGeomMirror | 
|---|
| 28 | // | 
|---|
| 29 | // This is the base class of the Mirror geometry. | 
|---|
| 30 | // | 
|---|
| 31 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 32 |  | 
|---|
| 33 | #include "MGeomMirror.h" | 
|---|
| 34 |  | 
|---|
| 35 | #include "MLog.h" | 
|---|
| 36 | #include "MLogManip.h" | 
|---|
| 37 |  | 
|---|
| 38 | ClassImp(MGeomMirror); | 
|---|
| 39 |  | 
|---|
| 40 | using namespace std; | 
|---|
| 41 |  | 
|---|
| 42 | // -------------------------------------------------------------------------- | 
|---|
| 43 | // | 
|---|
| 44 | // Initializes a Mirror geometry with 0 values, except for fMirrorID. | 
|---|
| 45 | // | 
|---|
| 46 | MGeomMirror::MGeomMirror(Int_t mir, const char *name, const char *title) | 
|---|
| 47 | { | 
|---|
| 48 | fName  = name  ? name  : "MGeomMirror"; | 
|---|
| 49 | fTitle = title ? title : "Storage container for  a mirror geometry"; | 
|---|
| 50 |  | 
|---|
| 51 | fMirrorId=mir;   // the Mirror Id | 
|---|
| 52 |  | 
|---|
| 53 | fFocalDist=0.;   //  focal distance of that mirror [cm] | 
|---|
| 54 | fSX=0.;          // curvilinear coordinate of mirror's center in X[cm] | 
|---|
| 55 | fSY=0.;          // curvilinear coordinate of mirror's center in X[cm] | 
|---|
| 56 | fX=0.;           // x coordinate of the center of the mirror [cm] | 
|---|
| 57 | fY=0.;           // y coordinate of the center of the mirror [cm] | 
|---|
| 58 | fZ=0.;           // z coordinate of the center of the mirror [cm] | 
|---|
| 59 | fThetaN=0.;      // polar theta angle of the direction | 
|---|
| 60 | //  where the mirror points to | 
|---|
| 61 | fPhiN=0.;        // polar phi angle of the direction | 
|---|
| 62 | // where the mirror points to | 
|---|
| 63 | fXN=0.;          // xn coordinate of the normal vector | 
|---|
| 64 | // in the center | 
|---|
| 65 | fYN=0.;          // yn coordinate of the normal vector | 
|---|
| 66 | // in the center | 
|---|
| 67 | fZN=0.;          // zn coordinate of the normal vector | 
|---|
| 68 | // in the center | 
|---|
| 69 | // Note: fXN^2*fYN^2*fZN^2 = 1 | 
|---|
| 70 | fDeviationX=0.;  // deviation in x [cm] | 
|---|
| 71 | fDeviationY=0.;  // deviation in y [cm] | 
|---|
| 72 | // of the spot of a single mirror on the camera plane | 
|---|
| 73 |  | 
|---|
| 74 | } | 
|---|
| 75 |  | 
|---|
| 76 | // -------------------------------------------------------------------------- | 
|---|
| 77 | // | 
|---|
| 78 | // DESCRIPTION MISSING: Please contact Oscar | 
|---|
| 79 | // | 
|---|
| 80 | void MGeomMirror::SetMirrorContent(Int_t mir, Float_t focal, Float_t curv_x, | 
|---|
| 81 | Float_t curv_y, Float_t lin_x, Float_t lin_y, | 
|---|
| 82 | Float_t lin_z, Float_t theta, Float_t phi, | 
|---|
| 83 | Float_t x_n, Float_t y_n, Float_t z_n){ | 
|---|
| 84 | fMirrorId=mir;   // the Mirror Id | 
|---|
| 85 |  | 
|---|
| 86 | fFocalDist=focal;   //  focal distance of that mirror [cm] | 
|---|
| 87 | fSX=curv_x;          // curvilinear coordinate of mirror's center in X[cm] | 
|---|
| 88 | fSY=curv_y;          // curvilinear coordinate of mirror's center in X[cm] | 
|---|
| 89 | fX=lin_x;           // x coordinate of the center of the mirror [cm] | 
|---|
| 90 | fY=lin_y;           // y coordinate of the center of the mirror [cm] | 
|---|
| 91 | fZ=lin_z;           // z coordinate of the center of the mirror [cm] | 
|---|
| 92 | fThetaN=theta;      // polar theta angle of the direction | 
|---|
| 93 | //  where the mirror points to | 
|---|
| 94 | fPhiN=phi;        // polar phi angle of the direction | 
|---|
| 95 | // where the mirror points to | 
|---|
| 96 | fXN=x_n;          // xn coordinate of the normal vector | 
|---|
| 97 | // in the center | 
|---|
| 98 | fYN=y_n;          // yn coordinate of the normal vector | 
|---|
| 99 | // in the center | 
|---|
| 100 | fZN=z_n;          // zn coordinate of the normal vector | 
|---|
| 101 | // in the center | 
|---|
| 102 | // Note: fXN^2*fYN^2*fZN^2 = 1 | 
|---|
| 103 | } | 
|---|
| 104 |  | 
|---|
| 105 | void MGeomMirror::SetMirrorDeviations(Float_t dev_x, Float_t dev_y){ | 
|---|
| 106 | fDeviationX=dev_x;  // deviation in x [cm] | 
|---|
| 107 | fDeviationY=dev_x;  // deviation in y [cm] | 
|---|
| 108 | // of the spot of a single mirror on the camera plane | 
|---|
| 109 | } | 
|---|
| 110 |  | 
|---|
| 111 | // -------------------------------------------------------------------------- | 
|---|
| 112 | // | 
|---|
| 113 | // Setting function to store the mirror reflectivity (ref) at different | 
|---|
| 114 | // wavelength (wav). | 
|---|
| 115 | // | 
|---|
| 116 | void MGeomMirror::SetReflectivity(const TArrayF &wav, const TArrayF &ref) | 
|---|
| 117 | { | 
|---|
| 118 | if (fWavelength.GetSize()!=wav.GetSize() || | 
|---|
| 119 | fReflectivity.GetSize()!=ref.GetSize()) | 
|---|
| 120 | { | 
|---|
| 121 | *fLog << err << dbginf << " fWavelength or fQE do not have "; | 
|---|
| 122 | *fLog << "size of setting arrays" << endl; | 
|---|
| 123 | return; | 
|---|
| 124 | } | 
|---|
| 125 |  | 
|---|
| 126 | fWavelength = wav; | 
|---|
| 127 | fReflectivity = ref; | 
|---|
| 128 | } | 
|---|
| 129 |  | 
|---|
| 130 |  | 
|---|
| 131 |  | 
|---|
| 132 |  | 
|---|
| 133 |  | 
|---|
| 134 |  | 
|---|
| 135 |  | 
|---|
| 136 |  | 
|---|