| 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 Cherenkov 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 | ! Author(s): Daniel Mazin, 05/2004 <mailto:mazin@imppmu.mpg.de>
|
|---|
| 18 | !
|
|---|
| 19 | ! Copyright: MAGIC Software Development, 2000-2004
|
|---|
| 20 | !
|
|---|
| 21 | !
|
|---|
| 22 | \* ======================================================================== */
|
|---|
| 23 |
|
|---|
| 24 | // Daniel Mazin 17.05.2004 mazin@mppmu.mpg.de
|
|---|
| 25 | // **********************************************************************************
|
|---|
| 26 | // this macro is a part from the macro falsesourcemethod.C
|
|---|
| 27 | // This macro reads mars file with hillas parameters etc. and puts the values into vectors
|
|---|
| 28 | // input: hillas parameter file
|
|---|
| 29 | // output: vectors with the same information
|
|---|
| 30 | // **********************************************************************************
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 | void hillasfileread()
|
|---|
| 34 | {
|
|---|
| 35 | lengthpar.ResizeTo(MAXNUMEVENTS);
|
|---|
| 36 | widthpar.ResizeTo(MAXNUMEVENTS);
|
|---|
| 37 | sizepar.ResizeTo(MAXNUMEVENTS);
|
|---|
| 38 | xpar.ResizeTo(MAXNUMEVENTS);
|
|---|
| 39 | ypar.ResizeTo(MAXNUMEVENTS);
|
|---|
| 40 | deltapar.ResizeTo(MAXNUMEVENTS);
|
|---|
| 41 | alphapar.ResizeTo(MAXNUMEVENTS);
|
|---|
| 42 | distpar.ResizeTo(MAXNUMEVENTS);
|
|---|
| 43 | cosgam.ResizeTo(MAXNUMEVENTS);
|
|---|
| 44 | singam.ResizeTo(MAXNUMEVENTS);
|
|---|
| 45 | conc1.ResizeTo(MAXNUMEVENTS);
|
|---|
| 46 | leak1.ResizeTo(MAXNUMEVENTS);
|
|---|
| 47 |
|
|---|
| 48 | lengthpar.Zero();
|
|---|
| 49 | widthpar.Zero();
|
|---|
| 50 | sizepar.Zero();
|
|---|
| 51 | xpar.Zero();
|
|---|
| 52 | ypar.Zero();
|
|---|
| 53 | deltapar.Zero();
|
|---|
| 54 | alphapar.Zero();
|
|---|
| 55 | distpar.Zero();
|
|---|
| 56 | cosgam.Zero();
|
|---|
| 57 | singam.Zero();
|
|---|
| 58 | conc1.Zero();
|
|---|
| 59 | leak1.Zero();
|
|---|
| 60 |
|
|---|
| 61 | MParList plist;
|
|---|
| 62 |
|
|---|
| 63 | MTaskList tlist;
|
|---|
| 64 | plist.AddToList(&tlist);
|
|---|
| 65 |
|
|---|
| 66 | //
|
|---|
| 67 | // Now setup the tasks and tasklist:
|
|---|
| 68 | // ---------------------------------
|
|---|
| 69 | //
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 | MReadMarsFile read("Events");
|
|---|
| 73 | read.DisableAutoScheme();
|
|---|
| 74 |
|
|---|
| 75 | read.AddFile(HILLASFILENAME);
|
|---|
| 76 |
|
|---|
| 77 | MHillas mhillas;
|
|---|
| 78 | plist.AddToList(&mhillas);
|
|---|
| 79 |
|
|---|
| 80 | MHillasSrc mhillassrc;
|
|---|
| 81 | plist.AddToList(&mhillassrc);
|
|---|
| 82 |
|
|---|
| 83 | MNewImagePar mnewimpar;
|
|---|
| 84 | plist.AddToList(&mnewimpar);
|
|---|
| 85 |
|
|---|
| 86 | MGeomCamMagic cam;
|
|---|
| 87 | plist.AddToList(&cam);
|
|---|
| 88 |
|
|---|
| 89 | MMcEvt mcevt;
|
|---|
| 90 | plist.AddToList(&mcevt);
|
|---|
| 91 |
|
|---|
| 92 | MPointingPos mpoint;
|
|---|
| 93 | plist.AddToList(&mpoint);
|
|---|
| 94 |
|
|---|
| 95 | MObservatory observ;
|
|---|
| 96 | plist.AddToList(&observ);
|
|---|
| 97 |
|
|---|
| 98 | MHStarMap starmap;
|
|---|
| 99 | plist.AddToList(&starmap);
|
|---|
| 100 |
|
|---|
| 101 | // MRawRunHeader header;
|
|---|
| 102 | // plist.AddToList(&header);
|
|---|
| 103 |
|
|---|
| 104 | tlist.AddToList(&read);
|
|---|
| 105 |
|
|---|
| 106 | MEvtLoop evtloop;
|
|---|
| 107 | evtloop.SetParList(&plist);
|
|---|
| 108 |
|
|---|
| 109 | Float_t fMm2Deg;
|
|---|
| 110 |
|
|---|
| 111 | cout << " file name: " << HILLASFILENAME << endl;
|
|---|
| 112 |
|
|---|
| 113 | if (!tlist.PreProcess(&plist))
|
|---|
| 114 | return;
|
|---|
| 115 |
|
|---|
| 116 | fMm2Deg = cam->GetConvMm2Deg();
|
|---|
| 117 | Int_t event = 0;
|
|---|
| 118 | Int_t filenumber = 0;
|
|---|
| 119 | Float_t theta, phi;
|
|---|
| 120 |
|
|---|
| 121 | imnum = 0;
|
|---|
| 122 |
|
|---|
| 123 | while (tlist.Process())
|
|---|
| 124 | {
|
|---|
| 125 | event++;
|
|---|
| 126 | //cout << event << endl;
|
|---|
| 127 |
|
|---|
| 128 | if (mhillas->GetLength() != -1.)
|
|---|
| 129 | {
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 | if (ROTOPTION == kTRUE)
|
|---|
| 133 | {
|
|---|
| 134 | // theta = mcevt->GetTelescopeTheta();
|
|---|
| 135 | theta = mpoint->GetZd();
|
|---|
| 136 | // phi = mcevt->GetTelescopePhi();
|
|---|
| 137 | phi = mpoint->GetAz();
|
|---|
| 138 | // printf("theta: %5.3f, phi: %5.3f\n", theta*180./4.1415, phi*180./4.1415);
|
|---|
| 139 | observ.RotationAngle(theta, phi, singam(imnum), cosgam(imnum));
|
|---|
| 140 | }
|
|---|
| 141 |
|
|---|
| 142 | lengthpar(imnum) = (mhillas->GetLength()) * fMm2Deg;
|
|---|
| 143 | widthpar(imnum) = (mhillas->GetWidth())*fMm2Deg;
|
|---|
| 144 | sizepar(imnum) = mhillas->GetSize();
|
|---|
| 145 | xpar(imnum) = (mhillas->GetMeanX())*fMm2Deg;
|
|---|
| 146 | ypar(imnum) = (mhillas->GetMeanY())*fMm2Deg;
|
|---|
| 147 | deltapar(imnum) = mhillas->GetDelta();
|
|---|
| 148 | conc1(imnum) = (mnewimpar->GetConc1());
|
|---|
| 149 | leak1(imnum) = mnewimpar->GetLeakage1();
|
|---|
| 150 |
|
|---|
| 151 | imnum++;
|
|---|
| 152 |
|
|---|
| 153 | }
|
|---|
| 154 | else filenumber++;
|
|---|
| 155 | }
|
|---|
| 156 |
|
|---|
| 157 | if (!tlist.PostProcess())
|
|---|
| 158 | return;
|
|---|
| 159 |
|
|---|
| 160 | printf("imnum = %d\n",imnum);
|
|---|
| 161 |
|
|---|
| 162 | lengthpar.ResizeTo(imnum);
|
|---|
| 163 | widthpar.ResizeTo(imnum);
|
|---|
| 164 | sizepar.ResizeTo(imnum);
|
|---|
| 165 | xpar.ResizeTo(imnum);
|
|---|
| 166 | ypar.ResizeTo(imnum);
|
|---|
| 167 | deltapar.ResizeTo(imnum);
|
|---|
| 168 | alphapar.ResizeTo(imnum);
|
|---|
| 169 | distpar.ResizeTo(imnum);
|
|---|
| 170 | cosgam.ResizeTo(imnum);
|
|---|
| 171 | singam.ResizeTo(imnum);
|
|---|
| 172 | conc1.ResizeTo(imnum);
|
|---|
| 173 | leak1.ResizeTo(imnum);
|
|---|
| 174 |
|
|---|
| 175 |
|
|---|
| 176 | cout << " conversion factor is: " << fMm2Deg << endl;
|
|---|
| 177 | cout << " events read in from file : " << event << endl;
|
|---|
| 178 | cout << " runs found in the file : " << filenumber << endl;
|
|---|
| 179 |
|
|---|
| 180 | }
|
|---|
| 181 |
|
|---|