Fork me on GitHub

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

Last change on this file since 412 was 412, checked in by severine ovyn, 16 years ago

remove PID output error

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