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.

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


+verbatim+
index: src/tautrack.cxx
===================================================================
--- src/tautrack.cxx	(revision 447210)
+++ src/tautrack.cxx	(working copy)
@@ -203,7 +203,7 @@
 
   rec::trackparticlecontainer::const_iterator track_begin = trackcontainer-&gt;begin();
   rec::trackparticlecontainer::const_iterator   track_end = trackcontainer-&gt;end();
-  rec::trackparticle* track;
+  const rec::trackparticle* track;
 
   double dr;
 
@@ -213,9 +213,9 @@
 
   p4eetaphim p4seed( 1., details-&gt;seedcalo_eta(), details-&gt;seedcalo_phi(), 0. );
 
-  std::vector&lt;rec::trackparticle*&gt; core_tracks;
-  std::vector&lt;rec::trackparticle*&gt; wide_tracks;
-  std::vector&lt;rec::trackparticle*&gt; other_tracks;
+  std::vector&lt;const rec::trackparticle*&gt; core_tracks;
+  std::vector&lt;const rec::trackparticle*&gt; wide_tracks;
+  std::vector&lt;const rec::trackparticle*&gt; other_tracks;
 
   for (; track_begin!=track_end; track_begin++)
   {
@@ -258,7 +258,7 @@
   std::sort( wide_tracks.begin(), wide_tracks.end(), tautracksort() );
   std::sort( other_tracks.begin(), other_tracks.end(), tautracksort() );
 
-  std::vector&lt;rec::trackparticle*&gt;::iterator itr;
+  std::vector&lt;const rec::trackparticle*&gt;::iterator itr;
 
 
   for ( itr = core_tracks.begin(); itr != core_tracks.end(); itr++ )
index: src/tauloosetrack.cxx
===================================================================
--- src/tauloosetrack.cxx	(revision 447210)
+++ src/tauloosetrack.cxx	(working copy)
@@ -148,7 +148,7 @@
 
     rec::trackparticlecontainer::const_iterator track_begin = trackcontainer-&gt;begin();
     rec::trackparticlecontainer::const_iterator   track_end = trackcontainer-&gt;end();
-    rec::trackparticle* track;
+    const rec::trackparticle* track;
 
     double dr;
    
@@ -158,7 +158,7 @@
     p4seed.setphi( details-&gt;seedcalo_phi() );
     
 
-    std::vector&lt;rec::trackparticle*&gt; loose_tracks;
+    std::vector&lt;const rec::trackparticle*&gt; loose_tracks;
        
     for (; track_begin!=track_end; track_begin++)
     {
@@ -185,7 +185,7 @@
     
     std::sort( loose_tracks.begin(), loose_tracks.end(), tautracksort() );
     
-    std::vector&lt;rec::trackparticle*&gt;::iterator itr;
+    std::vector&lt;const rec::trackparticle*&gt;::iterator itr;
           
     for ( itr = loose_tracks.begin(); itr != loose_tracks.end(); itr++ )
       details-&gt;addloosetrk( trackcontainer, *itr );
index: src/tauconversionfinder.cxx
===================================================================
--- src/tauconversionfinder.cxx	(revision 447210)
+++ src/tauconversionfinder.cxx	(working copy)
@@ -93,7 +93,7 @@
   // ------------------------------------------------------------------ 
   if (m_do_normal || m_do_loose) {
     analysis::taujetcontainer *taujetcont = data-&gt;taucontainer;
-    for (analysis::taujetcontainer::const_iterator tjcitr = taujetcont-&gt;begin(); tjcitr!=  taujetcont-&gt;end(); ++tjcitr) {
+    for (analysis::taujetcontainer::iterator tjcitr = taujetcont-&gt;begin(); tjcitr!=  taujetcont-&gt;end(); ++tjcitr) {
       analysis::taujet *tau = *tjcitr;
       analysis::taucommondetails* cd = const_cast&lt;analysis::taucommondetails*&gt;(tau-&gt;details&lt;const analysis::taucommondetails&gt;());
       unsigned int numtracks = tau-&gt;numtrack();
index: src/tau1p3ptrackleading.cxx
===================================================================
--- src/tau1p3ptrackleading.cxx	(revision 447210)
+++ src/tau1p3ptrackleading.cxx	(working copy)
@@ -185,9 +185,9 @@
             }
 	}
 
-        std::list&lt;rec::trackparticle*&gt; coretracks;
-        std::list&lt;rec::trackparticle*&gt; widetracks;
-        std::list&lt;rec::trackparticle*&gt; othertracks;
+        std::list&lt;const rec::trackparticle*&gt; coretracks;
+        std::list&lt;const rec::trackparticle*&gt; widetracks;
+        std::list&lt;const rec::trackparticle*&gt; othertracks;
         
 
         //---------------------------------------------------------------------
@@ -224,7 +224,7 @@
         //fixme: twice the same track container name (here and providing seed)
         rec::trackparticlecontainer::const_iterator   trk_begin = trackcontainer-&gt;begin();
         rec::trackparticlecontainer::const_iterator   trk_end   = trackcontainer-&gt;end();
-        rec::trackparticle* trk;
+        const rec::trackparticle* trk;
 
         for (; trk_begin!=trk_end; trk_begin++)
         {
@@ -292,7 +292,7 @@
 
 
         
-        std::list&lt;rec::trackparticle*&gt;::iterator itr;
+        std::list&lt;const rec::trackparticle*&gt;::iterator itr;
         double  resphi = 0;
         calophirange phirange ;
         for ( itr = coretracks.begin(); itr != coretracks.end(); itr++ )
index: src/photonconversionvertex.cxx
===================================================================
--- src/photonconversionvertex.cxx	(revision 447210)
+++ src/photonconversionvertex.cxx	(working copy)
@@ -80,8 +80,10 @@
       rec::trackparticlecontainer* tempcont = new rec::trackparticlecontainer(sg::view_elements);

       for (rec::trackparticlecontainer::const_iterator tpcitr=trackparticlecont-&gt;begin(); tpcitr!=trackparticlecont-&gt;end(); ++tpcitr) {    

         double mintaudr = getmindrtaudecay(taujetcont, *tpcitr);

-        if (mintaudr &lt; m_maxtaujetdr)

-            tempcont-&gt;push_back(*tpcitr);

+        if (mintaudr &lt; m_maxtaujetdr) {

+          // fixme: cast needed for copying between containers.

+          tempcont-&gt;push_back(const_cast&lt;rec::trackparticle*&gt; (*tpcitr));

+        }

       }

       ath_msg_verbose(&quot;number of tracks within tau seed cones for conversion finding: &quot; &lt;&lt; tempcont-&gt;size());

 

-verbatim-

i also had these changes to fix compilation with gcc 4.6:

+verbatim+
index: src/tau1p3ptrackmatchcells.cxx
===================================================================
--- src/tau1p3ptrackmatchcells.cxx	(revision 447210)
+++ src/tau1p3ptrackmatchcells.cxx	(working copy)
@@ -146,7 +146,7 @@
         clustercontainer-&gt;push_back( (*it).second );
 
     //ak 
-    sort( clustercontainer-&gt;begin(),clustercontainer-&gt;end(),orderclust() );
+    std::sort( clustercontainer-&gt;begin(),clustercontainer-&gt;end(),orderclust() );
 
     //---------------------------------------------------------------------
     // record cluster container
-verbatim-


and these to get rid of warnings about possibly uninitialized variables:

+verbatim+
index: src/tau1p3paddeflowinfo.cxx
===================================================================
--- src/tau1p3paddeflowinfo.cxx	(revision 447210)
+++ src/tau1p3paddeflowinfo.cxx	(working copy)
@@ -194,7 +194,7 @@
        analysis::taucommonextradetails *p_extradetails = dynamic_cast&lt;taucommonextradetails *&gt;(data-&gt;extradetails);
 
 
-       const calocellcontainer *p_cellcontainer;
+       const calocellcontainer *p_cellcontainer = 0;
        sc = data-&gt;getobject( &quot;cellcontainer&quot;, p_cellcontainer );
        if( sc.isfailure() || !p_cellcontainer )
        {
index: src/tau1p3pcreatepi0clus.cxx
===================================================================
--- src/tau1p3pcreatepi0clus.cxx	(revision 447210)
+++ src/tau1p3pcreatepi0clus.cxx	(working copy)
@@ -210,7 +210,7 @@
        std :: vector&lt;calocluster *&gt; clusterpi0;
 
        //fix me! needed only for cell coping
-       const calocellcontainer *p_cellcontainer;
+       const calocellcontainer *p_cellcontainer = 0;
        sc = data-&gt;getobject( &quot;cellcontainer&quot;, p_cellcontainer );
        if( sc.isfailure() || !p_cellcontainer )
        {
-verbatim-



