Fork me on GitHub

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

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

petites corrections S.O. Heidelberg

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