Changeset 5728 for trunk/MagicSoft/Mars/mbadpixels
- Timestamp:
- 01/07/05 19:41:50 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mbadpixels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.cc
r5574 r5728 67 67 68 68 #include <TEnv.h> 69 #include <TObjString.h> 69 70 70 71 #include "MArrayD.h" // Used instead of TArrayD because operator[] has no range check … … 101 102 // 102 103 MBadPixelsTreat::MBadPixelsTreat(const char *name, const char *title) 103 : fFlags(0), fNumMinNeighbors(3) , fNamePedPhotCam("MPedPhotCam")104 : fFlags(0), fNumMinNeighbors(3) 104 105 { 105 106 fName = name ? name : gsDefName.Data(); … … 123 124 } 124 125 126 void MBadPixelsTreat::AddNamePedPhotCam(const char *name) 127 { 128 fNamePedPhotCams.Add(new TObjString(name)); 129 } 130 125 131 // -------------------------------------------------------------------------- 126 132 // … … 159 165 } 160 166 161 fPedPhot = 0; 162 if (IsProcessPedestalEvt() || IsProcessPedestalRun()) 163 { 164 fPedPhot = (MPedPhotCam*)pList->FindObject(AddSerialNumber(fNamePedPhotCam), "MPedPhotCam"); 165 if (!fPedPhot) 166 { 167 *fLog << err << AddSerialNumber("MPedPhotCam") << " not found... aborting." << endl; 168 *fLog << " Use MBadPixelsTreat::SetProcessPedestalRun(kFALSE) and" << endl; 169 *fLog << " MBadPixelsTreat::SetProcessPedestalEvt(kFALSE) to switch" << endl; 170 *fLog << " Pedestal treatment off." << endl; 171 return kFALSE; 167 const Bool_t proc = IsProcessPedestalEvt() || IsProcessPedestalRun(); 168 169 if (fNamePedPhotCams.GetSize()>0 && !proc) 170 { 171 *fLog << err << "Pedestal list contains entries, but pedestal treatment is switched off... abort." << endl; 172 return kFALSE; 173 } 174 175 if (proc) 176 { 177 if (fNamePedPhotCams.GetSize()==0) 178 { 179 *fLog << inf << "No container names specified... using default: MPedPhotCam." << endl; 180 AddNamePedPhotCam(); 181 } 182 183 fPedPhotCams.Clear(); 184 185 TIter Next(&fNamePedPhotCams); 186 TObject *o=0; 187 while ((o=Next())) 188 { 189 TObject *p = pList->FindObject(AddSerialNumber(o->GetName()), "MPedPhotCam"); 190 if (!p) 191 { 192 *fLog << err << AddSerialNumber(o->GetName()) << " [MPedPhotCam] not found... aborting." << endl; 193 //*fLog << " Use MBadPixelsTreat::SetProcessPedestalRun(kFALSE) and" << endl; 194 //*fLog << " MBadPixelsTreat::SetProcessPedestalEvt(kFALSE) to switch" << endl; 195 //*fLog << " Pedestal treatment off." << endl; 196 return kFALSE; 197 } 198 199 fPedPhotCams.Add(p); 172 200 } 173 201 } … … 313 341 // -------------------------------------------------------------------------- 314 342 // 315 void MBadPixelsTreat::InterpolatePedestals( ) const316 { 317 const Int_t entries = fPedPhot->GetSize();343 void MBadPixelsTreat::InterpolatePedestals(MPedPhotCam &pedphot) const 344 { 345 const Int_t entries = pedphot.GetSize(); 318 346 319 347 // Create arrays (FIXME: Check if its possible to create it only once) … … 336 364 // 337 365 const MGeomPix &gpix = (*fGeomCam)[i]; 338 const MPedPhotPix &ppix = (*fPedPhot)[i];366 const MPedPhotPix &ppix = pedphot[i]; 339 367 340 368 // Do Not-Use-Central-Pixel … … 372 400 // 373 401 const Double_t nratio = fGeomCam->GetPixRatio(nidx); 374 const MPedPhotPix &nppix = (*fPedPhot)[nidx];402 const MPedPhotPix &nppix = pedphot[nidx]; 375 403 376 404 // … … 402 430 rms[i] = TMath::Sqrt(rms[i]/(num*ratio)); 403 431 404 (*fPedPhot)[i].Set(ped[i], rms[i]); 432 pedphot[i].Set(ped[i], rms[i]); 433 } 434 pedphot.SetReadyToSave(); 435 } 436 437 // -------------------------------------------------------------------------- 438 // 439 // loop over all MPedPhotCam and interpolate them 440 // 441 void MBadPixelsTreat::InterpolatePedestals() const 442 { 443 TIter Next(&fPedPhotCams); 444 MPedPhotCam *cam=0; 445 while ((cam=(MPedPhotCam*)Next())) 446 { 447 InterpolatePedestals(*cam); 448 cam->ReCalc(*fGeomCam, fBadPixels); 405 449 } 406 450 } … … 427 471 const Int_t n0 = gpix.GetNumNeighbors(); 428 472 429 MArrayD time( 6);473 MArrayD time(n0); 430 474 for (int j=0; j<n0; j++) 431 475 time[j] = (*fTimes)[gpix.GetNeighbor(j)]; … … 436 480 Double_t min=FLT_MAX; 437 481 for (int j=0; j<n0; j++) 438 for (int k= 1; k<j+1; k++)482 for (int k=0; k<j; k++) 439 483 { 440 const Double_t diff = TMath::Abs(time[ n0-k] - time[n0-k-j]);484 const Double_t diff = TMath::Abs(time[j] - time[k]); 441 485 442 486 if (diff>=min && diff<250) 443 487 continue; 444 488 445 p0 = n0-k;446 p1 = n0-k-j;489 p0 = j; 490 p1 = k; 447 491 min = diff; 448 492 } -
trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.h
r4768 r5728 16 16 private: 17 17 MGeomCam *fGeomCam; //! 18 MPedPhotCam *fPedPhot; //!18 //MPedPhotCam *fPedPhot; //! 19 19 MCerPhotEvt *fEvt; //! 20 20 MArrivalTime *fTimes; //! 21 21 MBadPixelsCam *fBadPixels; //! 22 22 23 TList fPedPhotCams; 24 23 25 Byte_t fFlags; // flag for the method which is used 24 26 Byte_t fNumMinNeighbors; 25 27 26 TString fNamePedPhotCam; // name of the 'MPedPhotCam' container 28 //TString fNamePedPhotCam; // name of the 'MPedPhotCam' container 29 TList fNamePedPhotCams; 27 30 28 31 enum … … 40 43 void InterpolateTimes() const; 41 44 void InterpolateSignal() const; 45 void InterpolatePedestals(MPedPhotCam &pedphot) const; 42 46 void InterpolatePedestals() const; 43 47 … … 92 96 93 97 void SetNumMinNeighbors(Byte_t num) { fNumMinNeighbors=num; } 94 void SetNamePedPhotCam(const char *name) { fNamePedPhotCam = name; } 98 void AddNamePedPhotCam(const char *name="MPedPhotCam"); 99 void SetNamePedPhotCam(const char *name) 100 { 101 AddNamePedPhotCam(name); 102 } // Deprecated! Use AddNamePedPhotCam instead (directly) 95 103 96 104 ClassDef(MBadPixelsTreat, 1) // Task to treat bad pixels (interpolation, unmapping)
Note:
See TracChangeset
for help on using the changeset viewer.