FitScanResult.cpp

00001 #include "FitScanResult.h"
00002 #include "RawScanResult.h"
00003 #include "ModuleConfiguration.h"
00004 #include "ScanPoints.h"
00005 #include "Defect.h"
00006 #include "FitObject.h"
00007 
00008 #include "Sct/SctParameters.h"
00009 #include <TH1.h>
00010 #include <iostream>
00011 
00012 using namespace Sct;
00013 
00014 namespace SctData {
00015 
00016 FitScanResult::FitScanResult() throw() : m_channelFits("ChannelFits"), m_chipFits("ChipFits"), m_linkFits("LinkFits"),
00017                                          m_summaryHist("summaryHist") {}
00018 
00019 FitScanResult::FitScanResult(const ResultHeader& header, const ModuleConfiguration& config, const ScanPoints& points) throw()
00020                             : ScanResult(header, config, points), m_channelFits("ChannelFits"),  m_chipFits("ChipFits"), m_linkFits("LinkFits"),
00021                             m_summaryHist("summaryHist") {}
00022 
00023 FitScanResult::FitScanResult(const RawScanResult& raw) throw () : ScanResult(raw), m_channelFits("ChannelFits"),  m_chipFits("ChipFits"), 
00024                             m_linkFits("LinkFits"), m_summaryHist("summaryHist") {}
00025 
00026 FitScanResult::~FitScanResult() throw() {
00027     for (vector<TH1D*>::iterator ih = m_summaryHist.begin(); ih != m_summaryHist.end(); ++ih ) {
00028         delete *ih;
00029     }
00030 }
00031 
00032 string FitScanResult::getClassName() const throw() {
00033     return "SctData::FitScanResult";
00034 }
00035 
00036 Sct::UniqueID FitScanResult::getUniqueID() const throw() {
00037     return getHeader().getUniqueID();
00038 }
00039 
00040 Sct::UniqueID FitScanResult::getUniqueID(const ResultHeader& header) throw() {
00041     return header.getUniqueID();
00042 }
00043 
00044 void FitScanResult::initializeChannelFits(const FitObject& prototype) throw() {
00045     resizeAndFill(m_channelFits, Sct::nChannelModule, prototype);
00046 }
00047 
00048 void FitScanResult::initializeChipFits(const FitObject& prototype) throw() {
00049     resizeAndFill(m_chipFits, Sct::nChipModule, prototype);
00050 }
00051 void FitScanResult::initializeLinkFits(const FitObject& prototype) throw() {
00052     resizeAndFill(m_linkFits, Sct::nLinkModule, prototype);
00053 }
00054 
00055 FitObject& FitScanResult::getLinkFit( const unsigned ilink ) const throw(LogicError) {
00056     return *m_linkFits[ilink] ;
00057 }
00058 
00059 FitObject& FitScanResult::getChipFit( const unsigned ilink, const unsigned ichip ) const throw (LogicError) {
00060     return this->getChipFit( ilink*6+ichip );
00061 }
00062 
00063 FitObject& FitScanResult::getChipFit( const unsigned ichip ) const throw (LogicError) {
00064     return *m_chipFits[ichip] ;
00065 }
00066 
00067 FitObject& FitScanResult::getChannelFit( const unsigned ilink, const unsigned ichannel ) const throw (LogicError ) {
00068     return this->getChannelFit(ilink*nChannelLink+ichannel);
00069 }
00070 
00071 FitObject& FitScanResult::getChannelFit( const unsigned ichannel ) const throw(LogicError) {
00072     return *m_channelFits[ichannel] ;
00073 }
00074 
00075 void FitScanResult::setChannelFit(unsigned int channel, shared_ptr<FitObject> fit) throw(LogicError) {
00076     m_channelFits[channel] = fit;
00077 }
00078     
00079 void FitScanResult::setChipFit(unsigned int chip, shared_ptr<FitObject> fit) throw(LogicError) {
00080     m_chipFits[chip] = fit;
00081 }
00082     
00083 void FitScanResult::setLinkFit(unsigned int link, shared_ptr<FitObject> fit) throw(LogicError) {
00084     m_linkFits[link] = fit;
00085 }
00086 
00087 unsigned FitScanResult::getNLinkFits() const throw() {
00088     return m_linkFits.size();
00089 }
00090 
00091 unsigned FitScanResult::getNChipFits() const throw() {
00092     return m_chipFits.size();
00093 }
00094 
00095 unsigned FitScanResult::getNChannelFits() const throw() {
00096     return m_channelFits.size();
00097 }
00098 
00099 void FitScanResult::setNChannelFits(unsigned int n) throw() {
00100     m_channelFits.resize(n);
00101 }
00102     
00103 void FitScanResult::setNChipFits(unsigned int n) throw() {
00104     m_chipFits.resize(n);    
00105 }
00106     
00107 void FitScanResult::setNLinkFits(unsigned int n) throw() {
00108     m_linkFits.resize(n);    
00109 }
00110 
00111 
00112 const TH1D& FitScanResult::getHist(unsigned i) const throw(LogicError) {
00113     return *(m_summaryHist[i]);
00114 }
00115 
00116 }
00117 
00118 ostream& operator<<(ostream& os, const SctData::FitScanResult& r) throw() {
00119     os << r.getClassName() << "  " << (string) r.getUniqueID();
00120     return os;
00121 }

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