Changeset 8565
- Timestamp:
- 06/16/07 23:10:47 (18 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mpedestal/MPedestalSubtract.cc
r8502 r8565 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MPedestalSubtract.cc,v 1. 5 2007-05-14 09:53:15tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MPedestalSubtract.cc,v 1.6 2007-06-16 22:05:27 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 129 129 } 130 130 131 void MPedestalSubtract::Memcpy(void *dest, Int_t offset, void *src, Int_t cnt) const 132 { 133 memcpy(dest+offset, src, cnt); 134 /* 135 if (fRawEvt->GetNumBytesPerSample()==2) 136 memcpy((UShort_t*)dest+offset, src, cnt*2); 137 else 138 { 139 const Byte_t *b = (Byte_t*)src+offset; 140 for (USample_t *ptr=(USample_t*)dest; ptr<(USample_t*)dest+cnt; ptr++) 141 *ptr = *b++; 142 } 143 */ 144 } 145 131 146 // -------------------------------------------------------------------------- 132 147 // … … 137 152 const Int_t numh = fRawEvt->GetNumHiGainSamples(); 138 153 const Int_t numl = fRawEvt->GetNumLoGainSamples(); 154 155 const UInt_t scale = fRawEvt->GetScale(); 139 156 140 157 // initialize fSignal … … 154 171 } 155 172 // Get pointer were to store merged raw data 156 Byte_t *sample = fSignal->GetSamplesRaw(pixidx);173 USample_t *sample = fSignal->GetSamplesRaw(pixidx); 157 174 158 175 // copy hi- and lo-gains samples together 159 memcpy(sample,pixel.GetHiGainSamples(), numh);160 memcpy(sample+numh, pixel.GetLoGainSamples(), numl);176 Memcpy(sample, 0, pixel.GetHiGainSamples(), numh); 177 Memcpy(sample, numh, pixel.GetLoGainSamples(), numl); 161 178 162 179 // start of destination array, end of hi-gain destination array … … 165 182 Float_t *end = beg + fSignal->GetNumSamples(); 166 183 167 const Byte_t *src = sample;184 const USample_t *src = sample; 168 185 169 186 // if no pedestals are given just convert the data into … … 172 189 { 173 190 while (beg<end) 174 *beg++ = *src ++;191 *beg++ = *src;//Float_t(*src++)/scale; 175 192 continue; 176 193 } … … 191 208 // FIXME: Shell we really subtract the pedestal from saturating slices??? 192 209 for (Float_t *ptr=beg; ptr<end; ptr++) 193 *ptr = (Float_t)*src++- mean[(ptr-beg)&1];210 *ptr = Float_t(*src++)/scale - mean[(ptr-beg)&1]; 194 211 } 195 212 -
trunk/MagicSoft/Mars/mpedestal/MPedestalSubtract.h
r8154 r8565 26 26 Int_t Process(); 27 27 28 void Memcpy(void *sample, Int_t offset, void *ptr, Int_t cnt) const; 29 28 30 public: 29 31 MPedestalSubtract(const char *name=NULL, const char *title=NULL); -
trunk/MagicSoft/Mars/mpedestal/MPedestalSubtractedEvt.cc
r8561 r8565 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MPedestalSubtractedEvt.cc,v 1. 5 2007-06-15 12:58:57tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MPedestalSubtractedEvt.cc,v 1.6 2007-06-16 22:08:00 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 82 82 // The user is responsible not to exceed the slices for one pixel! 83 83 // 84 Byte_t *MPedestalSubtractedEvt::GetSamplesRaw(UInt_t pixel) const84 USample_t *MPedestalSubtractedEvt::GetSamplesRaw(UInt_t pixel) const 85 85 { 86 86 return pixel>=fNumPixels ? NULL : fSamplesRaw.GetArray()+pixel*fNumSamples; … … 103 103 { 104 104 // Determin saturation of hi-gains 105 Byte_t *p0 = GetSamplesRaw(idx);106 107 Byte_t *sat0 = 0; // first saturating slice108 Byte_t *sat1 = 0; // last saturating slice105 USample_t *p0 = GetSamplesRaw(idx); 106 107 USample_t *sat0 = 0; // first saturating slice 108 USample_t *sat1 = 0; // last saturating slice 109 109 110 110 Int_t num = 0; 111 111 112 const Byte_t *end = p0+last;113 for ( Byte_t *ptr=p0+first; ptr<=end; ptr++)112 const USample_t *end = p0+last; 113 for (USample_t *ptr=p0+first; ptr<=end; ptr++) 114 114 { 115 115 if (*ptr>=limit) … … 170 170 { 171 171 // Get pointer to first slice to be considered 172 Byte_t const *sam = GetSamplesRaw(idx);173 174 Byte_t const *beg = sam+first;172 USample_t const *sam = GetSamplesRaw(idx); 173 174 USample_t const *beg = sam+first; 175 175 176 176 // The best information so far: the first slice is the maximum 177 const Byte_t *max = beg;178 179 for (const Byte_t *ptr=beg+1; ptr<=sam+last; ptr++)177 const USample_t *max = beg; 178 179 for (const USample_t *ptr=beg+1; ptr<=sam+last; ptr++) 180 180 if (*ptr>*max) 181 181 max = ptr; -
trunk/MagicSoft/Mars/mpedestal/MPedestalSubtractedEvt.h
r8519 r8565 11 11 #include "MArrayF.h" 12 12 #endif 13 #ifndef MARS_MArray B14 #include "MArray B.h"13 #ifndef MARS_MArrayS 14 #include "MArrayS.h" 15 15 #endif 16 17 //typedef UShort_t USample_t; 18 typedef Byte_t USample_t; 16 19 17 20 class MPedestalSubtractedEvt : public MParContainer, public MCamEvent … … 20 23 MArrayF fSamples; // list of all samples with pedestal subtracted 21 24 MArrayB fSamplesRaw; // list of all samples (raw) 25 // MArrayS fSamplesRaw; // list of all samples (raw) 22 26 23 27 UInt_t fNumSamples; // number of samples per pixel … … 33 37 void InitSamples(UInt_t samples, UInt_t pixels=0); 34 38 35 Float_t *GetSamples(UInt_t pixel) const;36 Byte_t *GetSamplesRaw(UInt_t pixel) const;39 Float_t *GetSamples(UInt_t pixel) const; 40 USample_t *GetSamplesRaw(UInt_t pixel) const; 37 41 38 42 UInt_t GetNumSamples() const { return fNumSamples; } … … 101 105 Int_t GetIntegralRaw(Int_t idx, Int_t first, Int_t last) const 102 106 { 103 Byte_t *ptr = GetSamplesRaw(idx);107 USample_t *ptr = GetSamplesRaw(idx); 104 108 105 const Byte_t *end = ptr + last - first + 1;109 const USample_t *end = ptr + last - first + 1; 106 110 107 111 Int_t sum = 0; -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.h
r8383 r8565 115 115 UShort_t GetNumNormalPixels() const; 116 116 UShort_t GetNumSpecialPixels() const; 117 UInt_t GetScale() const { return 1<<((fNumBytesPerSample-1)*8); } 117 118 118 119 UInt_t GetNumSamplesPerCrate() const
Note:
See TracChangeset
for help on using the changeset viewer.