Fork me on GitHub

Changeset 59abd43 in git for classes/DelphesHepMCReader.cc


Ignore:
Timestamp:
May 1, 2013, 7:29:33 PM (12 years ago)
Author:
pavel <pavel@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
9f6c8c4
Parents:
52db26b
Message:

add weight for HepMCEvent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • classes/DelphesHepMCReader.cc

    r52db26b r59abd43  
    2020
    2121#include <map>
     22#include <vector>
    2223
    2324#include <stdio.h>
     
    6970void DelphesHepMCReader::Clear()
    7071{
     72  fStateSize = 0;
     73  fState.clear();
     74  fWeightSize = 0;
     75  fWeight.clear();
    7176  fVertexCounter = -1;
    7277  fInCounter = -1;
     
    9499  map< int, pair< int, int > >::iterator itDaughterMap;
    95100  char key;
    96   int rc;
     101  int i, rc, state;
     102  double weight;
    97103
    98104  if(!fgets(fBuffer, kBufferSize, fInputFile)) return kFALSE;
     
    113119      && bufferStream.ReadInt(fProcessID)
    114120      && bufferStream.ReadInt(fSignalCode)
    115       && bufferStream.ReadInt(fVertexCounter);
     121      && bufferStream.ReadInt(fVertexCounter)
     122      && bufferStream.ReadInt(fBeamCode[0])
     123      && bufferStream.ReadInt(fBeamCode[1])
     124      && bufferStream.ReadInt(fStateSize);
     125
     126    if(!rc)
     127    {
     128      cerr << "** ERROR: " << "invalid event format" << endl;
     129      return kFALSE;
     130    }
     131
     132    for(i = 0; i < fStateSize; ++i)
     133    {
     134      rc = rc && bufferStream.ReadInt(state);
     135      fState.push_back(state);
     136    }
     137
     138    rc = rc && bufferStream.ReadInt(fWeightSize);
     139
     140    if(!rc)
     141    {
     142      cerr << "** ERROR: " << "invalid event format" << endl;
     143      return kFALSE;
     144    }
     145
     146    for(i = 0; i < fWeightSize; ++i)
     147    {
     148      rc = rc && bufferStream.ReadDbl(weight);
     149      fWeight.push_back(weight);
     150    }
    116151
    117152    if(!rc)
     
    236271  element->ProcessID = fProcessID;
    237272  element->MPI = fMPI;
     273  element->Weight = fWeight.size() > 0 ? fWeight[0] : 1.0;
    238274  element->Scale = fScale;
    239275  element->AlphaQED = fAlphaQED;
Note: See TracChangeset for help on using the changeset viewer.