Fork me on GitHub

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

Last change on this file since 390 was 386, checked in by Xavier Rouby, 16 years ago

new file PDG

File size: 4.3 KB
Line 
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** ------------------ **
11** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **
12** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **
13** FROG: [hep-ex/0901.2718v1] **
14** **
15** ------------------------------------------------------------------ **
16** **
17** Main authors: **
18** ------------- **
19** **
20** Severine Ovyn Xavier Rouby **
21** severine.ovyn@uclouvain.be xavier.rouby@cern **
22** **
23** Center for Particle Physics and Phenomenology (CP3) **
24** Universite catholique de Louvain (UCL) **
25** Louvain-la-Neuve, Belgium **
26** **
27** Copyright (C) 2008-2009, **
28** All rights reserved. **
29** **
30***********************************************************************/
31
32/// \file PdgParticle.h
33/// \brief Stores the data from PDG particle tables
34
35#include "PdgParticle.h"
36#include <iostream>
37#include <string>
38#include <map>
39
40//PdgParticle::PdgParticle() : _pid(1), _mass(-1), _charge(-999), _gamma_tot(-1), _tau(-1), _name("") {}
41
42PdgParticle::PdgParticle(const int pid, const std::string& name, const float m, const float q, const float gamma, const float tau) :
43 _pid(pid), _mass(m), _charge(q), _gamma_tot(gamma), _tau(tau), _name(name) {}
44
45
46PdgParticle::PdgParticle(const PdgParticle& p) :
47 _pid(p._pid), _mass(p._mass), _charge(p._charge), _gamma_tot(p._gamma_tot), _tau(p._tau), _name(p._name) {}
48
49PdgParticle& PdgParticle::operator=(const PdgParticle& p) {
50 if(this == &p) return *this;
51 _pid = p._pid; _name= p._name; _mass=p._mass;
52 _charge=p._charge; _gamma_tot=p._gamma_tot; _tau = p._tau;
53 return *this;
54}
55
56PdgTable::PdgTable(const PdgTable& table) {
57 std::map<int, PdgParticle>::const_iterator i;
58 for(i = table._table.begin(); i != table._table.end(); i++)
59 _table.insert(std::map<int,PdgParticle>::value_type(i->first,i->second));
60}
61
62PdgTable& PdgTable::operator=(const PdgTable& table) {
63 if(this == &table) return *this;
64 std::map<int, PdgParticle>::const_iterator i;
65 for(i = table._table.begin(); i != table._table.end(); i++)
66 _table.insert(std::map<int,PdgParticle>::value_type(i->first,i->second));
67 return *this;
68}
69
70void PdgTable::insert(const int pid, const PdgParticle &p) {
71 _table.insert(std::map<int,PdgParticle>::value_type(pid,p));
72}
73
74void PdgTable::print() const {
75 std::map<int, PdgParticle>::const_iterator i;
76 for(i = _table.begin(); i != _table.end(); i++)
77 std::cout << "name = " << i->second.name() << "\t\tpid = "
78 << i->first << "\t M=" << i->second.mass() << "\t Q="
79 << i->second.charge() << std::endl;
80}
81
82PdgParticle PdgTable::operator[](const int pid) const {
83 std::map<int, PdgParticle>::const_iterator i;
84 i =_table.find(pid);
85 if(i==_table.end()) {
86 std::cout <<"** WARNING: PDG ID not found (" << pid << "), use default values **" << std::endl;
87 return PdgParticle();
88 }
89
90 return i->second;
91}
Note: See TracBrowser for help on using the repository browser.