public TOFWithError GetResult() { TOFWithError temp = new TOFWithError(); temp.Calibration = calibration; temp.ClockPeriod = clockPeriod; temp.GateStartTime = gateStartTime; temp.Data = Data; temp.Errors = Errors; return(temp); }
private ChannelSet <TOFWithError> AppendChannelSetWithSpecialValues(ChannelSet <TOFWithError> tcs) { ChannelSet <TOFWithError> tcsWithSpecialValues = tcs; // Extract the TOFChannels that we need. TOFWithError c_eb = (TOFWithError)tcs.GetChannel(new string[] { "E", "B" }); TOFWithError c_edb = (TOFWithError)tcs.GetChannel(new string[] { "E", "DB" }); TOFWithError c_bdb = (TOFWithError)tcs.GetChannel(new string[] { "B", "DB" }); TOFWithError c_dbrf1f = (TOFWithError)tcs.GetChannel(new string[] { "DB", "RF1F" }); TOFWithError c_dbrf2f = (TOFWithError)tcs.GetChannel(new string[] { "DB", "RF2F" }); TOFWithError c_e = (TOFWithError)tcs.GetChannel(new string[] { "E" }); TOFWithError c_b = (TOFWithError)tcs.GetChannel(new string[] { "B" }); TOFWithError c_db = (TOFWithError)tcs.GetChannel(new string[] { "DB" }); TOFWithError c_sig = (TOFWithError)tcs.GetChannel(new string[] { "SIG" }); TOFWithError c_brf1f = (TOFWithError)tcs.GetChannel(new string[] { "B", "RF1F" }); TOFWithError c_brf2f = (TOFWithError)tcs.GetChannel(new string[] { "B", "RF2F" }); TOFWithError c_edbrf1f = (TOFWithError)tcs.GetChannel(new string[] { "E", "DB", "RF1F" }); TOFWithError c_edbrf2f = (TOFWithError)tcs.GetChannel(new string[] { "E", "DB", "RF2F" }); TOFWithError c_bdbrf1f = (TOFWithError)tcs.GetChannel(new string[] { "B", "DB", "RF1F" }); TOFWithError c_bdbrf2f = (TOFWithError)tcs.GetChannel(new string[] { "B", "DB", "RF2F" }); TOFWithError c_ebdb = (TOFWithError)tcs.GetChannel(new string[] { "E", "B", "DB" }); TOFWithError c_ebdbrf1f = (TOFWithError)tcs.GetChannel(new string[] { "E", "B", "DB", "RF1F" }); TOFWithError c_ebdbrf2f = (TOFWithError)tcs.GetChannel(new string[] { "E", "B", "DB", "RF2F" }); TOFWithError c_rf1f = (TOFWithError)tcs.GetChannel(new string[] { "RF1F" }); TOFWithError c_rf2f = (TOFWithError)tcs.GetChannel(new string[] { "RF2F" }); TOFWithError c_erf1f = (TOFWithError)tcs.GetChannel(new string[] { "E", "RF1F" }); TOFWithError c_erf2f = (TOFWithError)tcs.GetChannel(new string[] { "E", "RF2F" }); TOFWithError c_rf1a = (TOFWithError)tcs.GetChannel(new string[] { "RF1A" }); TOFWithError c_rf2a = (TOFWithError)tcs.GetChannel(new string[] { "RF2A" }); TOFWithError c_dbrf1a = (TOFWithError)tcs.GetChannel(new string[] { "DB", "RF1A" }); TOFWithError c_dbrf2a = (TOFWithError)tcs.GetChannel(new string[] { "DB", "RF2A" }); // For SOME blocks there is no LF1 channel (and hence switch states). // To get around this problem I will populate the TOFChannel with "SIG" // It will then be obvious in the analysis when LF1 takes on real values. TOFWithError c_lf1; TOFWithError c_dblf1; if (!tcs.Channels.Contains("LF1")) { c_lf1 = c_sig; c_dblf1 = c_sig; } else { c_lf1 = (TOFWithError)tcs.GetChannel(new string[] { "LF1" }); c_dblf1 = (TOFWithError)tcs.GetChannel(new string[] { "DB", "LF1" }); } // Work out the terms for the full, corrected edm. TOFWithError terms = c_eb * c_db - c_edb * c_b + c_bdb * c_e - c_ebdb * c_sig + c_erf1f * c_bdbrf1f + c_erf2f * c_bdbrf2f - c_brf1f * c_edbrf1f - c_brf2f * c_edbrf2f - c_ebdbrf1f * c_rf1f - c_ebdbrf2f * c_rf2f ; TOFWithError preDenominator = c_db * c_db - c_edb * c_edb + c_bdb * c_bdb - c_ebdb * c_ebdb + c_bdbrf1f * c_bdbrf1f + c_bdbrf2f * c_bdbrf2f - c_edbrf1f * c_edbrf1f - c_edbrf2f * c_edbrf2f + c_ebdbrf1f * c_ebdbrf1f + c_ebdbrf2f * c_ebdbrf2f ; // Work out terms for corrected edm (no rf channels) TOFWithError termsNoRf = c_eb * c_db - c_edb * c_b + c_bdb * c_e + c_ebdb * c_sig; TOFWithError preDenominatorNoRf = c_db * c_db - c_edb * c_edb + c_bdb * c_bdb - c_ebdb * c_ebdb; // it's important when working out the non-linear channel // combinations to always keep them dimensionless. If you // don't you'll run into trouble with integral vs. average // signal. TOFWithError edmDB = c_eb / c_db; tcs.AddChannel(new string[] { "EDMDB" }, edmDB); // The corrected edm channel. This should be proportional to the edm phase. TOFWithError edmCorrDB = terms / preDenominator; tcs.AddChannel(new string[] { "EDMCORRDB" }, edmCorrDB); // It's useful to have an estimate of the size of the correction. Here // we return the difference between the corrected edm channel and the // naive guess, edmDB. TOFWithError correctionDB = edmCorrDB - edmDB; tcs.AddChannel(new string[] { "CORRDB" }, correctionDB); // The "old" correction that just corrects for the E-correlated amplitude change. // This is included in the dblocks for debugging purposes. TOFWithError correctionDB_old = (c_edb * c_b) / (c_db * c_db); tcs.AddChannel(new string[] { "CORRDB_OLD" }, correctionDB_old); TOFWithError edmCorrDB_old = edmDB - correctionDB_old; tcs.AddChannel(new string[] { "EDMCORRDB_OLD" }, edmCorrDB_old); // The "no rf" correction that just corrects for the E/B-correlated amplitude change. // This is included in the dblocks for debugging purposes. TOFWithError edmCorrDB_norf = termsNoRf / preDenominatorNoRf; tcs.AddChannel(new string[] { "EDMCORRDB_NORF" }, edmCorrDB_norf); TOFWithError correctionDB_norf = edmCorrDB_norf - edmDB; tcs.AddChannel(new string[] { "CORRDB_NORF" }, correctionDB_norf); // Normalised RFxF channels. TOFWithError rf1fDB = c_rf1f / c_db; tcs.AddChannel(new string[] { "RF1FDB" }, rf1fDB); TOFWithError rf2fDB = c_rf2f / c_db; tcs.AddChannel(new string[] { "RF2FDB" }, rf2fDB); // And RFxF.DB channels, again normalised to DB. The naming of these channels is quite // unfortunate, but it's just tough. TOFWithError rf1fDBDB = c_dbrf1f / c_db; tcs.AddChannel(new string[] { "RF1FDBDB" }, rf1fDBDB); TOFWithError rf2fDBDB = c_dbrf2f / c_db; tcs.AddChannel(new string[] { "RF2FDBDB" }, rf2fDBDB); // Normalised RFxAchannels. TOFWithError rf1aDB = c_rf1a / c_db; tcs.AddChannel(new string[] { "RF1ADB" }, rf1aDB); TOFWithError rf2aDB = c_rf2a / c_db; tcs.AddChannel(new string[] { "RF2ADB" }, rf2aDB); // And RFxA.DB channels, again normalised to DB. The naming of these channels is quite // unfortunate, but it's just tough. TOFWithError rf1aDBDB = c_dbrf1a / c_db; tcs.AddChannel(new string[] { "RF1ADBDB" }, rf1aDBDB); TOFWithError rf2aDBDB = c_dbrf2a / c_db; tcs.AddChannel(new string[] { "RF2ADBDB" }, rf2aDBDB); // the E.RFxF channels, normalized to DB TOFWithError erf1fDB = c_erf1f / c_db; tcs.AddChannel(new string[] { "ERF1FDB" }, erf1fDB); TOFWithError erf2fDB = c_erf2f / c_db; tcs.AddChannel(new string[] { "ERF2FDB" }, erf2fDB); // the E.RFxF.DB channels, normalized to DB, again dodgy naming convention. TOFWithError erf1fDBDB = c_edbrf1f / c_db; tcs.AddChannel(new string[] { "ERF1FDBDB" }, erf1fDBDB); TOFWithError erf2fDBDB = c_edbrf2f / c_db; tcs.AddChannel(new string[] { "ERF2FDBDB" }, erf2fDBDB); // the LF1 channel, normalized to DB TOFWithError lf1DB = c_lf1 / c_db; tcs.AddChannel(new string[] { "LF1DB" }, lf1DB); TOFWithError lf1DBDB = c_dblf1 / c_db; tcs.AddChannel(new string[] { "LF1DBDB" }, lf1DBDB); TOFWithError bDB = c_b / c_db; tcs.AddChannel(new string[] { "BDB" }, bDB); // we also need to extract the rf-step induced phase shifts. These come out in the // B.RFxF channels, but like the edm, need to be corrected. //// Work out the terms //TOFWithError brf1fCorrectionTerms = c_eb * c_db // - c_edb * c_b + c_bdb * c_e - c_ebdb * c_sig // + c_erf1f * c_bdbrf1f + c_erf2f * c_bdbrf2f // - c_brf1f * c_edbrf1f - c_brf2f * c_edbrf2f // - c_ebdbrf1f * c_rf1f - c_ebdbrf2f * c_rf2f // ; //TOFWithError brf1fPreDenominator = c_db * c_db // - c_edb * c_edb + c_bdb * c_bdb - c_ebdb * c_ebdb // + c_bdbrf1f * c_bdbrf1f + c_bdbrf2f * c_bdbrf2f // - c_edbrf1f * c_edbrf1f - c_edbrf2f * c_edbrf2f // + c_ebdbrf1f * c_ebdbrf1f + c_ebdbrf2f * c_ebdbrf2f // ; TOFWithError brf1fCorrDB = (c_brf1f / c_db) - ((c_b * c_dbrf1f) / (c_db * c_db)); tcs.AddChannel(new string[] { "BRF1FCORRDB" }, brf1fCorrDB); TOFWithError brf2fCorrDB = (c_brf2f / c_db) - ((c_b * c_dbrf2f) / (c_db * c_db)); tcs.AddChannel(new string[] { "BRF2FCORRDB" }, brf2fCorrDB); //Some extra channels for various shot noise calculations, these are a bit weird tcs.AddChannel(new string[] { "SIGNL" }, c_sig); tcs.AddChannel(new string[] { "ONEOVERDB" }, 1 / c_db); TOFWithError dbSigNL = c_db / c_sig; tcs.AddChannel(new string[] { "DBSIG" }, dbSigNL); TOFWithError dbdbSigSigNL = dbSigNL * dbSigNL; tcs.AddChannel(new string[] { "DBDBSIGSIG" }, dbdbSigSigNL); TOFWithError SigdbdbNL = c_sig / (c_db * c_db); tcs.AddChannel(new string[] { "SIGDBDB" }, SigdbdbNL); return(tcsWithSpecialValues); }