CMS 3D CMS Logo

Classes | Functions
lheh5 Namespace Reference

Classes

struct  EventHeader
 
struct  Events
 
struct  Events2
 
struct  Particle
 

Functions

std::ostream & operator<< (std::ostream &os, EventHeader const &eh)
 
std::ostream & operator<< (std::ostream &os, Particle const &p)
 
Events readEvents (HighFive::Group &g_index, HighFive::Group &g_particle, HighFive::Group &g_event, size_t first_event, size_t n_events)
 
Events2 readEvents (HighFive::Group &g_particle, HighFive::Group &g_event, size_t first_event, size_t n_events, int npLO, int npNLO)
 

Function Documentation

◆ operator<<() [1/2]

std::ostream & lheh5::operator<< ( std::ostream &  os,
EventHeader const &  eh 
)
inline

Definition at line 10 of file lheh5.cc.

10  {
11  os << "\tnparticles: " << eh.nparticles << " procid: " << eh.pid << " weight: " << eh.weight
12  << " trials: " << eh.trials << "\n";
13  os << "\tscale: " << eh.scale << " rscale: " << eh.rscale << " fscale: " << eh.fscale << " aqed: " << eh.aqed
14  << " aqcd: " << eh.aqcd << "\n";
15  os << "\tnpLO: " << eh.npLO << " npNLO: " << eh.npNLO << "\n";
16  return os;
17  }

References lheh5::EventHeader::aqcd, lheh5::EventHeader::aqed, lheh5::EventHeader::fscale, lheh5::EventHeader::nparticles, lheh5::EventHeader::npLO, lheh5::EventHeader::npNLO, lheh5::EventHeader::pid, lheh5::EventHeader::rscale, lheh5::EventHeader::scale, lheh5::EventHeader::trials, and lheh5::EventHeader::weight.

◆ operator<<() [2/2]

std::ostream & lheh5::operator<< ( std::ostream &  os,
Particle const &  p 
)
inline

Definition at line 5 of file lheh5.cc.

5  {
6  os << "\tpx: " << p.px << " py: " << p.py << " pz: " << p.pz << " e: " << p.e << "\n";
7  return os;
8  }

References AlCaHLTBitMon_ParallelJobs::p.

◆ readEvents() [1/2]

Events lheh5::readEvents ( HighFive::Group &  g_index,
HighFive::Group &  g_particle,
HighFive::Group &  g_event,
size_t  first_event,
size_t  n_events 
)

Definition at line 68 of file lheh5.cc.

