Changeset 8364 for trunk/MagicSoft/Mars/msignal/MSignalCalc.cc
- Timestamp:
- 03/04/07 14:01:14 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msignal/MSignalCalc.cc
r8357 r8364 46 46 47 47 #include "MRawRunHeader.h" 48 #include "MRawEvtData.h" // MRawEvtData::GetNumPixels49 48 #include "MSignalCam.h" 50 49 #include "MPedestalPix.h" 51 50 #include "MPedestalCam.h" 52 51 #include "MRawEvtPixelIter.h" 52 #include "MPedestalSubtractedEvt.h" 53 53 54 54 ClassImp(MSignalCalc); … … 66 66 fName = name ? name : "MSignalCalc"; 67 67 fTitle = title ? title : "Task to calculate Cerenkov photons from raw data"; 68 69 AddToBranchList("MRawEvtData.fHiGainPixId");70 AddToBranchList("MRawEvtData.fLoGainPixId");71 AddToBranchList("MRawEvtData.fHiGainFadcSamples");72 AddToBranchList("MRawEvtData.fLoGainFadcSamples");73 68 } 74 69 … … 95 90 } 96 91 97 fRawEvt = (M RawEvtData*)pList->FindObject("MRawEvtData");92 fRawEvt = (MPedestalSubtractedEvt*)pList->FindObject("MPedestalSubtractedEvt"); 98 93 if (!fRawEvt) 99 94 { 100 *fLog << dbginf << "M RawEvtDatanot found... aborting." << endl;95 *fLog << dbginf << "MPedestalSubtractedEvt not found... aborting." << endl; 101 96 return kFALSE; 102 97 } … … 130 125 // pixel in the MSignalCam container. 131 126 // 127 #include <TSystem.h> 132 128 Int_t MSignalCalc::Process() 133 129 { 134 MRawEvtPixelIter pixel(fRawEvt); 135 136 while (pixel.Next()) 130 const Int_t npix = fRawEvt->GetNumPixels(); 131 const Int_t nhi = fRunHeader->GetNumSamplesHiGain(); 132 const Int_t nlo = fRunHeader->GetNumSamplesLoGain(); 133 134 for (int i=0; i<npix; i++) 137 135 { 138 Byte_t *ptr = pixel.GetHiGainSamples(); 139 Byte_t *max = ptr+pixel.GetIdxMaxHiGainSample(); 140 Byte_t *end = ptr+fRunHeader->GetNumSamplesHiGain(); 136 Byte_t *raw = fRawEvt->GetSamplesRaw(i); 137 138 Byte_t *ptr = raw; 139 Byte_t *max = ptr+fRawEvt->GetMax(i, 0, nhi); 140 Byte_t *end = ptr+nhi; 141 141 Byte_t *first = max-fBefore; 142 142 Byte_t *last = max+fAfter; … … 144 144 ULong_t sumb = 0; // sum background 145 145 ULong_t sqb = 0; // sum sqares background 146 ULong_t sumsb = 0; // sum signal+background146 //ULong_t sumsb = 0; // sum signal+background 147 147 ULong_t sqsb = 0; // sum sqares signal+background 148 148 … … 168 168 else 169 169 { 170 sumsb += *ptr;170 //sumsb += *ptr; 171 171 sqsb += *ptr* *ptr; 172 172 nsb++; … … 175 175 } 176 176 177 if ( sat==0 && ishi)177 if (nlo>0 && sat==0 && ishi) 178 178 { 179 179 // Area: x9 180 ptr = pixel.GetLoGainSamples();181 end = ptr+ fRunHeader->GetNumSamplesLoGain();180 ptr = raw+nhi; 181 end = ptr+nlo; 182 182 183 183 sumb = 0; // sum background … … 187 187 while (ptr<end) 188 188 { 189 // Background already ca lced from hi-gains!189 // Background already caced from hi-gains! 190 190 sumb += *ptr; 191 191 sqb += *ptr* *ptr; … … 195 195 } 196 196 197 if ( sat>1 && !ishi)197 if (nlo>0 && sat>1 && !ishi) 198 198 { 199 199 // Area: x9 200 ptr = pixel.GetLoGainSamples();201 max = ptr+ pixel.GetIdxMaxLoGainSample();200 ptr = raw+nhi; 201 max = ptr+fRawEvt->GetMax(i, nhi, nhi+nlo); 202 202 203 203 if (*max>250) … … 207 207 } 208 208 209 end = ptr+ fRunHeader->GetNumSamplesLoGain();209 end = ptr+nlo; 210 210 first = max-fBefore; 211 211 last = max+fAfter; 212 212 213 sumsb = 0; // sum signal+background214 sqsb = 0; // sum sqares signal+background215 //sumb = 0; // sum background213 //sumsb = 0; // sum signal+background 214 //sqsb = 0; // sum sqares signal+background 215 sumb = 0; // sum background 216 216 //sqb = 0; // sum sqares background 217 217 … … 230 230 else 231 231 { 232 sumsb += *ptr;232 //sumsb += *ptr; 233 233 sqsb += *ptr* *ptr; 234 234 nsb++; … … 238 238 } 239 239 240 Float_t b = (float)sumb/nb; // background241 Float_t sb = (float)sumsb/nsb; // signal+background242 243 Float_t msb = (float)sqb/nb; // mean square background240 Float_t b = nb==0 ? 0 : (float)sumb/nb; // background 241 //Float_t sb = (float)sumsb/nsb; // signal+background 242 243 Float_t msb = nb==0 ? 0 : (float)sqb/nb; // mean square background 244 244 //Float_t mssb = (float)sqsb/nsb; // mean square signal+background 245 245 … … 247 247 //Float_t sigsb = sqrt(mssb-sb*sb); // sigma signal+background 248 248 249 Float_t s = sb-b; // signal249 //Float_t s = sb-b; // signal 250 250 //Float_t sqs = sqsb-nsb*b; // sum squares signal 251 251 … … 253 253 //Float_t sigs = sqrt(mss-s*s); // sigma signal 254 254 255 if (sat>1) 256 s *= 11.3; 257 258 Int_t idx = pixel.GetPixelId(); 255 //if (sat>1) 256 // s *= 11.3; 257 259 258 //fCerPhotEvt->AddPixel(idx, s, sigs); 260 259 … … 262 261 // MMcPedestalCopy and MMcPedestalNSBAdd 263 262 if (fPedestals) 264 (*fPedestals)[i dx].Set(b, sigb);263 (*fPedestals)[i].Set(b, sigb); 265 264 } 266 265
Note:
See TracChangeset
for help on using the changeset viewer.