BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcPatRec/MdcRecoUtil/include/MdcRecoUtil/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(zhangyao@ihep.ac.cn)
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/PdtEntry.h"
33#include "MdcRecoUtil/PdtGeant.h"
34#include "MdcRecoUtil/PdtLund.h"
35#include "MdcRecoUtil/PdtPid.h"
36#include <map>
37#include <string>
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
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, float spin, float charge,
121 float mass, float width = 0.0, float cut = 0.0 );
122 static void addParticle( const char* pname, PdtGeant::GeantType id, float spin, float charge,
123 float mass, float width = 0.0, float cut = 0.0 );
124
125 static void addDecay( const char* pname, float bf, const char* child1,
126 const char* child2 = 0, const char* child3 = 0, const char* child4 = 0,
127 const char* child5 = 0 );
128
129 static void addDecay( PdtLund::LundType id, float bf, PdtLund::LundType child1,
134
135 // code conversions from Lund and Geant id
140
142 static PdtPdg::PdgType pdgId( const PdtPid::PidType pid, int charge = -1 ) {
143 return pdgId( lundId( pid, charge ) );
144 }
145 static PdtPdg::PdgType pdgId( const PdtPid::PidNeutralType pid, int charge = 0 ) {
146 return pdgId( lundId( pid, charge ) );
147 }
149 return pdgId( lundId( geant ) );
150 }
151
156 return geantId( lundId( pdg ) );
157 }
158
161 static PdtPid::PidType pidId( const PdtPdg::PdgType pdg ) { return pidId( lundId( pdg ) ); }
165 return pidNeutId( lundId( pdg ) );
166 }
167
168 // conversions from Pid code need the charge as an extra argument
169
170 // conversions from integer, useful in "for" cycles and to load
171 // from FORTRAN common blocks. Example:
172 // int i;
173 // for (i = PdtPid::electron; i <= PdtPid::proton; i++)
174 // { PdtEntry* pdt = Pdt::lookup(Pdt::pidId(i)); }
175 //
176 static PdtLund::LundType lundId( const int id ) { return (PdtLund::LundType)id; };
177 static PdtGeant::GeantType geantId( const int id ) { return (PdtGeant::GeantType)id; };
178 static PdtPid::PidType pidId( const int id ) { return (PdtPid::PidType)id; };
179 static PdtPid::PidNeutralType pidNeutId( const int id ) {
180 return (PdtPid::PidNeutralType)id;
181 };
182 static PdtPdg::PdgType pdgId( const int id ) { return (PdtPdg::PdgType)id; };
183
184private:
185 // Hash tables for looking up particles
186 static std::map<int, PdtEntry*>* _entries; // By pdt number
187 static AstStringMap<PdtEntry>* _entriesn; // By name
188 static std::map<int, PdtEntry*>* _entriesg; // By geant number
189 static std::map<int, PdtEntry*>* _entriesl; // By lund number
190 // Pid type is too small to bother.
191
192 // hash functions for particle numbers and name
193 static unsigned PdtNumHash( const int& num );
194 static unsigned PdtNameHash( const std::string& c );
195
196 // cache common particles for fast access
197 static PdtEntry* _positiveEntries[5];
198 static PdtEntry* _negativeEntries[5];
199 static PdtEntry* _neutralEntries[5];
200};
201
202#endif
*********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
static PdtPdg::PdgType pdgId(const int id)
static float lifetime(PdtLund::LundType id)
static PdtLund::LundType lundId(const PdtPdg::PdgType)
static float lifetime(PdtPid::PidNeutralType id)
static float mass(PdtPid::PidNeutralType id)
static void addDecay(PdtLund::LundType id, float bf, PdtLund::LundType child1, PdtLund::LundType child2=PdtLund::null, PdtLund::LundType child3=PdtLund::null, PdtLund::LundType child4=PdtLund::null, PdtLund::LundType child5=PdtLund::null)
static float width(PdtLund::LundType id)
static PdtPdg::PdgType pdgId(const PdtLund::LundType)
static PdtPdg::PdgType pdgPid(const PdtGeant::GeantType geant)
static PdtGeant::GeantType geantId(const PdtPdg::PdgType pdg)
static float mass(PdtGeant::GeantType id)
static PdtEntry * lookup(const std::string &name)
static PdtPdg::PdgType pdgId(const PdtPid::PidNeutralType pid, int charge=0)
static float width(PdtGeant::GeantType id)
static PdtEntry * lookup(PdtLund::LundType id)
static PdtPdg::PdgType pdgId(const PdtPid::PidType pid, int charge=-1)
static PdtEntry * lookup(PdtGeant::GeantType id)
static float charge(PdtGeant::GeantType id)
static float lifetime(PdtGeant::GeantType id)
static float spin(PdtGeant::GeantType id)
static PdtLund::LundType antiCode(PdtLund::LundType)
static PdtPid::PidType pidId(const PdtPdg::PdgType pdg)
static float charge(PdtLund::LundType id)
static PdtPid::PidNeutralType pidNeutId(const PdtLund::LundType)
static void printOn(std::ostream &)
static PdtGeant::GeantType geantId(const PdtPid::PidType, int charge=-1)
static bool sameOrConj(PdtEntry *id1, PdtEntry *id2)
static PdtLund::LundType lundId(const PdtGeant::GeantType)
static PdtEntry * lookup(PdtPid::PidType id, int charge=-1)
static float mass(PdtLund::LundType id)
static PdtEntry * lookup(PdtPdg::PdgType id)
static PdtPid::PidType pidId(const PdtGeant::GeantType)
static void readMCppTable(std::string filenm)
static PdtPid::PidType pidId(const int id)
static float spin(PdtPid::PidNeutralType id)
static float lifetime(PdtPid::PidType id)
static PdtEntry * lookup(PdtPid::PidNeutralType id, int charge=0)
static PdtPid::PidType pidId(const PdtLund::LundType)
static PdtLund::LundType lundId(const PdtPid::PidNeutralType, int charge=0)
static PdtLund::LundType lundId(const int id)
static PdtGeant::GeantType geantId(const PdtLund::LundType)
static const PdtEntry * conjugate(const PdtEntry *)
static float width(PdtPid::PidNeutralType id)
static PdtGeant::GeantType geantId(const PdtLund::LundType)
Definition Pdt.cxx:384
static void addParticle(const char *pname, PdtGeant::GeantType id, float spin, float charge, float mass, float width=0.0, float cut=0.0)
static PdtGeant::GeantType geantId(const int id)
static PdtPdg::PdgType pdgId(const PdtLund::LundType)
Definition Pdt.cxx:532
static PdtPid::PidNeutralType pidNeutId(const PdtLund::LundType)
Definition Pdt.cxx:422
static PdtPid::PidNeutralType pidNeutId(const PdtPdg::PdgType pdg)
static bool sameOrConj(PdtLund::LundType id1, PdtLund::LundType id2)
static PdtPid::PidNeutralType pidNeutId(const int id)
static PdtGeant::GeantType geantId(const PdtPid::PidNeutralType, int charge=0)
static PdtLund::LundType lundId(const PdtPid::PidType, int charge=-1)
static PdtLund::LundType lundId(const PdtGeant::GeantType)
Definition Pdt.cxx:376
static PdtEntry * lookup(const std::string &name)
Definition Pdt.cxx:183
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)
static void deleteAll()
static float spin(PdtLund::LundType id)
static bool sameOrConj(PdtPdg::PdgType id1, PdtPdg::PdgType id2)
static PdtPid::PidNeutralType pidNeutId(const PdtGeant::GeantType)
static void addParticle(const char *pname, PdtLund::LundType id, float spin, float charge, float mass, float width=0.0, float cut=0.0)