Changeset 2001 for trunk/MagicSoft/Mars/manalysis/MPadSchweizer.cc
- Timestamp:
- 04/24/03 11:58:50 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MPadSchweizer.cc
r1999 r2001 17 17 ! 18 18 ! Author(s): Robert Wagner <mailto:magicsoft@rwagner.de> 10/2002 19 ! 19 ! Author(s): Wolfgang Wittek <mailto:wittek@mppmu.mpg.de> 02/2003 20 20 ! 21 21 ! Copyright: MAGIC Software Development, 2000-2003 … … 25 25 26 26 ///////////////////////////////////////////////////////////////////////////// 27 // // 28 // MPadSchweizer // 29 // // 30 // This task applies padding such that for a given pixel and for a given // 31 // Theta bin the resulting distribution of the pedestal sigma is identical// 32 // to the distributions given by fHSigmaPixTheta and fHDiffPixTheta. // 33 // // 34 // The number of photons, its error and the pedestal sigmas are altered. // 35 // On average, the number of photons added is zero. // 36 // // 37 // The formulas used can be found in Thomas Schweizer's Thesis, // 38 // Section 2.2.1 // 39 // // 40 // There are 2 options for the padding : // 41 // // 42 // 1) fPadFlag = 1 : // 43 // Generate first a Sigmabar using the 2D-histogram Sigmabar vs. Theta // 44 // (fHSigmaTheta). Then generate a pedestal sigma for each pixel using // 45 // the 3D-histogram Theta, pixel no., Sigma^2-Sigmabar^2 // 46 // (fHDiffPixTheta). // 47 // // 48 // This is the preferred option as it takes into account the // 49 // correlations between the Sigma of a pixel and Sigmabar. // 50 // // 51 // 2) fPadFlag = 2 : // 52 // Generate a pedestal sigma for each pixel using the 3D-histogram // 53 // Theta, pixel no., Sigma (fHSigmaPixTheta). // 54 // // 55 // // 56 // The padding has to be done before the image cleaning because the // 57 // image cleaning depends on the pedestal sigmas. // 58 // // 59 // // 60 // This implementation has been tested for CT1 data. For MAGIC some // 61 // modifications are necessary. // 62 // // 27 // 28 // MPadSchweizer 29 // 30 // This task applies padding such that for a given pixel and for a given 31 // Theta bin the resulting distribution of the pedestal sigma is identical 32 // to the distributions given by fHSigmaPixTheta and fHDiffPixTheta. 33 // 34 // The number of photons, its error and the pedestal sigmas are altered. 35 // On average, the number of photons added is zero. 36 // 37 // The formulas used can be found in Thomas Schweizer's Thesis, 38 // Section 2.2.1 39 // 40 // There are 2 options for the padding : 41 // 42 // 1) fPadFlag = 1 : 43 // Generate first a Sigmabar using the 2D-histogram Sigmabar vs. Theta 44 // (fHSigmaTheta). Then generate a pedestal sigma for each pixel using 45 // the 3D-histogram Theta, pixel no., Sigma^2-Sigmabar^2 46 // (fHDiffPixTheta). 47 // 48 // This is the preferred option as it takes into account the 49 // correlations between the Sigma of a pixel and Sigmabar. 50 // 51 // 2) fPadFlag = 2 : 52 // Generate a pedestal sigma for each pixel using the 3D-histogram 53 // Theta, pixel no., Sigma (fHSigmaPixTheta). 54 // 55 // 56 // The padding has to be done before the image cleaning because the 57 // image cleaning depends on the pedestal sigmas. 58 // 59 // For random numbers gRandom is used. 60 // 61 // This implementation has been tested for CT1 data. For MAGIC some 62 // modifications are necessary. 63 // 63 64 ///////////////////////////////////////////////////////////////////////////// 64 65 #include "MPadSchweizer.h" … … 66 67 #include <stdio.h> 67 68 68 #include "TH1.h"69 #include "TH2.h"70 #include "TH3.h"71 #include "TRandom.h"72 #include "TCanvas.h"69 #include <TH1.h> 70 #include <TH2.h> 71 #include <TH3.h> 72 #include <TRandom.h> 73 #include <TCanvas.h> 73 74 74 75 #include "MBinning.h" … … 96 97 fName = name ? name : "MPadSchweizer"; 97 98 fTitle = title ? title : "Task for the padding (Schweizer)"; 98 99 //fHSigmaTheta = fHist2;100 //fHSigmaPixTheta = fHist3;101 //fHDiffPixTheta = fHist3Diff;102 103 //fHSigmaTheta->SetDirectory(NULL);104 //fHSigmaPixTheta->SetDirectory(NULL);105 //fHDiffPixTheta->SetDirectory(NULL);106 107 //Print();108 99 } 109 100 110 101 // -------------------------------------------------------------------------- 111 102 // 112 // Destructor. 103 // Destructor. STLL DOESN'T DESTRUCT EVERYTHING 113 104 // 114 105 MPadSchweizer::~MPadSchweizer() 115 106 { 116 //nothing yet107 *fLog << all << "WARNING: ~MPadSchweizer called: Potential Memory Leak" << endl; 117 108 } 118 109 … … 120 111 // 121 112 // Set the references to the histograms to be used in the padding 122 // 123 // 124 void MPadSchweizer::SetHistograms(TH2D * fHist2, TH3D *fHist3, TH3D *fHist3Diff)113 // DOCUMENTATION of the arguments MISSING 114 // 115 void MPadSchweizer::SetHistograms(TH2D *hist2, TH3D *hist3, TH3D *hist3Diff) 125 116 { 126 fHSigmaTheta = fHist2;127 fHSigmaPixTheta = fHist3;128 fHDiffPixTheta = fHist3Diff;129 130 fHSigmaTheta->SetDirectory(NULL);131 fHSigmaPixTheta->SetDirectory(NULL);132 fHDiffPixTheta->SetDirectory(NULL);133 134 Print();117 fHSigmaTheta = hist2; 118 fHSigmaPixTheta = hist3; 119 fHDiffPixTheta = hist3Diff; 120 121 fHSigmaTheta->SetDirectory(NULL); 122 fHSigmaPixTheta->SetDirectory(NULL); 123 fHDiffPixTheta->SetDirectory(NULL); 124 125 Print(); 135 126 } 136 127 137 128 // -------------------------------------------------------------------------- 138 129 // 139 // Set the option for the padding 140 // 141 // There are 2 options for the padding : //142 // //143 // 1) fPadFlag = 1 : //144 // Generate first a Sigmabar using the 2D-histogram Sigmabar vs. Theta //145 // (fHSigmaTheta). Then generate a pedestal sigma for each pixel using //146 // the 3D-histogram Theta, pixel no., Sigma^2-Sigmabar^2 //147 // (fHDiffPixTheta). //148 // //149 // This is the preferred option as it takes into account the //150 // correlations between the Sigma of a pixel and Sigmabar. //151 // //152 // 2) fPadFlag = 2 : //153 // Generate a pedestal sigma for each pixel using the 3D-histogram //154 // Theta, pixel no., Sigma (fHSigmaPixTheta). //155 // //130 // Set the option for the padding 131 // 132 // There are 2 options for the padding : 133 // 134 // 1) fPadFlag = 1 : 135 // Generate first a Sigmabar using the 2D-histogram Sigmabar vs. Theta 136 // (fHSigmaTheta). Then generate a pedestal sigma for each pixel using 137 // the 3D-histogram Theta, pixel no., Sigma^2-Sigmabar^2 138 // (fHDiffPixTheta). 139 // 140 // This is the preferred option as it takes into account the 141 // correlations between the Sigma of a pixel and Sigmabar. 142 // 143 // 2) fPadFlag = 2 : 144 // Generate a pedestal sigma for each pixel using the 3D-histogram 145 // Theta, pixel no., Sigma (fHSigmaPixTheta). 146 // 156 147 void MPadSchweizer::SetPadFlag(Int_t padflag) 157 148 { … … 166 157 Bool_t MPadSchweizer::PreProcess(MParList *pList) 167 158 { 168 fRnd = new TRandom3(0);169 170 159 fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt"); 171 160 if (!fMcEvt) … … 573 562 // throw actual number of additional NSB photons (NSB) 574 563 // and its RMS (sigmaNSB) 575 Double_t NSB0 = fRnd->Poisson(lambdabar*Area);564 Double_t NSB0 = gRandom->Poisson(lambdabar*Area); 576 565 Double_t arg = NSB0*(F2excess-1.0) + elNoise2Pix; 577 566 Double_t sigmaNSB0; … … 592 581 // smear NSB0 according to sigmaNSB0 593 582 // and subtract lambdabar because of AC coupling 594 Double_t NSB = fRnd->Gaus(NSB0, sigmaNSB0) - lambdabar*Area;583 Double_t NSB = gRandom->Gaus(NSB0, sigmaNSB0) - lambdabar*Area; 595 584 596 585 //---------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.