SSO Logout

Subversion Repositories hepmc

Rev

Rev 354 | Rev 356 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 354 Rev 355
Line 257... Line 257...
257
\item ability to store the state of random number generators (as
257
\item ability to store the state of random number generators (as
258
  integers)
258
  integers)
259
\item ability to store an arbitrary number of event weights
259
\item ability to store an arbitrary number of event weights
260
\item strategies for conversion to/from HEPEVT (Ref.~\cite{Boos:2001cv})
260
\item strategies for conversion to/from HEPEVT (Ref.~\cite{Boos:2001cv})
261
  which are easily extendible to support other event records
261
  which are easily extendible to support other event records
262
\item strategies for input/output to/from ascii files which
-
 
-
 
262
\item strategies for input/output to/from Ascii files which
263
  are easily extendible to support other forms of persistency
263
  are easily extendible to support other forms of persistency
264
\end{itemize}
264
\end{itemize}
265
265
266
%
266
%
267
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
267
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Line 330... Line 330...
330
The IO\_Ascii output class is deprecated in favor of IO\_GenEvent,
330
The IO\_Ascii output class is deprecated in favor of IO\_GenEvent,
331
described in Section~\ref{iogenevent}.  
331
described in Section~\ref{iogenevent}.  
332
IO\_GenEvent persists all information in the updated GenEvent object and
332
IO\_GenEvent persists all information in the updated GenEvent object and
333
uses iostreams for greater flexibility.  IO\_GenEvent also has a
333
uses iostreams for greater flexibility.  IO\_GenEvent also has a
334
constructor taking a file name and mode type for backwards compatibility.
334
constructor taking a file name and mode type for backwards compatibility.
335
Output remains in ascii format.
-
 
-
 
335
Output remains in Ascii format.
336
336
337
%
337
%
338
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
338
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
339
%
339
%
340
340
Line 396... Line 396...
396

396

397
\subsection{Namespace}
397
\subsection{Namespace}
398

398

399
The HepMC package is written within the HepMC:: namespace. Outside of
399
The HepMC package is written within the HepMC:: namespace. Outside of
400
this namespace all class names will need to be prefixed by HepMC::.
400
this namespace all class names will need to be prefixed by HepMC::.
-
 
401

-
 
402
The units methods and enums are in the HepMC::Units:: namespace.
401

403

402
\subsection{Performance}
404
\subsection{Performance}
403

405

404
The CPU time performance of the HepMC event record has been quantified
406
The CPU time performance of the HepMC event record has been quantified
405
by generating 1000 LHC $W\gamma$ production events using Pythia 5.7
407
by generating 1000 LHC $W\gamma$ production events using Pythia 5.7
Line 425... Line 427...
425
\end{center}
427
\end{center}
426
\caption{\label{benchmarks}
428
\caption{\label{benchmarks}
427
  CPU time performance and file size using a dedicated 450 MHz Pentium~III.}
429
  CPU time performance and file size using a dedicated 450 MHz Pentium~III.}
428
\end{table}
430
\end{table}
429
431
430
The time to write HepMC events as ascii files using the IO\_Ascii
-
 
-
 
432
The time to write HepMC events as Ascii files using the IO\_Ascii
431
strategy was compared to \verb!LCWRITE!, a simple Fortran routine used
433
strategy was compared to \verb!LCWRITE!, a simple Fortran routine used
432
in NLC studies to write the HEPEVT common block in formatted ascii to file.
-
 
-
 
