void NormaliseByCurrent::exec() { // Get the input workspace MatrixWorkspace_sptr inputWS = getProperty("InputWorkspace"); MatrixWorkspace_sptr outputWS = getProperty("OutputWorkspace"); // Get the good proton charge and check it's valid double charge = extractCharge(inputWS); if (charge == 0) { throw std::domain_error("The proton charge is zero"); } g_log.information() << "Normalisation current: " << charge << " uamps" << std::endl; charge = 1.0 / charge; // Inverse of the charge to be multiplied by // The operator overloads properly take into account of both EventWorkspaces // and doing it in place or not. if (inputWS != outputWS) { outputWS = inputWS * charge; setProperty("OutputWorkspace", outputWS); } else { inputWS *= charge; } outputWS->setYUnitLabel("Counts per microAmp.hour"); }
/* Creates a map: ("peptide" + "_" + "charge") => ScanMergeInfo(scanNr, PEP, isDecoy, charge, peptide) of all PSMs under qvalue_thresh */ void parsePercOutfile(std::string percOutFN, SpectraMergeMap& peptideScanMap, bool isDecoy, double qvalue_thresh = 0.01) { std::ifstream percOut(percOutFN.c_str()); std::string line, tmp, id, peptide; double qvalue, pep; if (percOut.is_open()) { getline(percOut, line); /* remove header line */ while (getline(percOut, line)) { std::istringstream iss(line); iss >> id >> tmp >> qvalue >> pep >> peptide; std::string key = peptide + "_" + extractCharge(id); if (qvalue > qvalue_thresh) break; peptideScanMap[key].push_back(ScanMergeInfo(extractScannr(id), pep, isDecoy, extractIntCharge(id), peptide)); /* std::cerr << "Inserting peptide " << peptide << " with scannr " << scannr << std::endl; */ } } else {