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


C++ EventPtr类代码示例

本文整理汇总了C++中EventPtr的典型用法代码示例。如果您正苦于以下问题:C++ EventPtr类的具体用法?C++ EventPtr怎么用?C++ EventPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: nextEvent

inline EventPtr Simulator::getNextEvent()
{
	EventPtr nextEvent (*m_eventPtrQueue.begin());
	m_eventPtrQueue.erase(m_eventPtrQueue.begin());
	nextEvent->setInEventQueue(false);
	return nextEvent;
}
开发者ID:bizunas,项目名称:RFIDSIM,代码行数:7,代码来源:simulator.hpp

示例2: analyse

void JetAnalyser::analyse(const EventPtr event) {

    histMan_->setCurrentHistogramFolder(histogramFolder_);
    weight_ = event->weight() * prescale_ * scale_;
    const JetCollection jets = event->Jets();
    unsigned int numberOfBJets(0);

    for (unsigned int index = 0; index < jets.size(); ++index) {

        const JetPointer jet(jets.at(index));
        histMan_->H1D_BJetBinned("all_jet_pT")->Fill(jet->pt(), weight_);
        histMan_->H1D_BJetBinned("all_jet_phi")->Fill(jet->phi(), weight_);
        histMan_->H1D_BJetBinned("all_jet_eta")->Fill(jet->eta(), weight_);
        if (jet->isBJet(BtagAlgorithm::CombinedSecondaryVertex, BtagAlgorithm::MEDIUM))
            ++numberOfBJets;

        if (index < 7) {
            stringstream temp;
            temp << "jet" << (index + 1);
            string nthJet = temp.str();
            histMan_->H1D_BJetBinned(nthJet + "_pT")->Fill(jet->pt(), weight_);
            histMan_->H1D_BJetBinned(nthJet + "_phi")->Fill(jet->phi(), weight_);
            histMan_->H1D_BJetBinned(nthJet + "_eta")->Fill(jet->eta(), weight_);
        }

    }

    histMan_->H1D_BJetBinned("N_Jets")->Fill(jets.size(), weight_);
    histMan_->H1D("N_BJets")->Fill(numberOfBJets, weight_);
}
开发者ID:TopPairPlusGamma,项目名称:AnalysisTools,代码行数:30,代码来源:JetAnalyser.cpp

示例3: analyse

void ElectronAnalyser::analyse(const EventPtr event) {
	histMan_->setCurrentHistogramFolder(histogramFolder_);
	weight_ = event->weight() * prescale_ * scale_;
	const ElectronCollection electrons = event->Electrons();

	if (singleElectronOnly_)
		return;
	histMan_->H1D("Number_Of_Electrons")->Fill(electrons.size(), weight_);
	for (unsigned int index = 0; index < electrons.size(); ++index) {
		const ElectronPointer electron(electrons.at(index));

		histMan_->H1D("All_Electron_Pt")->Fill(electron->pt(), weight_);
		histMan_->H1D("All_Electron_Eta")->Fill(electron->eta(), weight_);
		histMan_->H1D("All_Electron_AbsEta")->Fill(fabs(electron->eta()), weight_);
		histMan_->H1D("All_Electron_Phi")->Fill(electron->phi(), weight_);
		histMan_->H1D("All_Electron_pfIsolation_03_deltaBeta")->Fill(electron->PFRelIso03DeltaBeta(), weight_);

		histMan_->H1D("All_Electron_sigma_ietaieta")->Fill(electron->sigmaIEtaIEta(), weight_);
		histMan_->H1D("All_Electron_dPhi_in")->Fill(electron->dPhiIn(), weight_);
		histMan_->H1D("All_Electron_dEta_in")->Fill(electron->dEtaIn(), weight_);
		histMan_->H1D("All_Electron_HadOverEM")->Fill(electron->HadOverEm(), weight_);
		histMan_->H1D("All_Electron_mvaTrigV0")->Fill(electron->mvaTrigV0(), weight_);
		histMan_->H1D("All_Electron_mvaNonTrigV0")->Fill(electron->mvaNonTrigV0(), weight_);
		histMan_->H1D("All_Electron_dB")->Fill(electron->d0(), weight_);
	}
}
开发者ID:kreczko,项目名称:AnalysisSoftware,代码行数:26,代码来源:ElectronAnalyser.cpp

