diff --git a/DDG4/lcio/LCIOEventReader.cpp b/DDG4/lcio/LCIOEventReader.cpp index b689e3fffae01afe7adad0093d6d35b8c05432ad..23d83ff2de3df01c26e822bd07425dd46d05fd40 100644 --- a/DDG4/lcio/LCIOEventReader.cpp +++ b/DDG4/lcio/LCIOEventReader.cpp @@ -75,14 +75,13 @@ LCIOEventReader::readParticles(int event_number, if ( NHEP == 0 ) return EVENT_READER_NO_PRIMARIES; //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 ; vertices.push_back( vtx ); vtx->x = 0; vtx->y = 0; vtx->z = 0; vtx->time = 0; - bool haveVertex = true ; + // bool haveVertex = false ; mcpcoll.resize(NHEP,0); @@ -139,19 +138,20 @@ LCIOEventReader::readParticles(int event_number, << 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 - if( !haveVertex && genStatus == 1 ){ - vtx->x = p->vsx ; - vtx->y = p->vsy ; - vtx->z = p->vsz ; - vtx->time = p->time ; - haveVertex = false ; - } + // if( !haveVertex && genStatus == 1 ){ + // vtx->x = p->vsx ; + // vtx->y = p->vsy ; + // vtx->z = p->vsz ; + // vtx->time = p->time ; + // haveVertex = true ; + // } if ( p->parents.size() == 0 ) { - PropertyMask st(p->status); - if ( st.isSet(G4PARTICLE_GEN_EMPTY) || st.isSet(G4PARTICLE_GEN_DOCUMENTATION) ) - vtx->in.insert(p->id); // Beam particles and primary quarks etc. + if ( status.isSet(G4PARTICLE_GEN_EMPTY) || status.isSet(G4PARTICLE_GEN_DOCUMENTATION) ) + vtx->in.insert(p->id); // Beam particles and primary quarks etc else vtx->out.insert(p->id); // Stuff, to be given to Geant4 together with daughters } diff --git a/DDG4/plugins/Geant4EventReaderHepEvt.cpp b/DDG4/plugins/Geant4EventReaderHepEvt.cpp index 4e19d4af78c2568be9d5da9b169f2778be5f8dbb..07438183de15f7afdc207820525c564713e14977 100644 --- a/DDG4/plugins/Geant4EventReaderHepEvt.cpp +++ b/DDG4/plugins/Geant4EventReaderHepEvt.cpp @@ -159,24 +159,30 @@ Geant4EventReaderHepEvt::readParticles(int /* event_number */, // // Read the event, check for errors // - int NHEP; // number of entries + unsigned NHEP(0); // number of entries m_input >> NHEP; - if( m_input.eof() ) { - // - // End of File :: ??? Exception ??? - // -> FG: EOF is not an exception as it happens for every file at the end ! - return EVENT_READER_IO_ERROR; + + if( m_input.eof() ){ 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 ) - // and fill it below from the first final state particle Geant4Vertex* vtx = new Geant4Vertex ; vertices.push_back( vtx ); vtx->x = 0; vtx->y = 0; vtx->z = 0; vtx->time = 0; - bool haveVertex = false ; + // bool haveVertex = false ; + // // Loop over particles int ISTHEP(0); // status code @@ -198,7 +204,7 @@ Geant4EventReaderHepEvt::readParticles(int /* event_number */, vector<int> daughter1; vector<int> daughter2; - for( int IHEP=0; IHEP<NHEP; IHEP++ ) { + for( unsigned IHEP=0; IHEP<NHEP; IHEP++ ) { if ( m_format == HEPEvtShort ) m_input >> ISTHEP >> IDHEP >> JDAHEP1 >> JDAHEP2 >> PHEP1 >> PHEP2 >> PHEP3 >> PHEP5; @@ -252,14 +258,16 @@ Geant4EventReaderHepEvt::readParticles(int /* event_number */, else if ( ISTHEP == 3 ) 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 - if( !haveVertex && ISTHEP == 1 ){ - vtx->x = p->vsx ; - vtx->y = p->vsy ; - vtx->z = p->vsz ; - vtx->time = p->time ; - haveVertex = true ; - } + // if( !haveVertex && ISTHEP == 1 ){ + // vtx->x = p->vsx ; + // vtx->y = p->vsy ; + // vtx->z = p->vsz ; + // vtx->time = p->time ; + // haveVertex = true ; + // } // // Keep daughters information for later @@ -277,7 +285,7 @@ Geant4EventReaderHepEvt::readParticles(int /* event_number */, // information, and this utility assumes all parents listed are // parents and all daughters listed are daughters // - for( int IHEP=0; IHEP<NHEP; IHEP++ ) { + for( unsigned IHEP=0; IHEP<NHEP; IHEP++ ) { struct ParticleHandler { Particle* m_part; ParticleHandler(Particle* p) : m_part(p) {} diff --git a/DDRec/include/DDRec/API/IDDecoder.h b/DDRec/include/DDRec/API/IDDecoder.h index 8ea3190aae7f99c65b5719b91697fbc45fea446d..839784312830c8efdcafe463fc334ab25c67cd5d 100644 --- a/DDRec/include/DDRec/API/IDDecoder.h +++ b/DDRec/include/DDRec/API/IDDecoder.h @@ -150,7 +150,6 @@ public: protected: Geometry::VolumeManager _volumeManager; - TGeoManager* _tgeoMgr; /// Helper method to find the corresponding Readout object to a DetElement Geometry::Readout findReadout(const Geometry::DetElement& det) const;