Changeset 2581
- Timestamp:
- 12/01/03 18:58:01 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2580 r2581 4 4 5 5 -*-*- END OF LINE -*-*- 6 7 2003/12/01: Markus Gaug 8 9 * macros/calibration.C: 10 - adjusted some parameters 11 12 * manalysis/MCalibrationCalc.cc: 13 - cosmics are now skipped from the fit 14 15 * manalysis/MCalibrationPix: 16 - cosmics are now skipped from the fit 17 18 * mhist/MHCalibrationPixel: 19 - cosmics are now skipped from the fit 20 21 * manalysis/Makefile 22 - MPedCalcPedRun was not in Makefile 23 24 * manalysis/AnalysisLinkDef 25 - MPedCalcPedRun was not in AnalysisLinkDef 26 6 27 7 28 2003/12/01: Thomas Bretz -
trunk/MagicSoft/Mars/macros/calibration.C
r2570 r2581 23 23 \* ======================================================================== */ 24 24 25 void calibration(TString pedname=". /20031102_02399_P_Unavailable_E.root",26 TString calname=". /20031102_02400_D_Flip500Hz_E.root")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") 27 27 { 28 28 … … 45 45 46 46 MGeomApply geomapl; 47 MPedCalcPedRun pedcalc; 47 48 MGeomCamMagic geomcam; 48 MGeomCam geom;49 MPedCalcPedRun pedcalc;50 49 MPedestalCam pedcam; 51 50 … … 57 56 58 57 MHCamEvent hist("Pedestal"); 59 hist.SetType( 1);58 hist.SetType(0); 60 59 plist.AddToList(&hist); 61 60 MFillH fill(&hist, "MPedestalCam"); … … 63 62 tlist.AddToList(&fill); 64 63 65 // 66 // Update frequency by default = 1Hz 67 // 68 MStatusDisplay *d = new MStatusDisplay; 64 MStatusDisplay *d1 = new MStatusDisplay; 69 65 70 66 // Set update time to 3s 71 d ->SetUpdateTime(3000);67 d1->SetUpdateTime(3000); 72 68 73 69 // … … 76 72 MEvtLoop evtloop; 77 73 evtloop.SetParList(&plist); 78 evtloop.SetDisplay(d );74 evtloop.SetDisplay(d1); 79 75 80 76 // … … 86 82 tlist.PrintStatistics(); 87 83 84 MPedestalCam *ped = plist.FindObject("MPedestalCam"); 85 ped.Print(); 86 88 87 // 89 88 // Create a empty Parameter List and an empty Task List … … 94 93 plist2.AddToList(&tlist2); 95 94 95 96 96 plist2.AddToList((MPedestalCam*)plist.FindObject("MPedestalCam")); 97 97 98 MGeomApply geomapl2;98 // MGeomApply geomapl2; 99 99 tlist2.AddToList(&geomapl); 100 100 … … 108 108 109 109 MCalibrationCalc calcalc; 110 calcalc.SetSkipTFits();110 // calcalc.SetSkipTFits(); 111 111 112 112 plist2.AddToList(&geomcam); … … 114 114 // 115 115 // As long, as we don't have digital modules, 116 // we have to set the color by hand116 // we have to set the color of the pulser LED by hand 117 117 // 118 118 calcalc.SetPulserColor(MCalibrationCalc::kEBlue); … … 141 141 tlist2.PrintStatistics(); 142 142 143 // plist2.FindObject("MCalibrationCam")->Print();144 145 143 // 146 144 // just one example how to get the plots of individual pixels … … 148 146 MCalibrationCam *cam = plist2.FindObject("MCalibrationCam"); 149 147 MCalibrationPix *pix = cam->GetCalibrationPix(523); 150 //pix->Draw(); 151 148 pix->Draw(); 149 150 // 151 // Here we are confronted to a serious bug in ROOT: 152 // If we do not apply the next command, gPad will get 153 // screwed up completely: (Thanks to tbretz for finding out 154 // the reason during several hours!!!) 155 // 152 156 gROOT->GetListOfCanvases()->Delete(); 153 157 … … 193 197 disp12.SetYTitle("\\Delta_{Q} [FADC counts]"); 194 198 195 // TText text(0.1, 0.5, &fname[fname.Last('/')+1]); 196 // text.SetTextSize(0.015); 197 // text.DrawClone(); 198 TCanvas *c1 = &d->AddTab("Cal1");//MH::MakeDefCanvas("Calibration1","Plots of FADC Charges",700,900); 199 MStatusDisplay *d2 = new MStatusDisplay; 200 201 // Set update time to 1s 202 d2->SetUpdateTime(1000); 203 204 TCanvas *c1 = &d2->AddTab("Fitted Charges"); 199 205 c1->Divide(5, 2); 200 206 … … 241 247 obj->Draw(); 242 248 243 TCanvas *c2 = &d ->AddTab("Cal2");//MH::MakeDefCanvas("Calibration2","Plots of Arrival Times",700,900);249 TCanvas *c2 = &d2->AddTab("Fitted Times"); 244 250 c2->Divide(3, 2); 245 251 … … 265 271 obj->Draw(); 266 272 267 TCanvas *c3 = &d ->AddTab("Cal3");//MH::MakeDefCanvas("Calibration3","Plots of Pedestals",700,900);273 TCanvas *c3 = &d2->AddTab("Pedestals"); 268 274 c3->Divide(2, 2); 269 275 … … 282 288 obj->Draw(); 283 289 284 TCanvas *c4 = &d ->AddTab("Cal4");//MH::MakeDefCanvas("Calibration4","Plots of Reduced Charges",700,900);290 TCanvas *c4 = &d2->AddTab("Reduced Charges"); 285 291 c4->Divide(2, 2); 286 292 … … 299 305 obj->Draw(); 300 306 301 // c->SaveAs(fname(0, fname.Last('.')+1) + "ps"); 302 //c->SaveAs(fname(0, fname.Last('.')+1) + "root"); 307 #endif 303 308 304 309 } -
trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h
r2565 r2581 20 20 #pragma link C++ class MPedestalPix+; 21 21 #pragma link C++ class MPedestalCam+; 22 #pragma link C++ class MPedCalcPedRun+; 22 23 #pragma link C++ class MMcPedestalCopy+; 23 24 #pragma link C++ class MMcPedestalNSBAdd+; -
trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.cc
r2540 r2581 136 136 { 137 137 138 fOverFlow = 0; 139 fNrEvents = 0; 138 fHistOverFlow = 0; 139 fEvents = 0; 140 fCosmics = 0; 140 141 141 142 fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData"); … … 235 236 { 236 237 237 fNrEvents++; 238 fEvents++; 239 240 Bool_t cosmic = kFALSE; 238 241 239 242 MCalibrationBlindPix &blindpixel = *(fCalibrations->GetBlindPixel()); … … 267 270 mid = pixel.GetIdxMaxLoGainSample(); 268 271 269 sum = (max == gkSaturationLimit // overflow of LoGain ??? -> GimmeABreak!!!270 ? f OverFlow++, gkLoGainOverFlow // OUCH (Florian was maybe right)271 : sum*gkConversionHiLo ); // OUFF (Florian was wrong) !!272 sum = (max == gkSaturationLimit // overflow of LoGain ??? -> GimmeABreak!!! 273 ? fHistOverFlow++, gkLoGainOverFlow // OUCH (Florian was maybe right) 274 : sum*gkConversionHiLo ); // OUFF (Florian was wrong) !! 272 275 273 276 // *fLog << warn << "Warning: Saturation of HiGain reached in slice " << (int)mid << " !!! " << endl; 274 277 // *fLog << warn << "Max = " << max << endl; 275 278 276 if (f OverFlow)279 if (fHistOverFlow) 277 280 *fLog << err << dbginf << "Warning: Saturation of LoGain reached! " 278 281 << err << dbginf << "sum = " << sum << endl; 279 282 280 283 } 281 282 // 283 // sanity check (old MC files sometimes have pixids>577) 284 // 285 if (fPedestals && !fPedestals->CheckBounds(pixid)) 286 { 287 *fLog << inf << "Pixel ID larger than camera... skipping event." << endl; 288 return kCONTINUE; 289 } 290 284 285 291 286 MPedestalPix &ped = (*fPedestals)[pixid]; 292 287 MCalibrationPix &pix = (*fCalibrations)[pixid]; 293 288 294 Float_t pedes = ped.GetPedestal(); 289 Float_t pedes = ped.GetPedestal(); 290 Float_t pedrms = ped.GetPedestalRms(); 295 291 296 292 // … … 298 294 // Assume pedestals per time slice ==> multiply with number of slices 299 295 // 300 pedes *= (sat ? fNumLoGainSamples : fNumHiGainSamples ); 296 pedes *= (sat ? fNumLoGainSamples : fNumHiGainSamples ); 297 pedrms *= (sat ? fNumLoGainSamples : fNumHiGainSamples ); 298 299 // 300 // This is a very primitive check for the number of cosmics 301 // The cut will be applied in the fit, but for the blind pixel, 302 // we need to remove this event 303 // 304 // FIXME: In the future need a much more sophisticated one!!! 305 // 306 307 if ((float)sum < pedes+5.*pedrms) 308 cosmic = kTRUE; 301 309 302 310 Float_t rsum = (float)sum - pedes; … … 306 314 307 315 case gkCalibrationBlindPixelId: 308 if (!blindpixel.FillQ(sum)) 309 *fLog << warn << 310 "Overflow or Underflow occurred filling Blind Pixel means = " << sum << endl; 316 // 317 // FIXME: This works only when the blind pixel ID is much larger than 318 // the rest of the pixels (which is the case right now) 319 // 320 // if (!cosmic) 321 if (!blindpixel.FillQ(sum)) 322 *fLog << warn << 323 "Overflow or Underflow occurred filling Blind Pixel sum = " << sum << endl; 324 311 325 if (!blindpixel.FillT((int)mid)) 312 326 *fLog << warn << 313 327 "Overflow or Underflow occurred filling Blind Pixel time = " << (int)mid << endl; 314 if (!blindpixel.FillRQvsT(rsum,fNrEvents)) 328 329 if (!blindpixel.FillRQvsT(rsum,fEvents)) 315 330 *fLog << warn << 316 "Overflow or Underflow occurred filling Blind Pixel eventnr = " << f NrEvents << endl;331 "Overflow or Underflow occurred filling Blind Pixel eventnr = " << fEvents << endl; 317 332 318 333 case gkCalibrationPINDiodeId: … … 323 338 *fLog << warn << 324 339 "Overflow or Underflow occurred filling HT: time = " << (int)mid << endl; 325 if (!pindiode.FillRQvsT(rsum,f NrEvents))340 if (!pindiode.FillRQvsT(rsum,fEvents)) 326 341 *fLog << warn << 327 "Overflow or Underflow occurred filling HQvsN: eventnr = " << f NrEvents << endl;342 "Overflow or Underflow occurred filling HQvsN: eventnr = " << fEvents << endl; 328 343 329 344 default: … … 336 351 // Fill the reduced charge into the control histo for better visibility 337 352 // 338 if (!pix.FillRQvsT(rsum,f NrEvents))353 if (!pix.FillRQvsT(rsum,fEvents)) 339 354 *fLog << warn << "Could not fill red. Q vs. EvtNr of pixel: " << pixid 340 << " signal = " << rsum << " event Nr: " << f NrEvents << endl;355 << " signal = " << rsum << " event Nr: " << fEvents << endl; 341 356 342 357 … … 348 363 349 364 } /* while (pixel.Next()) */ 365 366 if (cosmic) 367 fCosmics++; 350 368 351 369 fCalibrations->SetReadyToSave(); … … 398 416 MCalibrationPix &pix = (*fCalibrations)[pixid]; 399 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); 400 422 401 423 if (TESTBIT(fFlags,kUseTFits)) … … 405 427 continue; 406 428 407 const Float_t ped = (*fPedestals)[pixid].GetPedestal();408 const Float_t prms = (*fPedestals)[pixid].GetPedestalRms();409 pix.SetPedestal(ped,prms);410 429 } 411 430 } … … 413 432 fCalibrations->SetReadyToSave(); 414 433 415 if (GetNumExecutions()==0 || fOverFlow==0)434 if (GetNumExecutions()==0) 416 435 return kTRUE; 417 436 418 *fLog << inf << endl; 419 *fLog << GetDescriptor() << " execution statistics:" << endl; 420 *fLog << dec << setfill(' '); 421 *fLog << " " << setw(7) << fOverFlow << " (" << setw(3) << (int)(fOverFlow*100/GetNumExecutions()) << "%) Evts skipped due to: lo gain saturated." << endl; 422 437 *fLog << endl; 438 *fLog << dec << setfill(' ') << fCosmics << " Events presumably cosmics" << endl; 439 423 440 return kTRUE; 424 441 } -
trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.h
r2540 r2581 35 35 MTime *fEvtTime; // Time of the event 36 36 37 Int_t fNrEvents; // Number of events 38 Int_t fOverFlow; // Number of events with saturated Low Gain 37 Int_t fEvents; // Number of events 38 Int_t fHistOverFlow; // Number of events with saturated Low Gain 39 Int_t fCosmics; // Number of events due to supposed cosmics 39 40 40 41 Byte_t fNumHiGainSamples; -
trunk/MagicSoft/Mars/manalysis/MCalibrationPix.cc
r2544 r2581 83 83 return kTRUE; 84 84 85 if (fPed && fPedRms) 86 fHist->SetLowerFitRange(fPed + 3.5*fPedRms); 87 else 88 *fLog << warn << "Cannot set lower fit range to suppress cosmics: Pedestals not available" << endl; 89 85 90 if(!fHist->FitQ()) 86 91 { -
trunk/MagicSoft/Mars/manalysis/Makefile
r2565 r2581 33 33 SRCFILES = MPedestalPix.cc \ 34 34 MPedestalCam.cc \ 35 MPedCalcPedRun.cc \ 35 36 MMcPedestalCopy.cc \ 36 37 MMcPedestalNSBAdd.cc \ -
trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.cc
r2544 r2581 55 55 56 56 using namespace std; 57 57 58 // -------------------------------------------------------------------------- 58 59 // … … 60 61 // 61 62 MHCalibrationPixel::MHCalibrationPixel(Int_t pix, const char *name, const char *title) 62 : fFitOK(kFALSE), fPixId(pix), fTGausFit(NULL), fQGausFit(NULL), fFitLegend(NULL) 63 { 63 : fPixId(pix), 64 fQGausFit(NULL), 65 fTGausFit(NULL), 66 fFitLegend(NULL), 67 fLowerFitRange(0.), 68 fFitOK(kFALSE) 69 { 64 70 65 71 fName = name ? name : "MHCalibrationPixel"; … … 328 334 } 329 335 330 Bool_t MHCalibrationPixel::FitQ( Axis_t rmin, Axis_t rmax,Option_t *option)336 Bool_t MHCalibrationPixel::FitQ(Option_t *option) 331 337 { 332 338 … … 337 343 // Get the fitting ranges 338 344 // 339 rmin = (rmin != 0.) ? rmin : fQfirst; 340 rmax = (rmax != 0.) ? rmax : fQlast; 345 Axis_t rmin = (fLowerFitRange != 0.) ? fLowerFitRange : fQfirst; 341 346 342 347 // … … 349 354 const Double_t si_guess = mu_guess/500.; 350 355 351 fQGausFit = new TF1("QGausFit","gaus",rmin, rmax);356 fQGausFit = new TF1("QGausFit","gaus",rmin,fQlast); 352 357 353 358 if (!fQGausFit) … … 360 365 fQGausFit->SetParNames("Area","#mu","#sigma"); 361 366 fQGausFit->SetParLimits(0,0.,entries); 362 fQGausFit->SetParLimits(1,rmin, rmax);363 fQGausFit->SetParLimits(2,0., rmax-rmin);367 fQGausFit->SetParLimits(1,rmin,fQlast); 368 fQGausFit->SetParLimits(2,0.,fQlast-rmin); 364 369 365 370 fHQ->Fit("QGausFit",option); -
trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.h
r2538 r2581 41 41 TPaveText *fFitLegend; 42 42 43 Axis_t fLowerFitRange; 43 44 Axis_t fQfirst; 44 45 Axis_t fQlast; … … 104 105 const TH1I *GetHQvsN() const { return fHQvsN; } 105 106 106 Bool_t FitQ( Axis_t rmin=0, Axis_t rmax=0,Option_t *option="RQ0+");107 Bool_t FitQ(Option_t *option="RQ0+"); 107 108 Bool_t FitT(Axis_t rmin=0, Axis_t rmax=0, Option_t *option="RQ0+"); 108 109 … … 110 111 virtual void CutAllEdges(); 111 112 virtual void Reset(); 113 114 void SetLowerFitRange(Axis_t min) { fLowerFitRange = min; } 112 115 113 116 void PrintQFitResult();
Note:
See TracChangeset
for help on using the changeset viewer.