Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CalibrationSmearer.cxx

Go to the documentation of this file.
00001 #include "CalibrationSmearer.h"
00002 
00003 ClassImp(CalibrationSmearer)
00004 
00005 CalibrationSmearer::CalibrationSmearer( Int_t size, TRandom* generator ) :
00006   fN(size),
00007   fValues(0)
00008 {
00009   TRandom* rand = generator;
00010   if(!rand) rand = gRandom;
00011   
00012   fValues = new Float_t[size];
00013   for(int i=0;i<size;i++) {
00014     fValues[i] = rand->Gaus(1.0);
00015   }
00016   
00017 }
00018 
00019 CalibrationSmearer:: ~CalibrationSmearer()
00020 {
00021   if(fValues) delete [] fValues;
00022 }  
00023 
00024 
00025 // Return a single random posson number (0,inf) that is always the same for 
00026 // a single value of KEY:
00027 Float_t  CalibrationSmearer::GetGausSmear(Int_t key) const
00028 {
00029   return fValues[key%fN];
00030 }
00031 
00032 // Return a set of n random poisson numbers:
00033 const Float_t* CalibrationSmearer::GetGausSmears(Int_t key, Int_t n) const
00034 {
00035   return fValues + (key%(fN-n));
00036 }

Generated on Mon Feb 15 11:06:27 2010 for loon by  doxygen 1.3.9.1