Changeset 13597 for fact/tools/rootmacros
- Timestamp:
- 05/08/12 11:51:22 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/PulseTemplates/pixel.C
r13594 r13597 227 227 //---------------------------------------------------------------------------- 228 228 229 230 void231 Pixel::DrawHistograms(232 TCanvas** pixelCanvas,233 int* histoFrameNr234 )235 {236 if (mVerbosityLevel > 2) cout << endl << "...drawing pulse histograms" ;237 for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++)238 {239 pixelCanvas[pulse_order]->cd( histoFrameNr[0] );240 hMaxOverlay[pulse_order]->Draw("COLZ");241 pixelCanvas[pulse_order]->cd( histoFrameNr[2] );242 hMaxProfile[pulse_order]->Draw();243 hEdgeProfile[pulse_order]->Draw("SAME");244 245 pixelCanvas[pulse_order]->cd( histoFrameNr[1] );246 hEdgeOverlay[pulse_order]->Draw("COLZ");247 }248 }249 // end of DrawPulseHistograms250 //----------------------------------------------------------------------------251 252 253 229 void 254 230 Pixel::BookDistributionHistos( ) … … 330 306 } 331 307 } 332 333 void 334 Pixel::DrawDistributionHistograms( 335 TCanvas** pixelCanvas, 336 int* histoFrameNr 337 ) 338 { 339 if (mVerbosityLevel > 2) cout << endl << "...drawing distribution histograms" ; 340 bool nothing_to_fill = true; 341 for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++) 342 { 343 if (mOptions.Contains("S") ) 344 { 345 pixelCanvas[pulse_order]->cd( histoFrameNr[0] ); 346 hSlopeRisingEdge[pulse_order]->Draw(); 347 nothing_to_fill = false; 348 } 349 350 if (mOptions.Contains("R") ) 351 { 352 pixelCanvas[pulse_order]->cd( histoFrameNr[1] ); 353 hRisingEdgeToMax[pulse_order]->Draw(); 354 nothing_to_fill = false; 355 } 356 357 if (mOptions.Contains("M") ) 358 { 359 pixelCanvas[pulse_order]->cd( histoFrameNr[2] ); 360 hPosOfMax[pulse_order]->Draw(); 361 nothing_to_fill = false; 362 } 363 364 } 365 if (nothing_to_fill) 366 { 367 cout << endl << "there were NO DISTRIBUTION HISTOGRAMS to fill" << endl; 368 } 369 } 370 // end of DrawDistributionHistograms 371 //---------------------------------------------------------------------------- 372 373 void 374 Pixel::SavePixelHistograms( 375 const char* outRootFileName, 376 bool saveResults 377 ) 378 { 379 if (mVerbosityLevel > 2) cout << endl << "Saving histograms of Pixel# " << mChid; 380 if (!saveResults) return; 381 SaveHistograms( 382 outRootFileName, 383 CreateSubDirName( mChid ), 384 hList, 385 saveResults, 386 mVerbosityLevel 387 ); 388 } 389 // end of SavePixelHistograms 390 //---------------------------------------------------------------------------- 391 392 void 393 Pixel::DeletePixelHistos() 394 { 395 if (mVerbosityLevel > 2) 396 { 397 cout << endl 398 << "\t...delete current overlay histograms of Pixel# " << mChid; 399 } 400 for (int order = 0; 401 order < mMaxPulseOrder; 402 order ++) 403 { 404 if (mVerbosityLevel > 3) 405 cout << endl << "\t\t...deleting hMaxOverlay" 406 << mChid << "_" << order 407 << " hMaxOverlay[order] adr " << hMaxOverlay[order] 408 << " hMaxOverlay adr " << hMaxOverlay 409 ; 410 411 delete hMaxOverlay[order]; 412 hMaxOverlay[order] = NULL; 413 414 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeOverlay" 415 << mChid << "_" << order ; 416 delete hEdgeOverlay[order]; 417 hEdgeOverlay[order] = NULL; 418 419 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile" 420 << mChid << "_" << order ; 421 delete hMaxProfile[order]; 422 hMaxProfile[order] = NULL; 423 424 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile2" 425 << mChid << "_" << order ; 426 delete hEdgeProfile[order]; 427 hEdgeProfile[order] = NULL; 428 } 429 if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays"; 430 431 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxOverlay"; 432 delete[] hMaxOverlay; 433 hMaxOverlay = NULL; 434 435 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeOverlay"; 436 delete[] hEdgeOverlay; 437 hEdgeOverlay = NULL; 438 439 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile"; 440 delete[] hMaxProfile; 441 hMaxProfile = NULL; 442 443 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeProfile"; 444 delete[] hEdgeProfile; 445 hEdgeProfile = NULL; 446 } 447 // end of DeletePixelHistos 448 //---------------------------------------------------------------------------- 449 450 void 451 Pixel::DeleteDistributionHistos() 452 { 453 if (mVerbosityLevel > 2) 454 { 455 cout << endl 456 << "\t...delete current distribution histograms" ; 457 } 458 459 for (int order = 0; 460 order < mMaxPulseOrder; 461 order ++) 462 { 463 if (mOptions.Contains("S")) 464 { 465 if (mVerbosityLevel > 3) cout << endl 466 << "\t\t...deleting hSlopeRisingEdge" 467 << mChid << "_" << order ; 468 delete hSlopeRisingEdge[order]; 469 } 470 471 if (mOptions.Contains("R")) 472 { 473 if (mVerbosityLevel > 3) cout << endl 474 << "\t\t...deleting hRisingEdgeToMax" 475 << mChid << "_" << order ; 476 // delete hRisingEdgeToMax[order]; 477 } 478 479 if (mOptions.Contains("M")) 480 { 481 if (mVerbosityLevel > 3) cout << endl 482 << "\t\t...deleting hPosOfMax" 483 << mChid << "_" << order ; 484 485 // delete hPosOfMax[order]; 486 } 487 488 } 489 if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays"; 490 491 if (mOptions.Contains("S")) 492 { 493 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hSlopeRisingEdge"; 494 delete[] hSlopeRisingEdge; 495 hSlopeRisingEdge = NULL; 496 } 497 498 if (mOptions.Contains("R")) 499 { 500 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hRisingEdgeToMax"; 501 delete[] hRisingEdgeToMax; 502 hRisingEdgeToMax = NULL; 503 } 504 505 if (mOptions.Contains("M")) 506 { 507 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPosOfMax"; 508 delete[] hPosOfMax; 509 hPosOfMax = NULL; 510 } 511 } 512 // end of DeletePixelHistos 513 //---------------------------------------------------------------------------- 514 515 void 516 Pixel::LoadPulseHistos() 517 { 518 mRootFile->cd(); 519 mRootFile->cd(CreateSubDirName( mChid )); 520 for (int order = 0; order < mMaxPulseOrder; order++) 521 { 522 hMaxOverlay[order] = (TH2F*)mRootFile->Get( HistoName("hMaxOverlay", order) ); 523 hEdgeOverlay[order] = (TH2F*)mRootFile->Get( HistoName("hEdgeOverlay", order) ); 524 hMaxProfile[order] = (TProfile*)mRootFile->Get( HistoName("hMaxProfile", order) ); 525 hEdgeProfile[order] = (TProfile*)mRootFile->Get( HistoName("hEdgeProfile", order) ); 526 } 527 } 528 529 TString 530 Pixel::HistoName( 531 TString histoname, 532 int order 533 ) 534 { 535 histoname += mChid; 536 histoname += "_"; 537 histoname += order; 538 return histoname; 539 } 540 541 TString 542 Pixel::HistoTitle( 543 TString histo_title, 544 int order 545 ) 546 { 547 histo_title += " [Pixel_Order] "; 548 histo_title += mChid; 549 histo_title += "_"; 550 histo_title += order; 551 return histo_title; 552 } 308 //end of BookDistributionHistos 309 //---------------------------------------------------------------------------- 553 310 554 311 void … … 624 381 //---------------------------------------------------------------------------- 625 382 383 384 void 385 Pixel::DrawOverlayHistograms( 386 TCanvas** pixelCanvas, 387 int* histoFrameNr 388 ) 389 { 390 if (mVerbosityLevel > 2) cout << endl << "...drawing pulse histograms" ; 391 for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++) 392 { 393 pixelCanvas[pulse_order]->cd( histoFrameNr[0] ); 394 hMaxOverlay[pulse_order]->Draw("COLZ"); 395 pixelCanvas[pulse_order]->cd( histoFrameNr[2] ); 396 hMaxProfile[pulse_order]->Draw(); 397 hEdgeProfile[pulse_order]->Draw("SAME"); 398 399 pixelCanvas[pulse_order]->cd( histoFrameNr[1] ); 400 hEdgeOverlay[pulse_order]->Draw("COLZ"); 401 } 402 } 403 // end of DrawOverlayHistograms 404 //---------------------------------------------------------------------------- 405 406 void 407 Pixel::DrawDistributionHistograms( 408 TCanvas** pixelCanvas, 409 int* histoFrameNr 410 ) 411 { 412 if (mVerbosityLevel > 2) cout << endl << "...drawing distribution histograms" ; 413 bool nothing_to_fill = true; 414 for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++) 415 { 416 if (mOptions.Contains("S") ) 417 { 418 pixelCanvas[pulse_order]->cd( histoFrameNr[0] ); 419 hSlopeRisingEdge[pulse_order]->Draw(); 420 nothing_to_fill = false; 421 } 422 423 if (mOptions.Contains("R") ) 424 { 425 pixelCanvas[pulse_order]->cd( histoFrameNr[1] ); 426 hRisingEdgeToMax[pulse_order]->Draw(); 427 nothing_to_fill = false; 428 } 429 430 if (mOptions.Contains("M") ) 431 { 432 pixelCanvas[pulse_order]->cd( histoFrameNr[2] ); 433 hPosOfMax[pulse_order]->Draw(); 434 nothing_to_fill = false; 435 } 436 437 } 438 if (nothing_to_fill) 439 { 440 cout << endl << "there were NO DISTRIBUTION HISTOGRAMS to fill" << endl; 441 } 442 } 443 // end of DrawDistributionHistograms 444 //---------------------------------------------------------------------------- 445 446 void 447 Pixel::DrawTemplateHistograms( 448 TCanvas** pixelCanvas, 449 int* histoFrameNr 450 ) 451 { 452 if (mVerbosityLevel > 2) cout << endl << "...drawing Template histograms" ; 453 for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++) 454 { 455 pixelCanvas[pulse_order]->cd( histoFrameNr[0] ); 456 hPixelMax[pulse_order]->Draw(); 457 458 pixelCanvas[pulse_order]->cd( histoFrameNr[1] ); 459 hPixelMedian[pulse_order]->Draw(); 460 461 pixelCanvas[pulse_order]->cd( histoFrameNr[2] ); 462 hPixelMean[pulse_order]->Draw(); 463 464 } 465 } 466 // end of DrawTemplateHistograms 467 //---------------------------------------------------------------------------- 468 469 void 470 Pixel::DeletePixelHistos() 471 { 472 if (mVerbosityLevel > 2) 473 { 474 cout << endl 475 << "\t...delete current overlay histograms of Pixel# " << mChid; 476 } 477 for (int order = 0; 478 order < mMaxPulseOrder; 479 order ++) 480 { 481 if (mVerbosityLevel > 3) 482 cout << endl << "\t\t...deleting hMaxOverlay" 483 << mChid << "_" << order 484 << " hMaxOverlay[order] adr " << hMaxOverlay[order] 485 << " hMaxOverlay adr " << hMaxOverlay 486 ; 487 488 delete hMaxOverlay[order]; 489 hMaxOverlay[order] = NULL; 490 491 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeOverlay" 492 << mChid << "_" << order ; 493 delete hEdgeOverlay[order]; 494 hEdgeOverlay[order] = NULL; 495 496 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile" 497 << mChid << "_" << order ; 498 delete hMaxProfile[order]; 499 hMaxProfile[order] = NULL; 500 501 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile2" 502 << mChid << "_" << order ; 503 delete hEdgeProfile[order]; 504 hEdgeProfile[order] = NULL; 505 } 506 if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays"; 507 508 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxOverlay"; 509 delete[] hMaxOverlay; 510 hMaxOverlay = NULL; 511 512 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeOverlay"; 513 delete[] hEdgeOverlay; 514 hEdgeOverlay = NULL; 515 516 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile"; 517 delete[] hMaxProfile; 518 hMaxProfile = NULL; 519 520 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeProfile"; 521 delete[] hEdgeProfile; 522 hEdgeProfile = NULL; 523 } 524 // end of DeletePixelHistos 525 //---------------------------------------------------------------------------- 526 527 void 528 Pixel::DeleteDistributionHistos() 529 { 530 if (mVerbosityLevel > 2) 531 { 532 cout << endl 533 << "\t...delete current distribution histograms" ; 534 } 535 536 for (int order = 0; 537 order < mMaxPulseOrder; 538 order ++) 539 { 540 if (mOptions.Contains("S")) 541 { 542 if (mVerbosityLevel > 3) cout << endl 543 << "\t\t...deleting hSlopeRisingEdge" 544 << mChid << "_" << order ; 545 delete hSlopeRisingEdge[order]; 546 } 547 548 if (mOptions.Contains("R")) 549 { 550 if (mVerbosityLevel > 3) cout << endl 551 << "\t\t...deleting hRisingEdgeToMax" 552 << mChid << "_" << order ; 553 // delete hRisingEdgeToMax[order]; 554 } 555 556 if (mOptions.Contains("M")) 557 { 558 if (mVerbosityLevel > 3) cout << endl 559 << "\t\t...deleting hPosOfMax" 560 << mChid << "_" << order ; 561 562 // delete hPosOfMax[order]; 563 } 564 565 } 566 if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays"; 567 568 if (mOptions.Contains("S")) 569 { 570 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hSlopeRisingEdge"; 571 delete[] hSlopeRisingEdge; 572 hSlopeRisingEdge = NULL; 573 } 574 575 if (mOptions.Contains("R")) 576 { 577 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hRisingEdgeToMax"; 578 delete[] hRisingEdgeToMax; 579 hRisingEdgeToMax = NULL; 580 } 581 582 if (mOptions.Contains("M")) 583 { 584 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPosOfMax"; 585 delete[] hPosOfMax; 586 hPosOfMax = NULL; 587 } 588 } 589 // end of DeletePixelHistos 590 //---------------------------------------------------------------------------- 591 626 592 void 627 593 Pixel::DeleteTemplateHistos() … … 671 637 hPixelMean = NULL; 672 638 } 639 // end of DeleteTemplateHistos 640 //---------------------------------------------------------------------------- 641 642 void 643 Pixel::SavePixelHistograms( 644 const char* outRootFileName, 645 bool saveResults 646 ) 647 { 648 if (mVerbosityLevel > 2) cout << endl << "Saving histograms of Pixel# " << mChid; 649 if (!saveResults) return; 650 SaveHistograms( 651 outRootFileName, 652 CreateSubDirName( mChid ), 653 hList, 654 saveResults, 655 mVerbosityLevel 656 ); 657 } 658 // end of SavePixelHistograms 659 //---------------------------------------------------------------------------- 660 661 void 662 Pixel::LoadPulseHistos() 663 { 664 mRootFile->cd(); 665 mRootFile->cd(CreateSubDirName( mChid )); 666 for (int order = 0; order < mMaxPulseOrder; order++) 667 { 668 hMaxOverlay[order] = (TH2F*)mRootFile->Get( HistoName("hMaxOverlay", order) ); 669 hEdgeOverlay[order] = (TH2F*)mRootFile->Get( HistoName("hEdgeOverlay", order) ); 670 hMaxProfile[order] = (TProfile*)mRootFile->Get( HistoName("hMaxProfile", order) ); 671 hEdgeProfile[order] = (TProfile*)mRootFile->Get( HistoName("hEdgeProfile", order) ); 672 } 673 } 674 // end of LoadPulseHistos 675 //---------------------------------------------------------------------------- 676 677 TString 678 Pixel::HistoName( 679 TString histoname, 680 int order 681 ) 682 { 683 histoname += mChid; 684 histoname += "_"; 685 histoname += order; 686 return histoname; 687 } 688 689 TString 690 Pixel::HistoTitle( 691 TString histo_title, 692 int order 693 ) 694 { 695 histo_title += " [Pixel_Order] "; 696 histo_title += mChid; 697 histo_title += "_"; 698 histo_title += order; 699 return histo_title; 700 } 701 702 673 703 674 704 //============================= ACESS ===================================
Note:
See TracChangeset
for help on using the changeset viewer.