BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
Pdt.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: Pdt.h,v 1.3 2009/12/23 02:59:56 zhangy Exp $
4//
5// Description:
6// Searchable Particle Lists for BaBar
7//
8// Environment:
9// Software developed for the BaBar Detector at the SLAC B-Factory.
10//
11// Author List:
12// John LoSecco Original Author
13// Zhang Yao([email protected])
14// Anders Ryd Reimplemented using RW hash tables
15//
16// Copyright Information:
17// Copyright (C) 1998 The University of Notre Dame
18//
19// History:
20// Migration for BESIII MDC
21//
22//------------------------------------------------------------------------
23//
24// Based on Pdt.h by Luca Lista
25//
26// See Also
27// PdtbEntry, DecayMode
28
29#ifndef PDT_HH
30#define PDT_HH
31
32#include "MdcRecoUtil/PdtLund.h"
34#include "MdcRecoUtil/PdtPid.h"
36#include <string>
37#include <map>
38
39//Hash size, should atleast be a prime and
40//of about the same size as the number of particles
41#define PdtHashSize 503
42
43//typedef PdtEntry* PdtEntryPtr;
44
45#include <iosfwd>
46
47template < class T > class AstStringMap;
48
49class Pdt {
50
51public:
52 // return PDT entry pointer given the particle id or name
53 static PdtEntry* lookup(const std::string& name);
57 static PdtEntry* lookup(PdtPid::PidType id, int charge=-1);
59 //
60 // LL: the following method is suggested by Gautier, but I think
61 // LL: could not be completely safe.
62 // LL: I suggest to use lookup(pdtId(int id), int charge) in replacement.
63 //
64 // static PdtEntry* lookup(int id, int charge=-1);
65
66 //lange Feb 11,2003
67 static bool sameOrConj( PdtLund::LundType id1, PdtLund::LundType id2);
68 static bool sameOrConj( PdtPdg::PdgType id1, PdtPdg::PdgType id2);
69 static bool sameOrConj( PdtEntry *id1, PdtEntry *id2);
70
71 // GHM 05/19/99 : get the conjugate of a PdtEntry
72 static const PdtEntry* conjugate( const PdtEntry* );
73
74 // get mass value
75 static float mass(PdtLund::LundType id) { return lookup(id)->mass(); }
76 static float mass(PdtGeant::GeantType id) { return lookup(id)->mass(); }
77 static float mass(PdtPid::PidType id) { return lookup(id)->mass();}
78 static float mass(PdtPid::PidNeutralType id) { return lookup(id)->mass();}
79 static float mass(const char* name) { return lookup(name)->mass(); }
80
81 // get width value
82 static float width(PdtLund::LundType id) { return lookup(id)->width(); }
83 static float width(PdtGeant::GeantType id) { return lookup(id)->width(); }
84 static float width(PdtPid::PidType id) { return lookup(id)->width(); }
85 static float width(PdtPid::PidNeutralType id) { return lookup(id)->width(); }
86 static float width(const char* name) { return lookup(name)->width(); }
87
88 // get lifetime value
89 static float lifetime(PdtLund::LundType id) { return lookup(id)->lifetime(); }
90 static float lifetime(PdtGeant::GeantType id){ return lookup(id)->lifetime(); }
91 static float lifetime(PdtPid::PidType id) { return lookup(id)->lifetime(); }
92 static float lifetime(PdtPid::PidNeutralType id) { return lookup(id)->lifetime(); }
93 static float lifetime(const char* name) { return lookup(name)->lifetime(); }
94
95 // get spin value
96 static float spin(PdtLund::LundType id) { return lookup(id)->spin(); }
97 static float spin(PdtGeant::GeantType id) { return lookup(id)->spin(); }
98 static float spin(PdtPid::PidType id) { return lookup(id)->spin(); }
99 static float spin(PdtPid::PidNeutralType id) { return lookup(id)->spin(); }
100 static float spin(const char* name) { return lookup(name)->spin(); }
101
102 // get charge. Not available for Pid code
103 static float charge(PdtLund::LundType id) { return lookup(id)->charge(); }
104 static float charge(PdtGeant::GeantType id) { return lookup(id)->charge(); }
105 static float charge(const char* name) { return lookup(name)->charge(); }
106
107 // get antiparticle code
109
110 // read the MC++ input file
111 static void readMCppTable(std::string filenm);
112
113 // remove all the entries
114 static void deleteAll();
115
116 // print the particle table
117 static void printOn( std::ostream & );
118
119 // create an entry for a particle that is its own antiparticle
120 static void addParticle(const char* pname, PdtLund::LundType id,
121 float spin, float charge, float mass, float width=0.0,
122 float cut = 0.0
123 );
124 static void addParticle(const char* pname, PdtGeant::GeantType id,
125 float spin, float charge, float mass, float width=0.0,
126 float cut = 0.0
127 );
128
129 static void addDecay(const char* pname, float bf,
130 const char* child1, const char* child2=0,
131 const char* child3=0, const char* child4=0,
132 const char* child5=0
133 );
134
135 static void addDecay(PdtLund::LundType id, float bf,
136 PdtLund::LundType child1,
141 );
142
143 // code conversions from Lund and Geant id
146 static PdtLund::LundType lundId (const PdtPid::PidType, int charge = -1);
148
150 static PdtPdg::PdgType pdgId (const PdtPid::PidType pid, int charge = -1)
151 { return pdgId(lundId(pid, charge)); }
153 { return pdgId(lundId(pid, charge)); }
155 { return pdgId(lundId(geant)); }
156
158 static PdtGeant::GeantType geantId(const PdtPid::PidType, int charge = -1);
161 { return geantId(lundId(pdg)); }
162
166 { return pidId(lundId(pdg)); }
170 { return pidNeutId(lundId(pdg)); }
171
172 // conversions from Pid code need the charge as an extra argument
173
174 // conversions from integer, useful in "for" cycles and to load
175 // from FORTRAN common blocks. Example:
176 // int i;
177 // for (i = PdtPid::electron; i <= PdtPid::proton; i++)
178 // { PdtEntry* pdt = Pdt::lookup(Pdt::pidId(i)); }
179 //
180 static PdtLund::LundType lundId (const int id) { return (PdtLund::LundType) id; };
181 static PdtGeant::GeantType geantId(const int id) { return (PdtGeant::GeantType) id; };
182 static PdtPid::PidType pidId (const int id) { return (PdtPid::PidType) id; };
183 static PdtPid::PidNeutralType pidNeutId (const int id) { return (PdtPid::PidNeutralType) id; };
184 static PdtPdg::PdgType pdgId (const int id) { return (PdtPdg::PdgType) id; };
185
186
187
188private:
189
190 //Hash tables for looking up particles
191 static std::map<int,PdtEntry*>* _entries; //By pdt number
192 static AstStringMap< PdtEntry >* _entriesn; //By name
193 static std::map<int,PdtEntry*>* _entriesg; //By geant number
194 static std::map<int,PdtEntry*>* _entriesl; //By lund number
195 //Pid type is too small to bother.
196
197 //hash functions for particle numbers and name
198 static unsigned PdtNumHash(const int& num);
199 static unsigned PdtNameHash(const std::string& c);
200
201 //cache common particles for fast access
202 static PdtEntry* _positiveEntries[5];
203 static PdtEntry* _negativeEntries[5];
204 static PdtEntry* _neutralEntries[5];
205
206};
207
208#endif
209
210
211
212
double mass
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared cut
Definition: KarFin.h:27
float mass() const
Definition: PdtEntry.h:55
float charge() const
Definition: PdtEntry.h:54
float spin() const
Definition: PdtEntry.h:59
float lifetime() const
Definition: PdtEntry.h:58
float width() const
Definition: PdtEntry.h:56
LundType
Definition: PdtLund.h:11
@ null
Definition: PdtLund.h:522
PdgType
Definition: PdtPdg.h:8
PidType
Definition: PdtPid.h:11
PidNeutralType
Definition: PdtPid.h:22
Definition: Pdt.h:49
static PdtPdg::PdgType pdgId(const int id)
Definition: Pdt.h:184
static float lifetime(PdtLund::LundType id)
Definition: Pdt.h:89
static float lifetime(PdtPid::PidNeutralType id)
Definition: Pdt.h:92
static float mass(PdtPid::PidNeutralType id)
Definition: Pdt.h:78
static float width(PdtLund::LundType id)
Definition: Pdt.h:82
static float spin(PdtPid::PidType id)
Definition: Pdt.h:98
static PdtPdg::PdgType pdgPid(const PdtGeant::GeantType geant)
Definition: Pdt.h:154
static PdtGeant::GeantType geantId(const PdtPdg::PdgType pdg)
Definition: Pdt.h:160
static float mass(PdtGeant::GeantType id)
Definition: Pdt.h:76
static PdtPdg::PdgType pdgId(const PdtPid::PidNeutralType pid, int charge=0)
Definition: Pdt.h:152
static float width(PdtGeant::GeantType id)
Definition: Pdt.h:83
static PdtPdg::PdgType pdgId(const PdtPid::PidType pid, int charge=-1)
Definition: Pdt.h:150
static float charge(PdtGeant::GeantType id)
Definition: Pdt.h:104
static float lifetime(PdtGeant::GeantType id)
Definition: Pdt.h:90
static float charge(const char *name)
Definition: Pdt.h:105
static void readMCppTable(std::string filenm)
Definition: Pdt.cxx:291
static float spin(PdtGeant::GeantType id)
Definition: Pdt.h:97
static PdtPid::PidType pidId(const PdtPdg::PdgType pdg)
Definition: Pdt.h:165
static float charge(PdtLund::LundType id)
Definition: Pdt.h:103
static PdtLund::LundType antiCode(PdtLund::LundType)
Definition: Pdt.cxx:73
static bool sameOrConj(PdtLund::LundType id1, PdtLund::LundType id2)
Definition: Pdt.cxx:663
static PdtPid::PidType pidId(const PdtLund::LundType)
Definition: Pdt.cxx:449
static float mass(PdtLund::LundType id)
Definition: Pdt.h:75
static void deleteAll()
Definition: Pdt.cxx:393
static PdtPid::PidType pidId(const int id)
Definition: Pdt.h:182
static void printOn(std::ostream &)
Definition: Pdt.cxx:244
static float spin(PdtPid::PidNeutralType id)
Definition: Pdt.h:99
static float width(PdtPid::PidType id)
Definition: Pdt.h:84
static float lifetime(PdtPid::PidType id)
Definition: Pdt.h:91
static float mass(const char *name)
Definition: Pdt.h:79
static PdtLund::LundType lundId(const int id)
Definition: Pdt.h:180
static float width(PdtPid::PidNeutralType id)
Definition: Pdt.h:85
static PdtGeant::GeantType geantId(const PdtLund::LundType)
Definition: Pdt.cxx:427
static PdtGeant::GeantType geantId(const int id)
Definition: Pdt.h:181
static PdtPdg::PdgType pdgId(const PdtLund::LundType)
Definition: Pdt.cxx:608
static PdtPid::PidNeutralType pidNeutId(const PdtLund::LundType)
Definition: Pdt.cxx:473
static float mass(PdtPid::PidType id)
Definition: Pdt.h:77
static float width(const char *name)
Definition: Pdt.h:86
static PdtPid::PidNeutralType pidNeutId(const PdtPdg::PdgType pdg)
Definition: Pdt.h:169
static PdtPid::PidNeutralType pidNeutId(const int id)
Definition: Pdt.h:183
static PdtLund::LundType lundId(const PdtGeant::GeantType)
Definition: Pdt.cxx:413
static PdtEntry * lookup(const std::string &name)
Definition: Pdt.cxx:207
static const PdtEntry * conjugate(const PdtEntry *)
Definition: Pdt.cxx:681
static float spin(PdtLund::LundType id)
Definition: Pdt.h:96
static float lifetime(const char *name)
Definition: Pdt.h:93
static float spin(const char *name)
Definition: Pdt.h:100
static void addParticle(const char *pname, PdtLund::LundType id, float spin, float charge, float mass, float width=0.0, float cut=0.0)
Definition: Pdt.cxx:91
static void addDecay(const char *pname, float bf, const char *child1, const char *child2=0, const char *child3=0, const char *child4=0, const char *child5=0)
Definition: Pdt.cxx:160
int num[96]
Definition: ranlxd.c:373