Macro to compare masses in ROOT data base to the values from pdg pdg.
The ROOT values are read in by TDatabasePDG from $ROOTSYS/etc/pdg_table.txt
Processing /mnt/build/workspace/root-makedoc-v608/rootspi/rdoc/src/v6-08-00-patches/tutorials/mc/CompareMasses.C...
a_00 10111 pdg mass 1.474000E+00 pdg err 1.900000E-02 root Mass 9.835000E-01 >> deltaM 4.905000E-01 = 33.277%
a_0+ 10211 pdg mass 1.474000E+00 pdg err 1.900000E-02 root Mass 9.835000E-01 >> deltaM 4.905000E-01 = 33.277%
void CompareMasses()
{
massWidthFile.
ReplaceAll(
"CompareMasses.C",
"mass_width_2008.mc.txt");
FILE* file = fopen(massWidthFile.
Data(),
"r");
if (!file){
Printf(
"Could not open PDG particle file %s", massWidthFile.
Data());
return;
}
char c[200];
char cempty;
while (fgets(c, 200, file)) {
if (c[0] != '*' && c[0] !='W') {
sscanf(&c[1], "%8d", &pdg[0]);
pdg[1] = 0;
for(int i = 0;i<8;i++){
sscanf(&c[9+i],"%c",&cempty);
if(cempty != ' ')sscanf(&c[9],"%8d",&pdg[1]);
}
pdg[2] = 0;
for(int i = 0;i<8;i++){
sscanf(&c[17+i],"%c",&cempty);
if(cempty != ' ')sscanf(&c[17],"%8d",&pdg[2]);
}
pdg[3] = 0;
for(int i = 0;i<8;i++){
sscanf(&c[25+i],"%c",&cempty);
if(cempty != ' ')sscanf(&c[25],"%8d",&pdg[3]);
}
sscanf(&c[35],"%14f",&mass);
sscanf(&c[50],"%8f",&err1);
sscanf(&c[50],"%8f",&err2);
for(int ipdg = 0;ipdg < 4;ipdg++){
if(pdg[ipdg]==0)continue;
if(partRoot){
if (mass != 0.0 && deltaM/mass>1E-05){
ndiff++;
Printf(
"%10s %8d pdg mass %E pdg err %E root Mass %E >> deltaM %E = %3.3f%%",partRoot->
GetName(),pdg[ipdg],mass,err,massRoot,deltaM,100.*deltaM/mass);
}
}
}
}
}
fclose(file);
if (ndiff == 0)
Printf(
"Crongratulations !! All particles in ROOT and PDG have identical masses");
}
- Author
- Christian.Klein-Boesing
Definition in file CompareMasses.C.