当前位置: 首页>>代码示例>>C++>>正文


C++ Trace::empty方法代码示例

本文整理汇总了C++中Trace::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Trace::empty方法的具体用法?C++ Trace::empty怎么用?C++ Trace::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Trace的用法示例。


在下文中一共展示了Trace::empty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Analyze

void FittingAnalyzer::Analyze(Trace &trace, const std::string &detType,
                              const std::string &detSubtype,
                              const std::map<std::string, int> & tagMap) {
    TraceAnalyzer::Analyze(trace, detType, detSubtype, tagMap);

    if(trace.HasValue("saturation") || trace.empty() ||
       trace.GetWaveform().size() == 0) {
        EndAnalyze();
        return;
    }

    Globals *globals = Globals::get();

    const double sigmaBaseline = trace.GetValue("sigmaBaseline");
    const double maxVal = trace.GetValue("maxval");
    const double qdc = trace.GetValue("qdc");
    const double maxPos = trace.GetValue("maxpos");
    const vector<double> waveform = trace.GetWaveform();
    bool isDblBeta = detType == "beta" && detSubtype == "double";
    bool isDblBetaT = isDblBeta && tagMap.find("timing") != tagMap.end();

    trace.plot(D_SIGMA, sigmaBaseline*100);

    if(!isDblBetaT) {
        if(sigmaBaseline > globals->sigmaBaselineThresh()) {
            EndAnalyze();
            return;
        }
    } else {
        if(sigmaBaseline > globals->siPmtSigmaBaselineThresh()) {
            EndAnalyze();
            return;
        }
    }

    pair<double,double> pars =  globals->fitPars(detType+":"+detSubtype);
    if(isDblBetaT)
        pars = globals->fitPars(detType+":"+detSubtype+":timing");

    FitDriver *driver;
    switch(fitterType_) {
        case FitDriver::GSL:
            driver = new GslFitter(isDblBetaT);
            break;
        case FitDriver::UNKNOWN:
        default:
            EndAnalyze();
            return;
    }

    driver->PerformFit(waveform, pars, sigmaBaseline, qdc);
    trace.InsertValue("phase", driver->GetPhase()+maxPos);

    trace.plot(DD_AMP, driver->GetAmplitude(), maxVal);
    trace.plot(D_PHASE, driver->GetPhase()*1000+100);
    trace.plot(D_CHISQPERDOF, driver->GetChiSqPerDof());

    delete(driver);
    EndAnalyze();
}
开发者ID:pixie16,项目名称:pixie_scan,代码行数:60,代码来源:FittingAnalyzer.cpp

示例2: Analyze

void WaveformAnalyzer::Analyze(Trace &trace, const ChannelConfiguration &cfg) {
    TraceAnalyzer::Analyze(trace, cfg);

    if (trace.IsSaturated() || trace.empty() || ignoredTypes_.find(cfg.GetType()) != ignoredTypes_.end()) {
        trace.SetHasValidAnalysis(false);
        EndAnalyze();
        return;
    }

    pair<unsigned int, unsigned int> range = cfg.GetWaveformBoundsInSamples();

    //First we calculate the position of the maximum.
    pair<unsigned int, double> max;
    try {
        max = TraceFunctions::FindMaximum(trace, cfg.GetTraceDelayInSamples());
    } catch (range_error &ex) {
        trace.SetHasValidAnalysis(false);
        cout << "WaveformAnalyzer::Analyze - " << ex.what() << endl;
        EndAnalyze();
        return;
    }

    //If the position of the maximum doesn't give us enough bins on the
    // baseline to calculate the average baseline then we're going to set
    // some of the variables to be used later to zero and end the analysis of
    // the waveform now.
    if (max.first - range.first < TraceFunctions::minimum_baseline_length) {
#ifdef VERBOSE
        cout << "WaveformAnalyzer::Analyze - The low bound for the trace overlaps with the minimum bins for the"
        "baseline." << endl;
#endif
        trace.SetHasValidAnalysis(false);
        EndAnalyze();
        return;
    }

    try {
        //Next we calculate the baseline and its standard deviation
        pair<double, double> baseline = TraceFunctions::CalculateBaseline(trace, make_pair(0, max.first - range.first));

        //For well behaved traces the standard deviation of the baseline
        // shouldn't ever be more than 1-3 ADC units. However, for traces
        // that are not captured properly, we can get really crazy values
        // here the SiPM often saw values as high as 20. We will put in a
        // hard limit of 50 as a cutoff since anything with a standard
        // deviation of this high will never be something we want to analyze.
        static const double extremeBaselineVariation = 50;
        if (baseline.second >= extremeBaselineVariation) {
            trace.SetHasValidAnalysis(false);
            EndAnalyze();
            return;
        }

        //Subtract the baseline from the maximum value.
        max.second -= baseline.first;

        vector<double> traceNoBaseline;
        for (unsigned int i = 0; i < trace.size(); i++)
            traceNoBaseline.push_back(trace[i] - baseline.first);

        //Finally, we calculate the QDC in the waveform range and subtract
        // the baseline from it.
        pair<unsigned int, unsigned int> waveformRange(max.first - range.first, max.first + range.second);
        double qdc = TraceFunctions::CalculateQdc(traceNoBaseline, waveformRange);

        //Now we are going to set all the different values into the trace.
        trace.SetQdc(qdc);
        trace.SetBaseline(baseline);
        trace.SetMax(max);
        trace.SetExtrapolatedMax(make_pair(max.first,
                                           TraceFunctions::ExtrapolateMaximum(trace, max).first - baseline.first));
        trace.SetTraceSansBaseline(traceNoBaseline);
        trace.SetWaveformRange(waveformRange);
        trace.SetHasValidAnalysis(true);
    } catch (range_error &ex) {
        trace.SetHasValidAnalysis(false);
        cout << "WaveformAnalyzer::Analyze - " << ex.what() << endl;
        EndAnalyze();
        return;
    }
}
开发者ID:spaulaus,项目名称:paass,代码行数:81,代码来源:WaveformAnalyzer.cpp


注:本文中的Trace::empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。