00001 #include "NoiseOccupancyTestResult.h"
00002 #include "RawScanResult.h"
00003 #include "ThresholdVariable.h"
00004 #include "NullVariable.h"
00005 #include "Sct/SctParameters.h"
00006
00007 #include <TF1.h>
00008 #include <TGraph.h>
00009 #include <TGraphAsymmErrors.h>
00010
00011 #include <iostream>
00012
00013 using namespace std;
00014
00015 namespace SctData {
00016
00017 NoiseOccupancyTestResult::NoiseOccupancyTestResult() throw() :
00018 chipResult("NoiseOccupancyTestResult::chipResult")
00019 {
00020 chipResult.resize(nChipModule);
00021 }
00022
00023
00024 NoiseOccupancyTestResult::NoiseOccupancyTestResult(const unsigned runNumber, const string& moduleName, const ThresholdVariable& scanVariable) throw() :
00025 TestResult(runNumber, moduleName, NullVariable::instance(), scanVariable),
00026 chipResult("NoiseOccupancyTestResult::chipResult")
00027 {
00028 chipResult.resize(nChipModule);
00029 }
00030
00031 NoiseOccupancyTestResult::~NoiseOccupancyTestResult() throw() {
00032 }
00033
00034 string NoiseOccupancyTestResult::getClassName() const throw() {
00035 return "SctData::NoiseOccupancyTestResult";
00036 }
00037
00038 void NoiseOccupancyTestResult::addScan(const unsigned scanNumber, const double testPoint) throw (LogicError) {
00039 if (data.size() != 0) throw InvariantViolatedError("NoiseOccupancyTestResult::addScan - can only contain 1 scan", __FILE__, __LINE__);
00040 TestResult::addScan(scanNumber, testPoint);
00041 }
00042
00043
00047 double ChipNOResult::getNoise() const throw() {
00048 if (!fit.get()) return 0.;
00049 return 6250.*sqrt(-1/(2*fit->GetParameter(1)));
00050
00051 }
00052
00053 ChipNOResult& ChipNOResult::operator=(const ChipNOResult& copyme) throw(){
00054 mean=copyme.mean; rms=copyme.rms;
00055 fit=copyme.fit; graph=copyme.graph;
00056 return *this;
00057 }
00058
00059 double lnerfc(double* x, double* par) {
00060 return par[0] + log(TMath::Erfc(sqrt(par[1]*x[0])));
00061 }
00062
00063
00064 auto_ptr<TF1> NoiseOccupancyTestResult::createFitFunction() throw() {
00065 return auto_ptr<TF1> (new TF1("fitfn", "pol1", 0.3, 2)) ;
00066
00067
00068
00069
00070
00071
00072 }
00073
00074 }
00075