#include "PhotonStatSummarizer.h"#include "PulserCalibration/PulserConventions.h"#include "Calibrator/ValueErr.h"#include "Calibrator/CalPmtDrift.h"#include "Calibrator/Calibrator.h"#include "DatabaseInterface/DbiResultPtr.h"#include "DatabaseInterface/DbiSqlContext.h"#include "DatabaseInterface/DbiWriter.h"#include "DatabaseInterface/DbiStatement.h"#include "DatabaseInterface/DbiTableProxyRegistry.h"#include "DatabaseInterface/DbiCascader.h"#include <TFile.h>#include <TTree.h>#include <iostream>#include <TH1.h>#include "MessageService/MsgService.h"#include <cmath>Go to the source code of this file.
Functions | |
| CVSID (" $Id: PhotonStatSummarizer.cxx,v 1.25 2006/05/27 10:05:44 rhatcher Exp $ ") | |
| bool | operator< (const SpotDrift &lhs, const SpotDrift &rhs) |
| FloatErr | GetWeightedMean (std::vector< SpotDrift >::const_iterator begin, std::vector< SpotDrift >::const_iterator end) |
|
||||||||||||
|
|
|
||||||||||||
|
Computes a weighted mean of the gains of the spots given. Unfortuantely, this doesn't work very well since the low-gain channels have the lowest error. (dg/g ~ constant.) So, this tends to bias heavily towards low-gain channels, something we don't like. So, we compose our own penalty function: simply penalize on the basis of sqrt(N). Definition at line 47 of file PhotonStatSummarizer.cxx. References FloatErr, and ValueErr< T >::GetValue(). Referenced by PhotonStatSummarizer::ComputePmtDrifts(). 00049 {
00060 double n=0;
00061 double b=0; // sum of x_i/sigma_i^2
00062 double c=0; // sum of 1/sigma_i^2
00063
00064 std::vector<SpotDrift>::const_iterator d = begin;;
00065 for(; d!=end; ++d) {
00066 n+=1.0;
00067 //double s2 = d->gain.GetError2(); // Does it properly.
00068 double s2 = 9.92e3/(d->n); // Roughly converts to 4.5% on 70 ADC counts.
00069 b+=d->gain.GetValue() / s2;
00070 c+=1.0/s2;
00071 }
00072
00073 if(n<1) {
00074 return FloatErr(0,0);
00075 }
00076
00077 return FloatErr((float)(b/c),
00078 (float)sqrt(1/c));
00079
00080 }
|
|
||||||||||||
|
Definition at line 29 of file PhotonStatSummarizer.cxx. 00030 {
00031 // return true if lhs is better than rhs.
00032 if((lhs.bad>0) != (rhs.bad>0)){
00033 if(rhs.bad>0) return true;
00034 else return false;
00035 }
00036 return (lhs.gain.GetError() < rhs.gain.GetError());
00037 }
|
1.3.9.1