slic/src
diff -u -r1.35 -r1.36
--- StdHepToLcioConvertor.cc 6 May 2008 01:41:41 -0000 1.35
+++ StdHepToLcioConvertor.cc 14 May 2008 03:22:59 -0000 1.36
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/StdHepToLcioConvertor.cc,v 1.35 2008/05/06 01:41:41 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/StdHepToLcioConvertor.cc,v 1.36 2008/05/14 03:22:59 jeremy Exp $
#include "StdHepToLcioConvertor.hh"
// slic
@@ -274,16 +274,14 @@
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))
+ // Check for valid daughter indices. Some generators such as Whizard put bad values in these fields.
+ if (!isValidDaughterIndex(dau1_idx) || !isValidDaughterIndex(dau2_idx))
{
#ifdef SLIC_LOG
log() << LOG::debug << "ihep <" << ihep << "> has invalid daughter index range <" << dau1_idx << ", " << dau2_idx << ">." << LOG::done;
-#endif
+#endif
return;
- }
+ }
std::vector<int> dauVec;
dauVec = makeIndexVec( dau1_idx, dau2_idx, dauVec );
slic/include
diff -u -r1.19 -r1.20
--- StdHepToLcioConvertor.hh 27 Apr 2007 01:54:33 -0000 1.19
+++ StdHepToLcioConvertor.hh 14 May 2008 03:22:59 -0000 1.20
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/StdHepToLcioConvertor.hh,v 1.19 2007/04/27 01:54:33 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/StdHepToLcioConvertor.hh,v 1.20 2008/05/14 03:22:59 jeremy Exp $
#ifndef SLIC_STDHEPTOLCIOCONVERTOR_HH
#define SLIC_STDHEPTOLCIOCONVERTOR_HH 1
@@ -20,119 +20,125 @@
namespace slic
{
- /**
- * @class StdHepToLcioConvertor
- * @brief Converts an input StdHep event to an LCIO MCParticle collection.
- */
-
- /**
- @verbatim
-
- The index "pointers" daughter1, daughter2, mother1 and mother2 are handled as follows,
- where idx1 is daughter1/mother1, and idx2 is daughter2/mother2.
-
- idx1 cmp idx2 action
- _______________________
-
- -1 -1 do nothing
- # -1 use idx1
- -1 # use idx2
- # == # use idx1
- # < # range = idx1 to idx2
- # > # use idx1 and idx2 as discrete indices
-
- @endverbatim
- */
- class StdHepToLcioConvertor : public Module
- {
-
- public:
- StdHepToLcioConvertor(lStdHep* rdr);
- StdHepToLcioConvertor();
- virtual ~StdHepToLcioConvertor();
-
- public:
-
- /**
- * Set the lStdHep reader to be used by the convertor.
- */
- void setStdHepReader(lStdHep* rdr)
- {
- assert( rdr );
- m_reader = rdr;
- }
-
- /**
- * Create the next MCP collection using current event
- * NOTE: This function depends upon an external read operation for the next event.
- */
- void fillCurrentMcpCollectionFromStdHep();
-
/**
- * Reset the current MCParticle collection.
+ * @class StdHepToLcioConvertor
+ * @brief Converts an input StdHep event to an LCIO MCParticle collection.
*/
- void setCurrentMcpCollection(EVENT::LCCollection* mcpColl);
/**
- * Get the current MCParticle collection.
- */
- EVENT::LCCollection* getCurrentMcpCollection();
+ @verbatim
- /**
- * Create a single MCParticle from a StdHep track.
- * NOTE: Does not setup mother or daughter links.
- */
- IMPL::MCParticleImpl* createMcpFromStdHep( int ihep );
+ The index "pointers" daughter1, daughter2, mother1 and mother2 are handled as follows,
+ where idx1 is daughter1/mother1, and idx2 is daughter2/mother2.
- /**
- * Setup the parent pointers of this track.
- */
- void setupParents( int ihep, IMPL::MCParticleImpl* );
+ idx1 cmp idx2 action
+ _______________________
- /**
- * Setup the input MCParticle as a parent of this track.
- */
- void addMcpParent( int parIdx, IMPL::MCParticleImpl* parMcp );
+ -1 -1 do nothing
+ # -1 use idx1
+ -1 # use idx2
+ # == # use idx1
+ # < # range = idx1 to idx2
+ # > # use idx1 and idx2 as discrete indices
- /**
- * Setup the daughter pointers of this track.
- */
- void setupDaughters( int ihep, IMPL::MCParticleImpl* );
-
- /**
- * Setup the input MCParticle as a parent of this track.
- */
- void addMcpDaughter( int dauIdx, IMPL::MCParticleImpl* parMcp );
-
- /**
- * Check if an MCParticle has another particle as its parent.
- */
- bool hasParent( IMPL::MCParticleImpl* dauMcp, IMPL::MCParticleImpl* parMcp);
-
- /**
- * Given two ihep indices, return a vector of all the included indices (discrete, range, etc.).
- */
- std::vector<int> makeIndexVec( int idx1, int idx2, std::vector<int>& vec );
-
- /**
- * Perform various sanity checks on the track's mother and daughter index values.
- */
- void checkParentage( int ihep );
+ @endverbatim
+ */
+ class StdHepToLcioConvertor : public Module
+ {
- /* Print utilities. */
- void printIndex( int ihep );
- void printMothers( int ihep );
- void printDaughters( int ihep );
- void printTrack( int ihep );
-
- private:
-
- /* Pointer to the current MCParticle collection that is being filled. */
- EVENT::LCCollection* m_currentMcpColl;
-
- /* Pointer to the lStdHep reader being used as a data source. */
- lStdHep* m_reader;
- };
+ public:
+ StdHepToLcioConvertor(lStdHep* rdr);
+ StdHepToLcioConvertor();
+ virtual ~StdHepToLcioConvertor();
+
+ public:
+
+ /**
+ * Set the lStdHep reader to be used by the convertor.
+ */
+ void setStdHepReader(lStdHep* rdr)
+ {
+ assert( rdr );
+ m_reader = rdr;
+ }
+
+ /**
+ * Create the next MCP collection using current event
+ * NOTE: This function depends upon an external read operation for the next event.
+ */
+ void fillCurrentMcpCollectionFromStdHep();
+
+ /**
+ * Reset the current MCParticle collection.
+ */
+ void setCurrentMcpCollection(EVENT::LCCollection* mcpColl);
+
+ /**
+ * Get the current MCParticle collection.
+ */
+ EVENT::LCCollection* getCurrentMcpCollection();
+
+ /**
+ * Create a single MCParticle from a StdHep track.
+ * NOTE: Does not setup mother or daughter links.
+ */
+ IMPL::MCParticleImpl* createMcpFromStdHep( int ihep );
+
+ /**
+ * Setup the parent pointers of this track.
+ */
+ void setupParents( int ihep, IMPL::MCParticleImpl* );
+
+ /**
+ * Setup the input MCParticle as a parent of this track.
+ */
+ void addMcpParent( int parIdx, IMPL::MCParticleImpl* parMcp );
+
+ /**
+ * Setup the daughter pointers of this track.
+ */
+ void setupDaughters( int ihep, IMPL::MCParticleImpl* );
+
+ /**
+ * Setup the input MCParticle as a parent of this track.
+ */
+ void addMcpDaughter( int dauIdx, IMPL::MCParticleImpl* parMcp );
+
+ /**
+ * Check if an MCParticle has another particle as its parent.
+ */
+ bool hasParent( IMPL::MCParticleImpl* dauMcp, IMPL::MCParticleImpl* parMcp);
+
+ /**
+ * Given two ihep indices, return a vector of all the included indices (discrete, range, etc.).
+ */
+ std::vector<int> makeIndexVec( int idx1, int idx2, std::vector<int>& vec );
+
+ /**
+ * Perform various sanity checks on the track's mother and daughter index values.
+ */
+ void checkParentage( int ihep );
+
+
+ /* Print utilities. */
+ void printIndex( int ihep );
+ void printMothers( int ihep );
+ void printDaughters( int ihep );
+ void printTrack( int ihep );
+
+ bool isValidDaughterIndex(int ihep)
+ {
+ return (ihep > -1 && ihep < m_reader->nTracks());
+ }
+
+ private:
+
+ /* Pointer to the current MCParticle collection that is being filled. */
+ EVENT::LCCollection* m_currentMcpColl;
+
+ /* Pointer to the lStdHep reader being used as a data source. */
+ lStdHep* m_reader;
+ };
}
#endif