hepmc

Subversion Repositories:
Compare Path: Rev
With Path: Rev
/trunk/ @ 91  →  /trunk/ @ 92
/trunk/test/testHepMC.cc.in
@@ -48,8 +48,8 @@
x = 0.1 * icount;
y = 0.13 * icount;
z = 0.012 * icount;
HepMC::PdfInfo* pdf = new HepMC::PdfInfo( 11, 12, x, y, z, 0.11, 0.34);
// give ownership of pdf to GenEvent
HepMC::PdfInfo pdf( 11, 12, x, y, z, 0.11, 0.34);
// GenEvent makes its own copy of pdf
evt->set_pdf_info(pdf);
ascii_out << evt;
particle_out << evt;
/trunk/ChangeLog
@@ -1,4 +1,10 @@
 
2007-06-01 Lynn Garren
 
* HepMC/GenEvent.h, src/GenEvent.cc: change interface such that
GenEvent makes its own copy of HeavyIon and PdfInfo
 
 
2007-05-29 Lynn Garren
 
* src/GenVertex.cc: initialize range in default constructor
/trunk/src/GenEvent.cc
@@ -14,16 +14,40 @@
 
namespace HepMC {
 
GenEvent::GenEvent( int signal_process_id,
int event_number,
GenVertex* signal_vertex,
const WeightContainer& weights,
const std::vector<long int>& random_states ) :
m_signal_process_id(signal_process_id), m_event_number(event_number),
m_event_scale(-1), m_alphaQCD(-1), m_alphaQED(-1),
m_signal_process_vertex(signal_vertex), m_weights(weights),
m_random_states(random_states),
m_heavy_ion(0),
m_pdf_info(0)
{
/// This constructor only allows null pointers to HeavyIon and PdfInfo
///
/// note: default values for m_event_scale, m_alphaQCD, m_alphaQED
/// are as suggested in hep-ph/0109068, "Generic Interface..."
s_counter++;
}
 
GenEvent::GenEvent( int signal_process_id, int event_number,
GenVertex* signal_vertex,
const WeightContainer& weights,
const std::vector<long int>&
random_states, HeavyIon* ion, PdfInfo* pdf ) :
GenVertex* signal_vertex,
const WeightContainer& weights,
const std::vector<long int>& random_states,
const HeavyIon& ion,
const PdfInfo& pdf ) :
m_signal_process_id(signal_process_id), m_event_number(event_number),
m_event_scale(-1), m_alphaQCD(-1), m_alphaQED(-1),
m_signal_process_vertex(signal_vertex), m_weights(weights),
m_random_states(random_states), m_heavy_ion(ion), m_pdf_info(pdf)
m_random_states(random_states),
m_heavy_ion( new HeavyIon(ion) ),
m_pdf_info( new PdfInfo(pdf) )
{
/// GenEvent makes its own copy of HeavyIon and PdfInfo
///
/// note: default values for m_event_scale, m_alphaQCD, m_alphaQED
/// are as suggested in hep-ph/0109068, "Generic Interface..."
s_counter++;
@@ -42,6 +66,8 @@
/// deletes all vertices/particles in this evt
///
delete_all_vertices();
delete m_heavy_ion;
delete m_pdf_info;
s_counter--;
}
 
@@ -96,9 +122,11 @@
set_alphaQCD( inevent.alphaQCD() );
set_alphaQED( inevent.alphaQED() );
set_random_states( inevent.random_states() );
set_heavy_ion( inevent.heavy_ion() );
set_pdf_info( inevent.pdf_info() );
weights() = inevent.weights();
//
// 5. copy these only if they are not null
if( inevent.heavy_ion() ) set_heavy_ion( *inevent.heavy_ion() );
if( inevent.pdf_info() ) set_pdf_info( *inevent.pdf_info() );
return *this;
}
 
