Changeset 13784 for fact/tools/rootmacros/PulseTemplates
- Timestamp:
- 05/18/12 21:25:58 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/PulseTemplates/pixel.C
r13659 r13784 15 15 int verbosityLevel, 16 16 bool stats, 17 TFile* filename 18 ) 19 { 20 mConstructorType = 1; //important for deletion 0 delete distribution 1 delete TemplateHistos 21 mChid = pixelID; 22 mStats = stats; 23 mMaxPulseOrder = maxPulsorder; 24 mVerbosityLevel = verbosityLevel; 25 mRootFile = filename; 26 27 hMaxOverlay = new TH2F*[mMaxPulseOrder]; 28 hEdgeOverlay = new TH2F*[mMaxPulseOrder]; 29 hMaxProfile = new TProfile*[mMaxPulseOrder]; 30 hEdgeProfile = new TProfile*[mMaxPulseOrder]; 31 32 hPixelMax = new TH1F*[mMaxPulseOrder]; 33 hPixelMedian = new TH1F*[mMaxPulseOrder]; 34 hPixelMean = new TH1F*[mMaxPulseOrder]; 35 36 hPixelEdgeMax = new TH1F*[mMaxPulseOrder]; 37 hPixelEdgeMedian = new TH1F*[mMaxPulseOrder]; 38 hPixelEdgeMean = new TH1F*[mMaxPulseOrder]; 39 40 hList = new TObjArray; 41 42 LoadPulseHistos( ); 43 BookTemplateHistos(); 44 } 45 46 Pixel::Pixel( 47 int pixelID, 48 int maxPulsorder, 49 int verbosityLevel, 50 bool stats, 51 TFile* filename, 17 TString options, 52 18 int pixelOverlayXaxisLeft, 53 19 int pixelOverlayXaxisRight, 54 20 float bSLMean, 55 21 float gainMean, 56 TString options 57 ) 58 { 59 mConstructorType = 0; 22 TFile* filename 23 ) 24 { 25 mConstructorType = 1; //important for deletion 0 delete distribution 1 delete TemplateHistos 26 60 27 mChid = pixelID; 61 mStats = stats; ///TODO: HANDOVER THE VALUE62 28 mMaxPulseOrder = maxPulsorder; 63 29 mVerbosityLevel = verbosityLevel; 30 mStats = stats; 64 31 mOptions = options; 65 32 mPixelOverlayXaxisLeft = pixelOverlayXaxisLeft; … … 74 41 hEdgeProfile = new TProfile*[mMaxPulseOrder]; 75 42 43 hPixelMax = new TH1F*[mMaxPulseOrder]; 44 hPixelMedian = new TH1F*[mMaxPulseOrder]; 45 hPixelMean = new TH1F*[mMaxPulseOrder]; 46 47 hPixelEdgeMax = new TH1F*[mMaxPulseOrder]; 48 hPixelEdgeMedian = new TH1F*[mMaxPulseOrder]; 49 hPixelEdgeMean = new TH1F*[mMaxPulseOrder]; 50 51 hList = new TList(); 52 if (options.Contains("L")) 53 { 54 LoadPulseHistos( ); 55 } 56 else 57 { 58 BookPixelHistos(); 59 } 60 BookTemplateHistos(); 61 BookEdgeTemplateHistos(); 62 } 63 64 Pixel::Pixel( 65 int pixelID, 66 int maxPulsorder, 67 int verbosityLevel, 68 bool stats, 69 TString options, 70 int pixelOverlayXaxisLeft, 71 int pixelOverlayXaxisRight, 72 float bSLMean, 73 float gainMean 74 ) 75 { 76 mConstructorType = 0; 77 78 mChid = pixelID; 79 mMaxPulseOrder = maxPulsorder; 80 mVerbosityLevel = verbosityLevel; 81 mStats = stats; ///TODO: HANDOVER THE VALUE 82 mOptions = options; 83 mPixelOverlayXaxisLeft = pixelOverlayXaxisLeft; 84 mPixelOverlayXaxisRight = pixelOverlayXaxisRight; 85 mBSLMean = bSLMean; 86 mGainMean = gainMean; 87 88 hMaxOverlay = new TH2F*[mMaxPulseOrder]; 89 hEdgeOverlay = new TH2F*[mMaxPulseOrder]; 90 hMaxProfile = new TProfile*[mMaxPulseOrder]; 91 hEdgeProfile = new TProfile*[mMaxPulseOrder]; 92 76 93 if (mOptions.Contains("S") ) 77 94 { … … 89 106 } 90 107 91 hList = new T ObjArray;108 hList = new TList(); 92 109 93 110 BookPixelHistos(); … … 97 114 Pixel::~Pixel() 98 115 { 99 if (mVerbosityLevel > 1) cout << endl << "...delete histograms of pixel " << mChid ; 116 if (mVerbosityLevel > 1) 117 { 118 cout << endl << "...delete histograms of pixel " << mChid ; 119 cout << endl << "...mConstructorType = " << mConstructorType ; 120 } 121 122 if (mConstructorType == 0) 123 { 124 DeleteDistributionHistos(); 125 } 126 127 if (mConstructorType == 1) 128 { 129 DeleteTemplateHistos(); 130 DeleteEdgeTemplateHistos(); 131 } 100 132 101 133 DeletePixelHistos(); 102 if (mConstructorType == 0)103 {104 DeleteDistributionHistos();105 }106 107 if (mConstructorType == 1)108 {109 DeleteTemplateHistos();110 }111 134 delete hList; 112 135 hList = NULL; 113 136 if (mVerbosityLevel > 1) 137 { 138 cout << endl << "...histograms of pixel " << mChid ; 139 cout << "...deleted " << endl ; 140 } 114 141 }// ~Pixel 115 142 … … 193 220 ) 194 221 { 195 if (mVerbosityLevel > 2) cout << endl << "...drawing Template histograms";222 if (mVerbosityLevel > 2) cout << "...drawing Template histograms" << endl ; 196 223 for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++) 197 224 { … … 266 293 histoname += "_"; 267 294 histoname += order; 295 return histoname; 296 } 297 298 TString 299 Pixel::ChooseCycleNumber( 300 TString histoname, 301 int cycleNumber 302 ) 303 { 304 histoname += ";"; 305 histoname += cycleNumber; 268 306 return histoname; 269 307 } … … 500 538 for (int order = 0; order < mMaxPulseOrder; order++) 501 539 { 502 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPixelMax", order) << endl; 540 if (mVerbosityLevel > 3) 541 { 542 cout << "\t...booking " << HistoName("hPixelMax", order) << endl; 543 } 544 503 545 hPixelMax[order]=new TH1F( 504 546 HistoName("hPixelMax", order), … … 641 683 Pixel::LoadPulseHistos() 642 684 { 643 mRootFile->cd(); 644 mRootFile->cd(CreateSubDirName( mChid )); 685 if (mVerbosityLevel > 1) 686 { 687 mRootFile->ls(); 688 cout << "Current File: " ; 689 gFile->pwd(); 690 } 691 692 mRootFile->cd( CreateSubDirName( mChid ) ); //Go to pixel's subdirectory 693 mDirectory = gDirectory; 694 695 if (mVerbosityLevel > 1) 696 { 697 cout << "Current Directory: " ; 698 gDirectory->ls(); 699 } 700 701 // mPixelOverlayXaxisRight =70; ///TODO: get it from the root file 702 // mPixelOverlayXaxisLeft =230; ///TODO: get it from the root file 703 // mBSLMean =-1; ///TODO: get it from the root file 704 // mGainMean =9; ///TODO: get it from the root file 705 // mOptions ="SRM"; ///TODO: get it from the root file 706 645 707 if (mVerbosityLevel > 2) cout << endl << "...load pixel histograms" << endl; 646 708 for (int order = 0; order < mMaxPulseOrder; order++) 647 709 { 648 710 649 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hMaxOverlay", order) << endl; 650 hMaxOverlay[order] = (TH2F*)mRootFile->Get( HistoName("hMaxOverlay", order) ); 651 652 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hEdgeOverlay", order) << endl; 653 hEdgeOverlay[order] = (TH2F*)mRootFile->Get( HistoName("hEdgeOverlay", order) ); 654 655 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hMaxProfile", order) << endl; 656 hMaxProfile[order] = (TProfile*)mRootFile->Get( HistoName("hMaxProfile", order) ); 657 658 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hEdgeProfile", order) << endl; 659 hEdgeProfile[order] = (TProfile*)mRootFile->Get( HistoName("hEdgeProfile", order) ); 660 } 711 if (mVerbosityLevel > 3) cout << "\t...loading " << ChooseCycleNumber( HistoName("hMaxOverlay", order), 1) << endl; 712 hMaxOverlay[order] = (TH2F*)mDirectory->Get( ChooseCycleNumber( HistoName("hMaxOverlay", order), 1) ); 713 714 if (mVerbosityLevel > 3) cout << "\t...loading " << HistoName("hEdgeOverlay", order) << endl; 715 hEdgeOverlay[order] = (TH2F*)mDirectory->Get( ChooseCycleNumber( HistoName("hEdgeOverlay", order), 1) ); 716 717 if (mVerbosityLevel > 3) cout << "\t...loading " << HistoName("hMaxProfile", order) << endl; 718 hMaxProfile[order] = (TProfile*)mDirectory->Get( ChooseCycleNumber( HistoName("hMaxProfile", order), 1) ); 719 cout << "histoname: " << HistoName("hMaxProfile", order) 720 << "histoname: " << ChooseCycleNumber( HistoName("hMaxProfile", order), 1) 721 << "histoname: " << hMaxProfile[order]; 722 if (mVerbosityLevel > 3) cout << "\t...loading " << HistoName("hEdgeProfile", order) << endl; 723 hEdgeProfile[order] = (TProfile*)mDirectory->Get( ChooseCycleNumber( HistoName("hEdgeProfile", order), 1) ); 724 } 725 661 726 } 662 727 // end of LoadPulseHistos … … 669 734 { 670 735 cout << endl 736 << endl 671 737 << "\t...delete current overlay histograms of Pixel# " << mChid; 672 738 } … … 677 743 if (mVerbosityLevel > 3) 678 744 cout << endl << "\t\t...deleting hMaxOverlay" 679 << mChid << "_" << order 680 << " hMaxOverlay[order] adr " << hMaxOverlay[order] 681 << " hMaxOverlay adr " << hMaxOverlay 682 ; 745 << mChid << "_" << order; 683 746 684 747 delete hMaxOverlay[order]; … … 801 864 order ++) 802 865 { 803 if (mVerbosityLevel > 3) 804 cout << endl << "\t\t...deleting hPixelMax" 805 << mChid << "_" << order; 806 delete hPixelMax[order]; 807 hPixelMax[order] = NULL; 866 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMean" 867 << mChid << "_" << order ; 868 delete hPixelMean[order]; 869 hPixelMean[order] = NULL; 808 870 809 871 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMedian" … … 812 874 hPixelMedian[order] = NULL; 813 875 814 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMean" 815 << mChid << "_" << order ; 816 delete hPixelMean[order]; 817 hPixelMean[order] = NULL; 876 if (mVerbosityLevel > 3) 877 cout << endl << "\t\t...deleting hPixelMax" 878 << mChid << "_" << order; 879 delete hPixelMax[order]; 880 hPixelMax[order] = NULL; 818 881 819 882 } … … 841 904 { 842 905 cout << endl 843 << "\t...delete current template histograms of Pixel# " << mChid;906 << "\t...delete current Edge template histograms of Pixel# " << mChid; 844 907 } 845 908 for (int order = 0; … … 928 991 ) 929 992 { 930 if (mVerbosityLevel > 3) cout << "\t... booking " << HistoName(histName, order) << endl;993 if (mVerbosityLevel > 3) cout << "\t...designing " << HistoName(histName, order) << endl; 931 994 932 995 histo->SetNameTitle(
Note:
See TracChangeset
for help on using the changeset viewer.