hi -

it has long been that the methods that dereference a const
datavector&lt;t&gt; (operator[], etc), return a `const t*',
even though the value_type is `t*'.

however, datavector&lt;t&gt;::const_iterator has been inconsistent with this,
in that dereferencing the iterator returns a `t*'.

we are trying to change this feature of datavector::const_iterator, so that
dereferencing it will also return a `const t*', consistent with
datavector.  we hope this will help catch instances where
data objects are unintentionally modified.

these changes are in datamodel-00-23-21.
unfortunately, this requires some changes in client packages.
(this is being tested in mig7.)

here are the changes in toptruthselection that were required to be
compatible with these changes.


+verbatim+
index: src/toptruthutils.cxx
===================================================================
--- src/toptruthutils.cxx	(revision 447210)
+++ src/toptruthutils.cxx	(working copy)
@@ -89,7 +89,8 @@
        abs((*itr)-&gt;pdgid()) == 13 ||
        abs((*itr)-&gt;pdgid()) == 15  ) 
     {   
-      aleptoncontainer-&gt;push_back(*itr);
+      // fixme: const_cast needed for copying btn containers
+      aleptoncontainer-&gt;push_back(const_cast&lt;truthparticle*&gt; (*itr));
     }
        
   }
@@ -108,7 +109,8 @@
        abs((*itr)-&gt;pdgid()) == 14 ||
        abs((*itr)-&gt;pdgid()) == 16  ) 
     {   
-      aneutrinocontainer-&gt;push_back(*itr);
+      // fixme: const_cast needed for copying btn containers
+      aneutrinocontainer-&gt;push_back(const_cast&lt;truthparticle*&gt; (*itr));
     }
        
   }
@@ -125,7 +127,8 @@
     
     if(abs((*itr)-&gt;pdgid()) &lt;= 4) 
     {   
-      alightquarkcontainer-&gt;push_back(*itr);
+      // fixme: const_cast needed for copying btn containers
+      alightquarkcontainer-&gt;push_back(const_cast&lt;truthparticle*&gt; (*itr));
     }
        
   }
@@ -142,7 +145,8 @@
     
     if(abs((*itr)-&gt;pdgid()) == 5) 
     {   
-      abquarkcontainer-&gt;push_back(*itr);
+      // fixme: const_cast needed for copying btn containers
+      abquarkcontainer-&gt;push_back(const_cast&lt;truthparticle*&gt; (*itr));
     }
        
   }
@@ -159,7 +163,8 @@
     
     if((*itr)-&gt;pdgid() == 21) 
     {   
-      aleptoncontainer-&gt;push_back(*itr);
+      // fixme: const_cast needed for copying btn containers
+      aleptoncontainer-&gt;push_back(const_cast&lt;truthparticle*&gt; (*itr));
     }
        
   }
index: src/toptruthinputsselector.cxx
===================================================================
--- src/toptruthinputsselector.cxx	(revision 447210)
+++ src/toptruthinputsselector.cxx	(working copy)
@@ -365,13 +365,14 @@
   
   for(itr=atruthparticlecontainer-&gt;begin(); itr!=atruthparticlecontainer-&gt;end(); itr++)
   {
-            
-    if     (toptruthutils::istopquark(*itr))      avertexcontainer-&gt;push_back(*itr);
-    else if(toptruthutils::isdquarkfromtop(*itr)) avertexcontainer-&gt;push_back(*itr);
-    else if(toptruthutils::issquarkfromtop(*itr)) avertexcontainer-&gt;push_back(*itr);
-    else if(toptruthutils::isbquarkfromtop(*itr)) avertexcontainer-&gt;push_back(*itr);
-    else if(toptruthutils::iswbosonfromtop(*itr)) avertexcontainer-&gt;push_back(*itr);
-    else if(toptruthutils::ishiggsfromtop(*itr))  avertexcontainer-&gt;push_back(*itr);
+    // fixme: const_cast needed for copying btn containers.
+    truthparticle* mvtx = const_cast&lt;truthparticle*&gt; (*itr);
+    if     (toptruthutils::istopquark(*itr))      avertexcontainer-&gt;push_back(mvtx);
+    else if(toptruthutils::isdquarkfromtop(*itr)) avertexcontainer-&gt;push_back(mvtx);
+    else if(toptruthutils::issquarkfromtop(*itr)) avertexcontainer-&gt;push_back(mvtx);
+    else if(toptruthutils::isbquarkfromtop(*itr)) avertexcontainer-&gt;push_back(mvtx);
+    else if(toptruthutils::iswbosonfromtop(*itr)) avertexcontainer-&gt;push_back(mvtx);
+    else if(toptruthutils::ishiggsfromtop(*itr))  avertexcontainer-&gt;push_back(mvtx);
 
   }
       