/trunk/src/IO_ExtendedAscii.cc
@@ -172,8 +172,8 @@
evt->weights() = weights;
evt->set_random_states( random_states );
// get HeavyIon and PdfInfo
evt->set_heavy_ion( read_heavy_ion() );
evt->set_pdf_info( read_pdf_info() );
evt->set_heavy_ion( *read_heavy_ion() );
evt->set_pdf_info( *read_pdf_info() );
//
// the end vertices of the particles are not connected until
// after the event is read --- we store the values in a map until then
/trunk/HepMC/GenEvent.h
@@ -140,12 +140,16 @@
friend class GenParticle;
friend class GenVertex;
public:
/// default constructor
/// default constructor creates null pointers to HeavyIon and PdfInfo
GenEvent( int signal_process_id = 0, int event_number = 0,
GenVertex* signal_vertex = 0,
const WeightContainer& weights = std::vector<double>(),
const std::vector<long int>& randomstates
= std::vector<long int>(), HeavyIon* ion = 0, PdfInfo* pdf = 0 );
const std::vector<long int>& randomstates = std::vector<long int>() );
/// explicit constructor that takes HeavyIon and PdfInfo
GenEvent( int signal_process_id, int event_number,
GenVertex* signal_vertex, const WeightContainer& weights,
const std::vector<long int>& randomstates,
const HeavyIon& ion, const PdfInfo& pdf );
GenEvent( const GenEvent& inevent ); //!< deep copy
GenEvent& operator=( const GenEvent& inevent ); //!< make a deep copy
virtual ~GenEvent(); //!<deletes all vertices/particles in this evt
@@ -178,9 +182,11 @@
const WeightContainer& weights() const; //!< direct access to WeightContainer
 
/// access the HeavyIon container if it exists
HeavyIon* heavy_ion() const;
HeavyIon* const heavy_ion() const;
HeavyIon* heavy_ion();
/// access the PdfInfo container if it exists
PdfInfo* pdf_info() const;
PdfInfo* const pdf_info() const;
PdfInfo* pdf_info();
 
/// vector of integers containing information about the random state
std::vector<long int> random_states() const;
@@ -197,9 +203,9 @@
void set_random_states( const std::vector<long int>& randomstates );
 
/// provide a pointer to the HeavyIon container
void set_heavy_ion( HeavyIon* ion );
void set_heavy_ion( const HeavyIon& ion );
/// provide a pointer to the PdfInfo container
void set_pdf_info( PdfInfo* p );
void set_pdf_info( const PdfInfo& p );
 
/// how many particle barcodes exist?
int particles_size() const;
@@ -510,12 +516,18 @@
inline const WeightContainer& GenEvent::weights() const
{ return m_weights; }
 
inline HeavyIon* GenEvent::heavy_ion() const
inline HeavyIon* const GenEvent::heavy_ion() const
{ return m_heavy_ion; }
 
inline PdfInfo* GenEvent::pdf_info() const
inline HeavyIon* GenEvent::heavy_ion()
{ return m_heavy_ion; }
 
inline PdfInfo* const GenEvent::pdf_info() const
{ return m_pdf_info; }
 
inline PdfInfo* GenEvent::pdf_info()
{ return m_pdf_info; }
 
/// Vector of integers which specify the random number
/// generator's state for this event. It is left to the
/// generator to make use of this. We envision a vector of
@@ -542,11 +554,11 @@
if ( m_signal_process_vertex ) add_vertex( m_signal_process_vertex );
}
 
inline void GenEvent::set_heavy_ion( HeavyIon* ion )
{ m_heavy_ion = ion; }
inline void GenEvent::set_heavy_ion( const HeavyIon& ion )
{ m_heavy_ion = new HeavyIon(ion); }
 
inline void GenEvent::set_pdf_info( PdfInfo* p )
{ m_pdf_info = p; }
inline void GenEvent::set_pdf_info( const PdfInfo& p )
{ m_pdf_info = new PdfInfo(p); }
 
inline void GenEvent::set_random_states( const std::vector<long int>&
randomstates )
/trunk/examples/example_UsingIterators.cc
@@ -159,7 +159,8 @@
}
}
}
 
// cleanup
delete evt;
// in analogy to the above, similar use can be made of the
// HepMC::GenVertex::vertex_iterator, which also accepts a range.
} // end scope of ascii_in