434
in NLC studies to write the HEPEVT common block in formatted Ascii to file.
433
Generating the events with Pythia, transferring them to HepMC, and
435
Generating the events with Pythia, transferring them to HepMC, and
434
writing them to file took 64~seconds and produced a 60.5~Mbyte file.
436
writing them to file took 64~seconds and produced a 60.5~Mbyte file.
435
Generating the events with Pythia and writing them to file using the
437
Generating the events with Pythia and writing them to file using the
436
\verb!LCWRITE! subroutine took 92~seconds and produced a 106~Mbyte
438
\verb!LCWRITE! subroutine took 92~seconds and produced a 106~Mbyte
437
file. Compression algorithms (such as \verb!gzip!) can reduce the file
439
file. Compression algorithms (such as \verb!gzip!) can reduce the file
Line 874... Line 876...
874
\begin{myitemize}{Important Public Methods}
876
\begin{myitemize}{Important Public Methods}
875
  \myitem{write\_event}{writes out the specified event to the output
877
  \myitem{write\_event}{writes out the specified event to the output
876
    strategy}
878
    strategy}
877
  \myitem{read\_next\_event}{reads the next event from the input
879
  \myitem{read\_next\_event}{reads the next event from the input
878
    strategy into memory}
880
    strategy into memory}
879
  \myitem{write\_particle\_data\_table}{writes out the specified
-
 
880
    particle data table to the output strategy}
-
 
881
  \myitem{read\_particle\_data\_table}{reads a particle data table from
-
 
882
    the input strategy}
-
 
883
  \myitem{operator$<<$,operator$>>$}{overloaded to give the
881
  \myitem{operator$<<$,operator$>>$}{overloaded to give the
884
    same results as any of the above methods}
882
    same results as any of the above methods}
885
\end{myitemize}
883
\end{myitemize}
886

884

887
IO\_BaseClass is the abstract base class defining the interface and
885
IO\_BaseClass is the abstract base class defining the interface and
Line 894... Line 892...
894
    This class handles all information found in a GenEvent object.
892
    This class handles all information found in a GenEvent object.
895
    This class replaces IO\_Ascii and reads both formats.
893
    This class replaces IO\_Ascii and reads both formats.
896
    Events may be contained within the same file together with
894
    Events may be contained within the same file together with
897
    an unlimited number of comments.
895
    an unlimited number of comments.
898
    The examples (Section~\ref{examples}) make use of this class.
896
    The examples (Section~\ref{examples}) make use of this class.
899
  \item {\bf IO\_Ascii} is deprecated.
-
 
-
 
897
  \item {\bf IO\_Ascii} is deprecated (Section~\ref{deprecated}).
900
  \item {\bf IO\_AsciiParticles} writes events in a format similar to
898
  \item {\bf IO\_AsciiParticles} writes events in a format similar to
901
     Pythia 6 output.  This is intended for human readability.
899
     Pythia 6 output.  This is intended for human readability.
902
  \item {\bf IO\_HEPEVT} reads and writes events to/from the Fortran HEPEVT
900
  \item {\bf IO\_HEPEVT} reads and writes events to/from the Fortran HEPEVT
903
    common block. It relies on a helper class HEPEVT\_Wrapper which
901
    common block. It relies on a helper class HEPEVT\_Wrapper which
904
    is the interface to the common block
902
    is the interface to the common block
Line 1125... Line 1123...
1125
are in the list of outgoing particles.
1123
are in the list of outgoing particles.
1126
In addition, if an incoming particle is not an outgoing particle of
1124
In addition, if an incoming particle is not an outgoing particle of
1127
some other vertex, then it is classified as an "orphan" incoming particle
1125
some other vertex, then it is classified as an "orphan" incoming particle
1128
and associated with the vertex IO.
1126
and associated with the vertex IO.
1129
In this way, each particle appears only once in the Ascii listing.
1127
In this way, each particle appears only once in the Ascii listing.
-
 
1128

-
 
1129
Below is an example of the format written to a file.  
-
 
1130
Only the first few lines are shown.
-
 