72  {
73  // Lookup
74  std::vector<size_t> _vstart, _vend;
75  // Particles
76  std::vector<int> _vid, _vstatus, _vmother1, _vmother2, _vcolor1, _vcolor2;
77  std::vector<double> _vpx, _vpy, _vpz, _ve, _vm, _vlifetime, _vspin;
78  // Event info
79  std::vector<int> _vnparticles, _vpid, _vnpLO, _vnpNLO;
80  std::vector<size_t> _vtrials;
81  std::vector<double> _vweight, _vscale, _vrscale, _vfscale, _vaqed, _vaqcd;
82 
83  //double starttime, endtime;
84  //starttime = MPI_Wtime();
85  // Lookup
86  HighFive::DataSet _start = g_index.getDataSet("start");
87  HighFive::DataSet _end = g_index.getDataSet("end");
88  // Particles
89  HighFive::DataSet _id = g_particle.getDataSet("id");
90  HighFive::DataSet _status = g_particle.getDataSet("status");
91  HighFive::DataSet _mother1 = g_particle.getDataSet("mother1");
92  HighFive::DataSet _mother2 = g_particle.getDataSet("mother2");
93  HighFive::DataSet _color1 = g_particle.getDataSet("color1");
94  HighFive::DataSet _color2 = g_particle.getDataSet("color2");
95  HighFive::DataSet _px = g_particle.getDataSet("px");
96  HighFive::DataSet _py = g_particle.getDataSet("py");
97  HighFive::DataSet _pz = g_particle.getDataSet("pz");
98  HighFive::DataSet _e = g_particle.getDataSet("e");
99  HighFive::DataSet _m = g_particle.getDataSet("m");
100  HighFive::DataSet _lifetime = g_particle.getDataSet("lifetime");
101  HighFive::DataSet _spin = g_particle.getDataSet("spin");
102  // Event info
103  HighFive::DataSet _nparticles = g_event.getDataSet("nparticles");
104  HighFive::DataSet _pid = g_event.getDataSet("pid");
105  HighFive::DataSet _weight = g_event.getDataSet("weight");
106  HighFive::DataSet _trials = g_event.getDataSet("trials");
107  HighFive::DataSet _scale = g_event.getDataSet("scale");
108  HighFive::DataSet _rscale = g_event.getDataSet("rscale");
109  HighFive::DataSet _fscale = g_event.getDataSet("fscale");
110  HighFive::DataSet _aqed = g_event.getDataSet("aqed");
111  HighFive::DataSet _aqcd = g_event.getDataSet("aqcd");
112  HighFive::DataSet _npLO = g_event.getDataSet("npLO");
113  HighFive::DataSet _npNLO = g_event.getDataSet("npNLO");
114 
115  //endtime = MPI_Wtime();
116  //printf("DS took %f seconds\n", endtime-starttime);
117  std::vector<size_t> offset_e = {first_event};
118  std::vector<size_t> readsize_e = {n_events};
119  //_vstart.reserve(n_events);
120  //_vend.reserve(n_events);
121 
122  _start.select(offset_e, readsize_e).read(_vstart);
123  _end.select(offset_e, readsize_e).read(_vend);
124  std::vector<size_t> offset_p = {_vstart.front()};
125  std::vector<size_t> readsize_p = {_vend.back() - _vstart.front()};
126 
127  int RESP = _vend.back() - _vstart.front();
128  _vid.reserve(RESP);
129  _vstatus.reserve(RESP);
130  _vmother1.reserve(RESP);
131  _vmother2.reserve(RESP);
132  _vcolor1.reserve(RESP);
133  _vcolor2.reserve(RESP);
134  _vpx.reserve(RESP);
135  _vpy.reserve(RESP);
136  _vpz.reserve(RESP);
137  _ve.reserve(RESP);
138  _vm.reserve(RESP);
139  _vlifetime.reserve(RESP);
140  _vspin.reserve(RESP);
141 
142  _vnparticles.reserve(n_events);
143  _vpid.reserve(n_events);
144  _vweight.reserve(n_events);
145  _vtrials.reserve(n_events);
146  _vscale.reserve(n_events);
147  _vrscale.reserve(n_events);
148  _vfscale.reserve(n_events);
149  _vaqed.reserve(n_events);
150  _vaqcd.reserve(n_events);
151  _vnpLO.reserve(n_events);
152  _vnpNLO.reserve(n_events);
153 
154  //starttime = MPI_Wtime();
155  // This is using HighFive's read
156  _id.select(offset_p, readsize_p).read(_vid);
157  _status.select(offset_p, readsize_p).read(_vstatus);
158  _mother1.select(offset_p, readsize_p).read(_vmother1);
159  _mother2.select(offset_p, readsize_p).read(_vmother2);
160  _color1.select(offset_p, readsize_p).read(_vcolor1);
161  _color2.select(offset_p, readsize_p).read(_vcolor2);
162  _px.select(offset_p, readsize_p).read(_vpx);
163  _py.select(offset_p, readsize_p).read(_vpy);
164  _pz.select(offset_p, readsize_p).read(_vpz);
165  _e.select(offset_p, readsize_p).read(_ve);
166  _m.select(offset_p, readsize_p).read(_vm);
167  _lifetime.select(offset_p, readsize_p).read(_vlifetime);
168  _spin.select(offset_p, readsize_p).read(_vspin);
169 
170  //endtime = MPI_Wtime();
171  //printf("SELP took %f seconds\n", endtime-starttime);
172  //starttime = MPI_Wtime();
173  _nparticles.select(offset_e, readsize_e).read(_vnparticles);
174  _pid.select(offset_e, readsize_e).read(_vpid);
175  _weight.select(offset_e, readsize_e).read(_vweight);
176  _trials.select(offset_e, readsize_e).read(_vtrials);
177  _scale.select(offset_e, readsize_e).read(_vscale);
178  _rscale.select(offset_e, readsize_e).read(_vrscale);
179  _fscale.select(offset_e, readsize_e).read(_vfscale);
180  _aqed.select(offset_e, readsize_e).read(_vaqed);
181  _aqcd.select(offset_e, readsize_e).read(_vaqcd);
182  _npLO.select(offset_e, readsize_e).read(_vnpLO);
183  _npNLO.select(offset_e, readsize_e).read(_vnpNLO);
184  //endtime = MPI_Wtime();
185  //printf("SELE took %f seconds\n", endtime-starttime);
186 
187  return {
188  std::move(_vstart), std::move(_vend), std::move(_vid), std::move(_vstatus), std::move(_vmother1),
189  std::move(_vmother2), std::move(_vcolor1), std::move(_vcolor2), std::move(_vpx), std::move(_vpy),
190  std::move(_vpz), std::move(_ve), std::move(_vm), std::move(_vlifetime), std::move(_vspin),
191  std::move(_vnparticles), std::move(_vpid), std::move(_vweight), std::move(_vtrials), std::move(_vscale),
192  std::move(_vrscale), std::move(_vfscale), std::move(_vaqed), std::move(_vaqcd), std::move(_vnpLO),
193  std::move(_vnpNLO), offset_p[0],
194  };
195  }

