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


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

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


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

示例1: Analyze

void CfdAnalyzer::Analyze(Trace &trace, const std::string &detType,
                          const std::string &detSubtype,
                          const std::map<std::string, int> & tagMap) {
    TraceAnalyzer::Analyze(trace, detType, detSubtype, tagMap);
    Globals *globals = Globals::get();
    unsigned int saturation = (unsigned int)trace.GetValue("saturation");
    if(saturation > 0) {
            EndAnalyze();
            return;
    }
    double aveBaseline = trace.GetValue("baseline");
    unsigned int maxPos = (unsigned int)trace.GetValue("maxpos");
    pair<unsigned int, unsigned int> range = globals->waveformRange("default");
    unsigned int waveformLow  = range.first;
    unsigned int waveformHigh = range.second;
    unsigned int delay = 2;
    double fraction = 0.25;
    vector<double> cfd;
    Trace::iterator cfdStart = trace.begin();
    advance(cfdStart, (int)(maxPos - waveformLow - 2));
    Trace::iterator cfdStop  = trace.begin();
    advance(cfdStop, (int)(maxPos + waveformHigh));
    for(Trace::iterator it = cfdStart;  it != cfdStop; it++) {
            Trace::iterator it0 = it;
            advance(it0, delay);
            double origVal = *it;
            double transVal = *it0;
            cfd.insert(cfd.end(), fraction *
                       (origVal - transVal - aveBaseline));
    }
    vector<double>::iterator cfdMax =
        max_element(cfd.begin(), cfd.end());
    vector<double> fitY;
    fitY.insert(fitY.end(), cfd.begin(), cfdMax);
    fitY.insert(fitY.end(), *cfdMax);
    vector<double>fitX;
    for(unsigned int i = 0; i < fitY.size(); i++)
        fitX.insert(fitX.end(), i);
    double num = fitY.size();
    double sumXSq = 0, sumX = 0, sumXY = 0, sumY = 0;
    for(unsigned int i = 0; i < num; i++) {
            sumXSq += fitX.at(i)*fitX.at(i);
            sumX += fitX.at(i);
            sumY += fitY.at(i);
            sumXY += fitX.at(i)*fitY.at(i);
    }
    double deltaPrime = num*sumXSq - sumX*sumX;
    double intercept =
        (1/deltaPrime)*(sumXSq*sumY - sumX*sumXY);
    double slope =
        (1/deltaPrime)*(num*sumXY - sumX*sumY);
    trace.InsertValue("phase", (-intercept/slope)+maxPos);
    EndAnalyze();
}
开发者ID:akeeler,项目名称:pixie_scan,代码行数:54,代码来源:CfdAnalyzer.cpp

示例2:

int
ThreadPoolSched::run(Trace & trace) 
{
	if(create_threads() < 0) {
		perror("ThreadPoolSched::run: failed to create thread.");
		return -1;
	}

	double pre_spin = Config::instance()->pre_spin();
	Trace::iterator iter = trace.begin();
	
	start_time( SysInfo::cur_time() );
	while( iter.hasNext() ) {
		IOEvent * event = iter.next();
		wait_until( event->trace_time, pre_spin );
		//event->insert_time = curr_time;
		queue()->push(event);
	}

	if( join_threads() < 0 ) {
		perror("ThreadPoolSched::run: failed to join threads.");
		return -1;
	}
	return 0;
}
开发者ID:eddyxu,项目名称:hifire,代码行数:25,代码来源:thread_pool_sched.cpp

示例3: updateHighlighted

void FlowGame::updateHighlighted()
{
    unsigned int width = _table->getWidth();
    unsigned int height = _table->getHeight();

    for(unsigned int x=0; x<width; ++x)
    {
        for(unsigned int y=0; y<height; ++y)
        {
            FlowPoint p(x,y);
            FlowPointState st = _table->get(p);
            if(st.isHighlighted())
            {
                st.setHighlighted(false);
                _renderer->updateCell(p, st);
            }
        }
    }

    for(FlowColor c=0; c<_active_traces.size(); ++c)
    {
        Trace* it = &_active_traces[c];
        for(Trace::iterator j=it->begin(); j!=it->end(); ++j)
        {
            FlowPoint p = *j;
            FlowPointState st = _table->get(p);
            st.setHighlighted(true);
            st.setHighlightColor(c);
            _renderer->updateCell(p, st);

        }
    }
}
开发者ID:Siemnok,项目名称:Alarm-x4,代码行数:33,代码来源:FlowGame.cpp

