6 #include "EVENT/LCIO.h" 
   13 using namespace EVENT;
 
   16 #define IDRUP_NAME "_idrup"  
   17 #define EVTWGT_NAME "_weight"  
   21 LCStdHepRdrNew::LCStdHepRdrNew(
const char* evfile) {
 
   26     if (_reader->getError()) {
 
   28         description << 
"LCStdHepRdrNew: no stdhep file: " << evfile << 
std::ends;
 
   35 LCStdHepRdrNew::~LCStdHepRdrNew() {
 
   44         _reader->printFileHeader();
 
   52         throw EVENT::Exception(
" LCStdHepRdrNew::updateEvent - null pointer for event ");
 
   77     if (_writeEventNumber) {
 
   78         std::cout << 
"LCStdHepRdrNew: setting event number " << _reader->evtNum() 
 
   89     double c_light = 299.792;  
 
   95     int errorcode = _reader->readEvent();
 
  102             description << 
"LCStdHepRdrNew::readEvent: error when reading event: " << errorcode << 
std::ends;
 
  131     int NHEP = _reader->nTracks();
 
  134     long idrup = _reader->idrup();
 
  156     double evtWeight = _reader->eventweight();
 
  162     for (
int IHEP = 0; IHEP < NHEP; IHEP++) {
 
  169         mcVec->
at(IHEP) = mcp;
 
  174         mcp->
setPDG(_reader->pid(IHEP));
 
  184     float p0[3] = {(float)_reader->Px(IHEP),(float)_reader->Py(IHEP),(float)_reader->Pz(IHEP)};
 
  189         mcp->
setMass(_reader->M(IHEP));
 
  193         double v0[3] = { _reader->X(IHEP), _reader->Y(IHEP), _reader->Z(IHEP) };
 
  206         mcp->
setTime(_reader->T(IHEP) / c_light);
 
  209         if (_reader->isStdHepEv4()) {
 
  211       float spin[3] = {(float) _reader->spinX( IHEP ) ,(float) _reader->spinY( IHEP ) , (float) _reader->spinZ( IHEP )   } ;
 
  214         int colorFlow[2] = {  (int)_reader->colorflow( IHEP , 0 ) ,  (int)_reader->colorflow( IHEP , 1 ) } ;
 
  293     for (
int IHEP = 0; IHEP < NHEP; IHEP++) {
 
  302         int fd = _reader->daughter1(IHEP) % 10000 - 1;
 
  303         int ld = _reader->daughter2(IHEP) % 10000 - 1;
 
  313         if ((fd > -1) && (ld > -1)) {
 
  315                 for (
int id = fd; 
id < ld + 1; 
id++) {
 
  323                     for (
int ip = 0; ip < np; ip++) {
 
  342                 for (
int ip = 0; ip < np; ip++) {
 
  352                 for (
int ip = 0; ip < np; ip++) {
 
  360         } 
else if (fd > -1) {
 
  366                 for (
int ip = 0; ip < np; ip++) {
 
  414     for (
int IHEP = 0; IHEP < NHEP; IHEP++) {
 
  425         if ((nic > 0) && (mcp->
getPDG() == 94)) {
 
  428             int parentid = _reader->mother1(IHEP) % 10000 - 1;
 
  429             int firstdau = _reader->daughter1(IHEP) % 10000 - 1;
 
  430             int lastdau = _reader->daughter2(IHEP) % 10000 - 1;
 
  431             unsigned outn = ( ( lastdau-firstdau +1 ) > 0 ?  lastdau-firstdau +1  : 0 ) ;
 
  437             for (
unsigned int nextparentid = parentid; IHEP - nextparentid > 0; nextparentid++) {
 
  461     for (
int IHEP = 0; IHEP < NHEP; IHEP++) {
 
  462         int mom1 = _reader->mother1(IHEP) - 1;
 
  463         int mom2 = _reader->mother2(IHEP) - 1;
 
  467         if (mom1 > 0 && mom2 == -1) {
 
  474         } 
else if (mom1 > -1 && mom2 > -1) {
 
  475             for (
int i = mom1; i <= mom2; i++) {
 
  489 int LCStdHepRdrNew::threeCharge(
int pdgID)
 const {
 
  497         nj = 1, nq3, nq2, nq1, nl, nr, n, n8, n9, n10
 
  502     unsigned short q1, q2, q3;
 
  503     static const int ch100[100] = { -1, 2, -1, 2, -1, 2, -1, 2, 0, 0, -3, 0, -3, 0, -3, 0, -3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
 
  504             0, 0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 3, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 
  505             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 
  508     ida = (pdgID < 0) ? -pdgID : pdgID;
 
  514     q1 = (ida / ((int) 
std::pow(10.0, (nq1 - 1)))) % 10;
 
  515     q2 = (ida / ((int) 
std::pow(10.0, (nq2 - 1)))) % 10;
 
  516     q3 = (ida / ((int) 
std::pow(10.0, (nq3 - 1)))) % 10;
 
  520     short dig_n9 = (ida / ((int) 
std::pow(10.0, (n9 - 1)))) % 10;
 
  521     short dig_n10 = (ida / ((int) 
std::pow(10.0, (n10 - 1)))) % 10;
 
  523     if ((dig_n10 == 1) && (dig_n9 == 0)) {
 
  526     } 
else if (q2 == 0 && q1 == 0) {
 
  529     } 
else if (ida <= 102) {
 
  538     int extraBits = ida / 10000000;
 
  541     short dig_nj = (ida / ((int) 
std::pow(10.0, (nj - 1)))) % 10;
 
  543     if (ida == 0 || extraBits > 0) {      
 
  545     } 
else if (sid > 0 && sid <= 100) { 
 
  546         charge = ch100[sid - 1];
 
  547         if (ida == 1000017 || ida == 1000018) {
 
  550         if (ida == 1000034 || ida == 1000052) {
 
  553         if (ida == 1000053 || ida == 1000054) {
 
  556         if (ida == 5100061 || ida == 5100062) {
 
  559     } 
else if (dig_nj == 0) {       
 
  561     } 
else if (q1 == 0) {           
 
  562         if (q2 == 3 || q2 == 5) {
 
  563             charge = ch100[q3 - 1] - ch100[q2 - 1];
 
  565             charge = ch100[q2 - 1] - ch100[q3 - 1];
 
  567     } 
else if (q3 == 0) {           
 
  568         charge = ch100[q2 - 1] + ch100[q1 - 1];
 
  570         charge = ch100[q3 - 1] + ch100[q2 - 1] + ch100[q1 - 1];
 
  574     } 
else if (pdgID < 0) {
 
Base exception class for LCIO - all other exceptions extend this. 
virtual EVENT::LCParameters & parameters()
Parameters defined for this run. 
virtual EVENT::LCObject * getElementAt(int index) const 
Returns pointer to element at index - no range check !. 
void setWeight(double w)
Set the event weight. 
void setTime(float time)
Sets the createion time. 
Implementation of the LCCollection using (inheriting from) an STL vector of LCObjects. 
Implementation of the main event class. 
virtual const EVENT::LCParameters & getParameters() const 
Parameters defined for this run. 
virtual const EVENT::MCParticleVec & getParents() const 
Returns the parents of this particle. 
virtual int getGeneratorStatus() const 
Returns the status for particles from the generator   0 empty line   1 undecayed particle, stable in the generator   2 particle decayed in the generator   3 documentation line. 
void setGeneratorStatus(int status)
Sets the Generator status. 
void addParent(EVENT::MCParticle *mom)
Adds a parent particle. 
virtual void addCollection(EVENT::LCCollection *col, const std::string &name)
Adds a collection with the given name (has to be a valid C/C++ variable name). 
void setColorFlow(const int cflow[2])
Sets the color flow. 
void setSimulatorStatus(int status)
Sets the Simulator status. 
void setEventNumber(int en)
Sets the event number. 
void setMass(float m)
Sets the mass. 
void setMomentum(const float p[3])
Sets the momentum. 
IOException used for reading/writing errors. 
void setVertex(const double vtx[3])
Sets the production vertex. 
virtual void setValue(const std::string &key, int value)=0
Set integer value for the given key. 
virtual float getFloatVal(const std::string &key) const =0
Returns the first float value for the given key. 
void setCharge(float c)
Sets the charge. 
virtual const EVENT::MCParticleVec & getDaughters() const 
Returns the daughters of this particle. 
virtual EVENT::LCParameters & parameters()
Parameters defined for this run. 
void setPDG(int pdg)
Sets the parent. 
virtual int getIntVal(const std::string &key) const =0
Returns the first integer value for the given key. 
EndOfDataException for signaling the end of a data stream. 
void setSpin(const float spin[3])
Sets the spin. 
virtual int getPDG() const 
Returns the number of daughters of this particle. 
Implementation of MCParticle.