NoiseOccupancyTestResult.cpp

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     //return 6250.*sqrt(1/(2*fit->GetParameter(1)));
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         static unsigned int ReneBrunMustDie=0;
00066     std::ostringstream different_name;
00067     different_name << "RcFitFn" << ReneBrunMustDie++;
00068     
00069     return auto_ptr<TF1> (new TF1(different_name.str().c_str(), "pol1", 0.3, 2)) ;
00070     //return auto_ptr<TF1> (new TF1("fitfn", "[0]-[1]*x-1./2.*log(x)", 0.5, 2)) ;
00071     //return auto_ptr<TF1> (new TF1("fitfn", "[0]+[1]*x-1./2.*log(x)+log(1.-[1]/(2.*pow(x,1.5)))", 0.5, 2)) ;
00072     //auto_ptr<TF1> f(new TF1("fitfn", lnerfc, 0.5, 2, 2)) ;
00073     //f->SetParameter(0, 1);
00074     //f->SetParameter(1, 1);
00075     //return f;
00076     }
00077     
00078 }
00079 

Generated on Mon Feb 6 14:01:23 2006 for SCT DAQ/DCS Software - C++ by  doxygen 1.4.6