00001 #include "Sct/SctParameters.h"
00002 #include "Sct/OutOfRangeError.h"
00003
00004 #include "RawScanResult.h"
00005 #include "ModuleConfiguration.h"
00006 #include "../ScanResultWriter/dataTypes.h"
00007 #include <TH1.h>
00008 #include <TH2.h>
00009 #include <TROOT.h>
00010
00011 #include <sstream>
00012
00013 using namespace Sct;
00014 using namespace std;
00015
00016
00017 namespace SctData {
00018
00019 RawScanResult::RawScanResult(const ResultHeader& scan, const ModuleConfiguration& module,
00020 const ScanPoints& points, TH2D& scan_link0, TH2D& scan_link1) throw() :
00021 ScanResult(scan, module, points), scanData_link0(&scan_link0), scanData_link1(&scan_link1) , occ_chip("Chip Occupancy Histograms"), m_dataType(SR_DT_ROOTHIST) {}
00022
00023
00024 RawScanResult::RawScanResult() throw () : occ_chip("Chip Occupancy Histograms"), m_dataType(SR_DT_ROOTHIST){
00025 }
00026
00027 RawScanResult::~RawScanResult() throw() {
00028 }
00029
00030 string RawScanResult::getClassName() const throw() {
00031 return "SctData::RawScanResult";
00032 }
00033
00034 UniqueID RawScanResult::getUniqueID() const throw() {
00035 return getHeader().getUniqueID();
00036 }
00037
00038
00039 UniqueID RawScanResult::getUniqueID(const ResultHeader& header) throw() {
00040 return header.getUniqueID();
00041 }
00042
00043 UINT16 RawScanResult::getDataType() const throw() {
00044 return m_dataType;
00045 }
00046
00047 TH2D& RawScanResult::getScanData(unsigned ilink) const throw(LogicError) {
00048 TH2D* data=0;
00049 if (ilink == 0) {
00050 data= scanData_link0.get();
00051 } else if ( ilink==1 ) {
00052 data= scanData_link1.get();
00053 } else {
00054 throw OutOfRangeError<unsigned>("RawScanResult::getScanData ilink ", __FILE__, __LINE__, ilink,0,1);
00055 }
00056 if (!data) throw InvariantViolatedError("RawScanResult::getScanData no scan data", __FILE__, __LINE__) ;
00057 return *data;
00058 }
00059
00060 unsigned RawScanResult::nOccupancyPerEvent() const{
00061 return occ_chip.size();
00062 }
00063
00064 TH2D& RawScanResult::getOccupancyPerEvent(unsigned ichip) const throw(LogicError) {
00065 if (occ_chip[ichip].get()) {
00066 return *occ_chip[ichip];
00067 }else{
00068 throw Sct::InvariantViolatedError("RawScanResult::getOccupancyPerEvent no scan data", __FILE__, __LINE__) ;
00069 }
00070 }
00071
00072 }
00073
00074