00001 #ifndef FITSCANRESULT_H
00002 #define FITSCANRESULT_H
00003
00004 #include "Sct/SctParameters.h"
00005 #include "ScanResult.h"
00006 #include "ModuleDefectList.h"
00007
00008 #include <boost/shared_ptr.hpp>
00009 #include <iostream>
00010
00011 using boost::shared_ptr;
00012 using namespace std;
00013
00014 class TH1D;
00015
00016 namespace SctData {
00017 class FitObject;
00018 class ScanHeader;
00019 class ModuleConfiguration;
00020 class RawScanResult;
00021 class FitScanResultIOHelper;
00022
00023
00030 class FitScanResult : public ScanResult {
00031 public:
00033 FitScanResult(const ScanHeader& header, const ModuleConfiguration& config, const ScanPoints& points) throw() ;
00034
00036 FitScanResult(const RawScanResult& raw) throw();
00037
00039 virtual ~FitScanResult() throw();
00040
00042
00043 virtual string getClassName() const throw();
00044 virtual string getUniqueID() const throw();
00046
00048 static string getUniqueID(const ScanHeader& header) throw();
00049
00051
00052 const ModuleDefectList& getDefects() const throw() {
00053 return defects;
00054 }
00055 ModuleDefectList& getDefects() throw() {
00056 return defects;
00057 }
00059
00061
00065 FitObject& getLinkFit (const unsigned ilink) const throw(LogicError) ;
00066
00070 FitObject& getChipFit (const unsigned ilink,
00071 const unsigned ichip) const throw(LogicError) ;
00072
00076 FitObject& getChipFit (const unsigned ichip) const throw(LogicError) ;
00077
00081 FitObject& getChannelFit (const unsigned ichannel) const throw(LogicError) ;
00082
00084
00088 FitObject& getChannelFit (const unsigned ilink,
00089 const unsigned ichip) const throw(LogicError) ;
00090
00092 unsigned getNHist() const throw() {
00093 return m_summaryHist.size();
00094 }
00095
00097 const TH1D& getHist(unsigned i) const throw(LogicError) ;
00098
00100
00105 unsigned getNLinkFits () const throw();
00106
00112 unsigned getNChipFits () const throw();
00113
00119 unsigned getNChannelFits () const throw();
00120
00124 void setNChannelFits(unsigned int n=Sct::nChannelModule) throw();
00125
00129 void setNChipFits(unsigned int n=Sct::nChipModule) throw();
00130
00134 void setNLinkFits(unsigned int n=Sct::nLinkModule) throw();
00135
00140 void initializeChannelFits(const FitObject& prototype) throw();
00142 void initializeChipFits(const FitObject& prototype) throw();
00144 void initializeLinkFits(const FitObject& prototype) throw();
00145
00150 void setChannelFit(unsigned int channel, shared_ptr<FitObject> fit) throw(LogicError);
00151
00156 void setChipFit(unsigned int chip, shared_ptr<FitObject> fit) throw(LogicError);
00157
00158
00163 void setLinkFit(unsigned int link, shared_ptr<FitObject> fit) throw(LogicError);
00164
00166
00167 protected:
00168 RangedVector <shared_ptr<FitObject> > m_channelFits;
00169 RangedVector <shared_ptr<FitObject> > m_chipFits;
00170 RangedVector <shared_ptr<FitObject> > m_linkFits;
00171 RangedVector <TH1D*> m_summaryHist;
00172 ModuleDefectList defects;
00173
00174 private:
00175
00176 template <class T>
00177 static void resizeAndFill( std::vector<shared_ptr<T> >& v, unsigned newSize, const T& prototype) throw();
00178 FitScanResult() throw();
00179 friend class FitScanResultIOHelper;
00180 };
00181
00182
00183 template <class T>
00184 void FitScanResult::resizeAndFill( std::vector<shared_ptr<T> >& v, unsigned newSize, const T& prototype) throw(){
00185 unsigned oldsize=v.size(); v.resize(newSize);
00186 for (unsigned i=oldsize; i<v.size(); ++i){
00187 v[i]=shared_ptr<T>(prototype.clone().release());
00188 }
00189 }
00190
00191 }
00192
00193 ostream & operator<< (ostream &, const SctData::FitScanResult &) throw() ;
00194
00195 #endif // #ifndef FITSCANRESULT_H