Changeset 5777 for trunk/MagicSoft/Mars/mbadpixels
- Timestamp:
- 01/10/05 18:07:40 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mbadpixels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.cc
r5717 r5777 56 56 57 57 #include <TEnv.h> 58 #include <TArrayD.h> 58 59 #include "MArrayI.h" 60 #include "MArrayD.h" 59 61 60 62 #include "MLog.h" … … 86 88 // 87 89 MBadPixelsCalc::MBadPixelsCalc(const char *name, const char *title) 88 : fPedestalLevel(3), f NamePedPhotCam("MPedPhotCam")90 : fPedestalLevel(3), fPedestalLevelVariance(-1), fNamePedPhotCam("MPedPhotCam") 89 91 { 90 92 fName = name ? name : gsDefName.Data(); … … 118 120 } 119 121 120 *fLog << inf << "Name of MPedPhotCam used: " << fNamePedPhotCam << endl; 122 *fLog << inf << "Name of MPedPhotCam to get 'pedestal rms' from used: " << fNamePedPhotCam << endl; 123 if (fPedestalLevel) 124 *fLog << "Checking mean 'pedestal rms' against absolute value with level " << fPedestalLevel << endl; 125 if (fPedestalLevelVariance) 126 *fLog << "Checking mean 'pedestal rms' against its variance with level " << fPedestalLevelVariance << endl; 121 127 122 128 return kTRUE; … … 167 173 const Int_t na = fGeomCam->GetNumAreas(); 168 174 169 TArrayD meanrms(na);170 TArrayI npix(na);175 MArrayD meanrms(na); 176 MArrayI npix(na); 171 177 172 178 for (Int_t i=0; i<entries; i++) … … 196 202 } 197 203 198 TArrayD meanrms2(na); 204 MArrayD meanrms2(na); 205 MArrayD varrms2(na); 199 206 for (Int_t i=0; i<entries; i++) 200 207 { … … 208 215 209 216 meanrms2[aidx] += rms; 217 varrms2 [aidx] += rms*rms; 210 218 npix[aidx]++; 211 219 } 212 220 213 221 //if no pixel has a minimum signal, return 222 MArrayD lolim1(na), lolim2(na); // Precalcualtion of limits 223 MArrayD uplim1(na), uplim2(na); // for speeed reasons 214 224 for (int i=0; i<na; i++) 215 225 { … … 221 231 222 232 meanrms2[i] /= npix[i]; 233 234 if (fPedestalLevel>0) 235 { 236 lolim1[i] = meanrms2[i]/fPedestalLevel; 237 uplim1[i] = meanrms2[i]*fPedestalLevel; 238 } 239 240 if (fPedestalLevelVariance>0) 241 { 242 varrms2[i] /= npix[i]; 243 varrms2[i] = TMath::Sqrt(varrms2[i]-meanrms2[i]*meanrms2[i]); 244 245 lolim2[i] = meanrms2[i]-fPedestalLevelVariance*varrms2[i]; 246 uplim2[i] = meanrms2[i]+fPedestalLevelVariance*varrms2[i]; 247 } 223 248 } 224 249 … … 231 256 const Byte_t aidx = (*fGeomCam)[i].GetAidx(); 232 257 233 if (rms>meanrms2[aidx]/fPedestalLevel && rms<=meanrms2[aidx]*fPedestalLevel) 258 if ((fPedestalLevel<0 || (rms>lolim1[aidx] && rms<=uplim1[aidx])) && 259 (fPedestalLevelVariance<0 || (rms>lolim2[aidx] && rms<=uplim2[aidx]))) 234 260 continue; 235 261 … … 237 263 bads++; 238 264 } 265 239 266 240 267 // Check if the number of pixels to blind is > 60% of total number of pixels … … 255 282 Int_t MBadPixelsCalc::Process() 256 283 { 257 if (fPedestalLevel>0 )284 if (fPedestalLevel>0 || fPedestalLevelVariance) 258 285 { 259 286 CheckPedestalRms(); 260 fPedPhotCam->ReCalc(*fGeomCam, fBadPixels);287 //fPedPhotCam->ReCalc(*fGeomCam, fBadPixels); 261 288 } 262 289 … … 267 294 // 268 295 // Read the setup from a TEnv, eg: 269 // MBadPixelsCalc.PedestalLevel: 3.0 296 // MBadPixelsCalc.PedestalLevel: 3.0 297 // MBadPixelsCalc.PedestalLevelVariance: 3.0 270 298 // 271 299 Int_t MBadPixelsCalc::ReadEnv(const TEnv &env, TString prefix, Bool_t print) … … 277 305 SetPedestalLevel(GetEnvValue(env, prefix, "PedestalLevel", fPedestalLevel)); 278 306 } 307 308 if (IsEnvDefined(env, prefix, "PedestalLevelVariance", print)) 309 { 310 rc = kTRUE; 311 SetPedestalLevelVariance(GetEnvValue(env, prefix, "PedestalLevelVariance", fPedestalLevelVariance)); 312 } 279 313 return rc; 280 314 } -
trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCalc.h
r5717 r5777 18 18 19 19 Float_t fPedestalLevel; 20 Float_t fPedestalLevelVariance; 21 20 22 TString fNamePedPhotCam; // name of the 'MPedPhotCam' container 21 23 … … 30 32 MBadPixelsCalc(const char *name=NULL, const char *title=NULL); 31 33 32 void SetPedestalLevel(Float_t f) { fPedestalLevel=f; } 33 void SetNamePedPhotCam(const char *name) { fNamePedPhotCam = name; } 34 void SetPedestalLevel(Float_t f) { fPedestalLevel=f; } 35 void SetPedestalLevelVariance(Float_t f) { fPedestalLevelVariance=f; } 36 void SetNamePedPhotCam(const char *name) { fNamePedPhotCam = name; } 34 37 35 38 ClassDef(MBadPixelsCalc, 1) // Task to find bad pixels (star, broken pixels, etc)
Note:
See TracChangeset
for help on using the changeset viewer.