示例4: analyse

void METAnalyser::analyse(const EventPtr event) {
	histMan_->setCurrentHistogramFolder(histogramFolder_);
	weight_ = event->weight() * prescale_ * scale_;

	for (unsigned index = 0; index < METAlgorithm::NUMBER_OF_METALGORITHMS; ++index) {
		std::string prefix = METAlgorithm::prefixes.at(index);
		METAlgorithm::value metType = (METAlgorithm::value) index;
		if (!MET::isAvailableInNTupleVersion(Globals::NTupleVersion, index))
			continue;
		bool isMCOnlyMET = MET::isMCOnlyMETType(index);

		if (isMCOnlyMET && event->isRealData()) //these METs are MC only (Jet resolution systematics)
			continue;
		const METPointer met(event->MET(metType));
		histMan_->setCurrentHistogramFolder(histogramFolder_ + "/" + prefix);
		histMan_->H1D_BJetBinned("MET")->Fill(met->et(), weight_);
		if (index != METAlgorithm::GenMET && !event->isRealData()) {
			histMan_->H2D_BJetBinned("RecoMET_vs_GenMET")->Fill(event->GenMET()->et(), met->et(), weight_);
		}
		//do not fill other histograms for met systematics
		if ((index > METAlgorithm::patType1p2CorrectedPFMet) && (index != METAlgorithm::recoMetPFlow))
			continue;
		histMan_->H1D_BJetBinned("MET_phi")->Fill(met->phi(), weight_);
		histMan_->H1D_BJetBinned("METsignificance")->Fill(met->significance(), weight_);
		histMan_->H2D_BJetBinned("METsignificance_vs_MET")->Fill(met->et(), met->significance(), weight_);
	}

}
开发者ID:phy6phs,项目名称:AnalysisSoftware,代码行数:28,代码来源:METAnalyser.cpp

示例5: analyseTransverseMass

void METAnalyser::analyseTransverseMass(const EventPtr event, const ParticlePointer particle) {
	histMan_->setCurrentHistogramFolder(histogramFolder_);
	weight_ = event->weight() * prescale_ * scale_;

	for (unsigned index = 0; index < METAlgorithm::NUMBER_OF_METALGORITHMS; ++index) {
		std::string prefix = METAlgorithm::prefixes.at(index);
		METAlgorithm::value metType = (METAlgorithm::value) index;
		if (!MET::isAvailableInNTupleVersion(Globals::NTupleVersion, index))
			continue;
		if (MET::isMCOnlyMETType(index) && event->isRealData())
			continue; //skip MC only METs for real data

		const METPointer met(event->MET(metType));
		histMan_->setCurrentHistogramFolder(histogramFolder_ + "/" + prefix);

		//do not fill histograms for met systematics
		if (index > METAlgorithm::patType1p2CorrectedPFMet)
			continue;

		double MT = Event::MT(particle, met);
		double angle = met->angle(particle);
		double delPhi = met->deltaPhi(particle);
		histMan_->H1D_BJetBinned("Transverse_Mass")->Fill(MT, weight_);
		histMan_->H1D_BJetBinned("Angle_lepton_MET")->Fill(angle, weight_);
		histMan_->H1D_BJetBinned("DeltaPhi_lepton_MET")->Fill(delPhi, weight_);
		if (met->et() < 20)
			histMan_->H1D_BJetBinned("Transverse_Mass_MET20")->Fill(MT, weight_);
	}
}
开发者ID:phy6phs,项目名称:AnalysisSoftware,代码行数:29,代码来源:METAnalyser.cpp

