Fork me on GitHub

Changeset 380 in svn for trunk/src


Ignore:
Timestamp:
May 12, 2009, 9:47:12 AM (16 years ago)
Author:
Xavier Rouby
Message:

new PDG table

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/BFieldProp.cc

    r294 r380  
    3131
    3232#include "BFieldProp.h"
     33#include "PdgParticle.h"
    3334#include "SystemOfUnits.h"
    3435#include "PhysicalConstants.h"
     
    131132  if (!DET->FLAG_bfield ) return;
    132133
    133   q  = ChargeVal(Part->PID) *eplus; // in units of 'e'
     134  double M;
     135  //int q1  = ChargeVal(Part->PID) *eplus; // in units of 'e'
     136  if(Part->M < -999) { // unitialised!
     137     PdgParticle pdg_part = DET->PDGtable[Part->PID];
     138     q  = pdg_part.charge() *eplus; // in units of 'e'
     139     M  = pdg_part.mass(); // GeV
     140  } else  { q = Part->Charge; M = Part->M; }
     141
    134142  if(q==0) return;
    135143  if(R_max==0) { cout << "ERROR: magnetic field has no lateral extention\n"; return;}
     
    165173    double PT = Part->PT;
    166174    double E  = Part->E;              // [GeV]
    167     double M  = Part->M;              // [GeV]/c²
     175    //double M  = Part->M;            // [GeV]/c²
    168176      double Phi = UNDEFINED;
    169177
     
    477485  double p  = sqrt(pz*pz + pt*pt); //sqrt(px*px+py*py+pz*pz);
    478486 
    479   double M  = Part->M;
     487  //double M  = Part->M; // see above
    480488  double vx = px/M;
    481489  double vy = py/M;
  • trunk/src/HEPEVTConverter.cc

    r352 r380  
    169169
    170170
    171 HEPEVTConverter::HEPEVTConverter(const string& inputFileList, const string& outputFileName, const int& Nevents) : DataConverter(Nevents)
     171HEPEVTConverter::HEPEVTConverter(const string& inputFileList, const string& outputFileName, const PdgTable& pdg, const int& Nevents) : DataConverter(pdg,Nevents)
    172172{
    173173  string buffer;
  • trunk/src/HepMCConverter.cc

    r376 r380  
    3636#include "BlockClasses.h"
    3737
    38 #include "SmearUtil.h"
     38#include "PdgParticle.h"
    3939#include "ExRootTreeWriter.h"
    4040#include "ExRootTreeBranch.h"
     
    197197      element->D1 = da1;
    198198      element->D2 = da2;
    199       element->Charge = ChargeVal(pid);
    200199
    201200      element->E = index_to_particle[n]->momentum().e();
     
    203202      element->Py = index_to_particle[n]->momentum().py();
    204203      element->Pz = index_to_particle[n]->momentum().pz();
    205       element->M =  index_to_particle[n]->momentum().m();
    206 
    207       float PT = sqrt(pow(element->Px,2)+pow(element->Py,2));
    208       element->PT = PT;
     204
     205
     206      //cout << "element->PID = " << pid << "\t";
     207      //PdgParticle pdg_part(PdgID[pid]);
     208      //element->M =  index_to_particle[n]->momentum().m(); // this is the particle virtuality, not its rest mass
     209      //element->M      = pdg_part.mass();
     210      //element->Charge = pdg_part.charge();
     211      //cout << "element->M = " << element->M << " \t element->Charge = " << element->Charge << endl;
     212
     213      element->PT = sqrt(pow(element->Px,2)+pow(element->Py,2));
    209214
    210215      momentum.SetPxPyPzE(element->Px, element->Py, element->Pz, element->E);
     
    256261//------------------------------------------------------------------------------
    257262
    258 HepMCConverter::HepMCConverter(const string& inputFileList, const string& outputFileName, const int& Nevents) : DataConverter(Nevents)
     263HepMCConverter::HepMCConverter(const string& inputFileList, const string& outputFileName, const PdgTable& pdg, const int& Nevents) : DataConverter(pdg,Nevents)
    259264{
    260265 
  • trunk/src/LHEFConverter.cc

    r369 r380  
    3939#include "BlockClasses.h"
    4040#include "LHEFConverter.h"
     41#include "SmearUtil.h"
     42#include "PdgParticle.h"
    4143
    4244using namespace std;
     
    8587    element->Pz = hepeup.PUP[particle][2];
    8688    element->E = hepeup.PUP[particle][3];
    87     element->M = hepeup.PUP[particle][4];
    88 
     89    //element->M = hepeup.PUP[particle][4];
     90    //element->Charge = ChargeVal(element->PID);
     91   
     92    PdgParticle pdg_part = pdg_table[element->PID];
     93    element->Charge = pdg_part.charge();
     94    element->M = pdg_part.mass();
     95   
    8996    momentum.SetPxPyPzE(element->Px, element->Py, element->Pz, element->E);
    9097    element->PT = momentum.Perp();
     
    105112//------------------------------------------------------------------------------
    106113//Nevents not yet implemented! 08.03.2009
    107 LHEFConverter::LHEFConverter(const string& inputFileList, const string& outputFileName, const int& Nevents) :
    108  DataConverter(Nevents) {
     114LHEFConverter::LHEFConverter(const string& inputFileList, const string& outputFileName, const PdgTable& pdg, const int& Nevents) :
     115 DataConverter(pdg,Nevents) {
    109116
    110117  ExRootTreeWriter *treeWriter = new ExRootTreeWriter(outputFileName, "GEN");
  • trunk/src/STDHEPConverter.cc

    r376 r380  
    4141#include "stdhep_declarations.h"
    4242#include "STDHEPConverter.h"
     43#include "PdgParticle.h"
    4344
    4445using namespace std;
     
    7980    element->D1 = myhepevt.jdahep[number][0] - 1;
    8081    element->D2 = myhepevt.jdahep[number][1] - 1;
    81 //    element->Charge = myhepevt.hepchg(element->PID);
    82     element->Charge = ChargeVal(element->PID);
     82    PdgParticle pdg_part = pdg_table[element->PID];
     83    element->Charge = pdg_part.charge();
     84    element->M = pdg_part.mass();
    8385
    8486    element->E = myhepevt.phep[number][3];
     
    8688    element->Py = myhepevt.phep[number][1];
    8789    element->Pz = myhepevt.phep[number][2];
    88     element->M = myhepevt.phep[number][4];
     90    //element->M = myhepevt.phep[number][4];
    8991
    9092    momentum.SetPxPyPzE(element->Px, element->Py, element->Pz, element->E);
     
    111113//------------------------------------------------------------------------------
    112114
    113 STDHEPConverter::STDHEPConverter(const string& inputFileList, const string& outputFileName, const int& Nevents) : DataConverter(Nevents)
     115STDHEPConverter::STDHEPConverter(const string& inputFileList, const string& outputFileName, const PdgTable& pdg, const int& Nevents) : DataConverter(pdg, Nevents)
    114116{
    115117  int ierr, entryType;
  • trunk/src/SmearUtil.cc

    r376 r380  
    4242#include <sstream>
    4343#include <iomanip>
     44#include <map>
    4445using namespace std;
    4546
     
    195196  RP_cross_y        = 0.0;
    196197  RP_cross_ang      = 142.5;
     198
     199  PdgTableFilename  = "data/particle.tbl";
    197200 
    198201}
     
    332335
    333336  PT_QUARKS_MIN    = DET.PT_QUARKS_MIN;
     337  PdgTableFilename = DET.PdgTableFilename;
     338  PDGtable         = DET.PDGtable;
    334339}
    335340
     
    468473
    469474  PT_QUARKS_MIN    = DET.PT_QUARKS_MIN;
     475
     476  PdgTableFilename = DET.PdgTableFilename;
     477  PDGtable         = DET.PDGtable;
    470478  return *this;
    471479}
     
    577585    else if(strstr(temp_string.c_str(),"FLAG_lhco"))        {curstring >> varname >> ivalue; FLAG_lhco        = ivalue;}
    578586    else if(strstr(temp_string.c_str(),"NEvents_Frog"))     {curstring >> varname >> ivalue; NEvents_Frog     = ivalue;}
     587
     588    else if(strstr(temp_string.c_str(),"PdgTableFilename"))     {curstring >> varname >> svalue; PdgTableFilename = svalue;}
    579589  }
    580590 
     
    657667  f_out <<"**********************************************************************"<< endl;
    658668  f_out <<"**                                                                  **"<< endl;
    659   f_out<<"#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n";
     669  f_out<<"#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n";
     670  f_out<<"#  Input PDG table : " << PdgTableFilename << "                               *"<<"\n";
     671  f_out<<"*                                                                    *"<<"\n";
    660672  f_out<<"*                                                                    *"<<"\n";
    661673  f_out<<"#********************************                                    *"<<"\n";
     
    12801292int ChargeVal(const int pid)
    12811293{
     1294  cout << "ChargeVal :: deprecated function, do not use it anymore" << endl;
    12821295  int charge;
    12831296  if(
     
    12951308           
    12961309}
     1310
     1311//------------------------------------------------------------------------------
     1312void RESOLution::ReadParticleDataGroupTable() {
     1313
     1314  string temp_string;
     1315  istringstream curstring;
     1316
     1317  ifstream fichier_a_lire(PdgTableFilename.c_str());
     1318  if(!fichier_a_lire.good()) {
     1319    cout <<"**        ERROR: PDG Table ("<< PdgTableFilename
     1320         <<  ") not found! exit.                        **" << endl;
     1321    exit(1);
     1322    return;
     1323  }
     1324  // first three lines of the file are useless
     1325  getline(fichier_a_lire,temp_string);
     1326  getline(fichier_a_lire,temp_string);
     1327  getline(fichier_a_lire,temp_string);
     1328
     1329
     1330  while (getline(fichier_a_lire,temp_string)) {
     1331    curstring.clear(); // needed when using several times istringstream::str(string)
     1332    curstring.str(temp_string);
     1333    int ID; string name; int charge; float mass; float width; float lifetime;
     1334    // ID name   chg       mass    total width   lifetime
     1335    //  1 d      -1      0.33000     0.00000   0.00000E+00
     1336    curstring >> ID >> name >> charge >> mass >> width >> lifetime;
     1337    PdgParticle particle(ID,name,mass,charge/3.,width,lifetime);
     1338    PDGtable.insert(ID,particle);
     1339    //PdgTable.insert(pair<int,PdgParticle>(ID,particle));
     1340    //cout << PDGtable[ID].name() <<  "\t" << PDGtable[ID].mass() << "\t" << PDGtable[ID].charge() << endl;
     1341  }
     1342 
     1343} // ReadParticleDataGroupTable
Note: See TracChangeset for help on using the changeset viewer.