Print

Print


Commit in slic/src on MAIN
StdHepToLcioConvertor.cc+36-31.34 -> 1.35
JM: skip daughter setup if indices are not valid

slic/src
StdHepToLcioConvertor.cc 1.34 -> 1.35
diff -u -r1.34 -r1.35
--- StdHepToLcioConvertor.cc	11 Apr 2008 03:20:19 -0000	1.34
+++ StdHepToLcioConvertor.cc	6 May 2008 01:41:41 -0000	1.35
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/StdHepToLcioConvertor.cc,v 1.34 2008/04/11 03:20:19 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/StdHepToLcioConvertor.cc,v 1.35 2008/05/06 01:41:41 jeremy Exp $
 #include "StdHepToLcioConvertor.hh"
 
 // slic
@@ -262,16 +262,44 @@
     void StdHepToLcioConvertor::setupDaughters( int ihep, IMPL::MCParticleImpl* mcp )
     {
 #ifdef SLIC_LOG
-        log() << LOG::debug << "setupDaughters" << LOG::done;    
+        log() << LOG::debug << "setupDaughters for ihep <" << ihep << "> and MCParticle <" << mcp << ">" << LOG::done;   
 #endif
 
         // get dau indices
         int dau1_idx = m_reader->daughter1( ihep ) % 10000 - 1;
         int dau2_idx = m_reader->daughter2( ihep ) % 10000 - 1;
 
+#ifdef SLIC_LOG
+        log() << LOG::debug << "dau1 <" << dau1_idx << ">" << LOG::done;
+        log() << LOG::debug << "dau2 <" << dau2_idx << ">" << LOG::done;
+#endif
+
+        int tracks = m_reader->nTracks();
+
+        // Return if no valid daughter indices found.
+        if ((dau1_idx > tracks || dau2_idx > tracks) || (dau1_idx == -1 && dau2_idx == -1))
+        {
+#ifdef SLIC_LOG
+            log() << LOG::debug << "ihep <" << ihep << "> has invalid daughter index range <" << dau1_idx << ", " << dau2_idx << ">." << LOG::done;
+#endif
+            return;
+        }
+
         std::vector<int> dauVec;
         dauVec = makeIndexVec( dau1_idx, dau2_idx, dauVec );
 
+        log() << "printing dau vec ..." << LOG::done;
+#ifdef SLIC_LOG
+        for (std::vector<int>::const_iterator it = dauVec.begin();
+             it != dauVec.end();
+             it++) 
+        {
+            log() << LOG::debug << (*it);
+        }
+        log () << LOG::done;
+
+#endif
+
         if ( dauVec.size() > 0 ) {
             for ( std::vector<int>::iterator it = dauVec.begin();
                   it != dauVec.end();
@@ -323,7 +351,12 @@
 
             MCParticleImpl* dauMcp = static_cast<MCParticleImpl*>
                 ( m_currentMcpColl->getElementAt( dauIdx ) );
-            assert( dauMcp );
+
+#ifdef SLIC_LOG
+            log() << LOG::debug << "found dau particle <" << dauMcp << ">" << LOG::done;
+#endif            
+
+//            assert( dauMcp );
 
             if ( dauMcp ) {
                 if ( !hasParent( dauMcp, parMcp ) ) {
CVSspam 0.2.8