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


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

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


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

示例1: Analyze

void TauAnalyzer::Analyze(Trace &trace, const std::string &aType,
                          const std::string &aSubtype,
                          const std::map<std::string, int> & tagMap) {
    // don't do analysis for piled-up traces
    if (trace.HasValue("filterEnergy2")) {
        return;
    }
    // only do analysis for the proper type and subtype
    if (type != "" && subtype != "" &&
        type != aType && subtype != aSubtype ) {
        return;
    }

    TraceAnalyzer::Analyze(trace, type, subtype);

    Trace::const_iterator itMax=max_element(trace.begin(), trace.end());
    Trace::const_iterator itMin=min_element(itMax, (Trace::const_iterator)trace.end());
    iterator_traits< Trace::const_iterator >::difference_type  size = distance(itMax, itMin);

    // skip over the area near the extrema since it may be non-exponential there
    advance(itMax, size/10);
    advance(itMin, -size/10);

    size = distance(itMax, itMin);
    double n = (double)size;

    double sum1=0, sum2=0;
    double i=0;
    for(Trace::const_iterator it=itMax; it != itMin; it++) {
            double j=i+1.;
            sum1 += double(*it)*(j*n*n-3*j*j*n+2*j*j*j);
            sum2 += double(*it)*(i*n*n-3*i*i*n+2*i*i*i);
            i+=1.;
    }
    double tau =  1 / log(sum1 / sum2) * Globals::get()->clockInSeconds();
    trace.SetValue("tau", tau);

    EndAnalyze();
}
开发者ID:akeeler,项目名称:pixie_scan,代码行数:39,代码来源:TauAnalyzer.cpp

示例2: Analyze

/**
 *   Detect a second crossing of the fast filter corresponding to a piled-up
 *     trace and deduce its energy
 */
void DoubleTraceAnalyzer::Analyze(Trace &trace,
                                  const string &type, const string &subtype)
{
    if (subtype == "top" || subtype == "bottom")
        return;

    TraceFilterer::Analyze(trace, type, subtype);
    // class to see when the fast filter falls below threshold
    static binder2nd< less<Trace::value_type> > recrossesThreshold
    (less<Trace::value_type>(), fastThreshold);

    if ( pulse.isFound && level >= 10 ) {
        // cout << "Double trace #" << numTracesAnalyzed << " for type " << type << ":" << subtype << endl;
        // trace filterer found a first pulse

        Trace::iterator iThr = fastFilter.begin() + pulse.time;
        Trace::iterator iHigh = fastFilter.end();

        vector<PulseInfo> pulseVec;
        // put the original pulse in the vector
        pulseVec.push_back(pulse);
        const size_t pulseLimit = 50; // maximum number of pulses to find

        while (iThr < iHigh) {
            // find the trailing edge (use rise samples?)
            advance(iThr, fastParms.GetGapSamples());
            iThr = find_if(iThr, iHigh, recrossesThreshold);
            // advance(iThr, fastParms.GetSize());
            advance(iThr, fastParms.GetRiseSamples());

            FindPulse(iThr, iHigh);
            if (pulse.isFound) {
                pulseVec.push_back(pulse);
                iThr = fastFilter.begin() + pulse.time;
            } else break;
            if (pulseVec.size() > pulseLimit) {
                cout << "Too many pulses, limit = " << pulseLimit << ", breaking out." << endl;
                EndAnalyze(); // update timing
                return;
            }
        } // while searching for multiple traces

        trace.SetValue("numPulses", (int)pulseVec.size());

        // now plot stuff
        if ( pulseVec.size() > 1 ) {
            using namespace dammIds::trace;

            // fill the trace info
            // first pulse info is set in TraceFilterer
            for (Trace::size_type i=1; i < pulseVec.size(); i++) {
                stringstream str;
                // the first pulse in the vector is the SECOND pulse in the trace
                str << "filterEnergy" << i+1;
                trace.SetValue(str.str(), pulseVec[i].energy);
                str.str(""); // clear the string
                str << "filterTime" << i+1;
                trace.SetValue(str.str(), (int)pulseVec[i].time);
            }

            // plot the double pulse stuff
            trace.Plot(DD_DOUBLE_TRACE, numDoubleTraces);
            if (pulseVec.size() > 2) {
                static int numTripleTraces = 0;
                cout << "Found triple trace " << numTripleTraces
                     << ", num pulses = " << pulseVec.size()
                     << ", sigma baseline = " << trace.GetValue("sigmaBaseline") << endl;
                trace.Plot(DD_TRIPLE_TRACE, numTripleTraces);
                fastFilter.ScalePlot(DD_TRIPLE_TRACE_FILTER1, numTripleTraces, fastParms.GetRiseSamples());
                energyFilter.ScalePlot(DD_TRIPLE_TRACE_FILTER2, numTripleTraces, energyParms.GetRiseSamples());
                if (useThirdFilter)
                    thirdFilter.ScalePlot(DD_TRIPLE_TRACE_FILTER3, numTripleTraces, thirdParms.GetRiseSamples());
                numTripleTraces++;
            }

            plot(D_ENERGY2, pulseVec[1].energy);
            plot(DD_ENERGY2__TDIFF, pulseVec[1].energy, pulseVec[1].time - pulseVec[0].time);
            plot(DD_ENERGY2__ENERGY1, pulseVec[1].energy, pulseVec[0].energy);

            numDoubleTraces++;
        } // if found double trace
    } // sufficient analysis level

    EndAnalyze(trace);
}
开发者ID:mohmd7shudif,项目名称:pixie_scan,代码行数:89,代码来源:DoubleTraceAnalyzer.cpp


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