00001
00002 #include "digiRootData/CalLog.h"
00003
00004 ClassImp(CalLog)
00005
00006 CalLog::CalTrigMode CalLog::m_mode;
00007
00008 CalLog::CalLog() {
00009
00010 m_mode = ALLRANGE;
00011 m_log.setTag(UInt_t(0));
00012 }
00013
00014 CalLog::CalLog(LogId &id) {
00015 m_mode = ALLRANGE;
00016 m_log.setTag(UInt_t(0));
00017 m_log = id;
00018 }
00019
00020 CalLog::~CalLog() {
00021
00022 }
00023
00024 Int_t CalLog::Compare(const TObject *obj) const {
00025 if (this == obj) return 0;
00026 if (CalLog::Class() != obj->IsA()) return -1;
00027 UInt_t id_this = m_log.getId();
00028 UInt_t id_hit = ((CalLog*)obj)->getLogId()->getId();
00029 if (id_this == id_hit)
00030 return 0;
00031 else
00032 return (id_this > id_hit) ? 1 : -1;
00033 }
00034
00035 Bool_t CalLog::IsSortable() const {
00036 return kTRUE;
00037 }
00038
00039 Bool_t CalLog::setAdcValue(UShort_t newVal, LogFace face, AdcRange range) {
00040
00041
00042 if (newVal & ~ADC_M_VAL) {
00043 return kFALSE;
00044 }
00045 else {
00046 m_AdcValues[face * 4 + range] &= ~(ADC_M_VAL << ADC_V_VAL);
00047 m_AdcValues[face * 4 + range] |= newVal << ADC_V_VAL;
00048
00049
00050 return kTRUE;
00051 }
00052 }
00053
00054 Bool_t CalLog::setAdcId(UShort_t newVal, LogFace face, AdcRange range) {
00055
00056
00057 if (newVal & ~ADC_M_VAL) {
00058 return kFALSE;
00059 }
00060 else {
00061 m_AdcValues[face * 4 + range] &= ~(ADC_M_ID << ADC_V_ID);
00062 m_AdcValues[face * 4 + range] |= newVal << ADC_V_ID;
00063
00064
00065 return kTRUE;
00066 }
00067 }
00068
00069 Bool_t CalLog::setAdcPinId(UShort_t newVal, LogFace face, AdcRange range) {
00070
00071
00072 if (newVal & ~ADC_M_VAL) {
00073 return kFALSE;
00074 }
00075 else {
00076 m_AdcValues[face * 4 + range] &= ~(ADC_M_PIN << ADC_V_PIN);
00077 m_AdcValues[face * 4 + range] |= newVal << ADC_V_PIN;
00078
00079
00080 return kTRUE;
00081 }
00082 }
00083
00084 Bool_t CalLog::setAdcRangeScale(UShort_t newVal, LogFace face, AdcRange range) {
00085
00086
00087 if (newVal & ~ADC_M_VAL) {
00088 return kFALSE;
00089 }
00090 else {
00091 m_AdcValues[face * 4 + range] &= ~(ADC_M_RS << ADC_V_RS);
00092 m_AdcValues[face * 4 + range] |= newVal << ADC_V_RS;
00093
00094
00095 return kTRUE;
00096 }
00097 }