Changeset 2627 for trunk/MagicSoft/Mars
- Timestamp:
- 12/09/03 18:25:21 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 6 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2626 r2627 4 4 5 5 -*-*- END OF LINE -*-*- 6 2003/12/09: Markus Gaug 7 8 * mhist/MHCamera: 9 - added feature MHCamError to set errors in histograms of MStatusDisplay 10 11 * mhist/MHCalibration*: 12 - all hists doubles to separate High Gain and Low Gain 13 14 * manalysis/MCalibration* 15 - separate Hi Gain and Lo Gain 16 - use MExtractSignals to extract charges 17 18 * manalysis/MExtractSignals: 19 - new class to extract signals 20 21 * manalysis/MExtractedSignalCam: 22 - new class to hold extracted signals 23 24 * manalysis/MExtractedSignalPix: 25 - new class to hold extracted signals for pixel 26 27 * manalysis/Makefile 28 * manalysis/AnalysisLinkDef: 29 - contain MExtractedSignalCam, MExtractedSignalPix, MExtractedSignal 30 31 * macros/calibration.C 32 - EventDisplay which allows to get plot by clicking on pixel 33 34 6 35 2003/12/08: Thomas Bretz 7 36 -
trunk/MagicSoft/Mars/macros/calibration.C
r2603 r2627 23 23 \* ======================================================================== */ 24 24 25 void calibration(TString pedname=" ../../Mars-0.8.2/20031102_02399_P_Unavailable_E.root",26 TString calname=" ../../Mars-0.8.2/20031102_02400_D_Flip500Hz_E.root")25 void calibration(TString pedname="/data/MAGIC/rootdata/2003_12_01/20031130_03340_P_CrabNebula_E.root", 26 TString calname="/data/MAGIC/rootdata/2003_12_01/20031130_03341_C_CrabNebula_E.root") 27 27 { 28 28 … … 62 62 tlist.AddToList(&fill); 63 63 64 //MStatusDisplay *d1 = new MStatusDisplay;64 MStatusDisplay *d1 = new MStatusDisplay; 65 65 66 66 // Set update time to 3s 67 //d1->SetUpdateTime(3000);67 d1->SetUpdateTime(3000); 68 68 69 69 // … … 72 72 MEvtLoop evtloop; 73 73 evtloop.SetParList(&plist); 74 //evtloop.SetDisplay(d1);74 evtloop.SetDisplay(d1); 75 75 76 76 // … … 114 114 // we have to set the color of the pulser LED by hand 115 115 // 116 calcalc.SetPulserColor(MCalibrationCalc::kE Blue);116 calcalc.SetPulserColor(MCalibrationCalc::kECT1); 117 117 118 118 tlist2.AddToList(&read2); … … 145 145 cam.Print(); 146 146 147 Int_t pixnr;148 149 while (1)150 {151 152 cout << "Which pixel number do you want to display? (Press 0 to exit)" << endl;153 cin >> pixnr;154 if (pixnr == 0)155 break;156 157 if (pixnr >= 577)158 break;159 160 MCalibrationPix *pix = cam->GetCalibrationPix(pixnr);161 pix->Draw();162 163 }164 165 147 // 166 148 // Here we are confronted to a serious bug in ROOT: … … 174 156 MHCamera &disp0 = *h.GetHistByName(); 175 157 MHCamera disp1 (geomcam, "MCalibrationCam;q", "Fitted Mean Charges"); 176 MHCamera disp2 (geomcam, "MCalibrationCam;errq", "Error of Fitted Mean Charges");158 // MHCamera disp2 (geomcam, "MCalibrationCam;errq", "Error of Fitted Mean Charges"); 177 159 MHCamera disp3 (geomcam, "MCalibrationCam;sigmaq", "Sigma of Fitted Mean Charges"); 178 MHCamera disp4 (geomcam, "MCalibrationCam;errsigmaq", "Error of Sigma of Fitted Mean Charges");160 // MHCamera disp4 (geomcam, "MCalibrationCam;errsigmaq", "Error of Sigma of Fitted Mean Charges"); 179 161 MHCamera disp5 (geomcam, "MCalibrationCam;probq", "Probability of Fit"); 180 162 MHCamera disp6 (geomcam, "MCalibrationCam;t", "Arrival Times"); … … 183 165 MHCamera disp9 (geomcam, "MCalibrationCam;ped", "Pedestals"); 184 166 MHCamera disp10 (geomcam, "MCalibrationCam;pedrms", "Pedestal RMS"); 185 MHCamera disp11 (geomcam, "MCalibrationCam;rq", "Reduced Charges"); 186 MHCamera disp12 (geomcam, "MCalibrationCam;rsigma", "Reduced Sigmas"); 187 MHCamera disp13 (geomcam, "MCalibrationCam;phe", "Nr. of Phe's (F-Factor Method)"); 188 MHCamera disp14 (geomcam, "MCalibrationCam;convphe", "Conversion Factor (F-Factor Method)"); 189 MHCamera disp15 (geomcam, "MCalibrationCam;photons", "Nr. of Photons (Blind Pixel Method)"); 190 MHCamera disp16 (geomcam, "MCalibrationCam;convphot", "Conversion Factor (Blind Pixel Method)"); 167 MHCamera disp11 (geomcam, "MCalibrationCam;rsigma", "Reduced Sigmas"); 168 MHCamera disp12 (geomcam, "MCalibrationCam;phe", "Nr. of Phe's (F-Factor Method)"); 169 MHCamera disp13 (geomcam, "MCalibrationCam;convphe", "Conversion Factor (F-Factor Method)"); 170 MHCamera disp14 (geomcam, "MCalibrationCam;photons", "Nr. of Photons (Blind Pixel Method)"); 171 MHCamera disp15 (geomcam, "MCalibrationCam;convphot", "Conversion Factor (Blind Pixel Method)"); 191 172 192 173 disp1.SetCamContent(*cam, 0); 193 disp2.SetCamContent(*cam, 1); 174 disp1.SetCamError(*cam,1); 175 // disp2.SetCamContent(*cam, 1); 176 194 177 disp3.SetCamContent(*cam, 2); 195 disp4.SetCamContent(*cam, 3); 178 disp3.SetCamError(*cam,3); 179 // disp4.SetCamContent(*cam, 3); 196 180 disp5.SetCamContent(*cam, 4); 181 197 182 disp6.SetCamContent(*cam, 5); 183 disp6.SetCamError(*cam,6); 198 184 disp7.SetCamContent(*cam, 6); 199 185 disp8.SetCamContent(*cam, 7); 186 200 187 disp9.SetCamContent(*cam, 8); 188 disp9.SetCamError(*cam,9); 201 189 disp10.SetCamContent(*cam, 9); 190 202 191 disp11.SetCamContent(*cam, 10); 192 203 193 disp12.SetCamContent(*cam, 11); 204 194 disp13.SetCamContent(*cam, 12); 205 195 disp14.SetCamContent(*cam, 13); 206 196 disp15.SetCamContent(*cam, 14); 207 disp16.SetCamContent(*cam, 15);197 // disp16.SetCamError(*cam, 16); 208 198 209 199 210 200 disp1.SetYTitle("Q [FADC counts]"); 211 disp2.SetYTitle("\\Delta Q [FADC counts]");201 // disp2.SetYTitle("\\Delta Q [FADC counts]"); 212 202 disp3.SetYTitle("\\sigma_{Q} [FADC counts]"); 213 disp4.SetYTitle("\\Delta {\\sigma_{Q}} [FADC counts]");203 // disp4.SetYTitle("\\Delta {\\sigma_{Q}} [FADC counts]"); 214 204 disp5.SetYTitle("P [au]"); 215 205 disp6.SetYTitle("T [FADC slices]"); … … 218 208 disp9.SetYTitle("P [FADC counts/ slice ]"); 219 209 disp10.SetYTitle("RMS_{P} [FADC counts / slice ]"); 220 disp11.SetYTitle("Q [FADC counts]"); 221 disp12.SetYTitle("\\sigma^2_{Q} - RMS^2_{P} [FADC counts^2]"); 222 disp13.SetYTitle("Nr Phe's"); 223 disp14.SetYTitle("Conversion Factor [Phe/FADC count]"); 224 disp15.SetYTitle("Nr Photons"); 225 disp16.SetYTitle("Conversion Factor [Ph/FADC count]"); 210 disp11.SetYTitle("\\sigma^2_{Q} - RMS^2_{P} [FADC counts^2]"); 211 disp12.SetYTitle("Nr Phe's"); 212 disp13.SetYTitle("Conversion Factor [Phe/FADC count]"); 213 disp14.SetYTitle("Nr Photons"); 214 disp15.SetYTitle("Conversion Factor [Ph/FADC count]"); 226 215 227 216 MStatusDisplay *d2 = new MStatusDisplay; … … 230 219 d2->SetUpdateTime(1000); 231 220 232 TCanvas *c1 = &d2->AddTab(" Charges Mean");221 TCanvas *c1 = &d2->AddTab("Fitted Charges"); 233 222 c1->Divide(2, 2); 234 223 … … 238 227 gStyle->SetOptStat(1111); 239 228 obj=disp1.DrawCopy("hist"); 229 ((MHCamera*)obj)->AddNotify(*cam); 240 230 241 231 c1->cd(3); … … 245 235 c1->cd(2); 246 236 gStyle->SetOptStat(1101); 247 obj=disp2.DrawCopy("hist"); 237 obj=disp3.DrawCopy("hist"); 238 ((MHCamera*)obj)->AddNotify(*cam); 248 239 249 240 c1->cd(4); … … 251 242 obj->Draw(); 252 243 253 TCanvas *c11 = &d2->AddTab("Charges Sigma");254 c11->Divide(2, 2);255 256 c11->cd(1);257 gStyle->SetOptStat(1101);258 obj=disp3.DrawCopy("hist");259 260 c11->cd(3);261 gPad->SetBorderMode(0);262 obj->Draw();263 264 c11->cd(2);265 gStyle->SetOptStat(1101);266 obj=disp4.DrawCopy("hist");267 268 c11->cd(4);269 gPad->SetBorderMode(0);270 obj->Draw();271 272 244 273 245 TCanvas *c12 = &d2->AddTab("Fit Prob."); … … 277 249 gStyle->SetOptStat(1101); 278 250 obj=disp5.DrawCopy("hist"); 251 ((MHCamera*)obj)->AddNotify(*cam); 279 252 280 253 c12->cd(2); … … 288 261 gStyle->SetOptStat(1111); 289 262 obj=disp6.DrawCopy("hist"); 263 ((MHCamera*)obj)->AddNotify(*cam); 290 264 291 265 c2->cd(4); … … 295 269 gStyle->SetOptStat(1101); 296 270 obj=disp7.DrawCopy("hist"); 271 ((MHCamera*)obj)->AddNotify(*cam); 297 272 298 273 c2->cd(5); … … 302 277 gStyle->SetOptStat(1101); 303 278 obj=disp8.DrawCopy("hist"); 279 ((MHCamera*)obj)->AddNotify(*cam); 304 280 305 281 c2->cd(6); … … 312 288 gStyle->SetOptStat(1111); 313 289 obj=disp9.DrawCopy("hist"); 290 ((MHCamera*)obj)->AddNotify(*cam); 314 291 315 292 c3->cd(3); … … 319 296 gStyle->SetOptStat(1111); 320 297 obj=disp10.DrawCopy("hist"); 298 ((MHCamera*)obj)->AddNotify(*cam); 321 299 322 300 c3->cd(4); … … 324 302 325 303 TCanvas *c4 = &d2->AddTab("Reduced Charges"); 326 c4->Divide(2, 2);304 c4->Divide(2,1); 327 305 328 306 c4->cd(1); 329 307 gStyle->SetOptStat(1111); 330 308 obj=disp11.DrawCopy("hist"); 309 ((MHCamera*)obj)->AddNotify(*cam); 331 310 332 311 c4->cd(3); 333 obj->Draw();334 335 c4->cd(2);336 gStyle->SetOptStat(1101);337 obj=disp12.DrawCopy("hist");338 339 c4->cd(4);340 312 obj->Draw(); 341 313 … … 345 317 c5->cd(1); 346 318 gStyle->SetOptStat(1111); 319 obj=disp12.DrawCopy("hist"); 320 ((MHCamera*)obj)->AddNotify(*cam); 321 322 c5->cd(3); 323 obj->Draw(); 324 325 c5->cd(2); 326 gStyle->SetOptStat(1101); 347 327 obj=disp13.DrawCopy("hist"); 348 349 c5->cd(3); 350 obj->Draw(); 351 352 c5->cd(2); 353 gStyle->SetOptStat(1101); 354 obj=disp14.DrawCopy("hist"); 328 ((MHCamera*)obj)->AddNotify(*cam); 355 329 356 330 c5->cd(4); … … 362 336 c6->cd(1); 363 337 gStyle->SetOptStat(1111); 338 obj=disp14.DrawCopy("hist"); 339 ((MHCamera*)obj)->AddNotify(*cam); 340 341 c6->cd(3); 342 obj->Draw(); 343 344 c6->cd(2); 345 gStyle->SetOptStat(1101); 364 346 obj=disp15.DrawCopy("hist"); 365 366 c6->cd(3); 367 obj->Draw(); 368 369 c6->cd(2); 370 gStyle->SetOptStat(1101); 371 obj=disp16.DrawCopy("hist"); 347 ((MHCamera*)obj)->AddNotify(*cam); 372 348 373 349 c6->cd(4); 374 350 obj->Draw(); 375 351 376 377 #endif378 379 352 } 380 353 -
trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h
r2581 r2627 69 69 #pragma link C++ class MCalibrationCalc+; 70 70 71 #pragma link C++ class MExtractedSignalCam+; 72 #pragma link C++ class MExtractedSignalPix+; 73 #pragma link C++ class MExtractSignal+; 74 71 75 72 76 #endif -
trunk/MagicSoft/Mars/manalysis/MCalibrationBlindPix.h
r2603 r2627 48 48 Float_t GetErrSigma1() const { return fErrSigma1; } 49 49 50 Float_t GetTime() 51 Float_t GetErrTime() 50 Float_t GetTime() const { return fTime; } 51 Float_t GetErrTime() const { return fErrTime; } 52 52 53 Bool_t FillCharge( Int_t q){ return fHist->FillBlindPixelCharge(q); }54 Bool_t FillTime(Int_t t) 53 Bool_t FillCharge(Float_t q) { return fHist->FillBlindPixelCharge(q); } 54 Bool_t FillTime(Int_t t) { return fHist->FillBlindPixelTime(t); } 55 55 Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillBlindPixelChargevsN(rq,t); } 56 56 57 Bool_t IsValid() 57 Bool_t IsValid() { return fLambda > 0. || fErrLambda > 0.; } 58 58 59 59 Bool_t FitCharge(); -
trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.cc
r2603 r2627 53 53 // Every MCalibrationPix holds a histogram class, // 54 54 // MHCalibrationPixel which itself hold histograms of type: // 55 // HCharge(npix) (distribution of summed FADC time slice entries) //56 // HTime(npix) (distribution of position of maximum) //57 // HChargevsN(npix) (distribution of charges vs. event number. //58 // //59 // PostProcess: All histograms HCharge(npix) are fitted to a Gaussian //60 // All histograms HTime(npix) are fitted to a Gaussian //61 // The histogram HBlindPixelCharge (blind pixel) is fitted to a single //62 // PhE fit //63 // The histogram HBlindPixelTime (blind pixel) is fitted to a Gaussian //64 // The histograms of the PIN Diode are fitted to Gaussians //65 // //66 // Fits can be excluded via the commands: //67 // MalibrationCam::SetSkipTimeFits() (skip all time fits) //68 // MalibrationCam::SetSkipBlindPixelFits() (skip all blind pixel fits) //69 // MalibrationCam::SetSkipPinDiodeFits() (skip all PIN Diode fits) //70 // //55 // HCharge(npix) (distribution of summed FADC time slice entries) 56 // HTime(npix) (distribution of position of maximum) 57 // HChargevsN(npix) (distribution of charges vs. event number. 58 // 59 // PostProcess: All histograms HCharge(npix) are fitted to a Gaussian 60 // All histograms HTime(npix) are fitted to a Gaussian 61 // The histogram HBlindPixelCharge (blind pixel) is fitted to a single 62 // PhE fit 63 // The histogram HBlindPixelTime (blind pixel) is fitted to a Gaussian 64 // The histograms of the PIN Diode are fitted to Gaussians 65 // 66 // Fits can be excluded via the commands: 67 // MalibrationCam::SetSkipTimeFits() (skip all time fits) 68 // MalibrationCam::SetSkipBlindPixelFits() (skip all blind pixel fits) 69 // MalibrationCam::SetSkipPinDiodeFits() (skip all PIN Diode fits) 70 // 71 71 ////////////////////////////////////////////////////////////////////////////// 72 72 … … 169 169 case kEBlue: 170 170 fCalibrations->SetColor(MCalibrationCam::kECBlue); 171 171 break; 172 172 case kEGreen: 173 173 fCalibrations->SetColor(MCalibrationCam::kECGreen); 174 174 break; 175 175 case kEUV: 176 176 fCalibrations->SetColor(MCalibrationCam::kECUV); 177 break; 178 case kECT1: 179 fCalibrations->SetColor(MCalibrationCam::kECCT1); 180 break; 181 default: 182 fCalibrations->SetColor(MCalibrationCam::kECCT1); 177 183 } 178 179 180 184 181 185 fPedestals = (MPedestalCam*)pList->FindObject("MPedestalCam"); … … 185 189 return kFALSE; 186 190 } 187 188 191 189 192 return kTRUE; … … 245 248 MRawEvtPixelIter pixel(fRawEvt); 246 249 250 // 247 251 // Create a first loop to sort out the cosmics ... 248 252 // … … 266 270 Float_t pedrms = ped.GetPedestalRms(); 267 271 268 if ((float)sum < ( pedes*fNumHiGainSamples)+(1.5*pedrms) )272 if ((float)sum < ((pedes*fNumHiGainSamples)+(30.*pedrms)) ) 269 273 cosmicpix++; 270 274 } … … 274 278 { 275 279 fCosmics++; 276 return k TRUE;280 return kCONTINUE; 277 281 } 278 282 279 283 pixel.Reset(); 280 284 285 // 286 // Create a second loop to do fill the calibration histograms 287 // 288 281 289 while (pixel.Next()) 282 290 { 283 291 284 292 UShort_t sat = 0; 285 UShort_t lowgainoverflow = 0;286 293 287 294 const Int_t pixid = pixel.GetPixelId(); 288 295 289 Byte_t *ptr = pixel.GetHiGainSamples();290 296 Byte_t mid = pixel.GetIdxMaxHiGainSample(); 291 297 UInt_t max = pixel.GetMaxHiGainSample(); 292 298 293 Int_t sum = (max > gkSaturationLimit // overflow ? 294 ? sat++, pixel.GetSumLoGainSamples() // take Low Gain 295 : pixel.GetSumHiGainSamples()); // no overflow 296 297 if (sat) 298 { 299 300 ptr = pixel.GetLoGainSamples(); 301 max = pixel.GetMaxLoGainSample(); 302 mid = pixel.GetIdxMaxLoGainSample(); 303 304 // 305 // FIXME: It seems the conversion HiGain LoGain is already 306 // performed in the data?!? 307 // 308 sum = (max > gkSaturationLimit // overflow of LoGain ??? -> GimmeABreak!!! 309 ? lowgainoverflow++, gkLoGainOverFlow // OUCH (Florian was maybe right) 310 : sum*gkConversionHiLo ); // OUFF (Florian was wrong) !! 311 // : sum ); 312 313 if (lowgainoverflow) 314 { 315 *fLog << err << dbginf << "Warning: Saturation of LoGain reached in pixel: " << pixid << " " 316 << " sum = " << sum << endl; 317 fHistOverFlow++; 318 } 319 } 320 321 MPedestalPix &ped = (*fPedestals)[pixid]; 322 MCalibrationPix &pix = (*fCalibrations)[pixid]; 323 299 MPedestalPix &ped = (*fPedestals)[pixid]; 300 MCalibrationPix &pix = (*fCalibrations)[pixid]; 301 324 302 Float_t pedes = ped.GetPedestal(); 325 Float_t pedrms = ped.GetPedestalRms();326 303 Float_t sum; 304 327 305 // 328 306 // FIXME: This is preliminary, we will change to pedestals per slice!!! 329 307 // Assume pedestals per time slice ==> multiply with number of slices 330 308 // 331 pedes *= (sat ? fNumLoGainSamples : fNumHiGainSamples ); 332 pedrms *= (sat ? fNumLoGainSamples : fNumHiGainSamples ); 333 334 Float_t rsum = (float)sum - pedes; 335 309 310 if (max < gkSaturationLimit) // take Hi Gain 311 { 312 sum = (float)pixel.GetSumHiGainSamples() - pedes*fNumHiGainSamples; 313 } 314 else // Lo Gain 315 { 316 317 sat++; 318 pix.SetHiGainSaturation(); 319 320 sum = (float)pixel.GetSumLoGainSamples() - pedes*fNumLoGainSamples ; 321 sum *= gkConversionHiLo; 322 323 max = pixel.GetMaxLoGainSample(); 324 mid = pixel.GetIdxMaxLoGainSample(); 325 326 if (max > gkSaturationLimit) 327 { 328 *fLog << err << dbginf 329 << "Warning: Saturation of Lo Gain reached in pixel: " 330 << pixid << " " << " sum = " << sum << endl; 331 fHistOverFlow++; 332 } 333 334 } 335 336 336 switch(pixid) 337 337 { … … 339 339 case gkCalibrationBlindPixelId: 340 340 341 //342 // FIXME: This works only when the blind pixel ID is much larger than343 // the rest of the pixels (which is the case right now)344 //345 341 if (!blindpixel.FillCharge(sum)) 346 342 *fLog << warn << … … 351 347 "Overflow or Underflow occurred filling Blind Pixel time = " << (int)mid << endl; 352 348 353 if (!blindpixel.FillRChargevsTime( rsum,fEvents))349 if (!blindpixel.FillRChargevsTime(sum,fEvents)) 354 350 *fLog << warn << 355 351 "Overflow or Underflow occurred filling Blind Pixel eventnr = " << fEvents << endl; … … 362 358 *fLog << warn << 363 359 "Overflow or Underflow occurred filling HTime: time = " << (int)mid << endl; 364 if (!pindiode.FillRChargevsTime( rsum,fEvents))360 if (!pindiode.FillRChargevsTime(sum,fEvents)) 365 361 *fLog << warn << 366 362 "Overflow or Underflow occurred filling HChargevsN: eventnr = " << fEvents << endl; … … 368 364 default: 369 365 370 if (!pix.FillCharge(sum)) 371 *fLog << warn << "Could not fill Charge of pixel: " << pixid 372 << " signal = " << sum << endl; 373 374 // 375 // Fill the reduced charge into the control histo for better visibility 376 // 377 if (!pix.FillRChargevsTime(rsum,fEvents)) 378 *fLog << warn << "Could not fill red. Charge vs. EvtNr of pixel: " << pixid 379 << " signal = " << rsum << " event Nr: " << fEvents << endl; 380 381 382 if (!pix.FillTime((int)mid)) 383 *fLog << warn << "Could not fill Time of pixel: " << pixid << " time = " << (int)mid << endl; 384 385 366 if (sat) 367 { 368 369 if (!pix.FillChargeLoGain(sum)) 370 *fLog << warn << "Could not fill Lo Gain Charge of pixel: " << pixid 371 << " signal = " << sum << endl; 372 373 if (!pix.FillTimeLoGain((int)mid)) 374 *fLog << warn << "Could not fill Lo Gain Time of pixel: " 375 << pixid << " time = " << (int)mid << endl; 376 377 // 378 // Fill the reduced charge into the control histo for better visibility 379 // 380 if (!pix.FillRChargevsTimeLoGain(sum,fEvents)) 381 *fLog << warn << "Could not fill Lo Gain Charge vs. EvtNr of pixel: " 382 << pixid << " signal = " << sum << " event Nr: " << fEvents << endl; 383 384 } 385 else 386 { 387 if (!pix.FillChargeHiGain(sum)) 388 *fLog << warn << "Could not fill Hi Gain Charge of pixel: " << pixid 389 << " signal = " << sum << endl; 390 391 if (!pix.FillTimeHiGain((int)mid)) 392 *fLog << warn << "Could not fill Hi Gain Time of pixel: " 393 << pixid << " time = " << (int)mid << endl; 394 395 if (!pix.FillRChargevsTimeHiGain(sum,fEvents)) 396 *fLog << warn << "Could not fill Hi Gain Charge vs. EvtNr of pixel: " 397 << pixid << " signal = " << sum << " event Nr: " << fEvents << endl; 398 } 399 386 400 } /* switch(pixid) */ 387 401 … … 396 410 *fLog << inf << endl; 397 411 *fLog << GetDescriptor() << " Cut Histogram Edges" << endl; 412 398 413 // 399 414 // Cut edges to make fits and viewing of the hists easier … … 414 429 { 415 430 if (blindpixel.FitCharge()) 416 if (!fCalibrations->CalcNrPhotInnerPixel()) 417 *fLog << err << dbginf << "Could not calculate Number of photons from the blind pixel " << endl; 431 { 432 if (!fCalibrations->CalcNrPhotInnerPixel()) 433 *fLog << err << dbginf << "Could not calculate Number of photons from the blind pixel " << endl; 434 } 418 435 else 419 *fLog << err << dbginf << "Could not fit the blind pixel " << endl; 420 436 { 437 *fLog << err << dbginf << "Could not fit the blind pixel " << endl; 438 } 439 421 440 if (!blindpixel.FitTime()) 422 441 *fLog << warn << "Could not the Times of the blind pixel " << endl; -
trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.h
r2603 r2627 54 54 public: 55 55 56 enum PulserColor_t { kEGreen, kEBlue, kEUV };56 enum PulserColor_t { kEGreen, kEBlue, kEUV, kECT1 }; 57 57 58 58 private: -
trunk/MagicSoft/Mars/manalysis/MCalibrationCam.cc
r2603 r2627 57 57 MCalibrationCam::MCalibrationCam(const char *name, const char *title) 58 58 : fMeanNrPhotAvailable(kFALSE), 59 fMeanNrPhotInnerPix(-1.) 59 fMeanNrPhotInnerPix(-1.), 60 fMeanNrPhotInnerPixErr(-1.) 60 61 { 61 62 fName = name ? name : "MCalibrationCam"; … … 153 154 Bool_t MCalibrationCam::IsPixelFitted(Int_t idx) const 154 155 { 155 return ((*this)[idx].Get RCharge() > 0. && (*this)[idx].GetErrRCharge() > 0.);156 return ((*this)[idx].GetCharge() > 0. && (*this)[idx].GetErrCharge() > 0.); 156 157 } 157 158 … … 359 360 int id = 0; 360 361 362 *fLog << "Succesfully calibrated pixels:" << endl; 363 *fLog << endl; 364 361 365 TIter Next(fPixels); 362 366 MCalibrationPix *pix; … … 364 368 { 365 369 366 *fLog << id << " Pedestals: " << pix->GetPed() << " +- " << pix->GetPedRms() << " Charge: " 367 << pix->GetCharge() << " Reduced Charge: " << pix->GetRCharge() << " +- " 368 << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigma() << endl; 369 370 id++; 371 } 370 if (pix->GetCharge() >= 0.) 371 { 372 *fLog << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " << pix->GetPedRms() 373 << " Reduced Charge: " << pix->GetCharge() << " +- " 374 << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigma() << endl; 375 id++; 376 } 377 } 378 379 *fLog << id << " succesful pixels :-))" << endl; 380 id = 0; 381 382 *fLog << endl; 383 *fLog << "Pixels with errors:" << endl; 384 *fLog << endl; 385 386 TIter Next2(fPixels); 387 while ((pix=(MCalibrationPix*)Next2())) 388 { 389 390 if (pix->GetCharge() == -1.) 391 { 392 *fLog << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " << pix->GetPedRms() 393 << " Reduced Charge: " << pix->GetCharge() << " +- " 394 << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigma() << endl; 395 id++; 396 } 397 } 398 *fLog << id << " pixels with errors :-((" << endl; 399 372 400 } 373 401 … … 379 407 { 380 408 case 0: 381 382 409 val = (*this)[idx].GetCharge(); 410 break; 383 411 case 1: 384 385 412 val = (*this)[idx].GetErrCharge(); 413 break; 386 414 case 2: 387 388 415 val = (*this)[idx].GetSigmaCharge(); 416 break; 389 417 case 3: 390 391 418 val = (*this)[idx].GetErrSigmaCharge(); 419 break; 392 420 case 4: 393 394 421 val = (*this)[idx].GetChargeProb(); 422 break; 395 423 case 5: 396 397 424 val = (*this)[idx].GetTime(); 425 break; 398 426 case 6: 399 400 427 val = (*this)[idx].GetSigmaTime(); 428 break; 401 429 case 7: 402 403 430 val = (*this)[idx].GetTimeProb(); 431 break; 404 432 case 8: 405 406 433 val = (*this)[idx].GetPed(); 434 break; 407 435 case 9: 408 409 436 val = (*this)[idx].GetPedRms(); 437 break; 410 438 case 10: 411 val = (*this)[idx].GetR Charge();439 val = (*this)[idx].GetRSigma(); 412 440 break; 413 441 case 11: 414 val = (*this)[idx].Get RSigma();442 val = (*this)[idx].GetPheFFactorMethod(); 415 443 break; 416 444 case 12: 417 val = (*this)[idx].Get PheFFactorMethod();445 val = (*this)[idx].GetConversionFFactorMethod(); 418 446 break; 419 447 case 13: 420 val = (*this)[idx].GetConversionFFactorMethod(); 448 if (idx < 397) 449 val = (double)fMeanNrPhotInnerPix; 450 else 451 val = (double)fMeanNrPhotInnerPix*gkCalibrationOuterPixelArea; 421 452 break; 422 453 case 14: 423 val = (double)fMeanNrPhotInnerPix; 424 break; 425 case 15: 426 if ((fMeanNrPhotInnerPix > 0. ) && ((*this)[idx].GetRCharge() > 100.)) 427 val = fMeanNrPhotInnerPix / (*this)[idx].GetRCharge(); 428 else 429 val = -1.; 454 if ((fMeanNrPhotInnerPix > 0. ) && ((*this)[idx].GetCharge() != -1.)) 455 { 456 if (idx < 397) 457 val = fMeanNrPhotInnerPix / (*this)[idx].GetCharge(); 458 else 459 val = fMeanNrPhotInnerPix*gkCalibrationOuterPixelArea / (*this)[idx].GetCharge(); 460 } 461 else 462 { 463 val = -1.; 464 } 430 465 break; 431 466 default: … … 467 502 / gkCalibrationBlindPixelArea; 468 503 break; 504 case kECCT1: 505 default: 506 fMeanNrPhotInnerPix = (mean / gkCalibrationBlindPixelQECT1 ) 507 *TMath::Power(10,gkCalibrationBlindPixelAttCT1) 508 / gkCalibrationBlindPixelArea; 509 break; 469 510 } 470 511 … … 474 515 475 516 476 477 Bool_t MCalibrationCam::GetConversionFactor(Int_t ipx, Float_t &mean, Float_t &err) 517 Bool_t MCalibrationCam::GetConversionFactorBlindPixel(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma) 478 518 { 479 519 … … 485 525 return kFALSE; 486 526 487 mean = fMeanNrPhotInnerPix / (*this)[ipx].Get RCharge();527 mean = fMeanNrPhotInnerPix / (*this)[ipx].GetCharge(); 488 528 489 529 // 490 530 // Not yet ready , sorry 491 531 // 492 err = 100000000000.; 532 err = -1.; 533 sigma = -1.; 493 534 494 535 return kTRUE; 495 536 } 537 538 539 Bool_t MCalibrationCam::GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma) 540 { 541 542 if (ipx < 0 || !IsPixelFitted(ipx)) 543 return kFALSE; 544 545 Float_t conv = (*this)[ipx].GetConversionFFactorMethod(); 546 547 if (conv < 0.) 548 return kFALSE; 549 550 mean = conv; 551 552 // 553 // Not yet ready , sorry 554 // 555 err = -1.; 556 sigma = -1.; 557 558 return kTRUE; 559 } -
trunk/MagicSoft/Mars/manalysis/MCalibrationCam.h
r2603 r2627 38 38 MCalibrationPINDiode *fPINDiode; //! containing PIN Diode data with fit results 39 39 40 Bool_t fMeanNrPhotAvailable; 40 41 Float_t fMeanNrPhotInnerPix; // The mean number of photons in an inner pixel 41 42 Float_t fMeanNrPhotInnerPixErr; // The uncertainty about the number of photons in an inner pixel 42 Bool_t fMeanNrPhotAvailable;43 43 44 44 public: 45 45 46 enum CalibrationColor_t { kECGreen, kECBlue, kECUV };46 enum CalibrationColor_t { kECGreen, kECBlue, kECUV, kECCT1 }; 47 47 48 48 private: … … 89 89 void SetColor(CalibrationColor_t color) { fColor = color; } 90 90 91 Bool_t GetConversionFactor(Int_t ipx, Float_t &mean, Float_t &err); 91 Bool_t GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma); 92 Bool_t GetConversionFactorBlindPixel(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma); 92 93 93 94 ClassDef(MCalibrationCam, 1) // Storage Container for all calibration information of the camera -
trunk/MagicSoft/Mars/manalysis/MCalibrationConfig.h
r2603 r2627 15 15 16 16 // The conversion factor between High Gain and Low Gain 17 const UShort_t gkConversionHiLo = 10.;17 const Float_t gkConversionHiLo = 10.; 18 18 19 19 // The penalty constant to produce overflow in the histogram … … 29 29 const Float_t gkCalibrationBlindPixelQEBlue = 0.226; 30 30 const Float_t gkCalibrationBlindPixelQEUV = 0.247; 31 const Float_t gkCalibrationBlindPixelQECT1 = 0.247; 31 32 32 33 // Attenuation factor Blind Pixel (three colours) … … 34 35 const Float_t gkCalibrationBlindPixelAttBlue = 1.96; 35 36 const Float_t gkCalibrationBlindPixelAttUV = 1.95; 37 const Float_t gkCalibrationBlindPixelAttCT1 = 1.95; 36 38 37 39 // Area of Blind Pixel w.r.t. Inner Pixel 38 40 const Float_t gkCalibrationBlindPixelArea = 0.25; 41 42 // Area of Outer Pixel w.r.t. Inner Pixel 43 const Float_t gkCalibrationOuterPixelArea = 4.00; 39 44 40 45 // ----- PIN DIODE ------------------------// -
trunk/MagicSoft/Mars/manalysis/MCalibrationPINDiode.cc
r2603 r2627 79 79 Bool_t MCalibrationPINDiode::FitCharge() 80 80 { 81 if(!fHist->FitCharge ())81 if(!fHist->FitChargeHiGain()) 82 82 return kFALSE; 83 83 … … 94 94 { 95 95 96 if(!fHist->FitTime ())96 if(!fHist->FitTimeHiGain()) 97 97 return kFALSE; 98 98 -
trunk/MagicSoft/Mars/manalysis/MCalibrationPINDiode.h
r2603 r2627 33 33 void Clear(Option_t *o=""); 34 34 35 void SetPed(Float_t ped) { fPed = ped; }35 void SetPed(Float_t ped) { fPed = ped; } 36 36 void SetPedRms(Float_t pedrms) { fPedRms = pedrms; } 37 37 38 38 Bool_t IsValid() const { return fRCharge >=0 || fErrRCharge >= 0; } 39 39 40 Bool_t FillCharge( Int_t q) { return fHist->FillCharge(q); }41 Bool_t FillTime(Int_t t) { return fHist->FillTime(t); }42 Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillChargevsN (rq,t); }40 Bool_t FillCharge(Float_t q) { return fHist->FillChargeHiGain(q); } 41 Bool_t FillTime(Int_t t) { return fHist->FillTimeHiGain(t); } 42 Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillChargevsNHiGain(rq,t); } 43 43 44 44 Bool_t FitCharge(); -
trunk/MagicSoft/Mars/manalysis/MCalibrationPix.cc
r2603 r2627 50 50 fSigmaCharge(-1.), 51 51 fErrSigmaCharge(-1.), 52 fRSigma(-1.), 52 53 fChargeProb(-1.), 53 54 fPed(-1.), … … 56 57 fSigmaTime(-1.), 57 58 fTimeProb(-1.), 58 fRCharge(-1.),59 fErrRCharge(-1.),60 fRSigma(-1.),61 59 fFactor(1.3), 62 60 fPheFFactorMethod(-1.), 63 fConversionFFactorMethod(-1.) 61 fConversionFFactorMethod(-1.), 62 fHiGainSaturation(kFALSE) 64 63 { 65 64 … … 102 101 103 102 if (fPed && fPedRms) 104 fHist->SetLowerFitRange(fPed + 1.5*fPedRms); 103 fHist->SetLowerFitRange(3.5*fPedRms); 104 // fHist->SetLowerFitRange(fPed + 3.5*fPedRms); 105 105 else 106 106 *fLog << warn << "Cannot set lower fit range to suppress cosmics: Pedestals not available" << endl; 107 107 108 if(!fHist->FitCharge()) 108 109 if (fHiGainSaturation) 109 110 { 110 *fLog << warn << "Could not fit charges of pixel " << fPixId << endl; 111 fHist->PrintChargeFitResult(); 112 return kFALSE; 111 if(!fHist->FitChargeLoGain()) 112 { 113 *fLog << warn << "Could not fit Lo Gain charges of pixel " << fPixId << endl; 114 fHist->PrintChargeFitResult(); 115 return kFALSE; 116 } 117 } 118 else 119 { 120 if(!fHist->FitChargeHiGain()) 121 { 122 *fLog << warn << "Could not fit Hi Gain charges of pixel " << fPixId << endl; 123 fHist->PrintChargeFitResult(); 124 return kFALSE; 125 } 113 126 } 114 127 128 115 129 fCharge = fHist->GetChargeMean(); 116 130 fErrCharge = fHist->GetChargeMeanErr(); … … 122 136 { 123 137 124 fRCharge = fCharge - fPed;125 fErrRCharge = TMath::Sqrt(fErrCharge*fErrCharge + fPedRms*fPedRms);126 127 138 fRSigma = (fSigmaCharge*fSigmaCharge) - (fPedRms*fPedRms); 128 139 129 140 if (fRSigma > 0. ) 130 141 { 131 fPheFFactorMethod = fFactor * f RCharge*fRCharge / fRSigma;132 fConversionFFactorMethod = fPheFFactorMethod / fRCharge ;142 fPheFFactorMethod = fFactor * fCharge*fCharge / fRSigma; 143 fConversionFFactorMethod = fPheFFactorMethod / fCharge ; 133 144 } 134 145 else … … 144 155 } 145 156 157 146 158 void MCalibrationPix::SetPedestal(Float_t ped, Float_t pedrms) 147 159 { … … 150 162 fPedRms = pedrms; 151 163 152 if ((fRCharge == -1.) && (fCharge > 0.))153 fRCharge = fCharge - fPed;154 if ((fErrRCharge == -1.) && (fErrCharge > 0.))155 fErrRCharge = TMath::Sqrt(fErrCharge*fErrCharge + fPedRms*fPedRms);156 157 164 } 158 165 … … 160 167 { 161 168 162 if (!fHist->FitTime())169 if (fHiGainSaturation) 163 170 { 164 *fLog << warn << "Could not fit times of pixel " << fPixId << endl; 165 fHist->PrintTimeFitResult(); 166 return kFALSE; 171 if(!fHist->FitTimeLoGain()) 172 { 173 *fLog << warn << "Could not fit Lo Gain times of pixel " << fPixId << endl; 174 fHist->PrintTimeFitResult(); 175 return kFALSE; 176 } 167 177 } 168 178 else 179 { 180 if(!fHist->FitTimeHiGain()) 181 { 182 *fLog << warn << "Could not fit Hi Gain times of pixel " << fPixId << endl; 183 fHist->PrintTimeFitResult(); 184 return kFALSE; 185 } 186 } 187 169 188 fTime = fHist->GetTimeMean(); 170 189 fSigmaTime = fHist->GetTimeSigma(); -
trunk/MagicSoft/Mars/manalysis/MCalibrationPix.h
r2603 r2627 14 14 Int_t fPixId; // the pixel Id 15 15 16 Float_t fCharge; // The mean charge after the fit17 Float_t fErrCharge; // The error of mean charge after the fit16 Float_t fCharge; // The mean reduced charge after the fit 17 Float_t fErrCharge; // The error of reduced mean charge after the fit 18 18 Float_t fSigmaCharge; // The sigma of the mean charge after the fit 19 19 Float_t fErrSigmaCharge; // The error of the sigma of the mean charge after the fit 20 Float_t fRSigma; // The reduced squares of sigmas after the fit 20 21 Float_t fChargeProb; // The probability of the fit function 21 22 … … 27 28 Float_t fTimeProb; // The probability of the fit function 28 29 29 Float_t fRCharge; // The reduced mean charge after the fit30 Float_t fErrRCharge; // The error of the reduced mean charge after the fit31 Float_t fRSigma; // The reduced squares of sigmas after the fit32 33 30 Float_t fFactor; // The laboratory F-factor 34 31 Float_t fPheFFactorMethod; // The number of Phe's calculated after the F-factor method 35 32 Float_t fConversionFFactorMethod; // The conversion factor to Phe's calculated after the F-factor method 33 34 Bool_t fHiGainSaturation; // Is Lo-Gain used at all? 36 35 37 36 MHCalibrationPixel *fHist; //! Pointer to the histograms performing the fits, etc. … … 45 44 46 45 Float_t GetCharge() const { return fCharge; } 47 Float_t GetRCharge() const { return fRCharge; }48 46 Float_t GetRSigma() const { return fRSigma; } 49 47 50 48 Float_t GetErrCharge() const { return fErrCharge; } 51 Float_t GetErrRCharge() const { return fErrRCharge; }52 49 Float_t GetChargeProb() const { return fChargeProb; } 53 50 54 51 Float_t GetSigmaCharge() const { return fSigmaCharge; } 55 52 Float_t GetErrSigmaCharge() const { return fErrSigmaCharge; } 56 Float_t GetTime() const { return fTime; }57 Float_t GetSigmaTime() const { return fSigmaTime; }58 Float_t GetTimeProb() const { return fTimeProb; }53 Float_t GetTime() const { return fTime; } 54 Float_t GetSigmaTime() const { return fSigmaTime; } 55 Float_t GetTimeProb() const { return fTimeProb; } 59 56 60 Float_t GetPed() const { return fPed; }61 Float_t GetPedRms() const { return fPedRms; }57 Float_t GetPed() const { return fPed; } 58 Float_t GetPedRms() const { return fPedRms; } 62 59 63 60 void SetPedestal(Float_t ped, Float_t pedrms); 61 void SetHiGainSaturation() { fHiGainSaturation = kTRUE; fHist->SetUseLoGain(); } 64 62 65 Bool_t FillCharge(Int_t q) { return fHist->FillCharge(q); } 66 Bool_t FillTime(Int_t t) { return fHist->FillTime(t); } 67 Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillChargevsN(rq,t); } 63 Bool_t FillChargeHiGain(Float_t q) { return fHist->FillChargeHiGain(q); } 64 Bool_t FillTimeHiGain(Int_t t) { return fHist->FillTimeHiGain(t); } 65 Bool_t FillRChargevsTimeHiGain(Float_t rq, Int_t t) { return fHist->FillChargevsNHiGain(rq,t); } 66 67 Bool_t FillChargeLoGain(Float_t q) { return fHist->FillChargeLoGain(q); } 68 Bool_t FillTimeLoGain(Int_t t) { return fHist->FillTimeLoGain(t); } 69 Bool_t FillRChargevsTimeLoGain(Float_t rq, Int_t t) { return fHist->FillChargevsNLoGain(rq,t); } 68 70 69 Bool_t IsValid() const { return fRCharge >=0 || fErrRCharge >= 0; }70 Int_t GetPixId() const { return fPixId; }71 Bool_t IsValid() const { return fCharge >=0 || fErrCharge >= 0; } 72 Int_t GetPixId() const { return fPixId; } 71 73 void DefinePixId(Int_t i); 72 74 … … 74 76 Bool_t FitTime(); 75 77 76 MHCalibrationPixel *GetHist() const { return fHist;}77 v irtual void Draw(Option_t *opt=""){ fHist->Draw(opt); }78 MHCalibrationPixel *GetHist() const { return fHist; } 79 void Draw(Option_t *opt="") { fHist->Draw(opt); } 78 80 79 81 Float_t GetPheFFactorMethod() const { return fPheFFactorMethod; } -
trunk/MagicSoft/Mars/manalysis/Makefile
r2581 r2627 75 75 MCalibrationBlindPix.cc \ 76 76 MCalibrationPINDiode.cc \ 77 MCalibrationCam.cc 77 MCalibrationCam.cc \ 78 MExtractedSignalCam.cc \ 79 MExtractedSignalPix.cc \ 80 MExtractSignal.cc 78 81 79 82 SRCS = $(SRCFILES) -
trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.cc
r2603 r2627 69 69 70 70 // Create a large number of bins, later we will rebin 71 fBlindPixelChargefirst = 0;71 fBlindPixelChargefirst = -1000.; 72 72 fBlindPixelChargelast = gkStartBlindPixelBinNr; 73 fBlindPixelChargenbins = gkStartBlindPixelBinNr; 74 75 fHBlindPixelCharge = new TH1I("HBlindPixelCharge","Distribution of Summed FADC Slices",fBlindPixelChargenbins,fBlindPixelChargefirst,fBlindPixelChargelast); 73 fBlindPixelChargenbins = gkStartBlindPixelBinNr+(int)fBlindPixelChargefirst; 74 75 fHBlindPixelCharge = new TH1F("HBlindPixelCharge","Distribution of Summed FADC Slices", 76 fBlindPixelChargenbins,fBlindPixelChargefirst,fBlindPixelChargelast); 76 77 fHBlindPixelCharge->SetXTitle("Sum FADC Slices"); 77 78 fHBlindPixelCharge->SetYTitle("Nr. of events"); … … 313 314 const Double_t lambda_guess = 0.2; 314 315 const Double_t mu_0_guess = fHBlindPixelCharge->GetBinCenter(fHBlindPixelCharge->GetMaximumBin()); 315 const Double_t si_0_guess = mu_0_guess/ 10.;316 const Double_t si_0_guess = mu_0_guess/5.; 316 317 const Double_t mu_1_guess = mu_0_guess + 50.; 317 318 const Double_t si_1_guess = si_0_guess + si_0_guess; -
trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.h
r2603 r2627 32 32 private: 33 33 34 TH1 I* fHBlindPixelCharge; //-> Histogram with the single Phe spectrum34 TH1F* fHBlindPixelCharge; //-> Histogram with the single Phe spectrum 35 35 TH1F* fHBlindPixelErrCharge; //-> Variance of summed FADC slices 36 36 TH1I* fHBlindPixelTime; //-> Variance of summed FADC slices … … 83 83 ~MHCalibrationBlindPixel(); 84 84 85 Bool_t FillBlindPixelCharge( Int_t q){ return fHBlindPixelCharge->Fill(q) > -1; }86 Bool_t FillErrBlindPixelCharge(Float_t errq) { return fHBlindPixelErrCharge->Fill(errq) > -1; }87 Bool_t FillBlindPixelTime(Int_t t) { return fHBlindPixelTime->Fill(t) > -1; }85 Bool_t FillBlindPixelCharge(Float_t q) { return fHBlindPixelCharge->Fill(q) > -1; } 86 Bool_t FillErrBlindPixelCharge(Float_t errq) { return fHBlindPixelErrCharge->Fill(errq) > -1; } 87 Bool_t FillBlindPixelTime(Int_t t) { return fHBlindPixelTime->Fill(t) > -1; } 88 88 Bool_t FillBlindPixelChargevsN(Stat_t rq, Int_t t) { return fHBlindPixelChargevsN->Fill(t,rq) > -1; } 89 89 … … 123 123 void ChangeFitFunc(BlindPixelFitFunc fitfunc, Int_t par=5); 124 124 125 126 125 void CutAllEdges(); 127 126 void Draw(Option_t *option=""); 128 127 129 ClassDef(MHCalibrationBlindPixel, 0)128 ClassDef(MHCalibrationBlindPixel, 1) 130 129 }; 131 130 -
trunk/MagicSoft/Mars/mhist/MHCalibrationConfig.h
r2603 r2627 7 7 // // 8 8 // Contains all configuration data of the Calibration // 9 // //9 // i // 10 10 ///////////////////////////////////////////////////////////////////////////// 11 11 -
trunk/MagicSoft/Mars/mhist/MHCalibrationPINDiode.cc
r2603 r2627 67 67 68 68 // Create a large number of bins, later we will rebin 69 fChargeFirst = 0;70 fChargeLast = gkStartPINDiodeBinNr;71 fChargeNbins = gkStartPINDiodeBinNr;69 fChargeFirstHiGain = -1000.; 70 fChargeLastHiGain = gkStartPINDiodeBinNr; 71 fChargeNbinsHiGain = gkStartPINDiodeBinNr; 72 72 73 fHPCharge = new TH1I("HPCharge","Distribution of Summed FADC Slices",fChargeNbins,fChargeFirst,fChargeLast); 73 fHPCharge = new TH1I("HPCharge","Distribution of Summed FADC Slices", 74 fChargeNbinsHiGain,fChargeFirstHiGain,fChargeLastHiGain); 74 75 fHPCharge->SetXTitle("Sum FADC Slices"); 75 76 fHPCharge->SetYTitle("Nr. of events"); -
trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.cc
r2603 r2627 65 65 fTimeGausFit(NULL), 66 66 fFitLegend(NULL), 67 fLowerFitRange(0.), 67 fLowerFitRange(-2000.), 68 fChargeFirstHiGain(-2000.5), 69 fChargeLastHiGain(9999.5), 70 fChargeNbinsHiGain(12000), 71 fChargeFirstLoGain(-2000.5), 72 fChargeLastLoGain(9999.5), 73 fChargeNbinsLoGain(1200), 68 74 fFitOK(kFALSE), 69 75 fChargeChisquare(-1.), … … 72 78 fTimeChisquare(-1.), 73 79 fTimeProb(-1.), 74 fTimeNdf(-1) 80 fTimeNdf(-1), 81 fUseLoGain(kFALSE) 75 82 { 76 83 … … 79 86 80 87 // Create a large number of bins, later we will rebin 81 fChargeFirst = -0.5; 82 fChargeLast = 10000. - 0.5; 83 fChargeNbins = 20000; 84 85 fHCharge = new TH1I("HCharge","Distribution of Summed FADC Slices Pixel ", 86 fChargeNbins,fChargeFirst,fChargeLast); 87 fHCharge->SetXTitle("Sum FADC Slices"); 88 fHCharge->SetYTitle("Nr. of events"); 89 fHCharge->Sumw2(); 90 91 fHCharge->SetDirectory(NULL); 88 fHChargeHiGain = new TH1F("HChargeHiGain","Distribution of Summed FADC Hi Gain Slices Pixel ", 89 fChargeNbinsHiGain,fChargeFirstHiGain,fChargeLastHiGain); 90 fHChargeHiGain->SetXTitle("Sum FADC Slices (Hi Gain)"); 91 fHChargeHiGain->SetYTitle("Nr. of events"); 92 fHChargeHiGain->Sumw2(); 93 94 fHChargeHiGain->SetDirectory(NULL); 95 96 fHChargeLoGain = new TH1F("HChargeLoGain","Distribution of Summed FADC Lo Gain Slices Pixel ", 97 fChargeNbinsLoGain,fChargeFirstLoGain,fChargeLastLoGain); 98 fHChargeLoGain->SetXTitle("Sum FADC Slices (Lo Gain)"); 99 fHChargeLoGain->SetYTitle("Nr. of events"); 100 fHChargeLoGain->Sumw2(); 101 102 fHChargeLoGain->SetDirectory(NULL); 92 103 93 104 Axis_t tfirst = -0.5; … … 95 106 Int_t ntbins = 16; 96 107 97 fHTime = new TH1I("HTime","Distribution of Mean Arrival Times Pixel ", 98 ntbins,tfirst,tlast); 99 fHTime->SetXTitle("Mean Arrival Times [FADC slice nr]"); 100 fHTime->SetYTitle("Nr. of events"); 101 fHTime->Sumw2(); 102 103 fHTime->SetDirectory(NULL); 104 105 TString qvsntitle = "Sum of Charges vs. Event Number Pixel "; 108 fHTimeHiGain = new TH1I("HTimeHiGain","Distribution of Mean Arrival Hi Gain Times Pixel ", 109 ntbins,tfirst,tlast); 110 fHTimeHiGain->SetXTitle("Mean Arrival Times [Hi Gain FADC slice nr]"); 111 fHTimeHiGain->SetYTitle("Nr. of events"); 112 fHTimeHiGain->Sumw2(); 113 114 fHTimeHiGain->SetDirectory(NULL); 115 116 fHTimeLoGain = new TH1I("HTimeLoGain","Distribution of Mean Arrival Lo Gain Times Pixel ", 117 ntbins,tfirst,tlast); 118 fHTimeLoGain->SetXTitle("Mean Arrival Times [Lo Gain FADC slice nr]"); 119 fHTimeLoGain->SetYTitle("Nr. of events"); 120 fHTimeLoGain->Sumw2(); 121 122 fHTimeLoGain->SetDirectory(NULL); 106 123 107 124 // We define a reasonable number and later enlarge it if necessary … … 110 127 Axis_t nlast = (Axis_t)nqbins - 0.5; 111 128 112 fHChargevsN = new TH1I("HChargevsN",qvsntitle.Data(), 113 nqbins,nfirst,nlast); 114 fHChargevsN->SetXTitle("Event Nr."); 115 fHChargevsN->SetYTitle("Sum of FADC slices"); 116 117 fHChargevsN->SetDirectory(NULL); 129 fHChargevsNHiGain = new TH1I("HChargevsNHiGain","Sum of Hi Gain Charges vs. Event Number Pixel ", 130 nqbins,nfirst,nlast); 131 fHChargevsNHiGain->SetXTitle("Event Nr."); 132 fHChargevsNHiGain->SetYTitle("Sum of Hi Gain FADC slices"); 133 134 fHChargevsNHiGain->SetDirectory(NULL); 135 136 fHChargevsNLoGain = new TH1I("HChargevsNLoGain","Sum of Lo Gain Charges vs. Event Number Pixel ", 137 nqbins,nfirst,nlast); 138 fHChargevsNLoGain->SetXTitle("Event Nr."); 139 fHChargevsNLoGain->SetYTitle("Sum of Lo Gain FADC slices"); 140 141 fHChargevsNLoGain->SetDirectory(NULL); 118 142 119 143 } … … 122 146 { 123 147 124 delete fHCharge; 125 delete fHTime; 126 delete fHChargevsN; 148 delete fHChargeHiGain; 149 delete fHTimeHiGain; 150 delete fHChargevsNHiGain; 151 152 delete fHChargeLoGain; 153 delete fHTimeLoGain; 154 delete fHChargevsNLoGain; 127 155 128 156 if (fChargeGausFit) … … 141 169 fPixId = id; 142 170 143 TString nameQ = TString(fHCharge->GetName()); 144 nameQ += id; 145 fHCharge->SetName(nameQ.Data()); 146 147 TString nameT = TString(fHTime->GetName()); 148 nameT += id; 149 fHTime->SetName(nameT.Data()); 150 151 TString nameQvsN = TString(fHChargevsN->GetName()); 152 nameQvsN += id; 153 fHChargevsN->SetName(nameQvsN.Data()); 154 155 TString titleQ = TString(fHCharge->GetTitle()); 156 titleQ += id; 157 fHCharge->SetTitle(titleQ.Data()); 158 159 TString titleT = TString(fHTime->GetTitle()); 160 titleT += id; 161 fHTime->SetTitle(titleT.Data()); 162 163 TString titleQvsN = TString(fHChargevsN->GetTitle()); 164 titleQvsN += id; 165 fHChargevsN->SetTitle(titleQvsN.Data()); 171 TString nameQHiGain = TString(fHChargeHiGain->GetName()); 172 nameQHiGain += id; 173 fHChargeHiGain->SetName(nameQHiGain.Data()); 174 175 TString nameTHiGain = TString(fHTimeHiGain->GetName()); 176 nameTHiGain += id; 177 fHTimeHiGain->SetName(nameTHiGain.Data()); 178 179 TString nameQvsNHiGain = TString(fHChargevsNHiGain->GetName()); 180 nameQvsNHiGain += id; 181 fHChargevsNHiGain->SetName(nameQvsNHiGain.Data()); 182 183 TString titleQHiGain = TString(fHChargeHiGain->GetTitle()); 184 titleQHiGain += id; 185 fHChargeHiGain->SetTitle(titleQHiGain.Data()); 186 187 TString titleTHiGain = TString(fHTimeHiGain->GetTitle()); 188 titleTHiGain += id; 189 fHTimeHiGain->SetTitle(titleTHiGain.Data()); 190 191 TString titleQvsNHiGain = TString(fHChargevsNHiGain->GetTitle()); 192 titleQvsNHiGain += id; 193 fHChargevsNHiGain->SetTitle(titleQvsNHiGain.Data()); 194 195 196 TString nameQLoGain = TString(fHChargeLoGain->GetName()); 197 nameQLoGain += id; 198 fHChargeLoGain->SetName(nameQLoGain.Data()); 199 200 TString nameTLoGain = TString(fHTimeLoGain->GetName()); 201 nameTLoGain += id; 202 fHTimeLoGain->SetName(nameTLoGain.Data()); 203 204 TString nameQvsNLoGain = TString(fHChargevsNLoGain->GetName()); 205 nameQvsNLoGain += id; 206 fHChargevsNLoGain->SetName(nameQvsNLoGain.Data()); 207 208 TString titleQLoGain = TString(fHChargeLoGain->GetTitle()); 209 titleQLoGain += id; 210 fHChargeLoGain->SetTitle(titleQLoGain.Data()); 211 212 TString titleTLoGain = TString(fHTimeLoGain->GetTitle()); 213 titleTLoGain += id; 214 fHTimeLoGain->SetTitle(titleTLoGain.Data()); 215 216 TString titleQvsNLoGain = TString(fHChargevsNLoGain->GetTitle()); 217 titleQvsNLoGain += id; 218 fHChargevsNLoGain->SetTitle(titleQvsNLoGain.Data()); 166 219 } 167 220 … … 170 223 { 171 224 172 for (Int_t i = fHCharge ->FindBin(fChargeFirst);173 i <= fHCharge ->FindBin(fChargeLast); i++)174 fHCharge ->SetBinContent(i, 1.e-20);225 for (Int_t i = fHChargeHiGain->FindBin(fChargeFirstHiGain); 226 i <= fHChargeHiGain->FindBin(fChargeLastHiGain); i++) 227 fHChargeHiGain->SetBinContent(i, 1.e-20); 175 228 176 229 for (Int_t i = 0; i < 16; i++) 177 fHTime->SetBinContent(i, 1.e-20); 178 179 fChargeLast = 9999.5; 180 181 fHCharge->GetXaxis()->SetRangeUser(0.,fChargeLast); 230 fHTimeHiGain->SetBinContent(i, 1.e-20); 231 232 fChargeLastHiGain = 9999.5; 233 234 fHChargeLoGain->GetXaxis()->SetRangeUser(0.,fChargeLastLoGain); 235 236 for (Int_t i = fHChargeLoGain->FindBin(fChargeFirstLoGain); 237 i <= fHChargeLoGain->FindBin(fChargeLastLoGain); i++) 238 fHChargeLoGain->SetBinContent(i, 1.e-20); 239 240 for (Int_t i = 0; i < 16; i++) 241 fHTimeLoGain->SetBinContent(i, 1.e-20); 242 243 fChargeLastLoGain = 9999.5; 244 245 fHChargeLoGain->GetXaxis()->SetRangeUser(0.,fChargeLastLoGain); 182 246 183 247 return; … … 192 256 { 193 257 194 fHCharge->Reset(); 195 fHTime->Reset(); 258 fHChargeHiGain->Reset(); 259 fHTimeHiGain->Reset(); 260 fHChargeLoGain->Reset(); 261 fHTimeLoGain->Reset(); 196 262 197 263 return kTRUE; … … 240 306 fFitLegend->AddText(line8); 241 307 242 243 308 if (fFitOK) 244 309 fFitLegend->AddText("Result of the Fit: OK"); … … 266 331 gROOT->SetSelectedPad(NULL); 267 332 268 c->Divide(2, 2);333 c->Divide(2,4); 269 334 270 335 c->cd(1); … … 273 338 gPad->SetTicks(); 274 339 275 fHCharge->Draw(opt); 276 277 if (fChargeGausFit) 278 { 279 if (fFitOK) 280 fChargeGausFit->SetLineColor(kGreen); 281 else 282 fChargeGausFit->SetLineColor(kRed); 283 284 fChargeGausFit->Draw("same"); 285 c->Modified(); 286 c->Update(); 287 } 288 289 290 c->cd(2); 291 DrawLegend(); 292 c->Update(); 293 294 c->cd(3); 295 gStyle->SetOptStat(1111111); 296 297 gPad->SetLogy(1); 298 fHTime->Draw(opt); 299 300 if (fTimeGausFit) 301 { 302 if (fTimeChisquare > 1.) 303 fTimeGausFit->SetLineColor(kRed); 304 else 305 fTimeGausFit->SetLineColor(kGreen); 306 307 fTimeGausFit->Draw("same"); 308 c->Modified(); 309 c->Update(); 310 } 311 340 fHChargeHiGain->DrawCopy(opt); 341 312 342 c->Modified(); 313 343 c->Update(); 314 344 315 c->cd(4); 316 fHChargevsN->Draw(opt); 317 } 318 319 320 321 Bool_t MHCalibrationPixel::FitTime(Axis_t rmin, Axis_t rmax, Option_t *option) 345 if (fUseLoGain) 346 { 347 c->cd(2); 348 gPad->SetLogy(1); 349 gPad->SetTicks(); 350 fHChargeLoGain->DrawCopy(opt); 351 352 if (fChargeGausFit) 353 { 354 if (fFitOK) 355 fChargeGausFit->SetLineColor(kGreen); 356 else 357 fChargeGausFit->SetLineColor(kRed); 358 359 fChargeGausFit->DrawCopy("same"); 360 } 361 362 c->cd(4); 363 DrawLegend(); 364 365 } 366 else 367 { 368 if (fChargeGausFit) 369 { 370 if (fFitOK) 371 fChargeGausFit->SetLineColor(kGreen); 372 else 373 fChargeGausFit->SetLineColor(kRed); 374 375 fChargeGausFit->DrawCopy("same"); 376 } 377 c->cd(2); 378 gPad->SetLogy(1); 379 gPad->SetTicks(); 380 fHChargeLoGain->DrawCopy(opt); 381 c->cd(3); 382 DrawLegend(); 383 } 384 385 c->Modified(); 386 c->Update(); 387 388 c->cd(5); 389 gStyle->SetOptStat(1111111); 390 391 gPad->SetLogy(1); 392 fHTimeHiGain->DrawCopy(opt); 393 c->Modified(); 394 c->Update(); 395 396 if (fUseLoGain) 397 { 398 399 c->cd(6); 400 gPad->SetLogy(1); 401 fHTimeLoGain->DrawCopy(opt); 402 c->Modified(); 403 c->Update(); 404 405 if (fTimeGausFit) 406 { 407 if (fTimeChisquare > 1.) 408 fTimeGausFit->SetLineColor(kRed); 409 else 410 fTimeGausFit->SetLineColor(kGreen); 411 412 fTimeGausFit->DrawCopy("same"); 413 } 414 } 415 else 416 { 417 if (fTimeGausFit) 418 { 419 if (fTimeChisquare > 1.) 420 fTimeGausFit->SetLineColor(kRed); 421 else 422 fTimeGausFit->SetLineColor(kGreen); 423 424 fTimeGausFit->DrawCopy("same"); 425 c->Modified(); 426 c->Update(); 427 } 428 429 c->cd(6); 430 gPad->SetLogy(1); 431 fHTimeLoGain->DrawCopy(opt); 432 } 433 c->Modified(); 434 c->Update(); 435 436 c->cd(7); 437 fHChargevsNHiGain->DrawCopy(opt); 438 c->Modified(); 439 c->Update(); 440 441 c->cd(8); 442 fHChargevsNLoGain->DrawCopy(opt); 443 c->Modified(); 444 c->Update(); 445 446 } 447 448 449 450 Bool_t MHCalibrationPixel::FitTimeHiGain(Axis_t rmin, Axis_t rmax, Option_t *option) 322 451 { 323 452 … … 328 457 rmax = (rmax != 0.) ? rmax : 9.; 329 458 330 const Stat_t entries = fHTime ->GetEntries();331 const Double_t mu_guess = fHTime ->GetBinCenter(fHTime->GetMaximumBin());459 const Stat_t entries = fHTimeHiGain->GetEntries(); 460 const Double_t mu_guess = fHTimeHiGain->GetBinCenter(fHTimeHiGain->GetMaximumBin()); 332 461 const Double_t sigma_guess = (rmax - rmin)/2.; 333 462 const Double_t area_guess = entries/gkSq2Pi; … … 350 479 fTimeGausFit->SetRange(rmin,rmax); 351 480 352 fHTime ->Fit(fTimeGausFit,option);481 fHTimeHiGain->Fit(fTimeGausFit,option); 353 482 354 483 rmin = fTimeGausFit->GetParameter(1) - 3.*fTimeGausFit->GetParameter(2); … … 356 485 fTimeGausFit->SetRange(rmin,rmax); 357 486 358 fHTime ->Fit(fTimeGausFit,option);487 fHTimeHiGain->Fit(fTimeGausFit,option); 359 488 360 489 fTimeChisquare = fTimeGausFit->GetChisquare(); … … 375 504 } 376 505 377 Bool_t MHCalibrationPixel::FitCharge(Option_t *option) 506 Bool_t MHCalibrationPixel::FitTimeLoGain(Axis_t rmin, Axis_t rmax, Option_t *option) 507 { 508 509 if (fTimeGausFit) 510 return kFALSE; 511 512 rmin = (rmin != 0.) ? rmin : 4.; 513 rmax = (rmax != 0.) ? rmax : 9.; 514 515 const Stat_t entries = fHTimeLoGain->GetEntries(); 516 const Double_t mu_guess = fHTimeLoGain->GetBinCenter(fHTimeLoGain->GetMaximumBin()); 517 const Double_t sigma_guess = (rmax - rmin)/2.; 518 const Double_t area_guess = entries/gkSq2Pi; 519 520 TString name = TString("GausTime"); 521 name += fPixId; 522 fTimeGausFit = new TF1(name.Data(),"gaus",rmin,rmax); 523 524 if (!fTimeGausFit) 525 { 526 *fLog << err << dbginf << "Could not create fit function for Gauss fit" << endl; 527 return kFALSE; 528 } 529 530 fTimeGausFit->SetParameters(area_guess,mu_guess,sigma_guess); 531 fTimeGausFit->SetParNames("Area","#mu","#sigma"); 532 fTimeGausFit->SetParLimits(0,0.,entries); 533 fTimeGausFit->SetParLimits(1,rmin,rmax); 534 fTimeGausFit->SetParLimits(2,0.,(rmax-rmin)); 535 fTimeGausFit->SetRange(rmin,rmax); 536 537 fHTimeLoGain->Fit(fTimeGausFit,option); 538 539 rmin = fTimeGausFit->GetParameter(1) - 3.*fTimeGausFit->GetParameter(2); 540 rmax = fTimeGausFit->GetParameter(1) + 3.*fTimeGausFit->GetParameter(2); 541 fTimeGausFit->SetRange(rmin,rmax); 542 543 fHTimeLoGain->Fit(fTimeGausFit,option); 544 545 fTimeChisquare = fTimeGausFit->GetChisquare(); 546 fTimeNdf = fTimeGausFit->GetNDF(); 547 fTimeProb = fTimeGausFit->GetProb(); 548 549 fTimeMean = fTimeGausFit->GetParameter(1); 550 fTimeSigma = fTimeGausFit->GetParameter(2); 551 552 if (fTimeChisquare > 1.) 553 { 554 *fLog << warn << "Fit of the Arrival times failed ! " << endl; 555 return kFALSE; 556 } 557 558 return kTRUE; 559 560 } 561 562 Bool_t MHCalibrationPixel::FitChargeHiGain(Option_t *option) 378 563 { 379 564 … … 384 569 // Get the fitting ranges 385 570 // 386 Axis_t rmin = (fLowerFitRange != 0.) ? fLowerFitRange : fChargeFirst ;571 Axis_t rmin = (fLowerFitRange != 0.) ? fLowerFitRange : fChargeFirstHiGain; 387 572 Axis_t rmax = 0.; 388 573 … … 391 576 // otherwise the fit goes gaga because of high number of dimensions ... 392 577 // 393 const Stat_t entries = fHCharge ->GetEntries();578 const Stat_t entries = fHChargeHiGain->GetEntries(); 394 579 const Double_t area_guess = entries/gkSq2Pi; 395 const Double_t mu_guess = fHCharge ->GetBinCenter(fHCharge->GetMaximumBin());580 const Double_t mu_guess = fHChargeHiGain->GetBinCenter(fHChargeHiGain->GetMaximumBin()); 396 581 const Double_t sigma_guess = mu_guess/15.; 397 582 … … 399 584 name += fPixId; 400 585 401 fChargeGausFit = new TF1(name.Data(),"gaus",rmin,fChargeLast );586 fChargeGausFit = new TF1(name.Data(),"gaus",rmin,fChargeLastHiGain); 402 587 403 588 if (!fChargeGausFit) … … 410 595 fChargeGausFit->SetParNames("Area","#mu","#sigma"); 411 596 fChargeGausFit->SetParLimits(0,0.,entries); 412 fChargeGausFit->SetParLimits(1,rmin,fChargeLast );413 fChargeGausFit->SetParLimits(2,0.,fChargeLast -rmin);414 fChargeGausFit->SetRange(rmin,fChargeLast );415 416 fHCharge ->Fit(fChargeGausFit,option);597 fChargeGausFit->SetParLimits(1,rmin,fChargeLastHiGain); 598 fChargeGausFit->SetParLimits(2,0.,fChargeLastHiGain-rmin); 599 fChargeGausFit->SetRange(rmin,fChargeLastHiGain); 600 601 fHChargeHiGain->Fit(fChargeGausFit,option); 417 602 418 603 Axis_t rtry = fChargeGausFit->GetParameter(1) - 2.5*fChargeGausFit->GetParameter(2); … … 422 607 fChargeGausFit->SetRange(rmin,rmax); 423 608 424 fHCharge ->Fit(fChargeGausFit,option);609 fHChargeHiGain->Fit(fChargeGausFit,option); 425 610 426 611 // rmin = fChargeGausFit->GetParameter(1) - 2.5*fChargeGausFit->GetParameter(2); … … 428 613 // fChargeGausFit->SetRange(rmin,rmax); 429 614 430 // fHCharge ->Fit(fChargeGausFit,option);615 // fHChargeHiGain->Fit(fChargeGausFit,option); 431 616 432 617 fChargeChisquare = fChargeGausFit->GetChisquare(); … … 455 640 } 456 641 642 643 Bool_t MHCalibrationPixel::FitChargeLoGain(Option_t *option) 644 { 645 646 if (fChargeGausFit) 647 return kFALSE; 648 649 // 650 // Get the fitting ranges 651 // 652 Axis_t rmin = (fLowerFitRange != 0.) ? fLowerFitRange : fChargeFirstLoGain; 653 Axis_t rmax = 0.; 654 655 // 656 // First guesses for the fit (should be as close to reality as possible, 657 // otherwise the fit goes gaga because of high number of dimensions ... 658 // 659 const Stat_t entries = fHChargeLoGain->GetEntries(); 660 const Double_t area_guess = entries/gkSq2Pi; 661 const Double_t mu_guess = fHChargeLoGain->GetBinCenter(fHChargeLoGain->GetMaximumBin()); 662 const Double_t sigma_guess = mu_guess/15.; 663 664 TString name = TString("ChargeGausFit"); 665 name += fPixId; 666 667 fChargeGausFit = new TF1(name.Data(),"gaus",rmin,fChargeLastLoGain); 668 669 if (!fChargeGausFit) 670 { 671 *fLog << err << dbginf << "Could not create fit function for Gauss fit" << endl; 672 return kFALSE; 673 } 674 675 fChargeGausFit->SetParameters(area_guess,mu_guess,sigma_guess); 676 fChargeGausFit->SetParNames("Area","#mu","#sigma"); 677 fChargeGausFit->SetParLimits(0,0.,entries); 678 fChargeGausFit->SetParLimits(1,rmin,fChargeLastLoGain); 679 fChargeGausFit->SetParLimits(2,0.,fChargeLastLoGain-rmin); 680 fChargeGausFit->SetRange(rmin,fChargeLastLoGain); 681 682 fHChargeLoGain->Fit(fChargeGausFit,option); 683 684 Axis_t rtry = fChargeGausFit->GetParameter(1) - 2.5*fChargeGausFit->GetParameter(2); 685 686 rmin = (rtry < rmin ? rmin : rtry); 687 rmax = fChargeGausFit->GetParameter(1) + 2.5*fChargeGausFit->GetParameter(2); 688 fChargeGausFit->SetRange(rmin,rmax); 689 690 fHChargeLoGain->Fit(fChargeGausFit,option); 691 692 // rmin = fChargeGausFit->GetParameter(1) - 2.5*fChargeGausFit->GetParameter(2); 693 // rmax = fChargeGausFit->GetParameter(1) + 2.5*fChargeGausFit->GetParameter(2); 694 // fChargeGausFit->SetRange(rmin,rmax); 695 696 // fHChargeLoGain->Fit(fChargeGausFit,option); 697 698 fChargeChisquare = fChargeGausFit->GetChisquare(); 699 fChargeNdf = fChargeGausFit->GetNDF(); 700 fChargeProb = fChargeGausFit->GetProb(); 701 fChargeMean = fChargeGausFit->GetParameter(1); 702 fChargeMeanErr = fChargeGausFit->GetParError(1); 703 fChargeSigma = fChargeGausFit->GetParameter(2); 704 fChargeSigmaErr = fChargeGausFit->GetParError(2); 705 706 // 707 // The fit result is accepted under condition 708 // The Probability is greater than gkProbLimit (default 0.01 == 99%) 709 // 710 if (fChargeProb < gkProbLimit) 711 { 712 *fLog << warn << "Prob: " << fChargeProb << " is smaller than the allowed value: " << gkProbLimit << endl; 713 fFitOK = kFALSE; 714 return kFALSE; 715 } 716 717 718 fFitOK = kTRUE; 719 720 return kTRUE; 721 } 722 457 723 458 724 void MHCalibrationPixel::CutAllEdges() 459 725 { 460 726 461 Int_t nbins = 50; 462 463 CutEdges(fHCharge,nbins); 464 465 fChargeFirst = fHCharge->GetBinLowEdge(fHCharge->GetXaxis()->GetFirst()); 466 fChargeLast = fHCharge->GetBinLowEdge(fHCharge->GetXaxis()->GetLast())+fHCharge->GetBinWidth(0); 467 fChargeNbins = nbins; 468 469 CutEdges(fHChargevsN,0); 727 Int_t nbins = 30; 728 729 CutEdges(fHChargeHiGain,nbins); 730 731 fChargeFirstHiGain = fHChargeHiGain->GetBinLowEdge(fHChargeHiGain->GetXaxis()->GetFirst()); 732 fChargeLastHiGain = fHChargeHiGain->GetBinLowEdge(fHChargeHiGain->GetXaxis()->GetLast()) 733 +fHChargeHiGain->GetBinWidth(0); 734 fChargeNbinsHiGain = nbins; 735 736 CutEdges(fHChargeLoGain,nbins); 737 738 fChargeFirstLoGain = fHChargeLoGain->GetBinLowEdge(fHChargeLoGain->GetXaxis()->GetFirst()); 739 fChargeLastLoGain = fHChargeLoGain->GetBinLowEdge(fHChargeLoGain->GetXaxis()->GetLast()) 740 +fHChargeLoGain->GetBinWidth(0); 741 fChargeNbinsLoGain = nbins; 742 743 CutEdges(fHChargevsNHiGain,0); 744 CutEdges(fHChargevsNLoGain,0); 470 745 471 746 } -
trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.h
r2603 r2627 31 31 protected: 32 32 33 TH1I* fHCharge; //-> Summed FADC slices 34 TH1I* fHTime; //-> Mean arrival time in number of FADC sice 35 TH1I* fHChargevsN; //-> Summed Charge vs. Event Nr. 33 TH1F* fHChargeHiGain; //-> Summed FADC slices 34 TH1I* fHTimeHiGain; //-> Mean arrival time in number of FADC sice 35 TH1I* fHChargevsNHiGain; //-> Summed Charge vs. Event Nr. 36 37 TH1F* fHChargeLoGain; //-> Summed FADC slices 38 TH1I* fHTimeLoGain; //-> Mean arrival time in number of FADC sice 39 TH1I* fHChargevsNLoGain; //-> Summed Charge vs. Event Nr. 36 40 37 41 TF1* fChargeGausFit; … … 41 45 42 46 Axis_t fLowerFitRange; 43 Axis_t fChargeFirst; 44 Axis_t fChargeLast; 45 Int_t fChargeNbins; 47 Axis_t fChargeFirstHiGain; 48 Axis_t fChargeLastHiGain; 49 Int_t fChargeNbinsHiGain; 50 51 Axis_t fChargeFirstLoGain; 52 Axis_t fChargeLastLoGain; 53 Int_t fChargeNbinsLoGain; 46 54 47 55 Bool_t fFitOK; … … 62 70 Double_t fTimeMean; 63 71 Double_t fTimeSigma; 72 73 Bool_t fUseLoGain; 64 74 65 75 virtual void DrawLegend(); … … 75 85 Bool_t Fill(const MParContainer *, const Stat_t w=1) { return kTRUE; } 76 86 77 Bool_t FillCharge (Int_t q) { return fHCharge->Fill(q) > -1; }78 Bool_t FillTime (Int_t t) { return fHTime->Fill(t) > -1; }79 Bool_t FillChargevsN (Float_t q, Int_t n) { return fHChargevsN->Fill(n,q) > -1; }87 Bool_t FillChargeLoGain(Float_t q) { return fHChargeLoGain->Fill(q) > -1; } 88 Bool_t FillTimeLoGain(Int_t t) { return fHTimeLoGain->Fill(t) > -1; } 89 Bool_t FillChargevsNLoGain(Float_t q, Int_t n) { return fHChargevsNLoGain->Fill(n,q) > -1; } 80 90 81 const TH1I *GetHCharge() { return fHCharge; } 82 const TH1I *GetHCharge() const { return fHCharge; } 91 Bool_t FillChargeHiGain(Float_t q) { return fHChargeHiGain->Fill(q) > -1; } 92 Bool_t FillTimeHiGain(Int_t t) { return fHTimeHiGain->Fill(t) > -1; } 93 Bool_t FillChargevsNHiGain(Float_t q, Int_t n) { return fHChargevsNHiGain->Fill(n,q) > -1; } 94 95 void SetUseLoGain() { fUseLoGain = kTRUE; } 96 97 const TH1F *GetHCharge() { return fHChargeHiGain; } 98 const TH1F *GetHCharge() const { return fHChargeHiGain; } 83 99 84 100 const Double_t GetChargeMean() const { return fChargeMean; } … … 100 116 const Int_t GetTimeNdf() const { return fTimeNdf; } 101 117 102 const TH1I *GetHTime() { return fHTime ; }103 const TH1I *GetHTime() const { return fHTime ; }118 const TH1I *GetHTime() { return fHTimeHiGain; } 119 const TH1I *GetHTime() const { return fHTimeHiGain; } 104 120 105 const TH1I *GetHChargevsN() { return fHChargevsN ; }106 const TH1I *GetHChargevsN() const { return fHChargevsN ; }121 const TH1I *GetHChargevsN() { return fHChargevsNHiGain; } 122 const TH1I *GetHChargevsN() const { return fHChargevsNHiGain; } 107 123 108 Bool_t FitCharge(Option_t *option="RQ0"); 109 Bool_t FitTime(Axis_t rmin=0, Axis_t rmax=0, Option_t *option="RQ0"); 124 Bool_t FitChargeHiGain(Option_t *option="RQ0"); 125 Bool_t FitTimeHiGain(Axis_t rmin=0, Axis_t rmax=0, Option_t *option="RQ0"); 126 127 Bool_t FitChargeLoGain(Option_t *option="RQ0"); 128 Bool_t FitTimeLoGain(Axis_t rmin=0, Axis_t rmax=0, Option_t *option="RQ0"); 110 129 111 130 virtual void Draw(Option_t *option=""); -
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r2586 r2627 739 739 // ------------------------------------------------------------------------ 740 740 // 741 // Call this function to add a MCamEvent on top of the present contents. 742 // 743 void MHCamera::SetCamError(const MCamEvent &evt, Int_t type) 744 { 745 746 if (fNcells<=1 || IsFreezed()) 747 return; 748 749 // FIXME: Security check missing! 750 for (Int_t idx=0; idx<fNcells-2; idx++) 751 { 752 Double_t val=0; 753 if (evt.GetPixelContent(val, idx, *fGeomCam, type)/* && !IsUsed(idx)*/) 754 SetUsed(idx); 755 756 SetBinError(idx+1, val); // FIXME: Slow! 757 } 758 } 759 760 761 762 // ------------------------------------------------------------------------ 763 // 741 764 // Call this function to add a MHCamera on top of the present contents. 742 765 // Type: -
trunk/MagicSoft/Mars/mhist/MHCamera.h
r2586 r2627 124 124 virtual void SetCamContent(const TArrayD &evt, const TArrayC *used=NULL) { Reset(); AddCamContent(evt, used); } 125 125 virtual void SetCamContent(const MHCamera &d, Int_t type=0) { Reset(); AddCamContent(d, type); fEntries=d.fEntries; } 126 127 virtual void SetCamError(const MCamEvent &event, Int_t type=0); 128 126 129 virtual void CntCamContent(const MCamEvent &evt, Double_t threshold, Int_t type=0); 127 130 virtual void CntCamContent(const TArrayD &evt, Double_t threshold, Bool_t ispos=kTRUE);
Note:
See TracChangeset
for help on using the changeset viewer.