Fork me on GitHub

source: svn/trunk/src/PdgParticle.cc@ 515

Last change on this file since 515 was 469, checked in by Xavier Rouby, 15 years ago

property 'invisible()' added to PdgParticle

File size: 5.1 KB
RevLine 
[386]1/***********************************************************************
2** **
3** /----------------------------------------------\ **
4** | Delphes, a framework for the fast simulation | **
5** | of a generic collider experiment | **
6** \------------- arXiv:0903.2225v1 ------------/ **
7** **
8** **
9** This package uses: **
10** ------------------ **
[443]11** ROOT: Nucl. Inst. & Meth. in Phys. Res. A389 (1997) 81-86 **
[386]12** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **
13** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **
14** FROG: [hep-ex/0901.2718v1] **
[443]15** HepMC: Comput. Phys. Commun.134 (2001) 41 **
[386]16** **
17** ------------------------------------------------------------------ **
18** **
19** Main authors: **
20** ------------- **
21** **
22** Severine Ovyn Xavier Rouby **
23** severine.ovyn@uclouvain.be xavier.rouby@cern **
24** **
25** Center for Particle Physics and Phenomenology (CP3) **
26** Universite catholique de Louvain (UCL) **
27** Louvain-la-Neuve, Belgium **
28** **
29** Copyright (C) 2008-2009, **
30** All rights reserved. **
31** **
32***********************************************************************/
33
34/// \file PdgParticle.h
35/// \brief Stores the data from PDG particle tables
36
37#include "PdgParticle.h"
38#include <iostream>
39#include <string>
40#include <map>
[402]41#include <iomanip>
[386]42
[402]43//PdgParticle::PdgParticle() : _pid(1), _mass(-1), _charge(-999), _gamma_tot(-1), _ctau(-1), _name("") {}
[386]44
[469]45PdgParticle::PdgParticle(const long int pid, const std::string& name, const float m, const float q, const float gamma, const float ctau) :
46 _pid(pid), _mass(m), _charge(q), _gamma_tot(gamma), _ctau(ctau), _name(name) {
47 if( (abs(pid) == 12) || (abs(pid) == 14) || (abs(pid) == 16) ||
48 (abs(pid) == 1000022 ) || (abs(pid) == 1000023 ) || (abs(pid) == 1000025) ||
49 (abs(pid) == 1000035 ) || (abs(pid) == 1000045 ) ) { /*std::cout << "invisible : " << pid << std::endl;*/ _isInvisible = true; }
50 else _isInvisible = false;
51}
[386]52
53
54PdgParticle::PdgParticle(const PdgParticle& p) :
[469]55 _pid(p._pid), _mass(p._mass), _charge(p._charge), _gamma_tot(p._gamma_tot), _ctau(p._ctau), _name(p._name), _isInvisible(p._isInvisible) {}
[386]56
57PdgParticle& PdgParticle::operator=(const PdgParticle& p) {
58 if(this == &p) return *this;
59 _pid = p._pid; _name= p._name; _mass=p._mass;
[402]60 _charge=p._charge; _gamma_tot=p._gamma_tot; _ctau = p._ctau;
[469]61 _isInvisible = p._isInvisible;
[386]62 return *this;
63}
64
65PdgTable::PdgTable(const PdgTable& table) {
66 std::map<int, PdgParticle>::const_iterator i;
67 for(i = table._table.begin(); i != table._table.end(); i++)
68 _table.insert(std::map<int,PdgParticle>::value_type(i->first,i->second));
69}
70
71PdgTable& PdgTable::operator=(const PdgTable& table) {
72 if(this == &table) return *this;
73 std::map<int, PdgParticle>::const_iterator i;
74 for(i = table._table.begin(); i != table._table.end(); i++)
75 _table.insert(std::map<int,PdgParticle>::value_type(i->first,i->second));
76 return *this;
77}
78
[469]79void PdgTable::insert(const long int pid, const PdgParticle &p) {
[386]80 _table.insert(std::map<int,PdgParticle>::value_type(pid,p));
81}
82
83void PdgTable::print() const {
84 std::map<int, PdgParticle>::const_iterator i;
[469]85 for(i = _table.begin(); i != _table.end(); i++) {
[402]86 std::cout << "name = " << std::setw(20) << std::left << i->second.name()
87 << "pid = " << std::setw(10) << i->first
88 << "\t M=" << std::setw(10) << i->second.mass() << "GeV/c^2"
89 << "\t Q=" << std::setw(6) << i->second.charge() << "e+"
[469]90 << "\t ctau=" << i->second.ctau() << " m";
91 if(i->second.invisible()) std::cout << "\t invisible";
92 std::cout << std::endl;
93 }
[386]94}
95
96PdgParticle PdgTable::operator[](const int pid) const {
97 std::map<int, PdgParticle>::const_iterator i;
98 i =_table.find(pid);
99 if(i==_table.end()) {
[412]100// std::cout <<"** WARNING: PDG ID not found (" << pid << "), use default values **" << std::endl;
[386]101 return PdgParticle();
102 }
103
104 return i->second;
105}
Note: See TracBrowser for help on using the repository browser.