@@ -385,11 +386,12 @@
   
   for(itr=atruthparticlecontainer-&gt;begin(); itr!=atruthparticlecontainer-&gt;end(); itr++)
   {
-   
-    if     (toptruthutils::iswboson(*itr))        avertexcontainer-&gt;push_back(*itr);
-    else if(toptruthutils::isleptonfromw(*itr))   avertexcontainer-&gt;push_back(*itr);
-    else if(toptruthutils::isneutrinofromw(*itr)) avertexcontainer-&gt;push_back(*itr);
-    else if(toptruthutils::isquarkfromw(*itr))    avertexcontainer-&gt;push_back(*itr);
+    // fixme: const_cast needed for copying btn containers.
+    truthparticle* mvtx = const_cast&lt;truthparticle*&gt; (*itr);
+    if     (toptruthutils::iswboson(*itr))        avertexcontainer-&gt;push_back(mvtx);
+    else if(toptruthutils::isleptonfromw(*itr))   avertexcontainer-&gt;push_back(mvtx);
+    else if(toptruthutils::isneutrinofromw(*itr)) avertexcontainer-&gt;push_back(mvtx);
+    else if(toptruthutils::isquarkfromw(*itr))    avertexcontainer-&gt;push_back(mvtx);
 
   }
       
@@ -403,10 +405,11 @@
   
   for(itr=atruthparticlecontainer-&gt;begin(); itr!=atruthparticlecontainer-&gt;end(); itr++)
   {
-    
-    if     (toptruthutils::iszboson(*itr))      avertexcontainer-&gt;push_back(*itr);
-    else if(toptruthutils::isleptonfromz(*itr)) avertexcontainer-&gt;push_back(*itr);
-    else if(toptruthutils::isquarkfromz(*itr))  avertexcontainer-&gt;push_back(*itr);
+    // fixme: const_cast needed for copying btn containers.
+    truthparticle* mvtx = const_cast&lt;truthparticle*&gt; (*itr);
+    if     (toptruthutils::iszboson(*itr))      avertexcontainer-&gt;push_back(mvtx);
+    else if(toptruthutils::isleptonfromz(*itr)) avertexcontainer-&gt;push_back(mvtx);
+    else if(toptruthutils::isquarkfromz(*itr))  avertexcontainer-&gt;push_back(mvtx);
       
   }
       
@@ -420,12 +423,13 @@
   
   for(itr=atruthparticlecontainer-&gt;begin(); itr!=atruthparticlecontainer-&gt;end(); itr++)
   {
-    
-    if     (toptruthutils::ischargedhiggs(*itr))      avertexcontainer-&gt;push_back(*itr);
-    else if(toptruthutils::isleptonfromhiggs(*itr))   avertexcontainer-&gt;push_back(*itr);
-    else if(toptruthutils::isneutrinofromhiggs(*itr)) avertexcontainer-&gt;push_back(*itr);
-    else if(toptruthutils::isquarkfromhiggs(*itr))    avertexcontainer-&gt;push_back(*itr);
-    else if(toptruthutils::isphotonfromhiggs(*itr))   avertexcontainer-&gt;push_back(*itr);
+    // fixme: const_cast needed for copying btn containers.
+    truthparticle* mvtx = const_cast&lt;truthparticle*&gt; (*itr);
+    if     (toptruthutils::ischargedhiggs(*itr))      avertexcontainer-&gt;push_back(mvtx);
+    else if(toptruthutils::isleptonfromhiggs(*itr))   avertexcontainer-&gt;push_back(mvtx);
+    else if(toptruthutils::isneutrinofromhiggs(*itr)) avertexcontainer-&gt;push_back(mvtx);
+    else if(toptruthutils::isquarkfromhiggs(*itr))    avertexcontainer-&gt;push_back(mvtx);
+    else if(toptruthutils::isphotonfromhiggs(*itr))   avertexcontainer-&gt;push_back(mvtx);
       
   }
       
@@ -442,19 +446,23 @@
       
     if(abs((*itr)-&gt;pdgid()) &lt;= 5) 
     {
-      atruthinputscontainer-&gt;push_back(*itr);      
+      // fixme: const_cast needed for copying btn containers.
+      atruthinputscontainer-&gt;push_back(const_cast&lt;truthparticle*&gt; (*itr));      
     }  
     else if(abs((*itr)-&gt;pdgid()) == 11 || abs((*itr)-&gt;pdgid()) == 13)
     {      
-      atruthinputscontainer-&gt;push_back(*itr);      
+      // fixme: const_cast needed for copying btn containers.
+      atruthinputscontainer-&gt;push_back(const_cast&lt;truthparticle*&gt; (*itr));      
     }    
     else if(abs((*itr)-&gt;pdgid()) == 15)
     {    
-      atruthinputscontainer-&gt;push_back(*itr);  
+      // fixme: const_cast needed for copying btn containers.
+      atruthinputscontainer-&gt;push_back(const_cast&lt;truthparticle*&gt; (*itr));  
     }    
     else if((*itr)-&gt;pdgid() == 21)
     {
-      atruthinputscontainer-&gt;push_back(*itr);
+      // fixme: const_cast needed for copying btn containers.
+      atruthinputscontainer-&gt;push_back(const_cast&lt;truthparticle*&gt; (*itr));
     }
   
   }
-verbatim-
