Bool_t KVHarpeeIC::IsECalibrated() const { // Returns true if the detector has been calibrated in energy. // The ionization chamber is considered as calibrated if the // The 7 segments B are calibrated. Int_t Ncal = 0; Bool_t ok = kTRUE; TIter next(GetListOfCalibrators()); KVCalibrator* cal = NULL; while ((cal = (KVCalibrator*)next())) { //Energy only coded in ACQParam with label 'A' if (cal->GetLabel()[0] != 'A') continue; // Int_t num = cal->GetUniqueID(); // if( ((num%100)/10) != 1 ) continue; if (!cal->GetStatus()) { ok = kFALSE; break; } Ncal++; } return ok && (Ncal > 6); }
Double_t KVHarpeeIC::GetCalibE() { // Calculate energy in MeV from coder values. Only the 7 segments B // are used to calculate calibrated energy. // Returns 0 if calibration not ready for fired acquisition parameters // or if no acquisition parameter is fired. // (we require that at least one acquisition parameter has a value // greater than the current pedestal value). Bool_t ok = kTRUE; Double_t E = 0; TIter next(GetListOfCalibrators()); KVFunctionCal* cal = NULL; while (ok && (cal = (KVFunctionCal*)next())) { //Energy only coded in ACQParam with label 'A' if (cal->GetLabel()[0] != 'A') continue; // Int_t num = cal->GetUniqueID(); // if( ((num%100)/10) != 1 ) continue; if (cal->GetACQParam()->Fired("P")) { if (cal->GetStatus()) { E += cal->Compute(); } else ok = kFALSE; } } return (ok ? E : 0.); }
Double_t KVHarpeeIC::GetCalibE(Int_t seg_num) { // Calculate energy in MeV from the coder value of the acquisition parameter // with number 'seg_num' (i.e. segment number) and its corresponding calibrator. // Returns 0 if calibration not ready for the acquisition parameter. KVFunctionCal* cal = (KVFunctionCal*)GetListOfCalibrators()->FindObjectWithMethod(Form("%d", seg_num), "GetNumber"); if (cal && cal->GetStatus() && cal->GetACQParam()->Fired("P")) return cal->Compute(); return 0.; }
void KVHarpeeSi::Streamer(TBuffer &R__b){ // Stream an object of class KVHarpeeSi. // We set the pointers to the calibrator objects if (R__b.IsReading()) { KVHarpeeSi::Class()->ReadBuffer(R__b, this); TIter next( GetListOfCalibrators() ); TObject *cal = NULL; while( ( cal = next() ) ){ if( cal->InheritsFrom("KVRecombination") ) fPHD = (KVRecombination *)cal; else if( cal->InheritsFrom("KVFunctionCal") ) fCanalE = (KVFunctionCal *)cal; } } else { KVHarpeeSi::Class()->WriteBuffer(R__b, this); } }