示例6: getFramePos

/**
 * @brief Video::convertToEvent
 * @param path
 * @return
 */
EventPtr Video::convertToEvent(std::string path){
	cv::Mat shot;
	FramePtr frame;
	EventPtr event;

	unsigned int j=0;
	int framecount=0;

	double tmpPos = getFramePos();
	setFramePos(0);

	emit startProgress(0, (uint) getLengthFrames());

	while(getNextFrame(shot)){
		emit progressChanged(j);

		if (event.isNull()){
			event = EventPtr(new Event(this));
		}
		// create new frame
		frame = FramePtr(new Frame(this, shot, path));
		// add frame to event
		event->addFrame(frame);
		framecount ++;
		j++;
	}

	setFramePos(tmpPos);

	return event;
}
开发者ID:BioFoV,项目名称:BioFoV,代码行数:36,代码来源:Video.cpp

示例7: Send

Bool Connection::Send( EventPtr e )
{
	PacketStream ps;

	e->Pack( ps );

	// Go through the ModifierStack, if required.
	if (GetState() == MODIFIED_LINE) 
	{
		ModifierStack* modifier_stack = GetModifierStack();

		if (modifier_stack != NULL && !ModifierSkipper::Instance().Has( e->GetEvent() ) ) 
		{
			// Exclude packet length header
			void* buffer = ps.getPtr();
			UInt32 encLength = ps.size();

			if (modifier_stack->Modify(buffer, &encLength) == false) 
			{
				// Error!!!
				return false;
			}
		}
	}

	// 공유 되므로 락 필요
	{
		asio::detail::mutex::scoped_lock sl( m_sendLock );

		m_accBuf->write( ps.size() );
		m_accBuf->write( ps.getPtr(), ps.size() );	
	}

	return requestSend(); 
}
开发者ID:keedongpark,项目名称:acton,代码行数:35,代码来源:session.cpp

示例8: createInternalEvent

UUID SubgraphNode::addForwardingSlot(const UUID& internal_uuid, const TokenDataConstPtr& type, const std::string& label)
{
    graph_->registerUUID(internal_uuid);

    EventPtr relay = createInternalEvent(type, internal_uuid, label);

    auto cb = [relay](const TokenConstPtr& data) {
        relay->triggerWith(std::make_shared<Token>(*data));
        relay->message_processed(relay);
    };

    Slot* external_slot = VariadicSlots::createVariadicSlot(type, label, cb, false, false);

    relay->message_processed.connect(std::bind(&Slot::notifyEventHandled, external_slot));

    crossConnectLabelChange(external_slot, relay.get());

    external_to_internal_events_[external_slot->getUUID()] = relay;

    relay_to_external_slot_[internal_uuid] = external_slot->getUUID();

    forwarding_connector_added(relay);

    return external_slot->getUUID();
}
开发者ID:cogsys-tuebingen,项目名称:csapex,代码行数:25,代码来源:subgraph_node.cpp

示例9: GetTickCount

// Goes through the event queue and processes events for the given time.
bool EventManager::tick(unsigned int maxMS)
{
	unsigned int curTick = GetTickCount();
	unsigned int maxTime = maxMS + curTick;

	bool processed = false;

	while (m_eventQueue.size() > 0)
	{
		EventPtr event = m_eventQueue.front();
		m_eventQueue.pop_front();

		EventType type = event->getType();
		EventListenerMap::iterator itMap = m_listenerMap.find(type.getId());

		if (itMap == m_listenerMap.end())
			continue;

		EventListenerList theList = (*itMap).second;

		for (EventListenerList::iterator i = theList.begin(); i != theList.end(); i++)
		{
			if ((*i)->HandleEvent(*event))
				break;
		}

		curTick = GetTickCount();
		if (curTick >= maxTime)
			break;
	}
	return processed;
}
开发者ID:charlie-a-maxwell,项目名称:TowerDefense,代码行数:33,代码来源:Event.cpp

