Ignore:
Timestamp:
04/24/03 11:58:50 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MPadSchweizer.cc

    r1999 r2001  
    1717!
    1818!   Author(s): Robert Wagner   <mailto:magicsoft@rwagner.de> 10/2002
    19 !             Wolfgang Wittek <mailto:wittek@mppmu.mpg.de>  02/2003
     19!   Author(s): Wolfgang Wittek <mailto:wittek@mppmu.mpg.de>  02/2003
    2020!
    2121!   Copyright: MAGIC Software Development, 2000-2003
     
    2525
    2626/////////////////////////////////////////////////////////////////////////////
    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//
    6364/////////////////////////////////////////////////////////////////////////////
    6465#include "MPadSchweizer.h"
     
    6667#include <stdio.h>
    6768
    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>
    7374
    7475#include "MBinning.h"
     
    9697  fName  = name  ? name  : "MPadSchweizer";
    9798  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();
    10899}
    109100
    110101// --------------------------------------------------------------------------
    111102//
    112 // Destructor.
     103// Destructor. STLL DOESN'T DESTRUCT EVERYTHING
    113104//
    114105MPadSchweizer::~MPadSchweizer()
    115106{
    116   //nothing yet
     107    *fLog << all << "WARNING: ~MPadSchweizer called: Potential Memory Leak" << endl;
    117108}
    118109
     
    120111//
    121112// 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//
     115void MPadSchweizer::SetHistograms(TH2D *hist2, TH3D *hist3, TH3D *hist3Diff)
    125116{
    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();
    135126}
    136127
    137128// --------------------------------------------------------------------------
    138129//
    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//
    156147void MPadSchweizer::SetPadFlag(Int_t padflag)
    157148{
     
    166157Bool_t MPadSchweizer::PreProcess(MParList *pList)
    167158{
    168   fRnd = new TRandom3(0);
    169 
    170159  fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
    171160  if (!fMcEvt)
     
    573562    // throw actual number of additional NSB photons (NSB)
    574563    //       and its RMS (sigmaNSB)
    575     Double_t NSB0 = fRnd->Poisson(lambdabar*Area);
     564    Double_t NSB0 = gRandom->Poisson(lambdabar*Area);
    576565    Double_t arg  = NSB0*(F2excess-1.0) + elNoise2Pix;
    577566    Double_t sigmaNSB0;
     
    592581    // smear NSB0 according to sigmaNSB0
    593582    // 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;
    595584
    596585    //---------------------------------
Note: See TracChangeset for help on using the changeset viewer.