Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:14

0001 // lheh5.h
0002 #ifndef GeneratorInterface_LHEInterface_LHEH5_H
0003 #define GeneratorInterface_LHEInterface_LHEH5_H
0004 
0005 #include <iostream>
0006 #include <string>
0007 #include <vector>
0008 
0009 #include <unistd.h>
0010 
0011 #include "highfive/H5File.hpp"
0012 #include "highfive/H5DataSet.hpp"
0013 
0014 namespace lheh5 {
0015 
0016   struct Particle {
0017     int id, status, mother1, mother2, color1, color2;
0018     double px, py, pz, e, m, lifetime, spin;
0019     // id        .. IDUP
0020     // color1/2  .. ICOLUP firt/second
0021     // mother1/2 .. MOTHUP first/second
0022     // status    .. ISTUP
0023     // px ... m  .. PUP[..]
0024     // lifetime  .. VTIMUP  (UP ... user process)
0025     // spin      .. SPINUP
0026   };
0027 
0028   struct EventHeader {
0029     // Event info
0030     int nparticles;  // corr to NUP
0031     int pid;         // this is all LHAu-::setProcess
0032     double weight;
0033     size_t trials;
0034     double scale;
0035     double rscale;
0036     double fscale;
0037     double aqed;
0038     double aqcd;
0039     int npLO;
0040     int npNLO;
0041   };
0042 
0043   struct Events {
0044     // Lookup
0045     std::vector<size_t> _vstart;
0046     std::vector<size_t> _vend;
0047     // Particles
0048     std::vector<int> _vid;
0049     std::vector<int> _vstatus;
0050     std::vector<int> _vmother1;
0051     std::vector<int> _vmother2;
0052     std::vector<int> _vcolor1;
0053     std::vector<int> _vcolor2;
0054     std::vector<double> _vpx;
0055     std::vector<double> _vpy;
0056     std::vector<double> _vpz;
0057     std::vector<double> _ve;
0058     std::vector<double> _vm;
0059     std::vector<double> _vlifetime;
0060     std::vector<double> _vspin;
0061     // Event info
0062     std::vector<int> _vnparticles;
0063     std::vector<int> _vpid;
0064     std::vector<double> _vweight;
0065     std::vector<size_t> _vtrials;
0066     std::vector<double> _vscale;
0067     std::vector<double> _vrscale;
0068     std::vector<double> _vfscale;
0069     std::vector<double> _vaqed;
0070     std::vector<double> _vaqcd;
0071     std::vector<int> _vnpLO;
0072     std::vector<int> _vnpNLO;
0073     size_t _particle_offset;
0074 
0075     Particle mkParticle(size_t idx) const;
0076     std::vector<Particle> mkEvent(size_t ievent) const;
0077     EventHeader mkEventHeader(int ievent) const;
0078   };
0079 
0080   struct Events2 {
0081     // Lookup
0082     std::vector<size_t> _vstart;
0083     // Particles
0084     std::vector<int> _vid;
0085     std::vector<int> _vstatus;
0086     std::vector<int> _vmother1;
0087     std::vector<int> _vmother2;
0088     std::vector<int> _vcolor1;
0089     std::vector<int> _vcolor2;
0090     std::vector<double> _vpx;
0091     std::vector<double> _vpy;
0092     std::vector<double> _vpz;
0093     std::vector<double> _ve;
0094     std::vector<double> _vm;
0095     std::vector<double> _vlifetime;
0096     std::vector<double> _vspin;
0097     // Event info
0098     std::vector<int> _vnparticles;
0099     std::vector<int> _vpid;
0100     std::vector<double> _vweight;
0101     std::vector<size_t> _vtrials;
0102     std::vector<double> _vscale;
0103     std::vector<double> _vrscale;
0104     std::vector<double> _vfscale;
0105     std::vector<double> _vaqed;
0106     std::vector<double> _vaqcd;
0107     int npLO;
0108     int npNLO;
0109     size_t _particle_offset;
0110 
0111     Particle mkParticle(size_t idx) const;
0112     std::vector<Particle> mkEvent(size_t ievent) const;
0113     EventHeader mkEventHeader(int ievent) const;
0114   };
0115 
0116   Events readEvents(HighFive::Group& g_index,
0117                     HighFive::Group& g_particle,
0118                     HighFive::Group& g_event,
0119                     size_t first_event,
0120                     size_t n_events);
0121   Events2 readEvents(
0122       HighFive::Group& g_particle, HighFive::Group& g_event, size_t first_event, size_t n_events, int npLO, int npNLO);
0123   std::ostream& operator<<(std::ostream& os, Particle const& p);
0124   std::ostream& operator<<(std::ostream& os, EventHeader const& eh);
0125 }  // namespace lheh5
0126 
0127 #endif