Fork me on GitHub

Changeset b4786d3 in git for classes


Ignore:
Timestamp:
May 25, 2021, 7:33:19 PM (3 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
master
Children:
c1780a5
Parents:
f76741a
Message:

add DelphesHepMC3

Location:
classes
Files:
2 added
2 edited
2 moved

Legend:

Unmodified
Added
Removed
  • classes/DelphesHepMC2Reader.cc

    rf76741a rb4786d3  
    1717 */
    1818
    19 /** \class DelphesHepMCReader
     19/** \class DelphesHepMC2Reader
    2020 *
    2121 *  Reads HepMC file
     
    2525 */
    2626
    27 #include "classes/DelphesHepMCReader.h"
     27#include "classes/DelphesHepMC2Reader.h"
    2828
    2929#include <iostream>
     
    5454//---------------------------------------------------------------------------
    5555
    56 DelphesHepMCReader::DelphesHepMCReader() :
     56DelphesHepMC2Reader::DelphesHepMC2Reader() :
    5757  fInputFile(0), fBuffer(0), fPDG(0),
    5858  fVertexCounter(-1), fInCounter(-1), fOutCounter(-1),
     
    6666//---------------------------------------------------------------------------
    6767
    68 DelphesHepMCReader::~DelphesHepMCReader()
     68DelphesHepMC2Reader::~DelphesHepMC2Reader()
    6969{
    7070  if(fBuffer) delete[] fBuffer;
     
    7373//---------------------------------------------------------------------------
    7474
    75 void DelphesHepMCReader::SetInputFile(FILE *inputFile)
     75void DelphesHepMC2Reader::SetInputFile(FILE *inputFile)
    7676{
    7777  fInputFile = inputFile;
     
    8080//---------------------------------------------------------------------------
    8181
    82 void DelphesHepMCReader::Clear()
     82void DelphesHepMC2Reader::Clear()
    8383{
    8484  fStateSize = 0;
     
    9898//---------------------------------------------------------------------------
    9999
    100 bool DelphesHepMCReader::EventReady()
     100bool DelphesHepMC2Reader::EventReady()
    101101{
    102102  return (fVertexCounter == 0) && (fInCounter == 0) && (fOutCounter == 0);
     
    105105//---------------------------------------------------------------------------
    106106
    107 bool DelphesHepMCReader::ReadBlock(DelphesFactory *factory,
     107bool DelphesHepMC2Reader::ReadBlock(DelphesFactory *factory,
    108108  TObjArray *allParticleOutputArray,
    109109  TObjArray *stableParticleOutputArray,
     
    202202    }
    203203  }
    204 
    205204  else if(key == 'C')
    206205  {
    207206    rc = bufferStream.ReadDbl(fCrossSection)
    208207      && bufferStream.ReadDbl(fCrossSectionError);
    209   }
    210 
     208
     209    if(!rc)
     210    {
     211      cerr << "** ERROR: "
     212           << "invalid cross section format" << endl;
     213      return kFALSE;
     214    }
     215  }
    211216  else if(key == 'F')
    212217  {
     
    317322//---------------------------------------------------------------------------
    318323
    319 void DelphesHepMCReader::AnalyzeEvent(ExRootTreeBranch *branch, long long eventNumber,
     324void DelphesHepMC2Reader::AnalyzeEvent(ExRootTreeBranch *branch, long long eventNumber,
    320325  TStopwatch *readStopWatch, TStopwatch *procStopWatch)
    321326{
     
    348353//---------------------------------------------------------------------------
    349354
    350 void DelphesHepMCReader::AnalyzeWeight(ExRootTreeBranch *branch)
     355void DelphesHepMC2Reader::AnalyzeWeight(ExRootTreeBranch *branch)
    351356{
    352357  Weight *element;
     
    363368//---------------------------------------------------------------------------
    364369
    365 void DelphesHepMCReader::AnalyzeParticle(DelphesFactory *factory,
     370void DelphesHepMC2Reader::AnalyzeParticle(DelphesFactory *factory,
    366371  TObjArray *allParticleOutputArray,
    367372  TObjArray *stableParticleOutputArray,
     
    430435//---------------------------------------------------------------------------
    431436
    432 void DelphesHepMCReader::FinalizeParticles(TObjArray *allParticleOutputArray)
     437void DelphesHepMC2Reader::FinalizeParticles(TObjArray *allParticleOutputArray)
    433438{
    434439  Candidate *candidate;
  • classes/DelphesHepMC2Reader.h

    rf76741a rb4786d3  
    1717 */
    1818
    19 #ifndef DelphesHepMCReader_h
    20 #define DelphesHepMCReader_h
     19#ifndef DelphesHepMC2Reader_h
     20#define DelphesHepMC2Reader_h
    2121
    22 /** \class DelphesHepMCReader
     22/** \class DelphesHepMC2Reader
    2323 *
    2424 *  Reads HepMC file
     
    3939class DelphesFactory;
    4040
    41 class DelphesHepMCReader
     41class DelphesHepMC2Reader
    4242{
    4343public:
    44   DelphesHepMCReader();
    45   ~DelphesHepMCReader();
     44  DelphesHepMC2Reader();
     45  ~DelphesHepMC2Reader();
    4646
    4747  void SetInputFile(FILE *inputFile);
     
    102102};
    103103
    104 #endif // DelphesHepMCReader_h
     104#endif // DelphesHepMC2Reader_h
  • classes/DelphesStream.cc

    rf76741a rb4786d3  
    106106
    107107//------------------------------------------------------------------------------
     108
     109bool DelphesStream::FindChr(int value)
     110{
     111  char *position;
     112  bool result = false;
     113
     114  position = strchr(fBuffer, value);
     115
     116  if(position)
     117  {
     118    result = true;
     119    fBuffer = position + 1;
     120  }
     121
     122  return result;
     123}
     124
     125//------------------------------------------------------------------------------
     126
     127bool DelphesStream::FindStr(const char *value)
     128{
     129  char *position;
     130  bool result = false;
     131
     132  position = strstr(fBuffer, value);
     133
     134  if(position)
     135  {
     136    result = true;
     137    fBuffer = position + strlen(value);
     138  }
     139
     140  return result;
     141}
     142
     143//------------------------------------------------------------------------------
  • classes/DelphesStream.h

    rf76741a rb4786d3  
    3535  bool ReadDbl(double &value);
    3636  bool ReadInt(int &value);
     37  bool FindChr(int value);
     38  bool FindStr(const char *value);
    3739
    3840private:
Note: See TracChangeset for help on using the changeset viewer.