Fork me on GitHub

Changeset cf22deb in git for classes/DelphesHepMCReader.cc


Ignore:
Timestamp:
05/07/13 15:27:32 (7 years ago)
Author:
pavel <pavel@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
b68a60f
Parents:
c565aa1
Message:

read momentum and position units from HepMC file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • classes/DelphesHepMCReader.cc

    rc565aa1 rcf22deb  
    7474  fWeightSize = 0;
    7575  fWeight.clear();
     76  fMomentumCoefficient = 1.0;
     77  fPositionCoefficient = 1.0;
    7678  fVertexCounter = -1;
    7779  fInCounter = -1;
     
    98100  map< int, pair< int, int > >::iterator itMotherMap;
    99101  map< int, pair< int, int > >::iterator itDaughterMap;
    100   char key;
     102  char key, momentumUnit[4], positionUnit[3];
    101103  int i, rc, state;
    102104  double weight;
     
    156158    }
    157159  }
     160  else if(key == 'U')
     161  {
     162    rc = sscanf(fBuffer + 1, "%3s %2s", momentumUnit, positionUnit);
     163
     164    if(rc != 2)
     165    {
     166      cerr << "** ERROR: " << "invalid units format" << endl;
     167      return kFALSE;
     168    }
     169
     170    if(strncmp(momentumUnit, "GEV", 3) == 0)
     171    {
     172      fMomentumCoefficient = 1.0;
     173    }
     174    else if(strncmp(momentumUnit, "MEV", 3) == 0)
     175    {
     176      fMomentumCoefficient = 0.001;
     177    }
     178   
     179    if(strncmp(positionUnit, "MM", 3) == 0)
     180    {
     181      fPositionCoefficient = 1.0;
     182    }
     183    else if(strncmp(positionUnit, "CM", 3) == 0)
     184    {
     185      fPositionCoefficient = 10.0;
     186    }
     187  }
    158188  else if(key == 'F')
    159189  {
     
    311341
    312342  candidate->Momentum.SetPxPyPzE(fPx, fPy, fPz, fE);
     343  if(fMomentumCoefficient != 1.0)
     344  {
     345    candidate->Momentum *= fMomentumCoefficient;
     346  }
    313347
    314348  candidate->M2 = 1;
     
    323357    candidate->M1 = fOutVertexCode;
    324358    candidate->Position.SetXYZT(fX, fY, fZ, fT);
     359    if(fPositionCoefficient != 1.0)
     360    {
     361      candidate->Position *= fPositionCoefficient;
     362    }
    325363  }
    326364  if(fInVertexCode < 0)
Note: See TracChangeset for help on using the changeset viewer.