| 1 | #include "MRawPixel.h" | 
|---|
| 2 |  | 
|---|
| 3 | #include <iostream.h> | 
|---|
| 4 |  | 
|---|
| 5 | #include "TClonesArray.h" | 
|---|
| 6 | #include "TString.h" | 
|---|
| 7 | #include "TRandom.h" | 
|---|
| 8 |  | 
|---|
| 9 | //========== | 
|---|
| 10 | // MRawPixel | 
|---|
| 11 | // | 
|---|
| 12 | // One Event in the Camera of MAGIC consists of measurements of different | 
|---|
| 13 | // Photomultiplier. The measurements are taken with FADCs. So the raw | 
|---|
| 14 | // informations of one pixel are the ADC values of the FADCs. MAGIC will | 
|---|
| 15 | // measure the amplitude of one Photomulitplier in different branches | 
|---|
| 16 | // - one high and one low gain branch. The first is for small signals, the | 
|---|
| 17 | // other for big signals. With this method it is possible to increase the | 
|---|
| 18 | // dynamic range. | 
|---|
| 19 | // | 
|---|
| 20 | // The Class MRawPixel is used to manage this raw information. | 
|---|
| 21 | // | 
|---|
| 22 | // The data members are described in detail here: | 
|---|
| 23 | // | 
|---|
| 24 | // --------- | 
|---|
| 25 | // | 
|---|
| 26 | // UShort_t     PixelId     ; | 
|---|
| 27 | // | 
|---|
| 28 | // This is to identify the Pixel. | 
|---|
| 29 | // The Camera consists of CAMERA_PIXELS Pixels. Each one has a specific Id. | 
|---|
| 30 | // The center of the camera is zero and a spiral numbering is chosen. | 
|---|
| 31 | // | 
|---|
| 32 | // To reduce the amount of data, we store the information of the | 
|---|
| 33 | // low-gain-branch of the Fadc´s only if there is a signal in. Then the | 
|---|
| 34 | // PixelId is: | 
|---|
| 35 | //                   PixelId = 10000 + PixelId   . | 
|---|
| 36 | // | 
|---|
| 37 | // For the high gain Fadc values the rule is: | 
|---|
| 38 | //                   PixelId = PixelId . | 
|---|
| 39 | // | 
|---|
| 40 | // | 
|---|
| 41 | // --------- | 
|---|
| 42 | // | 
|---|
| 43 | // UChar_t      PixelStatus ; | 
|---|
| 44 | // | 
|---|
| 45 | // The PixelStatus may contain information if the Pixel has triggered | 
|---|
| 46 | // this event. Also the kind of gain-branch (high or low) may be indicated | 
|---|
| 47 | // by one bit of the PixelStatus. etc | 
|---|
| 48 | // | 
|---|
| 49 | // --------- | 
|---|
| 50 | // | 
|---|
| 51 | // UChar_t      Fadc[ kFADC_SLICES ]  ; | 
|---|
| 52 | // | 
|---|
| 53 | // The values of kFADC_SLICES fadc-slices. This is the information of the | 
|---|
| 54 | // measured ADC values for one branch (high gain or low gain). The typ of | 
|---|
| 55 | // branch is indicated in the usPixelNumber and in the PixelStatus. | 
|---|
| 56 |  | 
|---|
| 57 | ClassImp(MRawPixel) | 
|---|
| 58 |  | 
|---|
| 59 | MRawPixel::MRawPixel() | 
|---|
| 60 | { | 
|---|
| 61 | // | 
|---|
| 62 | //  The default constructor sets all members to zero. | 
|---|
| 63 | // | 
|---|
| 64 |  | 
|---|
| 65 | PixelId     = 0 ; | 
|---|
| 66 | PixelStatus = 0 ; | 
|---|
| 67 |  | 
|---|
| 68 | for (Int_t i = 0; i<kFADC_SLICES; i++) | 
|---|
| 69 | Fadc[i]   = 0 ; | 
|---|
| 70 | } | 
|---|
| 71 |  | 
|---|
| 72 |  | 
|---|
| 73 | MRawPixel::MRawPixel(UShort_t PId) | 
|---|
| 74 | { | 
|---|
| 75 | // | 
|---|
| 76 | //  constructor II  overloaded | 
|---|
| 77 | // | 
|---|
| 78 | //  Parameter is the PixelId. All other data member are set to zero | 
|---|
| 79 |  | 
|---|
| 80 | PixelId     = PId ; | 
|---|
| 81 | PixelStatus = 0 ; | 
|---|
| 82 |  | 
|---|
| 83 | for (Int_t i = 0; i<kFADC_SLICES; i++) | 
|---|
| 84 | Fadc[i]   = 0 ; | 
|---|
| 85 | } | 
|---|
| 86 |  | 
|---|
| 87 |  | 
|---|
| 88 | MRawPixel::MRawPixel(UShort_t usPId, UChar_t ucSt, UChar_t ucF[]) | 
|---|
| 89 | { | 
|---|
| 90 | // | 
|---|
| 91 | // constructor III overloaded | 
|---|
| 92 | // | 
|---|
| 93 | // parameters are PixelId, Status and an array with Fadc numbers. | 
|---|
| 94 |  | 
|---|
| 95 | PixelId     = usPId ; | 
|---|
| 96 | PixelStatus = ucSt  ; | 
|---|
| 97 |  | 
|---|
| 98 | for (Int_t i = 0; i<kFADC_SLICES; i++) | 
|---|
| 99 | Fadc[i]   = ucF[i] ; | 
|---|
| 100 | } | 
|---|
| 101 |  | 
|---|
| 102 | MRawPixel::~MRawPixel() | 
|---|
| 103 | { | 
|---|
| 104 | // | 
|---|
| 105 | //  default destructor | 
|---|
| 106 | // | 
|---|
| 107 | } | 
|---|
| 108 |  | 
|---|
| 109 | void MRawPixel::Clear(Option_t *t) | 
|---|
| 110 | { | 
|---|
| 111 | // | 
|---|
| 112 | //  Sets the data member back to zero | 
|---|
| 113 | // | 
|---|
| 114 | PixelId     = 0 ; | 
|---|
| 115 | PixelStatus = 0 ; | 
|---|
| 116 |  | 
|---|
| 117 | for (Int_t i = 0; i<kFADC_SLICES; i++) | 
|---|
| 118 | Fadc[i]   = 0 ; | 
|---|
| 119 | } | 
|---|
| 120 |  | 
|---|
| 121 |  | 
|---|
| 122 | void MRawPixel::Print(Option_t *t) | 
|---|
| 123 | { | 
|---|
| 124 | // | 
|---|
| 125 | //  This member function prints all Data of one Pixel on screen. | 
|---|
| 126 | // | 
|---|
| 127 |  | 
|---|
| 128 | cout << endl << "PixId " << PixelId; | 
|---|
| 129 | cout << " Stat " << (Int_t) PixelStatus << " --> "; | 
|---|
| 130 |  | 
|---|
| 131 | //  cout << "memory " << (UChar_t*)Fadc ; | 
|---|
| 132 | for (Int_t i=0 ; i<kFADC_SLICES ; i++ ) { | 
|---|
| 133 | cout<<" / " << (int) Fadc[i] ; | 
|---|
| 134 | } | 
|---|
| 135 | } | 
|---|
| 136 |  | 
|---|
| 137 | UShort_t MRawPixel::GetPixelId() | 
|---|
| 138 | { | 
|---|
| 139 | // | 
|---|
| 140 | // returns back the PixelId of the Pixel | 
|---|
| 141 | // | 
|---|
| 142 | return PixelId; | 
|---|
| 143 | } | 
|---|
| 144 |  | 
|---|
| 145 | UChar_t*  MRawPixel::GetPixelData() | 
|---|
| 146 | { | 
|---|
| 147 | // | 
|---|
| 148 | // returns back the pointer to the pixel data array | 
|---|
| 149 | // | 
|---|
| 150 | return (UChar_t *) Fadc; | 
|---|
| 151 | } | 
|---|
| 152 |  | 
|---|
| 153 | UChar_t MRawPixel::GetFadcSlice( Int_t iSli ) | 
|---|
| 154 | { | 
|---|
| 155 | // | 
|---|
| 156 | // returns back the fadc content of the slice iSli | 
|---|
| 157 | // | 
|---|
| 158 | return ( Fadc[iSli] ) ; | 
|---|
| 159 | } | 
|---|
| 160 |  | 
|---|