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.; }
Double_t KVVAMOSDetector::GetCalibE() { // Calculate energy in MeV from coder values. // Returns 0 if calibration not ready or acquisition parameter not fired // (we require that the acquisition parameter has a value // greater than the current pedestal value) KVFunctionCal* cal = GetECalibrator(); if (cal && cal->GetStatus() && cal->GetACQParam()->Fired("P")) return cal->Compute(); return 0; }
//------------------------------ void KVCsI_e475s::SetCalibrator(KVDBParameterSet* kvdbps) //------------------------------ { KVFunctionCal* cali = new KVFunctionCal(kvdbps); if (!AddCalibrator(cali)) { Warning("SetCalibrator(KVDBParameterSet*)", "Addition of Calibrator %s %s failed !", kvdbps->GetName(), kvdbps->GetTitle()); delete cali; } else { if (TString(cali->GetType()).Contains("(LT)")) fcalibLT = cali; else fcalibLT = 0; } }
Double_t KVVAMOSDetector::GetCalibT(const Char_t* type) { // Calculate calibrated time in ns of type 'type' (SED_HF, SI_HF, // SI_SED1, ...) for coder values. // Returns 0 if calibration not ready or time ACQ parameter not fired. // (we require that the acquisition parameter has a value // greater than the current pedestal value) KVFunctionCal* cal = GetTCalibrator(type); if (cal && cal->GetStatus() && cal->GetACQParam()->Fired("P")) return cal->Compute() + GetT0(type); return 0; }
Double_t KVHarpeeSi::GetCalibT(const Char_t *type){ // Calculate calibrated time in ns of type 'type' (SI_HF, SI_SED1, // SI_INDRA, SI_MCP, ...) for coder values. // Returns 0 if calibration not ready or time ACQ parameter not fired. // (we require that the acquisition parameter has a value // greater than the current pedestal value). // The reference time T0 used for the calibration is the one of the // fired silicon detector of Harpee which stopped the time. KVHarpeeSi *firedSi = GetFiredHarpeeSi(); if( !firedSi ) return 0; KVFunctionCal *cal = GetTCalibrator( type ); if( cal && cal->GetStatus() && cal->GetACQParam()->Fired("P")) return cal->Compute() + firedSi->GetT0( type ); return 0; }
void KVVAMOSDetector::SetCalibrators() { // Setup the calibrators for this detector. Call once name // has been set. // The calibrators are KVFunctionCal. // By default the all the calibration functions are first-degree // polynomial function and the range [Xmin,Xmax]=[0,4096]. // Here the calibrator are not ready (KVFunctionCal::GetStatus()). // You have to give the parameters and change the status // (see KVFunctionCal::SetParameter(...) and KVFunctionCal::SetStatus(...)) TIter nextpar(GetACQParamList()); KVACQParam* par = NULL; Double_t maxch = 16384.; // 14 bits TString calibtype("ERROR"); while ((par = (KVACQParam*)nextpar())) { Bool_t isTparam = kFALSE; if (par->IsType("E")) { calibtype = "channel->MeV"; } else if (par->IsType("Q")) { calibtype = "channel->Volt"; maxch = 4096.; // 12 bits } else if (par->GetType()[0] == 'T') { isTparam = kTRUE; calibtype = "channel->ns"; } else continue; calibtype.Append(" "); calibtype.Append(par->GetName()); TF1* func = new TF1(calibtype.Data(), "pol1", 0., maxch); KVFunctionCal* c = new KVFunctionCal(this, func); c->SetType(calibtype.Data()); c->SetLabel(par->GetLabel()); c->SetNumber(par->GetNumber()); c->SetUniqueID(par->GetUniqueID()); c->SetACQParam(par); c->SetStatus(kFALSE); if (!AddCalibrator(c)) delete c; else if (isTparam) { if (!fTlist) fTlist = new TList; fTlist->Add(par); if (!fT0list) fT0list = new TList; fT0list->Add(new KVNamedParameter(par->GetName(), 0.)); } } // Define and set to zero the T0 values for time of flight measurment // from this detector. The time of flight acq parameters are associated // to gVamos if (gVamos) { TIter next_vacq(gVamos->GetVACQParams()); while ((par = (KVACQParam*)next_vacq())) { if ((par->GetType()[0] == 'T') && IsStartForT(par->GetName() + 1)) { if (!fTlist) fTlist = new TList; fTlist->Add(par); if (!fT0list) fT0list = new TList; fT0list->Add(new KVNamedParameter(par->GetName(), 0.)); } } } }