ROOT logo
// @(#)$Id: hphysicsconstants.h,v 1.7 2008-09-18 13:09:34 halo Exp $
//*-- Author : Dan Magestro
//*-- Created: 03/09/01
//*-- Copy into Pid lib and changing the class name by Marcin Jaskula
//    15/10/02
//*-- Modified     : 24/02/03 by Marcin Jaskula
//                   new ids for fakes, get rid of TObject
//*-- Modified     : 03/11/06 by Alexander Belyaev
//                   leptonCharge, baryonCharge and strangeness are added

#ifndef HPHYSICSCONSTANTS_H
#define HPHYSICSCONSTANTS_H

// -----------------------------------------------------------------------------

#include "TObject.h"
#include "TString.h"
#include <map>
#include <iostream>
#include <iomanip>
using namespace std;

// -----------------------------------------------------------------------------


class HGeantKine;

// -----------------------------------------------------------------------------
typedef struct  {
    TString  fName;
    Double_t fMass;
    Int_t    fId;
    Int_t    fCharge;
    Int_t    fLeptonCharge;
    Int_t    fBaryonCharge;
    Int_t    fStrangeness;

    Int_t    fLineColor; // eventdisplay
    Int_t    fLineStyle; // eventdisplay

    void fill(Int_t id, TString name, Double_t mass,Int_t chrg,Int_t leptchrg,Int_t barychrg,Int_t strange)
    {
	fName         = name;
	fMass         = mass;
	fId           = id;
	fCharge       = chrg;
	fLeptonCharge = leptchrg;
	fBaryonCharge = barychrg;
	fStrangeness  = strange;
	fLineColor    = 2;
        fLineStyle    = 1;

    }
    void print(){
	cout<<setw(3)<<right<<fId
	    <<" "              <<setw(15)<<left <<fName.Data()
	    <<" mass "         <<setw(10)<<left <<fMass
	    <<" chrg "         <<setw(3) <<right<<fCharge
	    <<" lepton chrg "  <<setw(3) <<right<<fLeptonCharge
	    <<" baryon chrg "  <<setw(3) <<right<<fBaryonCharge
	    <<" strangeness "  <<setw(3) <<right<<fStrangeness
	    <<" col "          <<setw(3) <<right<<fLineColor
	    <<" style "        <<setw(3) <<right<<fLineStyle
	    <<endl;
    };

} particleproperties;

class HPhysicsConstants : public TObject
{

    

    static map<Int_t,particleproperties  >   idToProp;
    static map<TString,particleproperties> nameToProp;
    static map<Int_t,TString>           mGeantProcess;

public:
    static Int_t         pid(const Char_t *pidName);
    static const Char_t* pid(Short_t pid);

    static Int_t       charge(const Int_t id);
    static Int_t       charge(const Char_t *id) { return charge(pid(id)); }

    static Int_t       leptonCharge(const Int_t id);
    static Int_t       leptonCharge(const Char_t *id) { return leptonCharge(pid(id)); }

    static Int_t       baryonCharge(const Int_t id);
    static Int_t       baryonCharge(const Char_t *id) { return baryonCharge(pid(id)); }

    static Int_t       strangeness(const Int_t id);
    static Int_t       strangeness(const Char_t *id) { return strangeness(pid(id)); }

    static Float_t     mass(const Int_t id);
    static Float_t     mass(const Char_t *id)   { return mass(pid(id));   }

    static Int_t       lineColor(const Int_t id);
    static Int_t       lineColor(const Char_t *id)   { return lineColor(pid(id));   }

    static Int_t       lineStyle(const Int_t id);
    static Int_t       lineStyle(const Char_t *id)   { return lineStyle(pid(id));   }

    static Bool_t      isFake(Int_t iId);
    static Bool_t      isArtificial(Int_t iId);

    static const Char_t* geantProcess(Int_t mech);

    static Bool_t      addParticle(Int_t id, TString name, Double_t mass,Int_t chrg,Int_t leptchrg,Int_t barychrg,Int_t strange);
    static Bool_t      addParticle(particleproperties prop);
    static Bool_t      removeParticle(Int_t id);
    static Bool_t      moveParticle(Int_t id,Int_t newid);
    static Bool_t      cpParticle  (Int_t id,Int_t newid,TString newName);
    static void        clearParticles();
    static particleproperties createParticle(Int_t id,TString name, Double_t mass,Int_t chrg,Int_t leptchrg,Int_t barychrg,Int_t strange);

    static void        setGraphic       (Short_t pid, Int_t col, Int_t style);
    static void        setDefaultGraphic(Int_t col, Int_t style);


    static map<Int_t  ,particleproperties> initParticleID();
    static map<TString,particleproperties> initParticleName();
    static map<Int_t,TString>              initGeantProcess();



    static void        loadGeantIons();
    static void        print();

    // -------------------------------------------------------------------------

    static Short_t     artificialPos(void)  { return pid("artifical+"); }
    static Short_t     artificialNeg(void)  { return pid("artifical-"); }
    static Short_t     fakePos(void)        { return pid("fake+"); }
    static Short_t     fakeNeg(void)        { return pid("fake-"); }