1131
{\tiny
-
 
1132
\begin{verbatim}
-
 
1133
HepMC::Version 2.04.00
-
 
1134
HepMC::IO_GenEvent-START_EVENT_LISTING
-
 
1135
E 9 51 -1.0000000000000000e+00 -1.0000000000000000e+00 -1.0000000000000000e+00 20 0 309 1 2 0 0
-
 
1136
U GEV MM
-
 
1137
H 0 0 0 0 0 0 0 0 0 0 0 0 0
-
 
1138
F 2 3 3.5000000000000003e-01 6.4999999999999991e-01 8.4499999999999993e+00 2.4499999779912355e+03 4.5499999591265787e+03 230 230
-
 
1139
V -1 0 0 0 0 0 1 3 0
-
 
1140
P 1 2212 0 0 6.9999999371178146e+03 7.0000000000000000e+03 9.3827000000000005e-01 3 0 0 -1 0
-
 
1141
P 3 21 -9.5802904850995474e-01 3.4892974578914365e-01 1.5677975928920182e+01 1.5711094833049845e+01 0 3 0 0 -3 0
-
 
1142
P 12 2101 2.5787537037233477e-01 -1.1110299643709216e-01 1.2403958218239170e+03
-
 
1143
1.2403959888942973e+03 5.7933000000000001e-01 2 0 0 -9 0
-
 
1144
P 25 2 7.0015367813761997e-01 -2.3782674935205150e-01 2.3333682308044050e+00 2.4698753078332274e+00 3.3000000000000002e-01 2 0 0 -15 0
-
 
1145
V -2 0 0 0 0 0 1 2 0
-
 
1146
P 2 2212 0 0 -6.9999999371178146e+03 7.0000000000000000e+03 9.3827000000000005e-01 3 0 0 -2 0
-
 
1147
P 4 1 2.7745239600449745e-01 -1.8469236508822412e-01 -1.2668437617555701e+03 1.2668438056011901e+03 0 3 0 0 -4 0
-
 
1148
P 116 2203 -2.7745239600449745e-01 1.8469236508822412e-01 -1.8910900158159372e+03 1.8910902024916190e+03 7.7132999999999996e-01 2 0 0 -15 0
-
 
1149
\end{verbatim}
-
 
1150
}
1130
1151
1131
%
1152
%
1132
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1153
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1133
%
1154
%
1134
1155
Line 1281... Line 1302...
1281
  \item{\bf Verify that copying generated events behaves as expected:}
1302
  \item{\bf Verify that copying generated events behaves as expected:}
1282
     {testHerwigCopies.cc and testPythiaCopies.cc}
1303
     {testHerwigCopies.cc and testPythiaCopies.cc}
1283
\end{itemize}
1304
\end{itemize}
1284
1305

1285
All examples use IO\_GenEvent instead of the deprecated IO\_Ascii.
1306
All examples use IO\_GenEvent instead of the deprecated IO\_Ascii.
-
 
1307

-
 
1308
\vspace {1mm}
-
 
1309
Read HepMC events from a file:
-
 
1310
\vspace {-3mm}
-
 
1311
\begin{verbatim}
-
 
1312
HepMC::IO_GenEvent ascii_in("example.dat",std::ios::in);
-
 
1313
HepMC::GenEvent* evt =  ascii_in.read_next_event();
-
 
1314
while ( evt ) {
-
 
1315
    // analyze the event
-
 
1316
    ...
-
 
1317
    // delete the created event from memory
-
 
1318
    delete evt;
-
 
1319
}
-
 
1320
\end{verbatim}
-
 
1321

-
 
1322
Convert events from the HEPEVT common block to HepMC format
-
 
1323
and write them to a file:
-
 
1324
\vspace {-3mm}
-
 
1325
\begin{verbatim}
-
 
1326
HepMC::IO_HEPEVT hepevtio;      // the common block conversion methods
-
 
1327
HepMC::IO_GenEvent ascii_out("example.dat",std::ios::out);
-
 
1328
for ( int i = 1; i <= maxEvents; i++ ) {
-
 
1329
    // convert an event
-
 
1330
    HepMC::GenEvent* evt = hepevtio.read_next_event();
-
 
1331
    // analyze the event
-
 
1332
    ...
-
 
1333
    // write the HepMC event
-
 
1334
    ascii_out << evt;
-
 
1335
    // delete the created event from memory
-
 
1336
    delete evt;
-
 
1337
}
-
 
