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


C++ EventPtr::GenParticles方法代码示例

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


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

示例1: reweightTopPt

double EventWeightProvider::reweightTopPt(const EventPtr event) {
	const MCParticleCollection genPart(event->GenParticles());

	double topPt = 0.;
	double tbarPt = 0.;
	for (unsigned int i = 0; i < genPart.size(); i++) {

		if (genPart.at(i)->pdgId() == (6))
		  	  topPt = genPart.at(i)->pt();

		if (genPart.at(i)->pdgId() == (-6))
		  	  tbarPt = genPart.at(i)->pt();
	}

	double SFtop = exp(0.159-0.00141*topPt);
	double SFtbar = exp(0.159-0.00141*tbarPt);

	double weight=sqrt(SFtop*SFtbar);
  return weight;
}
开发者ID:BristolTopGroup,项目名称:AnalysisSoftware,代码行数:20,代码来源:EventWeightProvider.cpp

示例2: analyse

void MCAnalyser::analyse(const EventPtr event) {

	histMan_->setCurrentHistogramFolder("MCStudy");
	MCParticlePointer top, antitop, b_from_top, b_from_antitop, W_plus, W_minus, electron, neutrino, quark_from_W,
			antiquark_from_W;
	JetCollection genJets = event->GenJets();
	JetPointer topBjet, antitopBjet, jet1fromW, jet2fromW;
	bool ejets_event = false;
	bool leptonic_Wplus_found = false, leptonic_Wminus_found = false;
	bool hadronic_Wplus_found = false, hadronic_Wminus_found = false;
//	bool fully_hadronic_event = false, fully_leptonic_event = false;
	bool non_electron_leptonic_channel = false;
	int index = 0;
	int top_index = -100, antitop_index = -100, W_plus_index = -100, W_minus_index = -100;//, electron_index = -100,
//			neutrino_index = -100, b_from_top_index = -100, b_from_antitop_index = -100, quark_from_W_index = -100,
//			antiquark_from_W_index = -100;

	//TODO: change from iterator to index: std::vectors have constant time for index = no gain using iterators
	// MC ttbar reconstruction
	for (MCParticleCollection::const_iterator mc_particle = event->GenParticles().begin();
			mc_particle != event->GenParticles().end(); ++mc_particle, ++index) {

		if ((*mc_particle)->status() != 3)
			continue;
		//top quark
		if ((*mc_particle)->pdgId() == 6) {
			top = *mc_particle;
			top_index = index;
			continue;
		}

		//anti-top quark
		if ((*mc_particle)->pdgId() == -6) {
			antitop = *mc_particle;
			antitop_index = index;
			continue;
		}

		//W+/W- bosons
		if (((*mc_particle)->pdgId() == 24) && ((*mc_particle)->motherIndex() == top_index)) {
			W_plus = *mc_particle;
			W_plus_index = index;
			continue;
		}

		if (((*mc_particle)->pdgId() == -24) && ((*mc_particle)->motherIndex() == antitop_index)) {
			W_minus = *mc_particle;
			W_minus_index = index;
			continue;
		}

		//b-quarks
		if (((*mc_particle)->pdgId() == 5) && ((*mc_particle)->motherIndex() == top_index)) {
			b_from_top = *mc_particle;
//			b_from_top_index = index;
			continue;
		}
		if (((*mc_particle)->pdgId() == -5) && ((*mc_particle)->motherIndex() == antitop_index)) {
			b_from_antitop = *mc_particle;
//			b_from_antitop_index = index;
			continue;
		}

		//W+ decay products
		if ((*mc_particle)->motherIndex() == W_plus_index) {
			if ((*mc_particle)->pdgId() == -11) {
				electron = *mc_particle;
//				electron_index = index;
				leptonic_Wplus_found = true;
			}

			else if ((*mc_particle)->pdgId() == 12) {
				neutrino = *mc_particle;
//				neutrino_index = index;
				leptonic_Wplus_found = true;
			}

			else if ((*mc_particle)->isLepton()) {
				non_electron_leptonic_channel = true;
				leptonic_Wplus_found = true;
			}

			else if ((*mc_particle)->isQuark() && ((*mc_particle)->pdgId() > 0)) {
				quark_from_W = *mc_particle;
//				quark_from_W_index = index;
				hadronic_Wplus_found = true;
			}

			else if ((*mc_particle)->isQuark() && ((*mc_particle)->pdgId() < 0)) {
				antiquark_from_W = *mc_particle;
//				antiquark_from_W_index = index;
				hadronic_Wplus_found = true;
			}

			else {
				cout << "Something went wrong: W+ has unusual decay products." << endl;
			}

		}

//.........这里部分代码省略.........
开发者ID:jjacob,项目名称:AnalysisSoftware,代码行数:101,代码来源:MCAnalyser.cpp


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