3 modified files
slic/include
diff -u -r1.8 -r1.9
--- StdHepEventSource.hh 27 Apr 2007 01:54:32 -0000 1.8
+++ StdHepEventSource.hh 29 Aug 2008 00:42:49 -0000 1.9
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/StdHepEventSource.hh,v 1.8 2007/04/27 01:54:32 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/StdHepEventSource.hh,v 1.9 2008/08/29 00:42:49 jeremy Exp $
#ifndef SLIC_STDHEPEVENTSOURCE_HH
#define SLIC_STDHEPEVENTSOURCE_HH 1
@@ -39,6 +39,8 @@
virtual void beginEvent(const G4Event* anEvent);
+ lStdHep* getStdHepReader();
+
private:
StdHepLoader* m_loader;
StdHepToLcioConvertor* m_convertor;
slic/src
diff -u -r1.80 -r1.81
--- LcioManager.cc 26 Aug 2008 23:15:31 -0000 1.80
+++ LcioManager.cc 29 Aug 2008 00:42:49 -0000 1.81
@@ -1,7 +1,9 @@
-// $Header: /cvs/lcd/slic/src/LcioManager.cc,v 1.80 2008/08/26 23:15:31 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioManager.cc,v 1.81 2008/08/29 00:42:49 jeremy Exp $
#include "LcioManager.hh"
// slic
+#include "EventSourceManager.hh"
+#include "StdHepEventSource.hh"
#include "FileUtil.hh"
#include "TimeUtil.hh"
#include "PackageInfo.hh"
@@ -364,6 +366,18 @@
lcevt->setEventNumber(anEvent->GetEventID() );
lcevt->setRunNumber(m_runHdr->getRunNumber() );
lcevt->setDetectorName(m_runHdr->getDetectorName() );
+
+ // Set the event weight from the StdHep file.
+ EventSourceManager* genMgr = EventSourceManager::instance();
+ if (genMgr->getCurrentSourceType() == EventSourceManager::eStdHep)
+ {
+ lcevt->parameters().setValue("_weight",(float)((StdHepEventSource*)(genMgr->getCurrentSource()))->getStdHepReader()->eventweight());
+ }
+ else
+ {
+ lcevt->parameters().setValue("_weight",(float)1.0);
+ }
+
setCurrentLCEvent( lcevt );
return lcevt;
}
@@ -388,7 +402,8 @@
createFinalMcpCollection();
// If selected, add the initial MCParticle collection to the event.
- if ( LcioMcpManager::instance()->writeInitialMCParticleCollection() ) {
+ if ( LcioMcpManager::instance()->writeInitialMCParticleCollection() )
+ {
addInitialMCParticleCollection();
}
slic/src
diff -u -r1.6 -r1.7
--- StdHepEventSource.cc 27 Apr 2007 01:54:35 -0000 1.6
+++ StdHepEventSource.cc 29 Aug 2008 00:42:49 -0000 1.7
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/StdHepEventSource.cc,v 1.6 2007/04/27 01:54:35 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/StdHepEventSource.cc,v 1.7 2008/08/29 00:42:49 jeremy Exp $
#include "StdHepEventSource.hh"
// slic
@@ -7,88 +7,93 @@
namespace slic
{
- StdHepEventSource::StdHepEventSource(const std::string& fname)
- : EventSourceWithInputFile( "StdHepEventSource", fname ),
- m_convertor(0)
- {
- // create loader with internal reader
- m_loader = new StdHepLoader();
-
- // create new convertor
- m_convertor = new StdHepToLcioConvertor();
- }
-
- void StdHepEventSource::generate(G4Event* anEvent)
- {
- LcioManager::instance()
- ->getGenerator()
- ->generatePrimaryVertexFromMcpCollection( LcioMcpManager::instance()->getInitialMcpCollection(),
- anEvent );
- }
-
- // open the current file
- void StdHepEventSource::open()
- {
- m_loader->openStdHepFile( m_filename );
- m_fileIsOpen = true;
- }
-
- // close the current file
- void StdHepEventSource::close()
- {
- m_loader->closeStdHepFile();
- m_fileIsOpen = false;
- }
-
- // read the next event
- void StdHepEventSource::readNextEvent()
- {
- m_loader->readNextEvent();
-
- if ( m_loader->isEndOfInput() ) {
- m_eof = true;
- }
- }
-
- void StdHepEventSource::dumpCurrentEvent()
- {
- log() << LOG::okay << "Dumping StdHep event info ..." << LOG::done;
-
- lStdHep* rdr = m_loader->getStdHepReader();
-
- if ( rdr ) {
- rdr->printEventTable();
- }
- else {
- log() << LOG::error << "No current StdHep reader." << LOG::done;
- }
-
- log() << LOG::okay << LOG::endl;
- }
-
- void StdHepEventSource::beginRun(const G4Run* aRun)
- {
- // do superclass setup
- EventSourceWithInputFile::beginRun( aRun );
-
- // setup convertor
- assert( m_loader->getStdHepReader() );
- m_convertor->setStdHepReader( m_loader->getStdHepReader() );
- }
-
- void StdHepEventSource::beginEvent(const G4Event* anEvent)
- {
- // read an event
- EventSourceWithInputFile::beginEvent(anEvent);
-
- // not EOF?
- if ( !isEOF() ) {
+ StdHepEventSource::StdHepEventSource(const std::string& fname)
+ : EventSourceWithInputFile( "StdHepEventSource", fname ),
+ m_convertor(0)
+ {
+ // create loader with internal reader
+ m_loader = new StdHepLoader();
- // set convertor's coll
- m_convertor->setCurrentMcpCollection( LcioMcpManager::instance()->getInitialMcpCollection() );
+ // create new convertor
+ m_convertor = new StdHepToLcioConvertor();
+ }
+
+ void StdHepEventSource::generate(G4Event* anEvent)
+ {
+ LcioManager::instance()
+ ->getGenerator()
+ ->generatePrimaryVertexFromMcpCollection( LcioMcpManager::instance()->getInitialMcpCollection(),
+ anEvent );
+ }
+
+ // open the current file
+ void StdHepEventSource::open()
+ {
+ m_loader->openStdHepFile( m_filename );
+ m_fileIsOpen = true;
+ }
+
+ // close the current file
+ void StdHepEventSource::close()
+ {
+ m_loader->closeStdHepFile();
+ m_fileIsOpen = false;
+ }
+
+ // read the next event
+ void StdHepEventSource::readNextEvent()
+ {
+ m_loader->readNextEvent();
+
+ if ( m_loader->isEndOfInput() ) {
+ m_eof = true;
+ }
+ }
+
+ void StdHepEventSource::dumpCurrentEvent()
+ {
+ log() << LOG::okay << "Dumping StdHep event info ..." << LOG::done;
+
+ lStdHep* rdr = m_loader->getStdHepReader();
+
+ if ( rdr ) {
+ rdr->printEventTable();
+ }
+ else {
+ log() << LOG::error << "No current StdHep reader." << LOG::done;
+ }
+
+ log() << LOG::okay << LOG::endl;
+ }
+
+ void StdHepEventSource::beginRun(const G4Run* aRun)
+ {
+ // do superclass setup
+ EventSourceWithInputFile::beginRun( aRun );
+
+ // setup convertor
+ assert( m_loader->getStdHepReader() );
+ m_convertor->setStdHepReader( m_loader->getStdHepReader() );
+ }
+
+ void StdHepEventSource::beginEvent(const G4Event* anEvent)
+ {
+ // read an event
+ EventSourceWithInputFile::beginEvent(anEvent);
+
+ // not EOF?
+ if ( !isEOF() ) {
+
+ // set convertor's coll
+ m_convertor->setCurrentMcpCollection( LcioMcpManager::instance()->getInitialMcpCollection() );
+
+ // run convertor
+ m_convertor->fillCurrentMcpCollectionFromStdHep();
+ }
+ }
- // run convertor
- m_convertor->fillCurrentMcpCollectionFromStdHep();
+ lStdHep* StdHepEventSource::getStdHepReader()
+ {
+ return m_loader->getStdHepReader();
}
- }
-}
+}
CVSspam 0.2.8