示例10: analyse_ST

void METAnalyser::analyse_ST(const EventPtr event, const ParticlePointer particle, const JetCollection jets) {
	histMan_->setCurrentHistogramFolder(histogramFolder_);
	weight_ = event->weight() * prescale_ * scale_;
	for (unsigned index = 0; index < METAlgorithm::NUMBER_OF_METALGORITHMS; ++index) {
		std::string prefix = METAlgorithm::prefixes.at(index);
		METAlgorithm::value metType = (METAlgorithm::value) index;
		if (!MET::isAvailableInNTupleVersion(Globals::NTupleVersion, index))
			continue;
		bool isMCOnlyMET = MET::isMCOnlyMETType(index);

		if (isMCOnlyMET && event->isRealData()) //these METs are MC only (Jet resolution systematics)
			continue;

		const METPointer met(event->MET(metType));

		float ST = Event::ST(jets, particle, met);
		float WPT = Event::WPT(particle, met);
		float MT = Event::MT(particle, met);

		histMan_->setCurrentHistogramFolder(histogramFolder_ + "/" + prefix);
		histMan_->H1D("ST")->Fill(ST, weight_);
		histMan_->H1D("WPT")->Fill(WPT, weight_);
		histMan_->H1D("MT")->Fill(MT, weight_);

		treeMan_->setCurrentFolder(histogramFolder_);
		treeMan_->Fill("ST",ST);
		treeMan_->Fill("WPT",WPT);
		treeMan_->Fill("MT",MT);

		histMan_->H2D("HT_vs_MET_plus_leptonPt")->Fill(particle->pt() + met->et(), Event::HT(jets), weight_);
	}
}
开发者ID:dsmiff,项目名称:AnalysisSoftware,代码行数:32,代码来源:METAnalyser.cpp

示例11: fillLeptonEfficiencyCorrectionBranches