1338
\end{verbatim}
1286
1339
1287
%
1340
%
1288
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1341
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1289
%
1342
%
1290
1343
1291
\section{Deprecated Classes}
1344
\section{Deprecated Classes}
-
 
1345
\label{deprecated}
1292

1346

1293
Two major classes have been deprecated: IO\_Ascii and ParticleData.
1347
Two major classes have been deprecated: IO\_Ascii and ParticleData.
1294
IO\_Ascii is replaced by IO\_GenEvent, which uses iostreams instead of files.
1348
IO\_Ascii is replaced by IO\_GenEvent, which uses iostreams instead of files.
1295

1349

1296
The ParticleData classes had become outmoded and would need a lot of
1350
The ParticleData classes had become outmoded and would need a lot of
Line 1307... Line 1361...
1307
1361
1308
\subsection{HepMC::IO\_Ascii (deprecated)}
1362
\subsection{HepMC::IO\_Ascii (deprecated)}
1309

1363

1310
\begin{myitemize}{Notes and Conventions}
1364
\begin{myitemize}{Notes and Conventions}
1311
 \item {\bf IO\_Ascii} reads and writes events and particle data
1365
 \item {\bf IO\_Ascii} reads and writes events and particle data
1312
    tables to files in machine readable ascii, thereby providing a
-
 
-
 
1366
    tables to files in machine readable Ascii, thereby providing a
1313
    form of persistency for the event record. Events and particle data
1367
    form of persistency for the event record. Events and particle data
1314
    tables may be contained within the same file (recommend to write
1368
    tables may be contained within the same file (recommend to write
1315
    the particle data table first to save access time) together with
1369
    the particle data table first to save access time) together with
1316
    an unlimited number of comments.
1370
    an unlimited number of comments.
1317
   IO\_GenEvent will read files written by IO\_Ascii.
1371
   IO\_GenEvent will read files written by IO\_Ascii.
Line 1322... Line 1376...
1322
%
1376
%
1323
1377
1324
\subsection{HepMC::ParticleData (deprecated)}
1378
\subsection{HepMC::ParticleData (deprecated)}
1325

1379

1326
\begin{myitemize}{Relevant Data Members}
1380
\begin{myitemize}{Relevant Data Members}
1327
  \myitem{name}{std::string giving an ascii description of the
-
 
-
 
1381
  \myitem{name}{std::string giving an Ascii description of the
1328
    particle type}
1382
    particle type}
1329
  \myitem{pdg\_id}{unique ID integer denoting the particle type
1383
  \myitem{pdg\_id}{unique ID integer denoting the particle type
1330
    as defined by the PDG}
1384
    as defined by the PDG}
1331
  \myitem{charge}{in fraction of proton charge}
1385
  \myitem{charge}{in fraction of proton charge}
1332
  \myitem{mass}{in energy units}
1386
  \myitem{mass}{in energy units}
Line 1380... Line 1434...
1380
    ParticleDataTable if they are not already in the current table}
1434
    ParticleDataTable if they are not already in the current table}
1381
  \myitem{print}{gives a formatted printout of the table to the
1435
  \myitem{print}{gives a formatted printout of the table to the
1382
    specified output stream}
1436
    specified output stream}
1383
\end{myitemize}
1437
\end{myitemize}
1384
\begin{myitemize}{Relevant Data Members}
1438
\begin{myitemize}{Relevant Data Members}
1385
  \myitem{description}{ascii description of the table stored as
-
 
-
 
1439
  \myitem{description}{Ascii description of the table stored as
1386
    std::string}
1440
    std::string}
1387
  \myitem{data\_table}{container of pointers to ParticleData instances
1441
  \myitem{data\_table}{container of pointers to ParticleData instances
1388
    mapped onto their associated pdg\_id's}
1442
    mapped onto their associated pdg\_id's}
1389
\end{myitemize}
1443
\end{myitemize}
1390
1444