References hgcalDigitizer_cfi::_m, EcalDumpRaw_cfi::first_event, and eostools::move().

Referenced by lhef::H5Handler::readBlock().

◆ readEvents() [2/2]

Events2 lheh5::readEvents ( HighFive::Group &  g_particle,
HighFive::Group &  g_event,
size_t  first_event,
size_t  n_events,
int  npLO,
int  npNLO 
)

Definition at line 248 of file lheh5.cc.

249  {
250  // Lookup
251  std::vector<size_t> _vstart;
252  // Particles
253  std::vector<int> _vid, _vstatus, _vmother1, _vmother2, _vcolor1, _vcolor2;
254  std::vector<double> _vpx, _vpy, _vpz, _ve, _vm, _vlifetime, _vspin;
255  // Event info
256  std::vector<int> _vnparticles, _vpid;
257  std::vector<size_t> _vtrials;
258  std::vector<double> _vweight, _vscale, _vrscale, _vfscale, _vaqed, _vaqcd;
259 
260  //double starttime, endtime;
261  // Lookup
262  HighFive::DataSet _start = g_event.getDataSet("start");
263  // Particles
264  HighFive::DataSet _id = g_particle.getDataSet("id");
265  HighFive::DataSet _status = g_particle.getDataSet("status");
266  HighFive::DataSet _mother1 = g_particle.getDataSet("mother1");
267  HighFive::DataSet _mother2 = g_particle.getDataSet("mother2");
268  HighFive::DataSet _color1 = g_particle.getDataSet("color1");
269  HighFive::DataSet _color2 = g_particle.getDataSet("color2");
270  HighFive::DataSet _px = g_particle.getDataSet("px");
271  HighFive::DataSet _py = g_particle.getDataSet("py");
272  HighFive::DataSet _pz = g_particle.getDataSet("pz");
273  HighFive::DataSet _e = g_particle.getDataSet("e");
274  HighFive::DataSet _m = g_particle.getDataSet("m");
275  HighFive::DataSet _lifetime = g_particle.getDataSet("lifetime");
276  HighFive::DataSet _spin = g_particle.getDataSet("spin");
277  // Event info
278  HighFive::DataSet _nparticles = g_event.getDataSet("nparticles");
279  HighFive::DataSet _pid = g_event.getDataSet("pid");
280  HighFive::DataSet _weight = g_event.getDataSet("weight");
281  HighFive::DataSet _trials = g_event.getDataSet("trials");
282  HighFive::DataSet _scale = g_event.getDataSet("scale");
283  HighFive::DataSet _rscale = g_event.getDataSet("rscale");
284  HighFive::DataSet _fscale = g_event.getDataSet("fscale");
285  HighFive::DataSet _aqed = g_event.getDataSet("aqed");
286  HighFive::DataSet _aqcd = g_event.getDataSet("aqcd");
287 
288  std::vector<size_t> offset_e = {first_event};
289  std::vector<size_t> readsize_e = {n_events};
290 
291  // We now know the first event to read
292  _start.select(offset_e, readsize_e).read(_vstart);
293 
294  // That's the first particle
295  std::vector<size_t> offset_p = {_vstart.front()};
296  // The last particle is last entry in start + nparticles of that event
297  _vnparticles.reserve(n_events);
298  _nparticles.select(offset_e, readsize_e).read(_vnparticles);
299 
300  size_t RESP = _vstart.back() - _vstart.front() + _vnparticles.back();
301  std::vector<size_t> readsize_p = {RESP};
302 
303  _vid.reserve(RESP);
304  _vstatus.reserve(RESP);
305  _vmother1.reserve(RESP);
306  _vmother2.reserve(RESP);
307  _vcolor1.reserve(RESP);
308  _vcolor2.reserve(RESP);
309  _vpx.reserve(RESP);
310  _vpy.reserve(RESP);
311  _vpz.reserve(RESP);
312  _ve.reserve(RESP);
313  _vm.reserve(RESP);
314  _vlifetime.reserve(RESP);
315  _vspin.reserve(RESP);
316 
317  _vpid.reserve(n_events);
318  _vweight.reserve(n_events);
319  _vtrials.reserve(n_events);
320  _vscale.reserve(n_events);
321  _vrscale.reserve(n_events);
322  _vfscale.reserve(n_events);
323  _vaqed.reserve(n_events);
324  _vaqcd.reserve(n_events);
325 
326  // This is using HighFive's read
327  _id.select(offset_p, readsize_p).read(_vid);
328  _status.select(offset_p, readsize_p).read(_vstatus);
329  _mother1.select(offset_p, readsize_p).read(_vmother1);
330  _mother2.select(offset_p, readsize_p).read(_vmother2);
331  _color1.select(offset_p, readsize_p).read(_vcolor1);
332  _color2.select(offset_p, readsize_p).read(_vcolor2);
333  _px.select(offset_p, readsize_p).read(_vpx);
334  _py.select(offset_p, readsize_p).read(_vpy);
335  _pz.select(offset_p, readsize_p).read(_vpz);
336  _e.select(offset_p, readsize_p).read(_ve);
337  _m.select(offset_p, readsize_p).read(_vm);
338  _lifetime.select(offset_p, readsize_p).read(_vlifetime);
339  _spin.select(offset_p, readsize_p).read(_vspin);
340 
341  _pid.select(offset_e, readsize_e).read(_vpid);
342  _weight.select(offset_e, readsize_e).read(_vweight);
343  _trials.select(offset_e, readsize_e).read(_vtrials);
344  _scale.select(offset_e, readsize_e).read(_vscale);
345  _rscale.select(offset_e, readsize_e).read(_vrscale);
346  _fscale.select(offset_e, readsize_e).read(_vfscale);
347  _aqed.select(offset_e, readsize_e).read(_vaqed);
348  _aqcd.select(offset_e, readsize_e).read(_vaqcd);
349 
350  return {
351  std::move(_vstart),
352  std::move(_vid),
353  std::move(_vstatus),
354  std::move(_vmother1),
355  std::move(_vmother2),
356  std::move(_vcolor1),
357  std::move(_vcolor2),
358  std::move(_vpx),
359  std::move(_vpy),
360  std::move(_vpz),
361  std::move(_ve),
362  std::move(_vm),
363  std::move(_vlifetime),
364  std::move(_vspin),
365  std::move(_vnparticles),
366  std::move(_vpid),
367  std::move(_vweight),
368  std::move(_vtrials),
369  std::move(_vscale),
370  std::move(_vrscale),
371  std::move(_vfscale),
372  std::move(_vaqed),
373  std::move(_vaqcd),
374  npLO,
375  npNLO,
376  offset_p[0],
377  };
378  }

References hgcalDigitizer_cfi::_m, EcalDumpRaw_cfi::first_event, and eostools::move().

EcalDumpRaw_cfi.first_event
first_event
Definition: EcalDumpRaw_cfi.py:25
hgcalDigitizer_cfi._m
_m
Definition: hgcalDigitizer_cfi.py:211
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
eostools.move
def move(src, dest)
Definition: eostools.py:511