- Timestamp:
- 06/04/12 18:55:03 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/PulseTemplates/FCalcPulseTemplate.C
r13851 r14064 21 21 #include <TStyle.h> 22 22 #include <TString.h> 23 #include <TF1.h> 23 24 24 25 #include <stdio.h> … … 79 80 bool testmode 80 81 ); 82 81 83 //---------------------------------------------------------------------------- 82 84 //---------------------------------------------------------------------------- … … 92 94 int npixel = -1, 93 95 int pixelSetSize = 200, 94 int maxPulseOrder = 3,96 int maxPulseOrder = 1, 95 97 TString histoOptions = "SRM", 96 98 bool ProduceGraphic = true, 97 99 bool stats = true, 98 bool saveResults = true,100 bool saveResults = false, 99 101 // bool fitdata = false, 100 bool debugPixel = false,102 bool debugPixel = true, 101 103 // int refresh_rate = 500, //refresh rate for canvases 102 104 int verbosityLevel = 2 // different verbosity levels can be implemented here … … 173 175 174 176 //Canvas Pad numbering 175 int PixelCanvasFrameNrs[4] = { 177 int PixelCanvasFrameNrs[8] = 178 { 176 179 1, // Top left 177 2, // Top right 178 3, // bottom left 179 4 // bootom right 180 2, // Top mid left 181 3, // Top mid right 182 4, // Top right 183 5, // bootom left 184 6, // bootom mid left 185 7, // bottom mid right 186 8 // bootom right 180 187 }; 181 188 182 //Canvas Pad numbering183 int AllpixelCanvasFrameNrs[4] = {184 1, // Top left185 2, // Top right186 3, // bottom left187 4 // bootom right188 };189 // //Canvas Pad numbering 190 // int DistributionCanvasFrameNrs[4] = { 191 // 1, // Top left 192 // 2, // Top right 193 // 3, // bottom left 194 // 4 // bootom right 195 // }; 189 196 190 197 if (ProduceGraphic) … … 214 221 cgpDistributions[pulse_order] 215 222 = new TCanvas(cName,cTitle, 720,pulse_order*20,720,720); 216 cgpDistributions[pulse_order]->Divide(2, 2);223 // cgpDistributions[pulse_order]->Divide(2, 2); 217 224 218 225 cName ="cgpPixelPulses"; … … 223 230 224 231 cgpPixelPulses[pulse_order] 225 = new TCanvas(cName,cTitle, 0,pulse_order*20, 720,720);226 cgpPixelPulses[pulse_order]->Divide( 2, 2);232 = new TCanvas(cName,cTitle, 0,pulse_order*20,1400,1400); 233 cgpPixelPulses[pulse_order]->Divide(4, 2); 227 234 } 228 235 } … … 342 349 verbosityLevel, 343 350 stats, 344 " ",351 "C", 345 352 pixel[pixelID]->mPixelOverlayXaxisLeft, 346 353 pixel[pixelID]->mPixelOverlayXaxisRight , … … 425 432 if (ProduceGraphic && debugPixel) 426 433 { 434 pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->SetLimits( 435 0, 436 300 437 ); 438 // pixel[pixelID]->ShiftHistoInY( 439 // pixel[pixelID]->hPixelEdgeMax[pulse_order], 440 // 2 441 // ); 442 443 427 444 pixel[pixelID]->DrawTemplateHistograms( 428 445 cgpPixelPulses, … … 434 451 PixelCanvasFrameNrs 435 452 ); 453 454 //------------------------------------- 455 //------------------------------------- 456 // Test Area 457 //------------------------------------- 458 //------------------------------------- 459 460 cgpPixelPulses[pulse_order]->cd(6); 461 462 double fit_parameters[3]; 463 FitFallingEdge( 464 "hugo1", 465 pixel[pixelID]->hPixelEdgeMax[pulse_order], 466 pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetMaximumBin(), 467 pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->GetLast(), 468 fit_parameters 469 ); 470 cout << "Parameters\t" << fit_parameters[0] << "\n" 471 << fit_parameters[1] << "\n" 472 << fit_parameters[2] << "\n" << endl; 473 474 // TF1 *func = new TF1("func", template_function, 0, 300, 10); 475 476 // func->SetParameters( 477 // -0.5, // bsl 478 // pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->GetFirst() + 50, 479 // pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetMaximumBin() 480 // ); // range 481 482 483 484 // func->SetParNames("baseline", 485 // "begin of pol3", "begin of exp", 486 // "exp-factor", "exp-tau", "ext-t0", 487 // "pol3_0", "pol3_1", "pol3_2", "pol3_3" 488 // ); 489 // pixel[pixelID]->hPixelEdgeMax[pulse_order]->Fit(func); 490 491 TH1F* hTest = new TH1F( 492 "hTest", 493 "Test", 494 pixel[pixelID]->mPixelOverlayXaxisLeft 495 + pixel[pixelID]->mPixelOverlayXaxisRight , 496 (-1*pixel[pixelID]->mPixelOverlayXaxisLeft)-0.5, 497 pixel[pixelID]->mPixelOverlayXaxisRight-0.5 498 ); 499 500 hTest->GetXaxis()->SetLimits( 501 0, 502 300 503 ); 504 505 for (int bin = 0; 506 bin < pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->GetLast(); 507 bin++ 508 ) 509 { 510 hTest->SetBinContent( bin, (-1)*(fit_parameters[0]+TMath::Exp(fit_parameters[1]+fit_parameters[2]*(bin))) ); 511 } 512 513 hTest->Add(pixel[pixelID]->hPixelEdgeMax[pulse_order], 1); 514 515 cgpPixelPulses[pulse_order]->cd(7); 516 hTest->Draw(); 517 518 for (int bin = 0; 519 bin < pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->GetLast(); 520 bin++ 521 ) 522 { 523 hTest->SetBinContent( bin, (-1)*(hTest->GetBinContent(bin)) ); 524 } 525 526 // pixel[pixelID]->hPixelEdgeMax[pulse_order]->Fit(func); 527 528 double fit_parameters2[3]; 529 FitFallingEdge( 530 "hugo2", 531 hTest, 532 hTest->GetXaxis()->GetFirst()+68, 533 hTest->GetXaxis()->GetFirst()+80, 534 fit_parameters2 535 ); 536 537 cgpPixelPulses[pulse_order]->cd(8); 538 539 TH1F* hTest2 = new TH1F( 540 "hTest2", 541 "Test", 542 pixel[pixelID]->mPixelOverlayXaxisLeft 543 + pixel[pixelID]->mPixelOverlayXaxisRight , 544 (-1*pixel[pixelID]->mPixelOverlayXaxisLeft)-0.5, 545 pixel[pixelID]->mPixelOverlayXaxisRight-0.5 546 ); 547 548 hTest2->GetXaxis()->SetLimits( 549 0, 550 300 551 ); 552 553 for (int bin = 0; 554 bin < pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->GetLast(); 555 bin++ 556 ) 557 { 558 hTest2->SetBinContent( bin, (-1)*(hTest->GetBinContent(bin)) ); 559 } 560 561 double fit_parameters3[3]; 562 FitRisingEdge( 563 "hugo3", 564 hTest2, 565 hTest2->GetXaxis()->GetFirst()+68, 566 hTest2->GetXaxis()->GetFirst()+80, 567 fit_parameters3 568 ); 569 570 hTest2->Draw(); 571 572 573 //------------------------------------- 574 //------------------------------------- 575 // EOF Test Area 576 //------------------------------------- 577 //------------------------------------- 578 579 436 580 } 581 // FitMaxPropabilityPuls( 582 // pixel[pixelID]->hPixelEdgeMean[pulse_order], 583 // verbosityLevel 584 // ); 437 585 //------------------------------------- 438 586 // Fill Histogramms of Camera … … 455 603 ); 456 604 605 //------------------------------------- 606 // Comparisons 607 //------------------------------------- 608 609 //chi2 test 610 float chi2 = 611 pixel[pixelID]->hPixelEdgeMean[pulse_order]->Chi2Test( 612 pixel[pixelID]->hPixelMean[pulse_order], 613 "UUPCHI2" 614 ); 615 cout << "p-Value :" << chi2 << endl; 616 wholeCamera->hChi2EdgetoMax[pulse_order]->Fill(chi2); 617 cgpDistributions[pulse_order]->cd(); 618 wholeCamera->hChi2EdgetoMax[pulse_order]->Draw(); 457 619 458 620 if (verbosityLevel > 2) … … 486 648 if (input=="q\n") 487 649 { 488 break;650 return(0); 489 651 } 490 652 } 653 491 654 if ( saveResults ) 492 655 { … … 594 757 wholeCamera->DrawTemplateHistograms( 595 758 cgpPixelPulses, 596 AllpixelCanvasFrameNrs759 PixelCanvasFrameNrs 597 760 ); 598 761 599 762 wholeCamera->DrawEdgeTemplateHistograms( 600 763 cgpPixelPulses, 601 AllpixelCanvasFrameNrs764 PixelCanvasFrameNrs 602 765 ); 603 766 } … … 630 793 TString input = Getline("press <return> to exit: "); 631 794 timer.TurnOff(); 632 if (input=="q\n") 633 { 634 break; 635 } 795 cout << input ; 636 796 } 637 797 … … 827 987 return 0; 828 988 } 989 990
Note:
See TracChangeset
for help on using the changeset viewer.