hepmc - Blame information for rev 266

Subversion Repositories:
Rev:
Rev Author Line No. Line
234 garren 1 //////////////////////////////////////////////////////////////////////////
2 // testHerwigCopies.cc
3 //
4 // garren@fnal.gov, January 2008
5 // Multiple events in memory at the same time
6 //////////////////////////////////////////////////////////////////////////
7  
8 #include <fstream>
9 #include <iostream>
10 #include "HepMC/HerwigWrapper.h"
11 #include "HepMC/IO_HERWIG.h"
12 #include "HepMC/GenEvent.h"
13 #include "HepMC/CompareGenEvent.h"
14 #include "HepMC/HEPEVT_Wrapper.h"
15  
16 int main() {
17     //
18     //........................................HEPEVT
19     // Herwig 6.4 uses HEPEVT with 4000 entries and 8-byte floating point
20     //  numbers. We need to explicitly pass this information to the
21     //  HEPEVT_Wrapper.
22     //
23     HepMC::HEPEVT_Wrapper::set_max_number_entries(4000);
24     HepMC::HEPEVT_Wrapper::set_sizeof_real(8);
25     //
26     //.......................................INITIALIZATIONS
27  
28     hwproc.PBEAM1 = 7000.; // energy of beam1
29     hwproc.PBEAM2 = 7000.; // energy of beam2
30     // 1610 = gg->H--> WW, 1706 = qq-->ttbar, 2510 = ttH -> ttWW
31     hwproc.IPROC = 1706; // qq -> ttbar production
266 garren 32     hwproc.MAXEV = 50; // number of events
234 garren 33     // tell it what the beam particles are:
34     for ( unsigned int i = 0; i < 8; ++i ) {
35         hwbmch.PART1[i] = (i < 1) ? 'P' : ' ';
36         hwbmch.PART2[i] = (i < 1) ? 'P' : ' ';
37     }
38     hwigin();    // INITIALISE OTHER COMMON BLOCKS
39     hwevnt.MAXPR = 0; // number of events to print
40     hwuinc(); // compute parameter-dependent constants
41     hweini(); // initialise elementary process
42  
43     //........................................HepMC INITIALIZATIONS
44     //
45     // Instantiate an IO strategy for reading from HEPEVT.
46     HepMC::IO_HERWIG hepevtio;
47     //
48     // open some output files
49     std::ofstream out1( "testHerwigOriginals.dat" );
50     std::ofstream out2( "testHerwigCopies1.dat" );
51     std::ofstream out3( "testHerwigCopies2.dat" );
52     //
53     //........................................EVENT LOOP
54     for ( int i = 1; i <= hwproc.MAXEV; i++ ) {
55         if ( i%50==1 ) std::cout << "Processing Event Number "
56                                  << i << std::endl;
57         // initialise event
58         hwuine();
59         // generate hard subprocess
60         hwepro();
61         // generate parton cascades
62         hwbgen();
63         // do heavy object decays
64         hwdhob();
65         // do cluster formation
66         hwcfor();
67         // do cluster decays
68         hwcdec();
69         // do unstable particle decays
70         hwdhad();
71         // do heavy flavour hadron decays
72         hwdhvy();
73         // add soft underlying event if needed
74         hwmevt();
75         // finish event
76         hwufne();
77         HepMC::GenEvent* evt = hepevtio.read_next_event();
78         // add some information to the event
79         evt->set_event_number(i);
80         evt->set_signal_process_id(20);
81         //
82         //.......................make some copies
83         evt->print(out1);
84         HepMC::GenEvent ec = (*evt);
85         ec.print(out2);
86         HepMC::GenEvent* evt4 = new HepMC::GenEvent(*evt);
87         evt4->print(out3);
88         if( !compareGenEvent(evt,evt4) ) {
89            std::cerr << "testHerwigCopies: GenEvent comparison fails at event "
90                      << evt->event_number() << std::endl;
91            return -1;
92         }
93  
94         // we also need to delete the created event from memory
95         delete evt;
96         delete evt4;
97     }
98     //........................................TERMINATION
99     hwefin();
100     std::cout << "testHerwigCopies: event comparison is successful" << std::endl;
101  
102     return 0;
103 }