Changeset 2599 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 12/04/03 12:17:22 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/manalysis
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MCalibrationBlindPix.h
r2525 r2599 51 51 Float_t GetErrT() const { return fErrT; } 52 52 53 Bool_t FillQ(Int_t q) { return fHist->FillB PQ(q); }54 Bool_t FillT(Int_t t) { return fHist->FillB PT(t); }55 Bool_t FillRQvsT(Float_t rq, Int_t t) { return fHist->FillB PQvsN(rq,t); }53 Bool_t FillQ(Int_t q) { return fHist->FillBlindPixelQ(q); } 54 Bool_t FillT(Int_t t) { return fHist->FillBlindPixelT(t); } 55 Bool_t FillRQvsT(Float_t rq, Int_t t) { return fHist->FillBlindPixelQvsN(rq,t); } 56 56 57 57 Bool_t IsValid() { return fLambda > 0. || fErrLambda > 0.; } -
trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.cc
r2581 r2599 163 163 } 164 164 165 //166 // fRawEvt->GetNumPixels() does not work !!!!!!!!!!167 //168 fCalibrations->InitSize(577);169 165 170 166 switch (fColor) … … 189 185 } 190 186 191 192 // MTime does not work!!!!193 194 // fEvtTime = (MTime*)pList->FindObject("MRawEvtTime");195 // if (!fEvtTime)196 // {197 // *fLog << dbginf << "MTime could not be created ... ¡!¡!¡!¡!" << endl;198 // }199 200 // fEvtTime->SetTime(0.);201 202 187 203 188 return kTRUE; … … 222 207 fNumHiGainSamples = fRunHeader->GetNumSamplesHiGain(); 223 208 fNumLoGainSamples = fRunHeader->GetNumSamplesLoGain(); 224 209 210 // 211 // FIXME: The next statement simply does not work: 212 // fRawEvt->GetNumPixels() returns always 0 213 // fCalibrations->InitSize(fRawEvt->GetNumPixels()); 214 // 215 216 fCalibrations->InitSize(577); 217 218 for (Int_t i=0;i<577;i++) 219 { 220 MCalibrationPix &pix = (*fCalibrations)[i]; 221 pix.ChangePixId(i); 222 } 223 225 224 return kTRUE; 226 225 … … 238 237 fEvents++; 239 238 240 Bool_t cosmic = kFALSE;239 Int_t cosmicpix = 0; 241 240 242 241 MCalibrationBlindPix &blindpixel = *(fCalibrations->GetBlindPixel()); … … 251 250 const Int_t pixid = pixel.GetPixelId(); 252 251 253 if (!fCalibrations->IsPixelUsed(pixid))254 if (!fCalibrations->AddPixel(pixid))255 *fLog << err << dbginf << "MCalibrationPix(" << pixid << ") could not be created !!" << endl;256 257 252 Byte_t *ptr = pixel.GetHiGainSamples(); 258 253 Byte_t mid = pixel.GetIdxMaxHiGainSample(); … … 270 265 mid = pixel.GetIdxMaxLoGainSample(); 271 266 272 sum = (max == gkSaturationLimit // overflow of LoGain ??? -> GimmeABreak!!! 273 ? fHistOverFlow++, gkLoGainOverFlow // OUCH (Florian was maybe right) 274 : sum*gkConversionHiLo ); // OUFF (Florian was wrong) !! 275 276 // *fLog << warn << "Warning: Saturation of HiGain reached in slice " << (int)mid << " !!! " << endl; 277 // *fLog << warn << "Max = " << max << endl; 267 // 268 // FIXME: It seems the conversion HiGain LoGain is already 269 // performed in the data?!? 270 // 271 sum = (max > gkSaturationLimit // overflow of LoGain ??? -> GimmeABreak!!! 272 ? fHistOverFlow++, gkLoGainOverFlow // OUCH (Florian was maybe right) 273 : sum ); // OUFF (Florian was wrong) !! 274 // : sum*gkConversionHiLo ); // OUFF (Florian was wrong) !! 278 275 279 276 if (fHistOverFlow) … … 282 279 283 280 } 284 285 281 286 282 MPedestalPix &ped = (*fPedestals)[pixid]; … … 298 294 299 295 // 300 // This is a very primitive check for the number of cosmic s296 // This is a very primitive check for the number of cosmicpixs 301 297 // The cut will be applied in the fit, but for the blind pixel, 302 298 // we need to remove this event … … 305 301 // 306 302 307 if ((float)sum < pedes+ 5.*pedrms)308 cosmic = kTRUE;303 if ((float)sum < pedes+4.*pedrms) 304 cosmicpix++; 309 305 310 306 Float_t rsum = (float)sum - pedes; … … 314 310 315 311 case gkCalibrationBlindPixelId: 312 316 313 // 317 314 // FIXME: This works only when the blind pixel ID is much larger than 318 315 // the rest of the pixels (which is the case right now) 319 316 // 320 // if (!cosmic) 321 if (!blindpixel.FillQ(sum)) 317 if (cosmicpix < 100.) 318 { 319 if (!blindpixel.FillQ(sum)) 322 320 *fLog << warn << 323 "Overflow or Underflow occurred filling Blind Pixel sum = " << sum << endl; 324 325 if (!blindpixel.FillT((int)mid)) 326 *fLog << warn << 327 "Overflow or Underflow occurred filling Blind Pixel time = " << (int)mid << endl; 328 329 if (!blindpixel.FillRQvsT(rsum,fEvents)) 330 *fLog << warn << 331 "Overflow or Underflow occurred filling Blind Pixel eventnr = " << fEvents << endl; 332 321 "Overflow or Underflow occurred filling Blind Pixel sum = " << sum << endl; 322 323 if (!blindpixel.FillT((int)mid)) 324 *fLog << warn << 325 "Overflow or Underflow occurred filling Blind Pixel time = " << (int)mid << endl; 326 327 if (!blindpixel.FillRQvsT(rsum,fEvents)) 328 *fLog << warn << 329 "Overflow or Underflow occurred filling Blind Pixel eventnr = " << fEvents << endl; 330 } 331 333 332 case gkCalibrationPINDiodeId: 334 333 if (!pindiode.FillQ(sum)) … … 364 363 } /* while (pixel.Next()) */ 365 364 366 if (cosmic )365 if (cosmicpix > 300.) 367 366 fCosmics++; 368 367 369 fCalibrations->SetReadyToSave();370 371 368 return kTRUE; 372 369 } … … 405 402 406 403 *fLog << GetDescriptor() << " Fitting the Normal Pixels" << endl; 404 407 405 // 408 406 // loop over the pedestal events and check if we have calibration … … 411 409 { 412 410 413 if (fCalibrations->IsPixelUsed(pixid)) 414 { 415 416 MCalibrationPix &pix = (*fCalibrations)[pixid]; 417 418 const Float_t ped = (*fPedestals)[pixid].GetPedestal() * fNumHiGainSamples; 419 const Float_t prms = (*fPedestals)[pixid].GetPedestalRms() * fNumHiGainSamples; 420 421 pix.SetPedestal(ped,prms); 422 423 if (TESTBIT(fFlags,kUseTFits)) 424 pix.FitT(); 425 426 if (!pix.FitQ()) 427 continue; 428 429 } 411 MCalibrationPix &pix = (*fCalibrations)[pixid]; 412 413 const Float_t ped = (*fPedestals)[pixid].GetPedestal() * fNumHiGainSamples; 414 const Float_t prms = (*fPedestals)[pixid].GetPedestalRms() * fNumHiGainSamples; 415 416 pix.SetPedestal(ped,prms); 417 418 if (TESTBIT(fFlags,kUseTFits)) 419 pix.FitT(); 420 421 pix.FitQ(); 430 422 } 431 423 -
trunk/MagicSoft/Mars/manalysis/MCalibrationCam.cc
r2582 r2599 61 61 fTitle = title ? title : "Storage container for the Calibration Information in the camera"; 62 62 63 fPixels = new TClonesArray("MCalibrationPix", 0);63 fPixels = new TClonesArray("MCalibrationPix",1); 64 64 fBlindPixel = new MCalibrationBlindPix(); 65 65 fPINDiode = new MCalibrationPINDiode(); … … 92 92 93 93 // 94 // Here it is important to use GetEntriesFast, 95 // We get the array index of the last "filled" fPixel entry 96 // (Not the number of "filled" fPixels!!) 94 // Here we get the number of "filled" fPixels!! 97 95 // 98 96 return fPixels->GetEntriesFast(); … … 116 114 return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i)); 117 115 } 118 119 Bool_t MCalibrationCam::AddPixel(Int_t idx)120 {121 122 //123 // Check bounds first124 //125 if (!CheckBounds(idx))126 InitSize(idx);127 128 //129 // in case, new cannot allocate memory,130 // return FALSE131 //132 return (new ((*fPixels)[idx]) MCalibrationPix(idx));133 134 }135 136 116 137 117 // -------------------------------------------------------------------------- … … 173 153 Bool_t MCalibrationCam::IsPixelFitted(Int_t idx) const 174 154 { 175 if (!IsPixelUsed(idx))176 return kFALSE;177 178 155 return ((*this)[idx].GetRQ() > 0. && (*this)[idx].GetErrRQ() > 0.); 179 156 } … … 208 185 { 209 186 210 Int_t id = 0;211 212 187 TIter Next(fPixels); 213 188 MCalibrationPix *pix; 214 189 while ((pix=(MCalibrationPix*)Next())) 215 190 { 216 if (!IsPixelUsed(id++))217 continue;218 191 if (pix->FitQ()) 219 192 nsuccess++; … … 222 195 else // fit only the pixel with index i 223 196 { 224 if (!IsPixelUsed(i))225 return 0;226 197 if((*this)[i].FitQ()) 227 198 nsuccess++; … … 247 218 UShort_t nsuccess = 0; 248 219 249 Int_t id = 0;250 251 220 TIter Next(fPixels); 252 221 MCalibrationPix *pix; 253 222 while ((pix=(MCalibrationPix*)Next())) 254 223 { 255 if (!IsPixelUsed(id++))256 continue;257 224 if (pix->FitQ()) 258 225 nsuccess++; … … 293 260 { 294 261 295 Int_t id = 0;296 297 262 TIter Next(fPixels); 298 263 MCalibrationPix *pix; 299 264 while ((pix=(MCalibrationPix*)Next())) 300 265 { 301 if (!IsPixelUsed(id++)) 302 continue; 303 if (pix->FitT()) 266 if (pix->FitT()) 304 267 nsuccess++; 305 268 } … … 331 294 UShort_t nsuccess = 0; 332 295 333 Int_t id = 0;334 335 296 TIter Next(fPixels); 336 297 MCalibrationPix *pix; 337 298 while ((pix=(MCalibrationPix*)Next())) 338 299 { 339 if (!IsPixelUsed(id++))340 continue;341 300 if (pix->FitT()) 342 301 nsuccess++; … … 391 350 // we want to keep all pixel not used with a NULL pointer. 392 351 // 393 fPixels->Expand(size); 394 // 395 // Set all entries to the null pointer. 396 // Later we fill the array per pixId with the contruction: new (fPixels[i]) MCalibrationPix(pixid) 397 // To check, if pixels is already filled, we test the NULL pointer (see IsPixelUsed) 398 // 399 for (Int_t i=0; i< size; i++) 400 { 401 MCalibrationPix *pix = &(*this)[i]; 402 pix = NULL; 403 } 352 fPixels->ExpandCreate(size); 353 404 354 } 405 355 … … 413 363 while ((pix=(MCalibrationPix*)Next())) 414 364 { 415 if (!IsPixelUsed(id)) 416 continue; 417 418 *fLog << id << ": "; 365 366 *fLog << id << ": " << pix->GetPed() << " " << pix->GetPedRms() << " Charges: " ; 419 367 *fLog << pix->GetQ() << " " << pix->GetRQ() << endl; 420 368 … … 426 374 Bool_t MCalibrationCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const 427 375 { 428 429 if (!IsPixelFitted(idx))430 return kFALSE;431 376 432 377 switch (type) … … 468 413 val = (*this)[idx].GetErrRQ(); 469 414 break; 415 case 12: 416 val = (*this)[idx].GetPheFFactorMethod(); 417 break; 418 case 13: 419 val = (*this)[idx].GetConversionFFactorMethod(); 420 break; 470 421 default: 471 422 return kFALSE; … … 474 425 } 475 426 476 void MCalibrationCam::DrawPixelContent(Int_t num) const 477 { 478 *fLog << warn << "MCalibrationCam::DrawPixelContent - not available." << endl; 427 void MCalibrationCam::DrawPixelContent(Int_t idx) const 428 { 429 430 (*this)[idx].Draw(); 431 479 432 } 480 433 -
trunk/MagicSoft/Mars/manalysis/MCalibrationCam.h
r2525 r2599 77 77 Bool_t CheckBounds(Int_t i) const; 78 78 79 Bool_t AddPixel(Int_t idx);80 81 79 void Print(Option_t *o="") const; 82 80 -
trunk/MagicSoft/Mars/manalysis/MCalibrationPix.cc
r2581 r2599 40 40 using namespace std; 41 41 42 static const TString gsDefHTitle = "Calibration Histograms Pixel ";43 42 // -------------------------------------------------------------------------- 44 43 // 45 44 // Default Constructor. 46 45 // 47 MCalibrationPix::MCalibrationPix(Int_t pix, const char *name, const char *title) 48 : fPixId(pix) 46 MCalibrationPix::MCalibrationPix(const char *name, const char *title) 47 : fPixId(-1), 48 fQ(-1.), 49 fErrQ(-1.), 50 fSigmaQ(-1.), 51 fErrSigmaQ(-1.), 52 fQProb(-1.), 53 fPed(-1.), 54 fPedRms(-1.), 55 fT(-1.), 56 fSigmaT(-1.), 57 fTProb(-1.), 58 fRQ(-1.), 59 fErrRQ(-1.), 60 fFactor(1.3), 61 fPheFFactorMethod(-1.), 62 fConversionFFactorMethod(-1.) 49 63 { 50 64 … … 52 66 fTitle = title ? title : "Container of the MHCalibrationPixels and the fit results"; 53 67 54 fHist = new MHCalibrationPixel(fPixId,"MHCalibrationPixel",gsDefHTitle.Data()+fPixId); 55 56 fQ = fErrQ = 0.; 57 fPed = fPedRms = 0.; 58 fT = fSigmaT = 0.; 59 fRQ = fErrRQ = 0.; 60 fSigmaQ = fErrSigmaQ = 0.; 61 fQProb = 0.; 62 68 fHist = new MHCalibrationPixel("MHCalibrationPixel","Calibration Histograms Pixel"); 63 69 } 64 70 … … 67 73 delete fHist; 68 74 } 75 76 77 void MCalibrationPix::ChangePixId(Int_t i) 78 { 79 80 fPixId = i; 81 fHist->ChangeHistId(i); 82 83 } 84 69 85 70 86 // ------------------------------------------------------------------------ … … 84 100 85 101 if (fPed && fPedRms) 86 fHist->SetLowerFitRange(fPed + 3.5*fPedRms);102 fHist->SetLowerFitRange(fPed + 2.0*fPedRms); 87 103 else 88 104 *fLog << warn << "Cannot set lower fit range to suppress cosmics: Pedestals not available" << endl; … … 101 117 fQProb = fHist->GetQProb(); 102 118 103 if (fPed) 119 if ((fPed > 0.) && (fPedRms > 0.)) 120 { 121 104 122 fRQ = fQ - fPed; 105 if (fPedRms)106 123 fErrRQ = TMath::Sqrt(fErrQ*fErrQ + fPedRms*fPedRms); 107 124 125 fPheFFactorMethod = 126 fFactor 127 * fRQ * fRQ 128 / (fSigmaQ * fSigmaQ - fPedRms*fPedRms) ; 129 130 fConversionFFactorMethod = fPheFFactorMethod / fRQ ; 131 132 } 108 133 109 134 return kTRUE; … … 142 167 } 143 168 144 void MCalibrationPix::Test()145 {146 *fLog << "TEST: pixid: " << fPixId << endl;147 } -
trunk/MagicSoft/Mars/manalysis/MCalibrationPix.h
r2544 r2599 12 12 private: 13 13 14 //15 // FIXME: Derive class from MCerphotPix ??16 //17 14 Int_t fPixId; // the pixel Id 18 15 … … 32 29 Float_t fRQ; // The reduced mean charge after the fit 33 30 Float_t fErrRQ; // The error of the reduced mean charge after the fit 34 31 32 Float_t fFactor; // The F-factor 33 Float_t fPheFFactorMethod; // The number of Phe's calculated after the F-factor method 34 Float_t fConversionFFactorMethod; // The conversion factor to Phe's calculated after the F-factor method 35 35 36 MHCalibrationPixel *fHist; // Pointer to the histograms performing the fits, etc. 36 37 37 38 public: 38 39 39 MCalibrationPix( Int_t pix=-1,const char *name=NULL, const char *title=NULL);40 MCalibrationPix(const char *name=NULL, const char *title=NULL); 40 41 ~MCalibrationPix(); 41 42 … … 66 67 Bool_t IsValid() const { return fRQ >=0 || fErrRQ >= 0; } 67 68 Int_t GetPixId() const { return fPixId; } 68 69 void ChangePixId(Int_t i); 70 69 71 Bool_t FitQ(); 70 72 Bool_t FitT(); … … 73 75 virtual void Draw(Option_t *opt="") { fHist->Draw(opt); } 74 76 75 void Test(); 76 77 Float_t GetPheFFactorMethod() const { return fPheFFactorMethod; } 78 Float_t GetConversionFFactorMethod() const { return fConversionFFactorMethod; } 79 77 80 ClassDef(MCalibrationPix, 1) // Storage Container for Calibration information of one pixel 78 81 }; -
trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc
r2536 r2599 60 60 61 61 AddToBranchList("fHiGainPixId"); 62 //AddToBranchList("fLoGainPixId");63 62 AddToBranchList("fHiGainFadcSamples"); 64 //AddToBranchList("fLoGainFadcSamples");65 63 } 66 64 … … 98 96 fNumHiGainSamples = fRunheader->GetNumSamplesHiGain(); 99 97 98 fPedestals->InitSize(fRunheader->GetNumPixel()); 99 100 100 return kTRUE; 101 101 … … 105 105 Int_t MPedCalcPedRun::Process() 106 106 { 107 107 108 MRawEvtPixelIter pixel(fRawEvt); 108 109 109 110 while (pixel.Next()) 110 111 { 111 112 Byte_t *ptr = pixel.GetHiGainSamples(); 112 113 const Byte_t *end = ptr + fRawEvt->GetNumHiGainSamples(); 113 114 … … 115 116 const Float_t higainrms = CalcHiGainRms(ptr, end, higainped); 116 117 117 //const Float_t higainpederr = CalcHiGainMeanErr(higainrms);118 //const Float_t higainrmserr = CalcHiGainRmsErr(higainrms);119 120 118 const UInt_t pixid = pixel.GetPixelId(); 121 119 MPedestalPix &pix = (*fPedestals)[pixid]; 122 120 123 121 pix.Set(higainped, higainrms); 124 //pix.SetPedestalRms(higainpederr, higainrmserr); 122 125 123 } 126 124
Note:
See TracChangeset
for help on using the changeset viewer.