FitScanResult.h

00001 #ifndef FITSCANRESULT_H
00002 #define FITSCANRESULT_H
00003 
00004 #include "Sct/SctParameters.h"
00005 #include "Sct/RangedVector.h"
00006 #include "ScanResult.h"
00007 #include "DefectList.h"
00008 
00009 #include <boost/shared_ptr.hpp>
00010 #include <iostream>
00011 #include <vector>
00012 
00013 using boost::shared_ptr;
00014 using std::string;
00015 using std::ostream;
00016 using Sct::RangedVector;
00017 
00018 class TH1D;
00019 
00020 namespace SctData {
00021 class FitObject;
00022 class ModuleConfiguration;
00023 class RawScanResult;
00024 class FitScanResultIOHelper;
00025 
00026 
00033 class FitScanResult : public ScanResult {
00034 public:
00036     FitScanResult(const ResultHeader& header, const ModuleConfiguration& config, const ScanPoints& points) throw() ;
00037 
00039     FitScanResult(const RawScanResult& raw) throw();
00040 
00042     virtual ~FitScanResult() throw();
00043     
00045 
00046     virtual string getClassName() const throw();
00047     virtual Sct::UniqueID getUniqueID() const throw();
00049 
00051     static Sct::UniqueID getUniqueID(const ResultHeader& header) throw();
00052 
00054 
00055     const DefectList& getDefects() const throw() {
00056         return defects;
00057     }
00058     DefectList& getDefects() throw() {
00059         return defects;
00060     }
00062 
00064 
00068     FitObject& getLinkFit (const unsigned ilink) const throw(LogicError) ;
00069 
00073     FitObject& getChipFit (const unsigned ilink,
00074                            const unsigned ichip) const throw(LogicError) ;
00075 
00079     FitObject& getChipFit (const unsigned ichip) const throw(LogicError) ;
00080 
00084     FitObject& getChannelFit (const unsigned ichannel) const throw(LogicError) ;
00085 
00087 
00091     FitObject& getChannelFit (const unsigned ilink,
00092                               const unsigned ichip) const throw(LogicError) ;
00093 
00095     unsigned getNHist() const throw() {
00096         return m_summaryHist.size();
00097     }
00098 
00100     const TH1D& getHist(unsigned i) const throw(LogicError) ;
00101 
00103 
00108     unsigned getNLinkFits () const throw();
00109 
00115     unsigned getNChipFits () const throw();
00116 
00122     unsigned getNChannelFits () const throw();
00123     
00127     void setNChannelFits(unsigned int n=Sct::nChannelModule) throw();
00128     
00132     void setNChipFits(unsigned int n=Sct::nChipModule) throw();
00133     
00137     void setNLinkFits(unsigned int n=Sct::nLinkModule) throw();
00138     
00143     void initializeChannelFits(const FitObject& prototype) throw();
00145     void initializeChipFits(const FitObject& prototype) throw();
00147     void initializeLinkFits(const FitObject& prototype) throw();
00148 
00153     void setChannelFit(unsigned int channel, shared_ptr<FitObject> fit) throw(LogicError);
00154     
00159     void setChipFit(unsigned int chip, shared_ptr<FitObject> fit) throw(LogicError);
00160     
00161     
00166     void setLinkFit(unsigned int link, shared_ptr<FitObject> fit) throw(LogicError);
00167     
00169 
00170 protected:
00171     RangedVector <shared_ptr<FitObject> > m_channelFits;    
00172     RangedVector <shared_ptr<FitObject> > m_chipFits;   
00173     RangedVector <shared_ptr<FitObject> > m_linkFits;   
00174     RangedVector <TH1D*> m_summaryHist;        
00175     DefectList defects;             
00176 
00177 private:
00178     //IOHelper stuff
00179     template <class T>
00180     static void resizeAndFill( std::vector<shared_ptr<T> >& v, unsigned newSize, const T& prototype) throw(); 
00181     FitScanResult() throw();        
00182     friend class FitScanResultIOHelper; 
00183 };
00184 
00185 // INLINES:
00186 template <class T>
00187 void FitScanResult::resizeAndFill( std::vector<shared_ptr<T> >& v, unsigned newSize, const T& prototype) throw(){
00188     unsigned oldsize=v.size(); v.resize(newSize);
00189     for (unsigned i=oldsize; i<v.size(); ++i){
00190     v[i]=prototype.clone();
00191     }
00192 }
00193 
00194 }// end of namespace SctData
00195 
00196 ostream & operator<< (ostream &, const SctData::FitScanResult &) throw() ;
00197 
00198 #endif // #ifndef FITSCANRESULT_H

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