void TTbar_plus_X_analyser::fillLeptonEfficiencyCorrectionBranches( const EventPtr event, const unsigned int selectionCriteria, const LeptonPointer signalLepton ) {
	SelectionCriteria::selection selection = SelectionCriteria::selection(selectionCriteria);
	if ( selection == SelectionCriteria::ElectronPlusJetsReference ) {
		double electronEfficiencyCorrection = 1, electronEfficiencyCorrection_down = 1, electronEfficiencyCorrection_up = 1;
		if ( !event->isRealData() ) {
			const ElectronPointer signalElectron(boost::static_pointer_cast<Electron>(signalLepton));
			electronEfficiencyCorrection = signalElectron->getEfficiencyCorrection( 0 );
			electronEfficiencyCorrection_down = signalElectron->getEfficiencyCorrection( -1 );
			electronEfficiencyCorrection_up = signalElectron->getEfficiencyCorrection( 1 );
		}
		treeMan_->Fill("ElectronEfficiencyCorrection",electronEfficiencyCorrection);
		treeMan_->Fill("ElectronUp",electronEfficiencyCorrection_up);
		treeMan_->Fill("ElectronDown",electronEfficiencyCorrection_down);
	}
	else if ( selection == SelectionCriteria::MuonPlusJetsReference ) {
		double muonEfficiencyCorrection = 1, muonEfficiencyCorrection_down = 1, muonEfficiencyCorrection_up = 1;
		if ( !event->isRealData() ) {
			const MuonPointer signalMuon(boost::static_pointer_cast<Muon>(signalLepton));
			muonEfficiencyCorrection = signalMuon->getEfficiencyCorrection( 0 );
			muonEfficiencyCorrection_down = signalMuon->getEfficiencyCorrection( -1 );
			muonEfficiencyCorrection_up = signalMuon->getEfficiencyCorrection( 1 );
		}
		treeMan_->Fill("MuonEfficiencyCorrection",muonEfficiencyCorrection);
		treeMan_->Fill("MuonUp",muonEfficiencyCorrection_up);
		treeMan_->Fill("MuonDown",muonEfficiencyCorrection_down);
	}
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例12: while

bool EventManager::processEvents(Time max_process_time)
{
	Time curr_time = g_app->getCurrentTime();
	Time max_time = curr_time + max_process_time;


	// swap active queues and clear the new queue after the swap
	int queueToProcess = m_active_queue;
	m_active_queue = (m_active_queue + 1) % EVENTMANAGER_NUM_QUEUES;
	m_queues[m_active_queue].clear();

	// Process the queue
	while (!m_queues[queueToProcess].empty())
	{
		// pop the front of the queue
		EventPtr event = m_queues[queueToProcess].front();
		m_queues[queueToProcess].pop_front();
		cout<<"Send event \""<<event->getName()<<"\""<<endl;

		// find all the delegate functions registered for this event
		auto findIt = m_event_listeners.find(typeid(*event));
		if (findIt != m_event_listeners.end())
		{
			const EventListenerList& eventListeners = findIt->second;

			// call each listener
			for (auto it = eventListeners.begin(); it != eventListeners.end();++it)
			{
				EventListenerFunction event_function = (*it);
				if (event_function.getOwner() != event->getSender())
					event_function.execute(event);
			}
		}
		// check to see if time ran out
		curr_time = g_app->getCurrentTime();
		if (curr_time >= max_time)
		{
			cout<<"EventLoop: Aborting event processing; time ran out. Already "<<(curr_time-max_time).asMilliseconds()<<"ms too long."<<endl;
			break;
		}
	}

	// If we couldn’t process all of the events, push the remaining events to
	// the new active queue.
	// Note: To preserve sequencing, go back-to-front, inserting them at the
	// head of the active queue.
	bool queueFlushed = (m_queues[queueToProcess].empty());
	if (!queueFlushed)
	{
		while (!m_queues[queueToProcess].empty())
		{
			EventPtr event = m_queues[queueToProcess].back();
			m_queues[queueToProcess].pop_back();
			m_queues[m_active_queue].push_front(event);
		}
	}
	return queueFlushed;
}
开发者ID:HeckelCrow,项目名称:AdventureGameEngine,代码行数:58,代码来源:EventManager.cpp

示例13: dispatchEvent

inline void Simulator::dispatchEvent(EventPtr event)
{
	assert(event.get() != 0);
	SimTime fireTime = event->getFireTime();
	assert(m_clock <= fireTime);

	m_clock = fireTime;
	event->execute();
}
开发者ID:bizunas,项目名称:RFIDSIM,代码行数:9,代码来源:simulator.hpp

示例14: EventProcesseor

void* EventProcesseor(void* unused) {
    while (true) {
        EventPtr event;
        // fetch a event from event queue and handle with it
        EventQueue::Instance()->PopFront(&event);
        event->Handle();
    }
    return NULL;
}
开发者ID:celix,项目名称:cello,代码行数:9,代码来源:work_thread.cpp

示例15: ePlusJetsQcdAnalysis

void TTbar_plus_X_analyser::ePlusJetsQcdAnalysis(const EventPtr event) {
	if ( event->PassesElectronTriggerAndQCDSelection() ) {
		fillCommonTrees( event, SelectionCriteria::ElectronPlusJetsQCDNonIsolated, histogramFolder_ + "/EPlusJets/QCD non iso e+jets" );
	}

	if ( event->PassesElectronTriggerAndConversionSelection() ) {
		fillCommonTrees( event, SelectionCriteria::ElectronPlusJetsQCDConversion, histogramFolder_ + "/EPlusJets/QCDConversions" );
	}
}
开发者ID:BristolTopGroup,项目名称:AnalysisSoftware,代码行数:9,代码来源:TTbar_plus_X_analyser.cpp


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