00001 #include "CandDeadChipHandle.h" 00002 #include "MessageService/MsgService.h" 00003 00004 ClassImp(CandDeadChipHandle) 00005 00006 CandDeadChipHandle::CandDeadChipHandle() 00007 { 00008 00009 } 00010 00011 CandDeadChipHandle::CandDeadChipHandle(const CandDeadChipHandle& cdh) : 00012 CandHandle(cdh) 00013 { 00014 00015 } 00016 CandDeadChipHandle::CandDeadChipHandle(CandDeadChip* cd) : 00017 CandHandle(cd) 00018 { 00019 00020 } 00021 00022 CandDeadChipHandle::~CandDeadChipHandle() 00023 { 00024 00025 } 00026 00027 CandDeadChipHandle* CandDeadChipHandle::DupHandle() const 00028 { 00029 return new CandDeadChipHandle(*this); 00030 } 00031 00032 Int_t CandDeadChipHandle::GetEntries() const 00033 { 00034 return dynamic_cast<const CandDeadChip*>(GetCandBase())->fEntries; 00035 } 00036 00037 RawChannelId CandDeadChipHandle::GetChannelId() const 00038 { 00039 return dynamic_cast<const CandDeadChip*>(GetCandBase())->fRawChannelId; 00040 } 00041 00042 Int_t CandDeadChipHandle::GetAdc() const 00043 { 00044 return dynamic_cast<const CandDeadChip*>(GetCandBase())->fAdc; 00045 } 00046 00047 Int_t CandDeadChipHandle::GetTdc() const 00048 { 00049 return dynamic_cast<const CandDeadChip*>(GetCandBase())->fTdc; 00050 } 00051 00052 Int_t CandDeadChipHandle::GetTdc0() const 00053 { 00054 return dynamic_cast<const CandDeadChip*>(GetCandBase())->fTdc0; 00055 } 00056 00057 Int_t CandDeadChipHandle::GetErrorCode() const 00058 { 00059 return dynamic_cast<const CandDeadChip*>(GetCandBase())->fErrorCode; 00060 } 00061 00062 Int_t CandDeadChipHandle::GetTriggerRate() const 00063 { 00064 return dynamic_cast<const CandDeadChip*>(GetCandBase())->fTriggerRate; 00065 } 00066 00067 CandDeadChip::ChipStatus_t CandDeadChipHandle::GetChipStatus() const 00068 { 00069 return dynamic_cast<const CandDeadChip*>(GetCandBase())->fStatus; 00070 } 00071 00072 void CandDeadChipHandle::SetChannelId(RawChannelId rawch) 00073 { 00074 dynamic_cast<CandDeadChip*>(GetOwnedCandBase())->fRawChannelId=rawch; 00075 } 00076 00077 void CandDeadChipHandle::SetAdc(Int_t adc) 00078 { 00079 dynamic_cast<CandDeadChip*>(GetOwnedCandBase())->fAdc=adc; 00080 } 00081 00082 void CandDeadChipHandle::SetTdc(Int_t tdc) 00083 { 00084 dynamic_cast<CandDeadChip*>(GetOwnedCandBase())->fTdc=tdc; 00085 } 00086 00087 void CandDeadChipHandle::SetTdc0(Int_t tdc0) 00088 { 00089 dynamic_cast<CandDeadChip*>(GetOwnedCandBase())->fTdc0=tdc0; 00090 } 00091 00092 void CandDeadChipHandle::SetErrorCode(Int_t errcode) 00093 { 00094 dynamic_cast<CandDeadChip*>(GetOwnedCandBase())->fErrorCode=errcode; 00095 } 00096 00097 void CandDeadChipHandle::SetTriggerRate(Int_t trigrate) 00098 { 00099 dynamic_cast<CandDeadChip*>(GetOwnedCandBase())->fTriggerRate=trigrate; 00100 } 00101 00102 void CandDeadChipHandle::SetChipStatus(CandDeadChip::ChipStatus_t status) 00103 { 00104 dynamic_cast<CandDeadChip*>(GetOwnedCandBase())->fStatus=status; 00105 } 00106 00107 Bool_t CandDeadChipHandle::IsSameChip(RawChannelId rawch) const 00108 { 00109 Bool_t issamechip=0; 00110 00111 RawChannelId myrawch = this->GetChannelId(); 00112 00113 if( myrawch.GetElecType()==ElecType::kVA && rawch.GetElecType()==ElecType::kVA 00114 && myrawch.GetCrate()==rawch.GetCrate() 00115 && myrawch.GetVarcId()==rawch.GetVarcId() 00116 && myrawch.GetVmm()==rawch.GetVmm() 00117 && myrawch.GetVaAdcSel()==rawch.GetVaAdcSel() 00118 && myrawch.GetVaChip()==rawch.GetVaChip() ) issamechip=1; 00119 00120 if( myrawch.GetElecType()==ElecType::kQIE && rawch.GetElecType()==ElecType::kQIE 00121 && myrawch.GetCrate()==rawch.GetCrate() 00122 && myrawch.GetMaster()==rawch.GetMaster() 00123 && myrawch.GetMinder()==rawch.GetMinder() 00124 && myrawch.GetMenu()==rawch.GetMenu() ) issamechip=1; 00125 00126 return issamechip; 00127 } 00128 00129 void CandDeadChipHandle::AddRawChip(RawChip* chip) 00130 { 00131 00132 // Set the TDC, ADC and Channel ID 00133 // (choose the chip with the latest time) 00134 Int_t newadc=chip->GetAdc(); 00135 Int_t newtdc=chip->GetTdc(); 00136 if(this->GetTdc()<0 || chip->GetTdc()>=this->GetTdc()){ 00137 this->SetChannelId(chip->GetChannelId()); 00138 if( chip->GetTdc()==this->GetTdc() ) this->SetAdc(this->GetAdc()+newadc); 00139 if( chip->GetTdc()>this->GetTdc() ) this->SetAdc(newadc); 00140 this->SetTdc(newtdc); 00141 } 00142 00143 // Record TDC0 (the earliest TDC value) 00144 if(this->GetTdc0()<0 || chip->GetTdc()<this->GetTdc0()){ 00145 this->SetTdc0(newtdc); 00146 } 00147 00148 // Set the chip status 00149 // (set status bits and also any error codes or trigger rates) 00150 CandDeadChip::ChipStatus_t mystatus = this->GetChipStatus(); 00151 RawChip::ChipStatus_t newstatus = chip->GetChipStatus(); 00152 00153 if(newstatus==RawChip::kCold){ 00154 mystatus=(CandDeadChip::ChipStatus_t)(mystatus|CandDeadChip::kBad); 00155 mystatus=(CandDeadChip::ChipStatus_t)(mystatus|CandDeadChip::kCold); 00156 this->SetTriggerRate(chip->GetErrorCode()); 00157 } 00158 00159 if(newstatus==RawChip::kHot){ 00160 mystatus=(CandDeadChip::ChipStatus_t)(mystatus|CandDeadChip::kBad); 00161 mystatus=(CandDeadChip::ChipStatus_t)(mystatus|CandDeadChip::kHot); 00162 this->SetTriggerRate(chip->GetErrorCode()); 00163 } 00164 00165 if(newstatus==RawChip::kBusy){ 00166 mystatus=(CandDeadChip::ChipStatus_t)(mystatus|CandDeadChip::kBad); 00167 mystatus=(CandDeadChip::ChipStatus_t)(mystatus|CandDeadChip::kBusy); 00168 00169 } 00170 00171 if(newstatus==RawChip::kError){ 00172 mystatus=(CandDeadChip::ChipStatus_t)(mystatus|CandDeadChip::kBad); 00173 mystatus=(CandDeadChip::ChipStatus_t)(mystatus|CandDeadChip::kError); 00174 this->SetErrorCode(chip->GetErrorCode()); 00175 } 00176 00177 this->SetChipStatus(mystatus); 00178 this->AddEntry(); 00179 00180 } 00181 00182 void CandDeadChipHandle::AddEntry() 00183 { 00184 dynamic_cast<CandDeadChip*>(GetOwnedCandBase())->fEntries++; 00185 } 00186 00187 XXXITRIMP(CandDeadChipHandle) 00188
1.3.9.1