Changeset 5728 for trunk/MagicSoft
- Timestamp:
- 01/07/05 19:41:50 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r5727 r5728 26 26 signals and fix the extraction window from the occurrance of 27 27 saturation, then. Important for high-intensity calibration events. 28 29 28 30 29 31 2005/01/07 Abelardo Moralejo … … 76 78 - fixed a bug in GetMaxIdxHiLoGain which caused the loop to 77 79 read one byte behind the end of the array 80 - fixed HasLoGain() which really did weired things, means accessing 81 sometimes memory somewhere. This could theoretically result 82 in assigning the wrong lo-gains to the wrong pixels. 78 83 79 84 * mtrigger/MTriggerPattern.[h,cc], mtrigger/MTriggerPatternDecode.[h,cc], -
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) -
trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc
r5725 r5728 71 71 // -------------------------------------------------------------------------- 72 72 // 73 // return kTRUE the lo gains exist for the actual pixel, else return kFALSE 74 // 75 #include <iostream> 76 Bool_t MRawEvtPixelIter::HasLoGain() const 77 { 78 // We have no lo-gain at all 79 if (!fLoGainId) 80 return kFALSE; 81 82 // This is to make the first call of this function in Next() 83 // work properly! NEVER call this function before Next() 84 if (fNumLoGainEntry==0) 85 return kTRUE; 86 87 // cout << fNumLoGainEntry << " " << flush; 88 // cout << fData->fLoGainPixId->GetSize() << " " << flush; 89 90 if (fNumLoGainEntry>fData->fLoGainPixId->GetSize()) 91 return kFALSE; 92 93 /* 94 cout << fNumLoGainEntry << " " << flush; 95 cout << fData->fLoGainPixId->GetSize() << " " << flush; 96 cout << fData->fLoGainPixId->GetArray() << " " << flush; 97 cout << fLoGainId << endl; 98 */ 99 // cout << (int)(fLoGainId-fData->fLoGainPixId->GetArray()) << " " << flush; 100 // cout << (int)(fHiGainId-fData->fHiGainPixId->GetArray()) << " " << flush; 101 102 Bool_t rc = *fHiGainId!=*fLoGainId; 103 104 // cout << "done." << endl; 105 106 107 if (rc) 108 return kFALSE; 109 /* 110 // We have no lo-gain at all 111 if (!fLoGainId) 112 return kFALSE; 113 114 // This is to make the first call of this function in Next() 115 // work properly! NEVER call this function before Next() 116 if (fNumLoGainEntry==0) 117 return kTRUE; 118 119 // Make sure, that we don't exceed the last entry in the array! 120 if (fNumLoGainEntry==fData->fLoGainPixId->GetSize()) 121 return kFALSE; 122 123 // Check whether the current position in lo-gain fits the hi-gain 124 return *fHiGainId!=*fLoGainId; 125 */ 126 return kTRUE; 127 } 128 129 // -------------------------------------------------------------------------- 130 // 73 131 // It steps to the next pixel. If there is no next pixel NULL is returned. 74 132 // If a next pixel where found, a pointer to the primary given (constructor) … … 86 144 // if we are already at the last entry there is no 'next' entry anymore 87 145 // 88 if (fNumLoGainEntry != fData->fLoGainPixId->GetSize()) 89 if (HasLoGain()) 90 { 91 // 92 // if higainpixid and logainpixid of the actual pixel are 93 // identical then we have to move the pointer to the next 94 // entry in the lo gains 95 // 96 fNumLoGainEntry++; 97 fLoGainId++; 98 fLoGainPos += fNumLoGainSamples; 99 } 146 if (HasLoGain()) 147 { 148 // 149 // if higainpixid and logainpixid of the actual pixel are 150 // identical then we have to move the pointer to the next 151 // entry in the lo gains 152 // 153 fNumLoGainEntry++; 154 fLoGainId++; 155 fLoGainPos += fNumLoGainSamples; 156 } 100 157 101 158 // -
trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h
r4643 r5728 90 90 Short_t GetIdxMaxHiLoGainSample() const; 91 91 92 Bool_t HasLoGain() const 93 { 94 // 95 // return kTRUE the lo gains exist for the actual pixel, else return kFALSE 96 // 97 return fLoGainId && *fHiGainId==*fLoGainId; 98 } 92 Bool_t HasLoGain() const; 99 93 Bool_t IsABFlagValid() const { return fABFlags ? kTRUE : kFALSE; } 100 94 Bool_t HasABFlag() const -
trunk/MagicSoft/Mars/msignal/MExtractor.cc
r5601 r5728 422 422 *fLog << GetDescriptor() << ":" << endl; 423 423 424 *fLog << " Hi Gain Range: " << (int)fHiGainFirst << " " << (int)fHiGainLast << endl;425 *fLog << " Lo Gain Range: " << (int)fLoGainFirst << " " << (int)fLoGainLast << endl;426 *fLog << " Saturation Lim: " << (int)fSaturationLimit << endl;424 *fLog << " Hi Gain Range: " << (int)fHiGainFirst << " " << (int)fHiGainLast << endl; 425 *fLog << " Lo Gain Range: " << (int)fLoGainFirst << " " << (int)fLoGainLast << endl; 426 *fLog << " Saturation Lim: " << (int)fSaturationLimit << endl; 427 427 *fLog << " Num Samples HiGain: " << fNumHiGainSamples << " LoGain: " << fNumLoGainSamples << endl; 428 428 }
Note:
See TracChangeset
for help on using the changeset viewer.