示例4: output_trace

inline void Tracematch::output_trace(const Trace& trace)
{
    for (Trace::const_iterator i = trace.begin(); i != trace.end(); ++i) {
        output << symbol_string(i->symbol_id)
               << " (" << *i->debug_location << ")" << endl;
    }
}
开发者ID:eyolfson,项目名称:tracerory,代码行数:7,代码来源:tracematch.cpp

示例5: fs

void
PrintHelper::trace_print(const Trace& trace, const GeoPoint &loc)
{
  std::ofstream fs("results/res-trace.txt");

  for (auto it = trace.begin(); it != trace.end(); ++it)
    PrintTracePoint(*it, fs);
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:8,代码来源:Printing.cpp

示例6: fs

void
PrintHelper::trace_print(const Trace& trace, const GeoPoint &loc)
{
  Directory::Create(_T("output/results"));
  std::ofstream fs("output/results/res-trace.txt");

  for (auto it = trace.begin(); it != trace.end(); ++it)
    PrintTracePoint(*it, fs);
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:9,代码来源:Printing.cpp

示例7: Calculate

void Constraints::Calculate(RWHistory* history, int nextThreadNum) {
	clauses.clear();

	Trace* trace = &history->shared_rec; // to the accesses which are shared. 

	MapThrdToTrace allTrace;

	for (Thread i = 1; i < nextThreadNum; ++i) {
		allTrace[i] = new Trace;
	}

	/* convert total order to partial order */
	for (Trace::iterator it = trace->begin(), ite = trace->end();
    it != ite; it++) {
		Thread index = it->thr;
		allTrace[index]->push_back(*it);
	}

#ifdef DEBUG_TOOL
	for (Thread i = 1; i < nextThreadNum; ++i) {
		Trace* trace_temp = allTrace[i];
		cout << "Thread " << i.tid() << " : " << trace_temp->size() << endl;
	}
#endif

	/* for each partial order, generate constraints */
	for (Thread i = 1; i < nextThreadNum; ++i) {
		Trace* trace_temp = allTrace[i];
		int size = trace_temp->size();
		assert(trace_temp->size() > 0); 
		assert(trace_temp->begin()->label != 0); 
		int front = 0;
		while (1) {
			if ((*trace_temp)[front].label != 0) {
				break;
      }
			front++;
		}
		int back = findNextEnd(front, *trace_temp);
		while (1) {
#ifdef DEBUG_TOOL
		cout << "Front # " << front << endl;
		cout << "Back # " << back << endl;
#endif
			if (front == back) break;
			GenerateClauses(front, back, *trace_temp);
			front = findNextBegin(back, *trace_temp);
			back = findNextEnd(front, *trace_temp);
		}
	}

	for (Thread i = 1; i < nextThreadNum; ++i) {
		delete allTrace[i];
	}
}
开发者ID:chubbymaggie,项目名称:DFENCE,代码行数:55,代码来源:Constraints.cpp

示例8: trace

	void Proc::trace(const Trace &trace) {
		if (!interactive_) {
			return;
		}

		Word num = trace.size();

		writeTrace(wrapTraceData(t_));
		writeTrace(wrapTraceData(num));

		for (Trace::const_iterator i = trace.begin(); i != trace.end(); ++i) {
			Word portNum = i->first;

			writeTrace(wrapTraceData(portNum));
			writeTrace(wrapTraceData(i->second));
		}
	}
开发者ID:pbl64k,项目名称:icfpc2009,代码行数:17,代码来源:proc.cpp

示例9: 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

示例10: PreProcess

bool PspmtProcessor::PreProcess(RawEvent &event) {
    if (!EventProcessor::PreProcess(event))
        return false;

    static const vector<ChanEvent *> &pspmtEvents = sumMap["pspmt"]->GetList();

    data_.Clear();

    double q1 = 0, q2 = 0, q3 = 0, q4 = 0, qd = 0;
    double qdc1 = 0, qdc2 = 0, qdc3 = 0, qdc4 = 0, qdcd = 0;
    double tre1 = 0, tre2 = 0, tre3 = 0, tre4 = 0, tred = 0;

    double qright = 0, qleft = 0, qtop = 0, qbottom = 0, qsum = 0;
    double xright = 0, xleft = 0, ytop = 0, ybottom = 0;

    double qtre_r = 0, qtre_l = 0, qtre_t = 0, qtre_b = 0, qtre_s = 0;
    double xtre_r = 0, xtre_l = 0, ytre_t = 0, ytre_b = 0;

    double qqdc_r = 0, qqdc_l = 0, qqdc_t = 0, qqdc_b = 0, qqdc_s = 0;
    //double xqdc_r=0,xqdc_l=0,yqdc_t=0,yqdc_b=0;

    double pxright = 0, pxleft = 0, pytop = 0, pybottom = 0;
    double pxtre_r = 0, pxtre_l = 0, pytre_t = 0, pytre_b = 0;

    // tentatively local params //
    double threshold = 260;
    double slope = 0.0606;
    double intercept = 10.13;
    //////////////////////////////
    static int traceNum;

    double f = 0.1;

    for (vector<ChanEvent *>::const_iterator it = pspmtEvents.begin();
         it != pspmtEvents.end(); it++) {

        ChanEvent *chan = *it;
        string subtype = chan->GetChanID().GetSubtype();
        int ch = chan->GetChanID().GetLocation();
        double calEnergy = chan->GetCalibratedEnergy();
        //double pspmtTime  = chan->GetTime();
        Trace trace = chan->GetTrace();

        double trace_energy;
        //double trace_time;
        //double baseline;
        double qdc;
        //int    num        = trace.GetValue("numPulses");

        if (!trace.GetFilteredEnergies().empty()) {
            traceNum++;
            //trace_time      = trace.GetValue("filterTime");
            trace_energy = trace.GetFilteredEnergies().front();
            //baseline         = trace.GetValue("baseline");
            qdc = trace.GetQdc();

            if (ch == 0) {
                qdc1 = qdc;
                tre1 = trace_energy;
                histo.Plot(D_QDC_TRACE1, qdc1);
                histo.Plot(D_ENERGY_TRACE1, tre1);
            } else if (ch == 1) {
                qdc2 = qdc;
                tre2 = trace_energy;
                histo.Plot(D_QDC_TRACE2, qdc2);
                histo.Plot(D_ENERGY_TRACE2, tre2);
            } else if (ch == 2) {
                qdc3 = qdc;
                tre3 = trace_energy;
                histo.Plot(D_QDC_TRACE3, qdc3);
                histo.Plot(D_ENERGY_TRACE3, tre3);
            } else if (ch == 3) {
                qdc4 = qdc;
                tre4 = trace_energy;
                histo.Plot(D_QDC_TRACE4, qdc4);
                histo.Plot(D_ENERGY_TRACE4, tre4);
            } else if (ch == 4) {
                qdcd = qdc;
                tred = trace_energy;
                histo.Plot(D_QDC_TRACED, qdcd);
                histo.Plot(D_ENERGY_TRACED, tred);
            }
        }

        if (ch == 0) {
            q1 = calEnergy;
            histo.Plot(D_RAW1, q1);
        } else if (ch == 1) {
            q2 = calEnergy;
            histo.Plot(D_RAW2, q2);
        } else if (ch == 2) {
            q3 = calEnergy;
            histo.Plot(D_RAW3, q3);
        } else if (ch == 3) {
            q4 = calEnergy;
            histo.Plot(D_RAW4, q4);
        } else if (ch == 4) {
            qd = calEnergy;
            histo.Plot(D_RAWD, qd);
        }
//.........这里部分代码省略.........
开发者ID:spaulaus,项目名称:paass,代码行数:101,代码来源:PspmtProcessor.cpp


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