Skip to content
Snippets Groups Projects
Commit 729e4baa authored by Markus Frank's avatar Markus Frank
Browse files

Include changes from Frank

parent 89c144a6
No related branches found
No related tags found
No related merge requests found
...@@ -75,14 +75,13 @@ LCIOEventReader::readParticles(int event_number, ...@@ -75,14 +75,13 @@ LCIOEventReader::readParticles(int event_number,
if ( NHEP == 0 ) return EVENT_READER_NO_PRIMARIES; if ( NHEP == 0 ) return EVENT_READER_NO_PRIMARIES;
//fg: for now we create exactly one event vertex here ( as before ) //fg: for now we create exactly one event vertex here ( as before )
// and fill it below from the first final state particle
Geant4Vertex* vtx = new Geant4Vertex ; Geant4Vertex* vtx = new Geant4Vertex ;
vertices.push_back( vtx ); vertices.push_back( vtx );
vtx->x = 0; vtx->x = 0;
vtx->y = 0; vtx->y = 0;
vtx->z = 0; vtx->z = 0;
vtx->time = 0; vtx->time = 0;
bool haveVertex = true ; // bool haveVertex = false ;
mcpcoll.resize(NHEP,0); mcpcoll.resize(NHEP,0);
...@@ -139,19 +138,20 @@ LCIOEventReader::readParticles(int event_number, ...@@ -139,19 +138,20 @@ LCIOEventReader::readParticles(int event_number,
<< genStatus << " -> ignored ! " << endl; << genStatus << " -> ignored ! " << endl;
} }
//fixme: need to define the correct logic for selecting the particle to use
// for the _one_ event vertex
// fill vertex information from first stable particle // fill vertex information from first stable particle
if( !haveVertex && genStatus == 1 ){ // if( !haveVertex && genStatus == 1 ){
vtx->x = p->vsx ; // vtx->x = p->vsx ;
vtx->y = p->vsy ; // vtx->y = p->vsy ;
vtx->z = p->vsz ; // vtx->z = p->vsz ;
vtx->time = p->time ; // vtx->time = p->time ;
haveVertex = false ; // haveVertex = true ;
} // }
if ( p->parents.size() == 0 ) { if ( p->parents.size() == 0 ) {
PropertyMask st(p->status); if ( status.isSet(G4PARTICLE_GEN_EMPTY) || status.isSet(G4PARTICLE_GEN_DOCUMENTATION) )
if ( st.isSet(G4PARTICLE_GEN_EMPTY) || st.isSet(G4PARTICLE_GEN_DOCUMENTATION) ) vtx->in.insert(p->id); // Beam particles and primary quarks etc
vtx->in.insert(p->id); // Beam particles and primary quarks etc.
else else
vtx->out.insert(p->id); // Stuff, to be given to Geant4 together with daughters vtx->out.insert(p->id); // Stuff, to be given to Geant4 together with daughters
} }
......
...@@ -159,24 +159,30 @@ Geant4EventReaderHepEvt::readParticles(int /* event_number */, ...@@ -159,24 +159,30 @@ Geant4EventReaderHepEvt::readParticles(int /* event_number */,
// //
// Read the event, check for errors // Read the event, check for errors
// //
int NHEP; // number of entries unsigned NHEP(0); // number of entries
m_input >> NHEP; m_input >> NHEP;
if( m_input.eof() ) {
// if( m_input.eof() ){ return EVENT_READER_IO_ERROR; }
// End of File :: ??? Exception ???
// -> FG: EOF is not an exception as it happens for every file at the end !
return EVENT_READER_IO_ERROR; //check loop variable read from input file and chack that is reasonable
// should fix coverity issue: "Using tainted variable NHEP as a loop boundary."
if( NHEP > 1e6 ){
printout(ERROR,"EventReaderHepEvt::readParticles","Cannot read in more than million particles, but %d requested", NHEP );
return EVENT_READER_IO_ERROR;
} }
//fg: for now we create exactly one event vertex here ( as before ) //fg: for now we create exactly one event vertex here ( as before )
// and fill it below from the first final state particle
Geant4Vertex* vtx = new Geant4Vertex ; Geant4Vertex* vtx = new Geant4Vertex ;
vertices.push_back( vtx ); vertices.push_back( vtx );
vtx->x = 0; vtx->x = 0;
vtx->y = 0; vtx->y = 0;
vtx->z = 0; vtx->z = 0;
vtx->time = 0; vtx->time = 0;
bool haveVertex = false ; // bool haveVertex = false ;
// //
// Loop over particles // Loop over particles
int ISTHEP(0); // status code int ISTHEP(0); // status code
...@@ -198,7 +204,7 @@ Geant4EventReaderHepEvt::readParticles(int /* event_number */, ...@@ -198,7 +204,7 @@ Geant4EventReaderHepEvt::readParticles(int /* event_number */,
vector<int> daughter1; vector<int> daughter1;
vector<int> daughter2; vector<int> daughter2;
for( int IHEP=0; IHEP<NHEP; IHEP++ ) { for( unsigned IHEP=0; IHEP<NHEP; IHEP++ ) {
if ( m_format == HEPEvtShort ) if ( m_format == HEPEvtShort )
m_input >> ISTHEP >> IDHEP >> JDAHEP1 >> JDAHEP2 m_input >> ISTHEP >> IDHEP >> JDAHEP1 >> JDAHEP2
>> PHEP1 >> PHEP2 >> PHEP3 >> PHEP5; >> PHEP1 >> PHEP2 >> PHEP3 >> PHEP5;
...@@ -252,14 +258,16 @@ Geant4EventReaderHepEvt::readParticles(int /* event_number */, ...@@ -252,14 +258,16 @@ Geant4EventReaderHepEvt::readParticles(int /* event_number */,
else if ( ISTHEP == 3 ) status.set(G4PARTICLE_GEN_DOCUMENTATION); else if ( ISTHEP == 3 ) status.set(G4PARTICLE_GEN_DOCUMENTATION);
else status.set(G4PARTICLE_GEN_DOCUMENTATION); else status.set(G4PARTICLE_GEN_DOCUMENTATION);
//fixme: need to define the correct logic for selecting the particle to use
// for the _one_ event vertex
// fill vertex information from first stable particle // fill vertex information from first stable particle
if( !haveVertex && ISTHEP == 1 ){ // if( !haveVertex && ISTHEP == 1 ){
vtx->x = p->vsx ; // vtx->x = p->vsx ;
vtx->y = p->vsy ; // vtx->y = p->vsy ;
vtx->z = p->vsz ; // vtx->z = p->vsz ;
vtx->time = p->time ; // vtx->time = p->time ;
haveVertex = true ; // haveVertex = true ;
} // }
// //
// Keep daughters information for later // Keep daughters information for later
...@@ -277,7 +285,7 @@ Geant4EventReaderHepEvt::readParticles(int /* event_number */, ...@@ -277,7 +285,7 @@ Geant4EventReaderHepEvt::readParticles(int /* event_number */,
// information, and this utility assumes all parents listed are // information, and this utility assumes all parents listed are
// parents and all daughters listed are daughters // parents and all daughters listed are daughters
// //
for( int IHEP=0; IHEP<NHEP; IHEP++ ) { for( unsigned IHEP=0; IHEP<NHEP; IHEP++ ) {
struct ParticleHandler { struct ParticleHandler {
Particle* m_part; Particle* m_part;
ParticleHandler(Particle* p) : m_part(p) {} ParticleHandler(Particle* p) : m_part(p) {}
......
...@@ -150,7 +150,6 @@ public: ...@@ -150,7 +150,6 @@ public:
protected: protected:
Geometry::VolumeManager _volumeManager; Geometry::VolumeManager _volumeManager;
TGeoManager* _tgeoMgr;
/// Helper method to find the corresponding Readout object to a DetElement /// Helper method to find the corresponding Readout object to a DetElement
Geometry::Readout findReadout(const Geometry::DetElement& det) const; Geometry::Readout findReadout(const Geometry::DetElement& det) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment