Fork me on GitHub

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

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

new header in all files

File size: 4.6 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** ROOT: Nucl. Inst. & Meth. in Phys. Res. A389 (1997) 81-86 **
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] **
15** HepMC: Comput. Phys. Commun.134 (2001) 41 **
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>
41#include <iomanip>
42
43//PdgParticle::PdgParticle() : _pid(1), _mass(-1), _charge(-999), _gamma_tot(-1), _ctau(-1), _name("") {}
44
45PdgParticle::PdgParticle(const 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
48
49PdgParticle::PdgParticle(const PdgParticle& p) :
50 _pid(p._pid), _mass(p._mass), _charge(p._charge), _gamma_tot(p._gamma_tot), _ctau(p._ctau), _name(p._name) {}
51
52PdgParticle& PdgParticle::operator=(const PdgParticle& p) {
53 if(this == &p) return *this;
54 _pid = p._pid; _name= p._name; _mass=p._mass;
55 _charge=p._charge; _gamma_tot=p._gamma_tot; _ctau = p._ctau;
56 return *this;
57}
58
59PdgTable::PdgTable(const PdgTable& table) {
60 std::map<int, PdgParticle>::const_iterator i;
61 for(i = table._table.begin(); i != table._table.end(); i++)
62 _table.insert(std::map<int,PdgParticle>::value_type(i->first,i->second));
63}
64
65PdgTable& PdgTable::operator=(const PdgTable& table) {
66 if(this == &table) return *this;
67 std::map<int, PdgParticle>::const_iterator i;
68 for(i = table._table.begin(); i != table._table.end(); i++)
69 _table.insert(std::map<int,PdgParticle>::value_type(i->first,i->second));
70 return *this;
71}
72
73void PdgTable::insert(const int pid, const PdgParticle &p) {
74 _table.insert(std::map<int,PdgParticle>::value_type(pid,p));
75}
76
77void PdgTable::print() const {
78 std::map<int, PdgParticle>::const_iterator i;
79 for(i = _table.begin(); i != _table.end(); i++)
80 std::cout << "name = " << std::setw(20) << std::left << i->second.name()
81 << "pid = " << std::setw(10) << i->first
82 << "\t M=" << std::setw(10) << i->second.mass() << "GeV/c^2"
83 << "\t Q=" << std::setw(6) << i->second.charge() << "e+"
84 << "\t ctau=" << i->second.ctau() << " m" << std::endl;
85}
86
87PdgParticle PdgTable::operator[](const int pid) const {
88 std::map<int, PdgParticle>::const_iterator i;
89 i =_table.find(pid);
90 if(i==_table.end()) {
91// std::cout <<"** WARNING: PDG ID not found (" << pid << "), use default values **" << std::endl;
92 return PdgParticle();
93 }
94
95 return i->second;
96}
Note: See TracBrowser for help on using the repository browser.