| 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): Unknown | 
|---|
| 19 | ! | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2005 | 
|---|
| 21 | ! | 
|---|
| 22 | ! | 
|---|
| 23 | \* ======================================================================== */ | 
|---|
| 24 |  | 
|---|
| 25 | ////////////////////////////////////////////////////////////////////////////// | 
|---|
| 26 | // | 
|---|
| 27 | // MMcFadcHeader | 
|---|
| 28 | // | 
|---|
| 29 | // This class contains the MonteCarlo information | 
|---|
| 30 | // of the FADC simulation for the current run. | 
|---|
| 31 | // The information is saved only once, whatever the | 
|---|
| 32 | // number of events is | 
|---|
| 33 | // | 
|---|
| 34 | // NOTE : meaning of fAmplFadc, fAmplFadcOuter changed in camera 0.7, | 
|---|
| 35 | // 30/03/2004: before it was amplitude of (gaussian) pulse, now is | 
|---|
| 36 | // integral of pulse (which may be gaussian or not). | 
|---|
| 37 | // | 
|---|
| 38 | // In camera 0.7, the meaning of fPedesSigmaHigh, fPedesSigmaLow changed: | 
|---|
| 39 | // before it was the rms of the single FADC slice. Now we calculate the | 
|---|
| 40 | // RMS of the distribution of the sum of 14 FADC slices. The value we set | 
|---|
| 41 | // as fPedesSigmaHigh/Low is that RMS divided by sqrt(14). It can be seen | 
|---|
| 42 | // that the fluctuations of the integrated pedestal, when adding n slices | 
|---|
| 43 | // to obtain the pixel signal, with n>~6, is more or less well | 
|---|
| 44 | // approximated by sqrt(n)*RMS(sum_14)slices)/sqrt(14). | 
|---|
| 45 | // | 
|---|
| 46 | // Version 5: | 
|---|
| 47 | //   Added member fGainFluctuations | 
|---|
| 48 | // | 
|---|
| 49 | // Version 6: | 
|---|
| 50 | //   Added member fNoiseGainFluctuations | 
|---|
| 51 | // | 
|---|
| 52 | // Version 7: | 
|---|
| 53 | //   Derived class from MCamEvent | 
|---|
| 54 | // | 
|---|
| 55 | // Version 9: | 
|---|
| 56 | //   Added member fElecNoiseFileName | 
|---|
| 57 | // | 
|---|
| 58 | ////////////////////////////////////////////////////////////////////////////// | 
|---|
| 59 | #include "MMcFadcHeader.hxx" | 
|---|
| 60 |  | 
|---|
| 61 | #include <iostream> | 
|---|
| 62 |  | 
|---|
| 63 | ClassImp(MMcFadcHeader); | 
|---|
| 64 |  | 
|---|
| 65 | using namespace std; | 
|---|
| 66 |  | 
|---|
| 67 | MMcFadcHeader::MMcFadcHeader(const char *name, const char *title) { | 
|---|
| 68 | // | 
|---|
| 69 | //  default constructor | 
|---|
| 70 |  | 
|---|
| 71 | fName  = name  ? name  : "MMcFadcHeader"; | 
|---|
| 72 | fTitle = title ? title : "Fadc Header Information from Monte Carlo"; | 
|---|
| 73 |  | 
|---|
| 74 | //  set all values to zero | 
|---|
| 75 |  | 
|---|
| 76 | Int_t i; | 
|---|
| 77 |  | 
|---|
| 78 | fFadcShape=0.0; | 
|---|
| 79 | fAmplFadc=MFADC_RESPONSE_INTEGRAL; | 
|---|
| 80 | fFwhmFadc=MFADC_RESPONSE_FWHM; | 
|---|
| 81 | fAmplFadcOuter=MFADC_RESPONSE_INTEGRAL; | 
|---|
| 82 | fFwhmFadcOuter=MFADC_RESPONSE_FWHM; | 
|---|
| 83 |  | 
|---|
| 84 | for(i=0;i<MFADC_CHANNELS;i++){ | 
|---|
| 85 | fPedesMean[i]= 0.0    ; | 
|---|
| 86 | fPedesSigmaHigh[i]=-1.0    ; | 
|---|
| 87 | fPedesSigmaLow[i]=-1.0    ; | 
|---|
| 88 | fElecNoise[i]=-1.0   ; | 
|---|
| 89 | fDigitalNoise[i]=-1.0   ; | 
|---|
| 90 | } | 
|---|
| 91 | } | 
|---|
| 92 |  | 
|---|
| 93 | void MMcFadcHeader::Print(Option_t *Option) const { | 
|---|
| 94 | // | 
|---|
| 95 | //  print out the data member on screen | 
|---|
| 96 | // | 
|---|
| 97 | cout << endl; | 
|---|
| 98 | cout << "Monte Carlo Fadc output:" << endl; | 
|---|
| 99 | cout << " Shape type of the signal: "       << fFadcShape << endl; | 
|---|
| 100 | cout << " FADC integral for sphe [counts*ns]: " << fAmplFadc << endl; | 
|---|
| 101 | cout << " Width of the signal in nsec: "    << fFwhmFadc << endl; | 
|---|
| 102 | cout << " Outer FADC integral for sphe [counts*ns]: " << fAmplFadcOuter | 
|---|
| 103 | << endl; | 
|---|
| 104 | cout << " Width of the signal in nsec for outer: "    << fFwhmFadcOuter | 
|---|
| 105 | << endl; | 
|---|
| 106 | cout << " Pedestals and ElecNoise in fadc counts: " << endl; | 
|---|
| 107 | for (int i=0;i<MFADC_CHANNELS;i++){ | 
|---|
| 108 | cout << " Pixel "<<i<<": "<<fPedesMean[i]<<"  "<<fElecNoise[i]<<endl; | 
|---|
| 109 | } | 
|---|
| 110 | cout << endl ; | 
|---|
| 111 | } | 
|---|
| 112 |  | 
|---|
| 113 | Bool_t MMcFadcHeader::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const | 
|---|
| 114 | { | 
|---|
| 115 | if ((UInt_t)idx>=GetNumPixel()) | 
|---|
| 116 | return kFALSE; | 
|---|
| 117 |  | 
|---|
| 118 | switch (type) | 
|---|
| 119 | { | 
|---|
| 120 | case 0: | 
|---|
| 121 | val = fPedesMean[idx]; | 
|---|
| 122 | break; | 
|---|
| 123 | case 1: | 
|---|
| 124 | val = fPedesSigmaHigh[idx]; | 
|---|
| 125 | break; | 
|---|
| 126 | case 2: | 
|---|
| 127 | val = fPedesSigmaLow[idx]; | 
|---|
| 128 | break; | 
|---|
| 129 | case 3: | 
|---|
| 130 | val = fElecNoise[idx]; | 
|---|
| 131 | break; | 
|---|
| 132 | case 4: | 
|---|
| 133 | val = fDigitalNoise[idx]; | 
|---|
| 134 | break; | 
|---|
| 135 | default: | 
|---|
| 136 | return kFALSE; | 
|---|
| 137 | } | 
|---|
| 138 | return kTRUE; | 
|---|
| 139 | } | 
|---|