- Timestamp:
- 05/03/04 13:39:47 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc
r3700 r3936 88 88 // 89 89 MCalibrationCam::MCalibrationCam(const char *name, const char *title) 90 : fNumHiGainFADCSlices(0.), fNumLoGainFADCSlices(0.), fPulserColor(kNONE), 90 : fNumUnsuitable(), 91 fNumUnreliable(), 92 fNumHiGainFADCSlices(0.), fNumLoGainFADCSlices(0.), fPulserColor(kNONE), 91 93 fPixels(NULL), fAverageAreas(NULL), fAverageSectors(NULL) 92 94 { … … 189 191 fAverageAreas->ExpandCreate(i); 190 192 fAverageBadAreas->ExpandCreate(i); 193 194 fNumUnsuitable.Set(i); 195 fNumUnreliable.Set(i); 191 196 } 192 197 … … 219 224 // -------------------------------------------------------------------------- 220 225 // 226 // Returns the number of un-suitable pixels per area index and -1 if 227 // the area index exceeds the initialized array. 228 // 229 const Int_t MCalibrationCam::GetNumUnsuitable( Int_t aidx ) const 230 { 231 if (aidx < 0) 232 return -1; 233 234 return aidx > fNumUnsuitable.GetSize() ? -1 : fNumUnsuitable[aidx]; 235 } 236 237 // -------------------------------------------------------------------------- 238 // 239 // Returns the number of un-reliable pixels per area index and -1 if 240 // the area index exceeds the initialized array. 241 // 242 const Int_t MCalibrationCam::GetNumUnreliable( Int_t aidx ) const 243 { 244 if (aidx < 0) 245 return -1; 246 247 return aidx > fNumUnreliable.GetSize() ? -1 : fNumUnreliable[aidx]; 248 } 249 250 251 // -------------------------------------------------------------------------- 252 // 253 // Returns the current size of the TClonesArray fAverageAreas 254 // independently if the MCalibrationPix is filled with values or not. 255 // 256 const Int_t MCalibrationCam::GetAverageAreas() const 257 { 258 return fAverageAreas->GetEntriesFast(); 259 } 260 261 // -------------------------------------------------------------------------- 262 // 263 // Returns the current size of the TClonesArray fAverageSectors 264 // independently if the MCalibrationPix is filled with values or not. 265 // 266 const Int_t MCalibrationCam::GetAverageSectors() const 267 { 268 return fAverageSectors->GetEntriesFast(); 269 } 270 271 272 // -------------------------------------------------------------------------- 273 // 274 // Get i-th pixel (pixel number) 275 // 276 MCalibrationPix &MCalibrationCam::operator[](UInt_t i) 277 { 278 return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i)); 279 } 280 281 // -------------------------------------------------------------------------- 282 // 283 // Get i-th pixel (pixel number) 284 // 285 const MCalibrationPix &MCalibrationCam::operator[](UInt_t i) const 286 { 287 return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i)); 288 } 289 221 290 // Returns the current size of the TClonesArray fPixels 222 291 // independently if the MCalibrationPix is filled with values or not. 223 //224 292 const Int_t MCalibrationCam::GetSize() const 225 293 { … … 229 297 // -------------------------------------------------------------------------- 230 298 // 231 // Returns the current size of the TClonesArray fAverageAreas232 // independently if the MCalibrationPix is filled with values or not.233 //234 const Int_t MCalibrationCam::GetAverageAreas() const235 {236 return fAverageAreas->GetEntriesFast();237 }238 239 // --------------------------------------------------------------------------240 //241 // Returns the current size of the TClonesArray fAverageSectors242 // independently if the MCalibrationPix is filled with values or not.243 //244 const Int_t MCalibrationCam::GetAverageSectors() const245 {246 return fAverageSectors->GetEntriesFast();247 }248 249 250 // --------------------------------------------------------------------------251 //252 // Get i-th pixel (pixel number)253 //254 MCalibrationPix &MCalibrationCam::operator[](UInt_t i)255 {256 return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i));257 }258 259 // --------------------------------------------------------------------------260 //261 // Get i-th pixel (pixel number)262 //263 const MCalibrationPix &MCalibrationCam::operator[](UInt_t i) const264 {265 return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i));266 }267 268 // --------------------------------------------------------------------------269 //270 299 // Get i-th average pixel (area number) 271 300 // … … 360 389 } 361 390 391 void MCalibrationCam::SetNumUnsuitable( const UInt_t i, const Int_t aidx) 392 { 393 if (aidx < 0) 394 return; 395 396 if (aidx < fNumUnsuitable.GetSize()) 397 fNumUnsuitable[aidx] = i; 398 } 399 400 void MCalibrationCam::SetNumUnreliable( const UInt_t i, const Int_t aidx) 401 { 402 if (aidx < 0) 403 return; 404 if (aidx < fNumUnreliable.GetSize()) 405 fNumUnreliable[aidx] = i; 406 } -
trunk/MagicSoft/Mars/mcalib/MCalibrationCam.h
r3835 r3936 8 8 #include "MCamEvent.h" 9 9 #endif 10 #ifndef ROOT_TArrayI 11 #include "TArrayI.h" 12 #endif 10 13 11 14 class TClonesArray; … … 15 18 class MBadPixelsCam; 16 19 class MGeomCam; 17 18 20 class MCalibrationCam : public MParContainer, public MCamEvent 19 21 { … … 24 26 25 27 protected: 28 29 TArrayI fNumUnsuitable; 30 TArrayI fNumUnreliable; 26 31 27 32 Float_t fNumHiGainFADCSlices; // Number High-Gain FADC slices used by extractor … … 57 62 const Float_t GetNumHiGainFADCSlices() const { return fNumHiGainFADCSlices; } 58 63 const Float_t GetNumLoGainFADCSlices() const { return fNumLoGainFADCSlices; } 64 const Int_t GetNumUnsuitable ( Int_t aidx) const; 65 const Int_t GetNumUnreliable ( Int_t aidx) const; 66 59 67 virtual Bool_t GetPixelContent ( Double_t &val, Int_t idx, 60 68 const MGeomCam &cam, Int_t type=0) const; … … 74 82 void SetNumHiGainFADCSlices ( const Float_t f ) { fNumHiGainFADCSlices = f; } 75 83 void SetNumLoGainFADCSlices ( const Float_t f ) { fNumLoGainFADCSlices = f; } 84 void SetNumUnsuitable ( const UInt_t i, const Int_t aidx); 85 void SetNumUnreliable ( const UInt_t i, const Int_t aidx); 76 86 void SetPulserColor ( const PulserColor_t col=kCT1 ) { fPulserColor = col; } 77 87 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r3923 r3936 1444 1444 1445 1445 *fLog << inf << endl; 1446 *fLog << GetDescriptor() << ": C alibration statistics:" << endl;1446 *fLog << GetDescriptor() << ": Charge Calibration status:" << endl; 1447 1447 *fLog << dec << setfill(' '); 1448 1448 … … 1479 1479 1480 1480 for (Int_t aidx=0; aidx<nareas; aidx++) 1481 fCam->SetNumUn calibrated(counts[aidx], aidx);1481 fCam->SetNumUnsuitable(counts[aidx], aidx); 1482 1482 1483 1483 if (fGeom->InheritsFrom("MGeomCamMagic")) -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc
r3896 r3936 155 155 // Calls: 156 156 // - MCalibrationCam::Init() 157 // - fNumUncalibrated.Set(NumAreas);158 // - fNumUnreliable.Set(NumAreas);159 157 // 160 158 void MCalibrationChargeCam::Init(const MGeomCam &geom) 161 159 { 162 fNumUncalibrated.Set(geom.GetNumAreas());163 fNumUnreliable .Set(geom.GetNumAreas());164 160 MCalibrationCam::Init(geom); 165 161 } -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h
r3837 r3936 14 14 private: 15 15 16 TArrayI fNumUncalibrated;17 TArrayI fNumUnreliable;18 19 16 Byte_t fFlags; // Bit-field to hold the flags 20 17 … … 32 29 // Getters 33 30 Bool_t GetConversionFactorFFactor( Int_t ipx, Float_t &mean, Float_t &err, Float_t &ffactor ); 34 Int_t GetNumUncalibrated ( const Int_t aidx) const { return fNumUncalibrated[aidx]; }35 Int_t GetNumUnreliable ( const Int_t aidx) const { return fNumUnreliable [aidx]; }36 31 Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const; 37 32 Bool_t IsFFactorMethodValid() const; … … 45 40 // Setters 46 41 void SetFFactorMethodValid ( const Bool_t b=kTRUE ); 47 void SetNumUncalibrated ( const Int_t i, const Int_t aidx) { fNumUncalibrated[aidx] = i; }48 void SetNumUnreliable ( const Int_t i, const Int_t aidx) { fNumUnreliable [aidx] = i; }49 42 50 43 ClassDef(MCalibrationChargeCam, 1) // Container Charge Calibration Results Camera -
trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc
r3917 r3936 72 72 using namespace std; 73 73 74 const Float_t MCalibrationRelTimeCalc::fgRelTimeRelErrLimit = 3.;74 const Float_t MCalibrationRelTimeCalc::fgRelTimeRelErrLimit = 6.; 75 75 // -------------------------------------------------------------------------- 76 76 // … … 219 219 // First loop over pixels, call FinalizePedestals and FinalizeRelTimes 220 220 // 221 Int_t nvalid = 0; 222 223 for (Int_t pixid=0; pixid<fCam->GetSize(); pixid++) 224 { 225 226 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[pixid]; 227 // 228 // Check if the pixel has been excluded from the fits 229 // 230 if (pix.IsExcluded()) 231 continue; 232 233 MBadPixelsPix &bad = (*fBadPixels)[pixid]; 234 235 if (FinalizeRelTimes(pix,bad)) 236 nvalid++; 237 } 238 239 // 240 // The Michele check ... 241 // 242 if (nvalid == 0) 243 { 244 *fLog << err << GetDescriptor() << ": All pixels have non-valid calibration. " 245 << "Did you forget to fill the histograms " 246 << "(filling MHCalibrationRelTimeCam from MArrivalTimeCam using MFillH) ? " << endl; 247 *fLog << err << GetDescriptor() << ": Or, maybe, you have used a pedestal run " 248 << "instead of a calibration run " << endl; 249 return kFALSE; 250 } 251 252 for (UInt_t aidx=0; aidx<fGeom->GetNumAreas(); aidx++) 253 { 254 255 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)fCam->GetAverageArea(aidx); 256 FinalizeRelTimes(pix, fCam->GetAverageBadArea(aidx)); 257 } 258 259 for (UInt_t sector=0; sector<fGeom->GetNumSectors(); sector++) 260 { 261 262 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)fCam->GetAverageSector(sector); 263 FinalizeRelTimes(pix, fCam->GetAverageBadSector(sector)); 264 } 265 221 FinalizeRelTimes(); 222 266 223 // 267 224 // Finalize Bad Pixels … … 281 238 282 239 PrintUncalibrated(MBadPixelsPix::kDeviatingTimeResolution, 283 Form("%s%2.1f%s","Time resolution less than ",fRelTimeRelErrLimit," sigma from Mean: 240 Form("%s%2.1f%s","Time resolution less than ",fRelTimeRelErrLimit," sigma from Mean: ")); 284 241 PrintUncalibrated(MBadPixelsPix::kRelTimeOscillating, 285 242 "Pixels with changing Rel. Times over time: "); … … 301 258 // MBadPixelsPix::kDeviatingTimeResolution if excluded. 302 259 // 303 Bool_t MCalibrationRelTimeCalc::FinalizeRelTimes(MCalibrationRelTimePix &cal, MBadPixelsPix &bad)260 void MCalibrationRelTimeCalc::FinalizeRelTimes() 304 261 { 305 262 … … 309 266 Float_t lowlim [nareas]; 310 267 Float_t upplim [nareas]; 311 Float_t area errs[nareas];312 Float_t area mean[nareas];268 Float_t areasum [nareas]; 269 Float_t areasum2 [nareas]; 313 270 Int_t numareavalid[nareas]; 314 271 315 272 memset(lowlim ,0, nareas * sizeof(Float_t)); 316 273 memset(upplim ,0, nareas * sizeof(Float_t)); 317 memset(area errs,0, nareas * sizeof(Float_t));318 memset(area mean,0, nareas * sizeof(Float_t));274 memset(areasum ,0, nareas * sizeof(Float_t)); 275 memset(areasum2 ,0, nareas * sizeof(Float_t)); 319 276 memset(numareavalid ,0, nareas * sizeof(Int_t )); 320 277 … … 326 283 { 327 284 328 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam) 329 MBadPixelsPix &bad = (*fBadPixels)[i];330 331 if ( !pix.IsExcluded())285 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i]; 286 MBadPixelsPix &bad = (*fBadPixels)[i]; 287 288 if (pix.IsExcluded()) 332 289 continue; 333 290 … … 338 295 continue; 339 296 297 const Float_t res = pix.GetTimePrecision(); 298 const Int_t aidx = (*fGeom)[i].GetAidx(); 299 300 areasum [aidx] += res; 301 areasum2 [aidx] += res*res; 302 numareavalid[aidx] ++; 303 } 304 305 306 for (UInt_t aidx=0; aidx<nareas; aidx++) 307 { 308 if (numareavalid[aidx] == 0) 309 { 310 *fLog << warn << GetDescriptor() << ": No pixels with valid time resolution found " 311 << "in area index: " << aidx << endl; 312 continue; 313 } 314 315 // Calculate the rms out of sum2: 316 areasum2[aidx] = (areasum2[aidx] - areasum[aidx]*areasum[aidx]/numareavalid[aidx]); 317 areasum [aidx] /= numareavalid[aidx]; 318 areasum2[aidx] /= (numareavalid[aidx]-1.); 319 lowlim [aidx] = areamean[aidx] - fRelTimeRelErrLimit*areasum2[aidx]; 320 upplim [aidx] = areamean[aidx] + fRelTimeRelErrLimit*areasum2[aidx]; 321 } 322 323 324 325 for (UInt_t i=0; i<npixels; i++) 326 { 327 328 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i]; 329 MBadPixelsPix &bad = (*fBadPixels)[i]; 330 331 if (pix.IsExcluded()) 332 continue; 333 334 if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) 335 continue; 336 340 337 const Float_t res = pix.GetTimePrecision(); 341 const Float_t perr = pix.GetTimePrecisionErr();342 const Int_t aidx = (*fGeom)[i].GetAidx();343 344 areamean [aidx] += res;345 areaerrs [aidx] += perr;346 numareavalid[aidx] ++;347 }348 349 350 351 for (UInt_t i=0; i<nareas; i++)352 {353 if (numareavalid[i] == 0)354 {355 *fLog << warn << GetDescriptor() << ": No pixels with valid number of photo-electrons found "356 << "in area index: " << i << endl;357 continue;358 }359 360 areamean[i] = areamean[i] / numareavalid[i];361 areaerrs[i] = areaerrs[i] / numareavalid[i];362 lowlim [i] = areamean[i] - fRelTimeRelErrLimit*areaerrs[i];363 upplim [i] = areamean[i] + fRelTimeRelErrLimit*areaerrs[i];364 }365 366 367 368 //369 // Second loop: Exclude pixels deviating by more than fRelTimeErrLimit sigma.370 //371 for (UInt_t i=0; i<npixels; i++)372 {373 374 MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i];375 376 if (!pix.IsExcluded())377 continue;378 379 const Float_t res = pix.GetTimePrecision();380 381 MBadPixelsPix &bad = (*fBadPixels)[i];382 338 const Int_t aidx = (*fGeom)[i].GetAidx(); 383 339 384 340 if ( res < lowlim[aidx] || res > upplim[aidx] ) 385 341 { 386 342 *fLog << warn << GetDescriptor() << ": Deviating time resolution: " 387 343 << Form("%4.2f",res) << " out of accepted limits: [" 388 344 << Form("%4.2f%s%4.2f",lowlim[aidx],",",upplim[aidx]) << "] in pixel " << i << endl; 389 345 bad.SetUncalibrated( MBadPixelsPix::kDeviatingTimeResolution); 390 bad.SetUnsuitable ( MBadPixelsPix::kUnsuitableRun );391 346 pix.SetExcluded(); 392 347 } 393 348 } 394 395 return kTRUE; 396 } 397 349 } 398 350 399 351 … … 441 393 442 394 *fLog << inf << endl; 443 *fLog << GetDescriptor() << ": Calibration statistics:" << endl;395 *fLog << GetDescriptor() << ": Rel. Times Calibration status:" << endl; 444 396 *fLog << dec << setfill(' '); 445 397 … … 460 412 461 413 for (Int_t aidx=0; aidx<nareas; aidx++) 462 fCam->SetNumUn calibrated(counts[aidx], aidx);414 fCam->SetNumUnsuitable(counts[aidx], aidx); 463 415 464 416 if (fGeom->InheritsFrom("MGeomCamMagic")) -
trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.h
r3917 r3936 32 32 private: 33 33 34 static const Float_t fgRelTimeRelErrLimit; //! Default for fRelTimeRelErrLimit (now set to: 1.)34 static const Float_t fgRelTimeRelErrLimit; //! Default for fRelTimeRelErrLimit (now set to: 6.) 35 35 36 36 // Variables 37 37 Float_t fRelTimeRelErrLimit; // Limit acceptance rel. error mean (in abs. numbers) 38 38 Byte_t fFlags; // Bit-field for the flags 39 39 40 40 // Pointers 41 41 MBadPixelsCam *fBadPixels; // Bad Pixels … … 47 47 48 48 // functions 49 Bool_t FinalizeRelTimes ( MCalibrationRelTimePix &cal, MBadPixelsPix &bad ); 49 void FinalizeAverageResolution(); 50 void FinalizeRelTimes (); 50 51 void FinalizeBadPixels (); 51 52 void FinalizeUnsuitablePixels(); -
trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCam.h
r3917 r3936 13 13 class MCalibrationRelTimeCam : public MCalibrationCam 14 14 { 15 private:16 17 TArrayI fNumUncalibrated;18 TArrayI fNumUnreliable;19 20 15 public: 21 16 22 17 MCalibrationRelTimeCam(const char *name=NULL, const char *title=NULL); 23 18 ~MCalibrationRelTimeCam() {} 24 25 Int_t GetNumUncalibrated ( const Int_t aidx) const { return fNumUncalibrated[aidx]; }26 Int_t GetNumUnreliable ( const Int_t aidx) const { return fNumUnreliable [aidx]; }27 19 28 20 // Prints … … 33 25 void DrawPixelContent(Int_t num) const; 34 26 35 void SetNumUncalibrated ( const Int_t i, const Int_t aidx) { fNumUncalibrated[aidx] = i; }36 void SetNumUnreliable ( const Int_t i, const Int_t aidx) { fNumUnreliable [aidx] = i; }37 38 27 ClassDef(MCalibrationRelTimeCam, 1) // Container Rel. Arrival Time Calibration Results Camera 39 28 }; -
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r3929 r3936 1608 1608 for (int j=0; j<2; j++) 1609 1609 { 1610 half[j]->SetLineColor(kRed+i+ j);1610 half[j]->SetLineColor(kRed+i+2*j); 1611 1611 half[j]->SetDirectory(0); 1612 1612 half[j]->SetBit(kCanDelete);
Note:
See TracChangeset
for help on using the changeset viewer.