    // -------------------------------------------------------------------------
    ClassDef(HPhysicsConstants,0)
};

// -----------------------------------------------------------------------------

#endif
 hphysicsconstants.h:1
 hphysicsconstants.h:2
 hphysicsconstants.h:3
 hphysicsconstants.h:4
 hphysicsconstants.h:5
 hphysicsconstants.h:6
 hphysicsconstants.h:7
 hphysicsconstants.h:8
 hphysicsconstants.h:9
 hphysicsconstants.h:10
 hphysicsconstants.h:11
 hphysicsconstants.h:12
 hphysicsconstants.h:13
 hphysicsconstants.h:14
 hphysicsconstants.h:15
 hphysicsconstants.h:16
 hphysicsconstants.h:17
 hphysicsconstants.h:18
 hphysicsconstants.h:19
 hphysicsconstants.h:20
 hphysicsconstants.h:21
 hphysicsconstants.h:22
 hphysicsconstants.h:23
 hphysicsconstants.h:24
 hphysicsconstants.h:25
 hphysicsconstants.h:26
 hphysicsconstants.h:27
 hphysicsconstants.h:28
 hphysicsconstants.h:29
 hphysicsconstants.h:30
 hphysicsconstants.h:31
 hphysicsconstants.h:32
 hphysicsconstants.h:33
 hphysicsconstants.h:34
 hphysicsconstants.h:35
 hphysicsconstants.h:36
 hphysicsconstants.h:37
 hphysicsconstants.h:38
 hphysicsconstants.h:39
 hphysicsconstants.h:40
 hphysicsconstants.h:41
 hphysicsconstants.h:42
 hphysicsconstants.h:43
 hphysicsconstants.h:44
 hphysicsconstants.h:45
 hphysicsconstants.h:46
 hphysicsconstants.h:47
 hphysicsconstants.h:48
 hphysicsconstants.h:49
 hphysicsconstants.h:50
 hphysicsconstants.h:51
 hphysicsconstants.h:52
 hphysicsconstants.h:53
 hphysicsconstants.h:54
 hphysicsconstants.h:55
 hphysicsconstants.h:56
 hphysicsconstants.h:57
 hphysicsconstants.h:58
 hphysicsconstants.h:59
 hphysicsconstants.h:60
 hphysicsconstants.h:61
 hphysicsconstants.h:62
 hphysicsconstants.h:63
 hphysicsconstants.h:64
 hphysicsconstants.h:65
 hphysicsconstants.h:66
 hphysicsconstants.h:67
 hphysicsconstants.h:68
 hphysicsconstants.h:69
 hphysicsconstants.h:70
 hphysicsconstants.h:71
 hphysicsconstants.h:72
 hphysicsconstants.h:73
 hphysicsconstants.h:74
 hphysicsconstants.h:75
 hphysicsconstants.h:76
 hphysicsconstants.h:77
 hphysicsconstants.h:78
 hphysicsconstants.h:79
 hphysicsconstants.h:80
 hphysicsconstants.h:81
 hphysicsconstants.h:82
 hphysicsconstants.h:83
 hphysicsconstants.h:84
 hphysicsconstants.h:85
 hphysicsconstants.h:86
 hphysicsconstants.h:87
 hphysicsconstants.h:88
 hphysicsconstants.h:89
 hphysicsconstants.h:90
 hphysicsconstants.h:91
 hphysicsconstants.h:92
 hphysicsconstants.h:93
 hphysicsconstants.h:94
 hphysicsconstants.h:95
 hphysicsconstants.h:96
 hphysicsconstants.h:97
 hphysicsconstants.h:98
 hphysicsconstants.h:99
 hphysicsconstants.h:100
 hphysicsconstants.h:101
 hphysicsconstants.h:102
 hphysicsconstants.h:103
 hphysicsconstants.h:104
 hphysicsconstants.h:105
 hphysicsconstants.h:106
 hphysicsconstants.h:107
 hphysicsconstants.h:108
 hphysicsconstants.h:109
 hphysicsconstants.h:110
 hphysicsconstants.h:111
 hphysicsconstants.h:112
 hphysicsconstants.h:113
 hphysicsconstants.h:114
 hphysicsconstants.h:115
 hphysicsconstants.h:116
 hphysicsconstants.h:117
 hphysicsconstants.h:118
 hphysicsconstants.h:119
 hphysicsconstants.h:120
 hphysicsconstants.h:121
 hphysicsconstants.h:122
 hphysicsconstants.h:123
 hphysicsconstants.h:124
 hphysicsconstants.h:125
 hphysicsconstants.h:126
 hphysicsconstants.h:127
 hphysicsconstants.h:128
 hphysicsconstants.h:129
 hphysicsconstants.h:130
 hphysicsconstants.h:131
 hphysicsconstants.h:132
 hphysicsconstants.h:133
 hphysicsconstants.h:134
 hphysicsconstants.h:135
 hphysicsconstants.h:136
 hphysicsconstants.h:137
 hphysicsconstants.h:138
 hphysicsconstants.h:139
 hphysicsconstants.h:140
 hphysicsconstants.h:141
 hphysicsconstants.h:142
 hphysicsconstants.h:143