Commits

Anonymous committed dd320ab Merge

sync w/ atlasoff

Comments (0)

Files changed (6)

+2012-04-16 Walter Lampl <walter.lampl@ cern.ch>
+	* UserDataSvc.cxx: Put addRef in queryInterface
+	* tag AthenaServices-01-56-09
+	
+2012-04-05 Walter Lampl <walter.lampl@ cern.ch>
+	* UserDataSvc.cxx: Downgrade per-event INFO message to DEBUG
+	* tagging AthenaServices-01-56-08
+
+2012-04-04  Sebastien Binet  <binet@cern.ch>
+
+	* tagging AthenaServices-01-56-07
+	* be explicit about empty body of while loops
+	* M src/AtRndmGenSvc.cxx
+	* M src/AtRndmGenSvc.cxx
+	* M src/AtDSFMTGenSvc.cxx
+
+2012-03-29 Walter Lampl
+	* Redesign (I)UserDataSvc. StoreGate based implementation
+	* tag AthenaServices-01-56-06
+
+2012-03-22  Sebastien Binet  <sebastien.binet@cern.ch>
+
+	* tagging AthenaServices-01-56-05
+	* fix reference files as a consequence of -01-56-04
+	* M share/TestSeedRunEvent.ref
+	* M share/TestStopRun.ref
+
+2012-03-20  John Chapman  <John.Chapman@cern.ch>
+
+	* tagging AthenaServices-01-56-04
+	* src/AthenEventLoopMgr.cxx: Change Histograms saving not required
+	WARNING to DEBUG and protect DEBUG level messages.
+
+2012-03-10  scott snyder  <snyder@bnl.gov>
+
+	* tagging AthenaServices-01-56-03.
+	* src/UserDataSvc.cxx: Comment out debugging printouts.
+
+2012-03-02  Paolo Calafiura for Thomas Kittelmann
+
+	* tagging AthenaServices-01-56-02
+	* src/UserDataSvc.cxx: protect DEBUG printouts 
+
+2012-03-02  Sebastien Binet  <sebastien.binet@cern.ch>
+
+	* tagging AthenaServices-01-56-01
+	* support for disabling EventPrintoutInterval with value==0
+	* M src/AthenaEventLoopMgr.cxx
+
+2012-02-21  John Chapman  <John.Chapman@cern.ch>
+
+	* tagging AthenaServices-01-56-00 
+	* add src/AtDSFMTGenSvc.cxx, src/AtDSFMTGenSvc.h - new service
+	which uses a Mersenne Twister random number generator. (By Michael
+	and Paolo.) Requires External/AtlasDSFMT and
+	Simulation/Tools/AtlasCLHEP_RandomGenerators packages to be in the
+	release.
+	* src/components/AthenaServices_entries.cxx - add entries for
+	AtDSFMTGenSvc.
+	* cmt/requirements - add use statement for
+	AtlasCLHEP_RandomGenerators package.
+
+2012-02-01  Paolo Calafiura  <calaf@localhost6.localdomain6>
+
+	* tagging AthenaServices-01-55-05
+	* src/AtRndmGenSvc.cxx (AtRndmGenSvc::CreateStream): fix #90947
+	setSeeds requires a 0-terminated array(thanks Michael)
+
+2012-01-27  Peter van Gemmeren  <gemmeren@anl.gov>
+	* tagging AthenaServices-01-55-04
+	* src/AthenaSummarySvc.cxx, DecisionSvc.cxx, UserDataSvc.cxx: Directly #include FileIncident from Gaudi.
+
 2011-12-15  Sebastien Binet  <sebastien.binet@cern.ch>
 
 	* tagging AthenaServices-01-55-03

python/TPCnvDb.py

 
 from __future__ import with_statement
 
-__version__ = "$Revision$"
+__version__ = "$Revision: 321236 $"
 __author__  = "Sebastien Binet <binet@cern.ch>"
 __doc__ = """simple interface to the rootmap files to easily locate t/p cnvs"""
 

src/AtDSFMTGenSvc.cxx-nomanacore

File contents unchanged.

src/AtRanluxGenSvc.cxx

 {
   bool allOK(true);
   engineIter i(m_engines.begin()), e(m_engines.end());
-  while (i!=e && (allOK=(0 != this->setOnDefinedSeeds(eventNumber,
-						      runNumber,
-						      (*i++).first))));
+  while (i!=e && 
+         (allOK=(0 != this->setOnDefinedSeeds(eventNumber,
+                                              runNumber,
+                                              (*i++).first)))) {
+    /*empty*/
+  }
   return allOK;
 }
 
 AtRanluxGenSvc::setAllOnDefinedSeeds(uint32_t theSeed){
   bool allOK(true);
   engineIter i(m_engines.begin()), e(m_engines.end());
-  while (i!=e && (allOK=(0 != this->setOnDefinedSeeds(theSeed, (*i++).first))));
+  while (i!=e && 
+         (allOK=(0 != this->setOnDefinedSeeds(theSeed, (*i++).first)))) {
+    /*empty*/
+    }
   return allOK;
 }

src/AtRndmGenSvc.cxx

     if (citer == m_engines.end())
       m_engines.insert(engineValType(streamName, new RanecuEngine()));
     engineIter iter = m_engines.find(streamName);
-    long seeds[2] = { seed1, seed2 };
+    long seeds[3] = { seed1, seed2, 0 };
     ((*iter).second)->setSeeds( seeds, -1 );
 }
 
       (" INITIALISING " << streamName << " stream with DEFAULT seeds "
        << seed1 << "  " << seed2);
     
-    long seeds[2] = { seed1, seed2 };
+    long seeds[3] = { seed1, seed2, 0 };
     const long* s = seeds;
     engineIter	iter	=	m_engines.find(streamName);
     ((*iter).second)->setSeeds( s, -1 );
     m_engines.insert( engineValType(streamName, new RanecuEngine() ) ); 
   engineIter iter = m_engines.find(streamName); 
   int hashedStream(SG::simpleStringHash(streamName)); 
-  long seeds[2] = { 1000*runNumber + hashedStream,  
-		    eventNumber }; 
+  long seeds[3] = { 1000*runNumber + hashedStream,  
+		    eventNumber, 0 }; 
   assert( seeds[0] > 0 ); 
   assert( seeds[1] > 0 ); 
   const long* s = seeds; 
     m_engines.insert( engineValType(streamName, new RanecuEngine() ) ); 
   engineIter iter = m_engines.find(streamName); 
   int hashedStream(SG::simpleStringHash(streamName)); 
-  long seeds[2] = { hashedStream % (theSeed+13), theSeed }; 
+  long seeds[3] = { hashedStream % (theSeed+13), theSeed, 0 }; 
   assert( seeds[0] > 0 ); 
   assert( seeds[1] > 0 ); 
   const long* s = seeds; 
 {
   bool allOK(true);
   engineIter i(m_engines.begin()), e(m_engines.end());
-  while (i!=e && (allOK=(0 != this->setOnDefinedSeeds(eventNumber,
-						      runNumber,
-						      (*i++).first))));
+  while (i!=e && 
+         (allOK=(0 != this->setOnDefinedSeeds(eventNumber,
+                                              runNumber,
+                                              (*i++).first)))) {
+    /*empty*/
+  }
   return allOK;
 }
 
 AtRndmGenSvc::setAllOnDefinedSeeds(uint32_t theSeed){
   bool allOK(true);
   engineIter i(m_engines.begin()), e(m_engines.end());
-  while (i!=e && (allOK=(0 != this->setOnDefinedSeeds(theSeed, (*i++).first))));
+  while (i!=e && 
+         (allOK=(0 != this->setOnDefinedSeeds(theSeed, (*i++).first)))) {
+    /* empty */
+    }
   return allOK;
 }

src/UserDataSvc.cxx

-//$Id: UserDataSvc.cxx,v 1.17 2008/07/07 05:44:46 yyao Exp $
+#include "boost/any.hpp"
 
-#include <algorithm>
-#include <cassert>
-#include <memory>
-#include <string>
-#include <sstream>
-#include <cxxabi.h>
+#include "UserDataSvc.h" 
+#include "DataModel/UserDataStore.h"
+#include "AthenaKernel/errorcheck.h"
+#include "Navigation/AthenaBarCodeBase.h"
+#include "GaudiKernel/IIncidentSvc.h"
+#include "StoreGate/StoreGateSvc.h" 
 
-#include "TROOT.h"
-#include "TError.h"
-#include "TClass.h"
-#include "TString.h"
+UserDataSvc::UserDataSvc(const std::string& name, ISvcLocator* pSvcLocator ) : 
+  AthService(name,pSvcLocator),
+  m_storeGateSvc("StoreGateSvc",name),
+  m_userData(0),
+  m_cUserData(0),
+  m_eventABC(IAthenaBarCode::UNDEFINEDBARCODE){
 
-#include "GaudiKernel/System.h"
-#include "GaudiKernel/MsgStream.h"
-#include "GaudiKernel/IIncidentSvc.h"
-#include "GaudiKernel/IAlgManager.h"
-#include "GaudiKernel/ISvcLocator.h"
+  declareProperty("StoreGateSvc",m_storeGateSvc);
+  declareProperty("Key",m_key="UserDataStore","StoreGate key of UserDataStore object");
+  declareProperty("CreateStoreAtBegin",m_createAtBegin=false,"Create UserDataStore object at begin of each event");
+}
 
-#include "AthenaPoolKernel/FileIncident.h"
 
-#include "EventInfo/EventInfo.h"
-#include "EventInfo/EventID.h"
+StatusCode UserDataSvc::initialize() {
 
-#include "StoreGate/StoreGateSvc.h"
+  if (m_storeGateSvc.retrieve().isFailure()) {
+    msg(MSG::ERROR) << "Failed to retrieve StoreGateSvc" << endreq;
+    return StatusCode::FAILURE;
+  }
 
-#include "AthenaOutputStream.h"
 
-#include "AthenaBaseComps/AthMsgStreamMacros.h"
-#include "UserDataSvc.h"
+  IIncidentSvc* incSvc = 0;
+  if (service("IncidentSvc",incSvc).isFailure()) {
+    msg(MSG::ERROR) << "Unable to get the IncidentSvc" << endreq;
+    return StatusCode::FAILURE;
+  }
+  incSvc->addListener( this, IncidentType::BeginEvent  );
+  ATH_MSG_DEBUG("Added incidentLister for BeginEvent" );
 
-using namespace std;
+  //}
+  //else
+  //ATH_MSG_DEBUG("Don't create UserDataStore at BeginEvent incident");
 
-using namespace Athena;
+  return StatusCode::SUCCESS;
+}
 
 
-//- private helpers ---------------------------------------------------------
-template<typename T>
-static inline 
-void ConditionalBranchCreate(TTree* ttree, const char* bname, T* pv) {
-  if (!ttree->GetBranch(bname))
-     ttree->Branch(bname, pv);
-  else
-     ttree->SetBranchAddress(bname, pv);
+void UserDataSvc::handle( const Incident& inc ) {
+  ATH_MSG_DEBUG ("Incident handle. Incident type " << inc.type() << " from " << inc.source());
+  m_userData=NULL;
+  m_cUserData=NULL;
+  if (m_createAtBegin) createUserDataStore(m_key);
+  return;
 }
-//-
 
 
-UserDataSvc::UserDataSvc(const std::string& name, ISvcLocator* svc) :
-  AthService(name, svc), 
-  m_currRunNumber(0), 
-  m_currEventNumber(0),
-  m_associationtree(0), 
-  m_userdatatree(0), 
-  m_fileleveluserdatatree(0),
-  m_r_inputfilecounter(0), 
-  m_r_synchronized(false),
-  m_el_curevent_begin(-1), 
-  m_el_curevent_end(-1), 
-  m_r_el_evt_init(false),
-  m_r_el_tree(0), 
-  m_r_el_tree_abc(0), 
-  m_r_el_tree_label(0),
-  m_r_el_tree_blob(0),
-  m_r_el_tree_type(0),
-  m_activeStoreSvc("ActiveStoreSvc", name), 
-  m_thistsvc("THistSvc", name),
-  m_propTHistSvc(0), 
-  m_infirstevent(true),
-  m_outputStream(0),
-  m_doRead(false),
-  m_doWrite(false), 
-  m_doWriteTransient(true),
-  m_dictLoaderSvc("AthDictLoaderSvc", name) 
-{
+StatusCode UserDataSvc::finalize() {
+  return StatusCode::SUCCESS;
+}
 
-  declareProperty("InputFileCollection", m_inputfilecoll,
-      "List of name of the input files to read userdata from");
-  declareProperty("OutputFileName", m_outputfilename = "none",
-      "Name of the output file to write userdata to");
-  declareProperty("OutputStream", m_outputstreamname = "none",
-      "Name of the output file to write userdata to");
-  declareProperty("InputFileStreamName", m_inputfilestream,
-      "List of stream names corresponding to input files. set automatically.");
-  declareProperty("WriteTransient", m_doWriteTransient = true,
-                  "Allow writing to transient UserData store.");
-  declareProperty("MergeMode", m_doMerge = false,
-                  "Run in merge mode: read and write user data.");
 
-  m_outputstreamname.declareUpdateHandler(&UserDataSvc::outputstreamHandler,
-      this);
+UserDataSvc::~UserDataSvc() {
 
 }
 
-void
-UserDataSvc::outputstreamHandler(Property& /* theProp */) {
-  if (!m_doMerge) {
-    ServiceHandle<IAlgManager> theAlgMgr("ApplicationMgr", name());
-    StatusCode sc = theAlgMgr.retrieve();
 
-    if (sc.isSuccess()) {
-      msg() << MSG::DEBUG << "Got Alg Mgr " << theAlgMgr << endreq;
-    } else {
-      msg() << MSG::FATAL << "Can't Get Alg Mgr " << theAlgMgr << endreq;
-      throw GaudiException("Unable to get Algorithm Mgr", name(), sc);
+void UserDataSvc::createUserDataStore(const std::string& sgkey) {
+   m_userData=new UserDataStore;
+   StatusCode sc=m_storeGateSvc->record(m_userData,sgkey);
+   if (sc.isFailure()) {
+     msg(MSG::ERROR) << "Failed to record UserDataStore with key " << sgkey << endreq;
+     delete m_userData;
+     m_cUserData=NULL;
+     m_userData=NULL;
+     return;
+   }
+   m_cUserData=m_userData; //Store also as const pointer
+   ATH_MSG_DEBUG("Successfully created UserDataStore Object with key " << m_key);
+   AthenaBarCodeBase newEventABC; //Generate new AthenaBarCode
+   m_userData->setEventABC(newEventABC.getAthenaBarCode());
+   m_eventABC.setAthenaBarCode(newEventABC.getAthenaBarCode());
+   ATH_MSG_DEBUG("Event BarCode: " << newEventABC.getAthenaBarCode()); 
+   return;
+}
+
+
+void UserDataSvc::getUserDataStore() {
+  if (!m_userData) {
+    if (m_storeGateSvc->contains<UserDataStore>(m_key)) {
+      StatusCode sc=m_storeGateSvc->retrieve(m_userData,m_key);
+      if (sc.isFailure()) {
+	msg(MSG::ERROR) << "Failed to retrieve non-const UsterDataStore!" << endreq;
+	m_userData=NULL;
+	m_cUserData=NULL;
+	return;
+      }
+      m_cUserData=m_userData;
+      m_eventABC.setAthenaBarCode(m_cUserData->getEventABC());
+      ATH_MSG_DEBUG("Succesfully retrieved UserDataObject with key " << m_key);
+    }// end if contains
+    else {
+      ATH_MSG_DEBUG("Going to create UserDataStore object.");
+      createUserDataStore(m_key);
     }
+  }//end if doesn't exits already
+  return;
+}
 
-    if ( ! theAlgMgr->getAlgorithms().empty() ) { // too early (i.e. used in CreateSvc, i.e. w/ doMerge)
-      IAlgorithm* theIAlg(0);
-      if ( (theAlgMgr->getAlgorithm(m_outputstreamname.value(), theIAlg)).isSuccess() &&
-           (0 != (m_outputStream = dynamic_cast<AthenaOutputStream*>(theIAlg))) ) {
-        ATH_MSG_DEBUG("Got AthenaOutputStream " + m_outputStream->name());
-      } else {
-        ATH_MSG_FATAL("Unable to decode AcceptAlgs list");
-        throw GaudiException("Unable to decode AcceptAlgs list", name(), StatusCode::FAILURE);
+void UserDataSvc::getUserDataStore_cst() {
+  if (!m_cUserData) {
+    if (m_storeGateSvc->contains<UserDataStore>(m_key)) {
+      StatusCode sc=m_storeGateSvc->retrieve(m_cUserData,m_key);
+      if (sc.isFailure()) {
+	msg(MSG::ERROR) << "Failed to retrieve const UserDataStore object with default key " << m_key << " from StoreGate." << endreq;
+	return;
       }
+      m_eventABC.setAthenaBarCode(m_cUserData->getEventABC());
     }
+    else {//No object in SG
+      ATH_MSG_WARNING("No UserDataStore object with key " << m_key << " in StoreGate");
+    }
+    return;
+  }//end if doesn't exits already
+  return;
+}
+
+StatusCode UserDataSvc::recordAny(const IAthenaBarCode& abc,const std::string& label, const boost::any& value) {
+  ATH_MSG_DEBUG("Trying to record UserData with label " << label);
+  getUserDataStore();
+  if (!m_userData) return StatusCode::FAILURE;
+  return m_userData->recordAny(abc,label,value);
+}
+
+
+  
+StatusCode UserDataSvc::retrieveAny(const IAthenaBarCode& abc,const std::string& label, const boost::any*& value)  {
+  ATH_MSG_DEBUG("Trying to retrieve UserData with label " << label);
+  getUserDataStore_cst();
+  if (!m_cUserData) return StatusCode::FAILURE;
+  return m_cUserData->retrieveAny(abc,label,value);
+}
+
+
+bool UserDataSvc::contains(const IAthenaBarCode& abc,const std::string& label) {
+  ATH_MSG_DEBUG("Check existance of UserData with label " << label);
+  getUserDataStore_cst();
+  if (!m_cUserData) return false;
+  return m_cUserData->contains(abc,label);
+}
+ 
+ 
+
+StatusCode UserDataSvc::recordAny(const std::string& label, const boost::any& value) {
+  ATH_MSG_DEBUG("Trying to record Event UserData with label " << label);
+  return recordAny(m_eventABC,label,value);
+}
+
+  
+StatusCode UserDataSvc::retrieveAny(const std::string& label, const boost::any*& value) {
+  ATH_MSG_DEBUG("Trying to retrieve Event UserData with label " << label);
+  return retrieveAny(m_eventABC,label,value);
+}
+
+
+bool UserDataSvc::contains(const std::string& label) {
+  ATH_MSG_DEBUG("Check existance of Event UserData with label " << label);
+  return contains(m_eventABC,label);
+}
+
+StatusCode UserDataSvc::typeIDtoAny(const std::type_info &decoinfo, void* & deco, boost::any& out) {
+
+  if (this->AnyFromType<uint32_t>(decoinfo,deco,out)) 
+    return StatusCode::SUCCESS;
+  else if (this->AnyFromType<int32_t>(decoinfo,deco,out))
+    return StatusCode::SUCCESS;
+  else if (this->AnyFromType<float>(decoinfo,deco,out))
+    return StatusCode::SUCCESS;
+  else if (this->AnyFromType<double>(decoinfo,deco,out))
+    return StatusCode::SUCCESS;
+  else if (this->AnyFromType<std::vector<uint32_t> >(decoinfo,deco,out)) 
+    return StatusCode::SUCCESS;
+  else if (this->AnyFromType<std::vector<int32_t> >(decoinfo,deco,out))
+    return StatusCode::SUCCESS;
+  else if (this->AnyFromType<std::vector<float> >(decoinfo,deco,out))
+    return StatusCode::SUCCESS;
+  else if (this->AnyFromType<std::vector<double> >(decoinfo,deco,out))
+    return StatusCode::SUCCESS;
+  else {
+    msg(MSG::ERROR) << "Unsupported type " << decoinfo.name() << endreq;
+    return StatusCode::FAILURE;
   }
 }
+  
+
+int UserDataSvc::vdecorateElement(const IAthenaBarCode &abc, const std::string& label,
+					 const std::type_info &decoinfo, void* & deco) {
+  boost::any value;
+  CHECK(this->typeIDtoAny(decoinfo,deco,value));
+  if (this->recordAny(abc,label,value).isSuccess()) 
+    return 0;
+  else
+    return -1;
+}
+
+
+int UserDataSvc::vgetElementDecoration(const IAthenaBarCode &abc, const std::string& label,
+					      const std::type_info &decoinfo, void *&deco) {
+  
+  const boost::any* value=0;
+  if (this->retrieveAny(abc,label,value).isFailure()) {
+    return -1;
+  }
+  if (value->type()!=decoinfo) {
+    msg(MSG::ERROR) << "Typeid mismatch! " <<  value->type().name() << " vs " << decoinfo.name() << endreq;
+    return -1;
+  }
+ 
+  if (decoinfo==typeid(uint32_t)) {
+    deco=(void*)boost::any_cast<uint32_t>(value);
+  }
+  else if (decoinfo==typeid(int32_t)) {
+    deco=(void*)boost::any_cast<int32_t>(value);
+  }
+  else if (decoinfo==typeid(float)) {
+    deco=(void*)boost::any_cast<float>(value);
+  }
+  else if (decoinfo==typeid(double)) {
+    deco=(void*)boost::any_cast<double>(value);
+  }
+  else if (decoinfo==typeid(std::vector<uint32_t>)) {
+    deco=(void*)boost::any_cast<std::vector<uint32_t> >(value);
+  }
+  else if (decoinfo==typeid(std::vector<int32_t>)) {
+    deco=(void*)boost::any_cast<std::vector<int32_t> >(value);
+  }
+  else if (decoinfo==typeid(std::vector<float>)) {
+    deco=(void*)boost::any_cast<std::vector<float> >(value);
+  }
+  else if (decoinfo==typeid(std::vector<double>)) {
+    deco=(void*)boost::any_cast<std::vector<double> >(value);
+  }
+  else if (decoinfo==typeid(bool)) {
+    deco=(void*)boost::any_cast<bool>(value);
+  }
+  else {
+    msg(MSG::ERROR) << "Unsupported/unknown type " << decoinfo.name() << ", label=" << label << endreq;
+    return -1;
+  }
+
+  return 0;
+}
+
 
 StatusCode
 UserDataSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) {
   addRef();
   return StatusCode::SUCCESS;
 }
-
-StatusCode
-UserDataSvc::initialize() {
-
-  msg() << MSG::INFO << "Initializing " << name() << " - package version "
-        << PACKAGE_VERSION << endreq;
-
-  StatusCode sc = m_thistsvc.retrieve();
-  if (!sc.isSuccess()) {
-    msg() << MSG::FATAL << "Could not find THistSvc" << endreq;
-    return StatusCode::FAILURE;
-  }
-
-  sc = this->service("THistSvc", m_propTHistSvc, false);
-  if (!sc.isSuccess()) {
-    msg() << MSG::DEBUG
-        << "Could not retrieve IProperty Interface to 'THistSvc' " << sc
-        << endreq;
-    return StatusCode::FAILURE;
-  }
-
-  ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", this->name());
-  sc = incSvc.retrieve();
-  if (!sc.isSuccess()) {
-    msg() << MSG::FATAL << "Unable to get the IncidentSvc" << endreq;
-    return StatusCode::FAILURE;
-  }
-  incSvc->addListener(this, "BeginRun");
-  incSvc->addListener(this, "EndRun");
-  incSvc->addListener(this, "BeginEvent");
-  incSvc->addListener(this, "EndEvent");
-  incSvc->addListener(this, "BeginInputFile");
-  incSvc->addListener(this, "EndInputFile");
-  incSvc->addListener(this, "BeginTagFile");
-  incSvc->addListener(this, "EndTagFile");
-  incSvc.release().ignore();
-
-  if (!m_dictLoaderSvc.retrieve().isSuccess()) {
-    msg() << MSG::ERROR << "could not retrieve athena dict. loader service !"
-        << endreq;
-    return StatusCode::FAILURE;
-  }
-
-  if ( ! m_doMerge )
-     m_doRead = true;
-
-  msg() << MSG::DEBUG << "Doing Write = " << m_outputstreamname.value()
-      << endreq;
-
-  if (m_outputStream && m_outputstreamname.value() != "none") {
-
-    msg() << MSG::DEBUG << "Doing Write = " << m_outputStream->m_outputName
-        << endreq;
-    m_doWrite = true;
-    m_doWriteTransient = true;
-  }
-
-  if (m_doWriteTransient || m_doMerge) {
-    //Create new TTree.
-    m_userdatatree = new TTree("UserDataTree",
-        "TTree containing all Event/Collection level user data");
-    m_fileleveluserdatatree = new TTree("FileLevelUserDataTree",
-        "TTree containing all file level user data");
-    if (m_doWrite || m_doMerge) {
-      //Reg the tree with THistSvc
-      if (!(m_thistsvc->regTree(std::string("/userdataoutputstream_")+name()+"/UserDataTree",
-                                m_userdatatree)).isSuccess()) {
-        msg() << MSG::FATAL << "Could not register UserDataTree " << endreq;
-        return StatusCode::FAILURE;
-      }
-
-      //Reg the tree with THistSvc
-      if (!(m_thistsvc->regTree(std::string("/userdataoutputstream_")+name()+"/FileLevelUserDataTree",
-                                m_fileleveluserdatatree)).isSuccess()) {
-        msg() << MSG::FATAL << "Could not register FileLevelUserDataTree "
-              << endreq;
-        return StatusCode::FAILURE;
-      }
-    }
-
-    m_el_tree = new TTree("ElementLevelUserDataTree",
-        "ElementLevelUserDataTree");
-    //In the tree
-    //Event Number/Run Number/AthenaBarCode/Label/blob/typeString
-
-    //the m_el_tree_xxx are needed for branching the tree, they will be replaced by other
-    //vars when filling the tree.
- //   m_el_tree->Branch("RunNumber", &m_currRunNumber, "RunNumber/i");
- //   m_el_tree->Branch("EventNumber", &m_currEventNumber, "EventNumber/i");
-    m_el_tree->Branch("AthenaBarCode", &m_el_tree_abc, "AthenaBarCode/l");
-    m_el_tree->Branch("Label", &m_el_tree_label);
-    m_el_tree->Branch("Blob", &m_el_tree_blob);
-    m_el_tree->Branch("Type", &m_el_tree_type);
-
-    if (m_doWrite || m_doMerge) {
-      //Reg the tree with THistSvc
-      if (!(m_thistsvc->regTree(std::string("/userdataoutputstream_")+name()+"/ElementLevelUserDataTree",
-                                m_el_tree)).isSuccess()) {
-        msg() << MSG::FATAL << "Could not register FileLevelUserDataTree "
-              << endreq;
-        return StatusCode::FAILURE;
-      }
-
-    }
-
-  }
-
-  if (m_doWriteTransient || m_doRead) {
-    // Protect against multiple instances of TROOT
-    if (0 == gROOT) {
-      static TROOT root("root", "ROOT I/O");
-      //    gDebug = 99;
-      msg() << MSG::DEBUG << "ROOT not initialized, debug = " << gDebug
-          << endreq;
-
-    }
-    else {
-      msg() << MSG::DEBUG << "ROOT already initialized, debug = " << gDebug
-          << endreq;
-    }
-  }
-  return StatusCode::SUCCESS;
-}
-
-StatusCode
-UserDataSvc::finalize() {
-  msg() << MSG::INFO << "Finalizing " << name() << " - package version "
-      << PACKAGE_VERSION << endreq;
-
-  m_thistsvc.release().ignore();
-  m_activeStoreSvc.release().ignore();
-  return StatusCode::SUCCESS;
-}
-
-void
-UserDataSvc::dump() const {
-  msg() << MSG::INFO << "Dumping " << name() << " - package version "
-      << PACKAGE_VERSION << endreq;
-
-}
-
-StatusCode
-UserDataSvc::reinitialize() {
-  msg() << MSG::INFO << "RE-initializing " << name() << " - package version "
-      << PACKAGE_VERSION << endreq;
-  msg() << MSG::WARNING << "RE-initializing " << name()
-      << " not implemented, returning SUCCESS. " << endreq;
-  return StatusCode::SUCCESS;
-}
-
-void
-UserDataSvc::handle(const Incident &inc) {
-
-  if (inc.type() == "BeginEvent") {
-    msg() << MSG::DEBUG << "UserDataSvc::BeginEvent" << endreq;
-
-    const EventInfo* evt = 0;
-    StatusCode sc = eventStore()->retrieve(evt);
-    if (sc.isFailure()) {
-      msg() << MSG::WARNING << "Could not find event" << endreq;
-      return;
-    }
-
-    m_currRunNumber = evt->event_ID()->run_number();
-    m_currEventNumber = evt->event_ID()->event_number();
-
-    msg() << MSG::DEBUG << "Run:" << m_currRunNumber << " Event:"
-        << m_currEventNumber << endreq;
-
-    if (m_doWriteTransient) {
-
-      // If not in first event, reset all decorations.
-      // Do not reset if inside the first event,
-      // so that to carry forward the decorations set before the first event,
-      // in initialize(), for example
-      if (!m_infirstevent) {
-        for (unsigned int i = 0; i < m_associations.size(); i++) {
-          if (m_associations[i].getLevel() == UserDataAssociation::EVENT
-              || m_associations[i].getLevel()
-                  == UserDataAssociation::COLLECTION) {
-            m_numbersetinthisevent[i] = false;
-          }
-        }
-      }
-      if (!(decorateEvent("RunNumber", m_currRunNumber)).isSuccess()) {
-        msg() << MSG::WARNING << "Could not add RunNumber as event decoration"
-            << endreq;
-        return;
-      }
-
-      if (!(decorateEvent("EventNumber", m_currEventNumber)).isSuccess()) {
-        msg() << MSG::WARNING
-            << "Could not add EventNumber as event decoration" << endreq;
-        return;
-      }
-
-      if (!(decorateEvent("ElDecoBegin", m_el_curevent_begin)).isSuccess()) {
-        msg() << MSG::WARNING
-            << "Could not add ElDecoBegin as event decoration" << endreq;
-        return;
-      }
-      if (!(decorateEvent("ElDecoEnd", m_el_curevent_end)).isSuccess()) {
-        msg() << MSG::WARNING << "Could not add ElDecoEnd as event decoration"
-            << endreq;
-        return;
-      }
-
-      //for ElementLevel
-      clear_el_decodata();
-
-      m_el_decomap.clear();
-      m_el_label2id.clear();
-      m_el_labelarray.clear();
-      m_el_id2label.clear();
-
-      m_el_curevent_begin = m_el_curevent_end + 1; //in first event it will be set to 0
-
-
-    }
-
-    if (m_doRead) {
-      m_r_synchronized = false;
-      m_r_el_evt_init = false;
-
-      m_r_el_decomap.clear();
-      m_r_el_label2id.clear();
-      m_r_el_labelarray.clear();
-      m_r_el_id2label.clear();
-    }
-
-  }
-  else if (inc.type() == "EndEvent") {
-    msg() << MSG::DEBUG << "UserDataSvc::EndEvent" << endreq;
-    //msg()<<MSG::DEBUG<<m_outputStream->name()<<endreq;
-    //msg()<<MSG::DEBUG<<m_outputStream->m_outputName<<endreq;
-    //msg() << MSG::DEBUG << "m_doWrite="<<m_doWrite << endreq;
-
-    if (m_doWrite && m_outputStream) {
-      if (m_outputStream->isEventAccepted()) {
-        msg() << MSG::INFO << "Event Accepted, saving decorations" << endreq;
-
-	msg() << MSG::DEBUG << "#of Entries in the ElTree "
-	      << m_el_tree->GetEntries() 
-	      << " m_el_curevent_begin="<< m_el_curevent_begin 
-	      << " m_el_curevent_end="<< m_el_curevent_end 
-	      << endreq;
-	
-        //Element Level
-
-        for (std::vector<ElDataEntry>::size_type it = 0; it
-            < m_el_decodata.size(); it++) {
-
-          msg() << MSG::DEBUG << "\t" << it << "\t"
-		<< m_el_decodata[it].m_label << "\t" << std::hex
-		<< m_el_decodata[it].m_abc << "\t"
-		<< m_el_decodata[it].m_object.Address() << "\t" << endreq;
-	  
-          std::string *labelstr = &(m_el_decodata[it].m_label);
-          TBufferFile *buf = objectToStream(m_el_decodata[it].m_object); //need delete
-          int buflen = buf->Length();
-          char *bufptr = buf->Buffer();
-          std::string *blobstr = new std::string(bufptr, buflen); //need delete
-          std::string *typestr = new std::string(
-						 m_el_decodata[it].m_object.TypeOf().Name(REFLEX_NS::SCOPED)); //need delete
-	  
-          ULong64_t abc = (ULong64_t)(m_el_decodata[it].m_abc);
-	  
-
-          m_el_tree->SetBranchAddress("AthenaBarCode", &abc);
-	  
-          m_el_tree->SetBranchAddress("Label", &labelstr);
-          m_el_tree->SetBranchAddress("Blob", &blobstr);
-          m_el_tree->SetBranchAddress("Type", &typestr);
-	  
-          m_el_tree->Fill();
-
-	  
-          m_el_curevent_end++;
-	  
-          delete buf;
-          delete blobstr;
-          delete typestr;
-        }
-	
-        if (m_el_curevent_end < m_el_curevent_begin) {//no decoration for this event
-	  msg() << MSG::DEBUG << "No decoration for this event"<<endreq;
-        }
-        else {
-	  msg() << MSG::DEBUG << "Yes decoration for this event"<<endreq;	  
-        }
-
-        if (!(decorateEvent("ElDecoBegin", m_el_curevent_begin)).isSuccess()) {
-          msg() << MSG::WARNING
-              << "Could not add ElDecoBegin as event decoration" << endreq;
-          return;
-        }
-        if (!(decorateEvent("ElDecoEnd", m_el_curevent_end)).isSuccess()) {
-          msg() << MSG::WARNING
-              << "Could not add ElDecoEnd as event decoration" << endreq;
-          return;
-        }
-
-        //Event Level
-        //Loop over all decorations and reset the branch address
-        for (unsigned int i = 0; i < m_associations.size(); i++) {
-
-          //Fill event and collection level decorations
-          if (m_associations[i].getLevel() == UserDataAssociation::EVENT
-              || m_associations[i].getLevel()
-                  == UserDataAssociation::COLLECTION) {
-
-            void **addr = 0;
-            if (m_numbersetinthisevent[i]) {//use new address
-              addr = m_number2address[i];
-              msg() << MSG::DEBUG << "UserDataSvc::EndEvent:UseNewAddress"
-                  << endreq;
-            }
-            else {//use default address
-              addr = m_number2defaultaddress[i];
-              msg() << MSG::DEBUG << "UserDataSvc::EndEvent:UseDefaultAddress"
-                  << endreq;
-            }
-
-            if (m_numberissimpletype[i]) {
-              m_number2branch[i]->SetAddress(*addr);
-            }
-            else {
-              m_number2branch[i]->SetAddress(addr);
-            }
-
-            m_numbersetinthisevent[i] = false;
-          }
-        }
-
-        if (!m_doMerge)
-          m_userdatatree->Fill();
-
-        if (m_infirstevent)
-          m_infirstevent = false;
-
-      }
-      else {//Filtered out
-        msg() << MSG::INFO
-            << "Event Filtered out by OutputStream, not saving decorations for this event."
-            << endreq;
-      }
-
-    } // if (m_doWrite)
-  }
-  else if (inc.type() == "BeginRun") {
-    //Todos On the BeginRun Incident
-    msg() << MSG::DEBUG << "UserDataSvc::BeginRun" << endreq;
-  }
-  else if (inc.type() == "EndRun") {
-    msg() << MSG::DEBUG << "UserDataSvc::EndRun" << endreq;
-    if (m_doMerge)
-      SaveAssociations();
-
-    if (m_doWrite && !m_doMerge) {
-      SaveAssociations();
-      //Loop over all decorations and reset the branch address
-      for (unsigned int i = 0; i < m_associations.size(); i++) {
-
-        //Fill event and collection level decorations
-        if (m_associations[i].getLevel() == UserDataAssociation::FILE) {
-
-          void **addr = 0;
-          if (m_numbersetinthisevent[i]) {//use new address
-            addr = m_number2address[i];
-            msg() << MSG::DEBUG << "UserDataSvc::EndEvent:UseNewAddress"
-                << endreq;
-          }
-          else {//use default address
-            addr = m_number2defaultaddress[i];
-            msg() << MSG::DEBUG << "UserDataSvc::EndEvent:UseDefaultAddress"
-                << endreq;
-          }
-
-          if (m_numberissimpletype[i]) {
-            m_number2branch[i]->SetAddress(*addr);
-          }
-          else {
-            m_number2branch[i]->SetAddress(addr);
-          }
-
-          m_numbersetinthisevent[i] = false;
-        }
-      }
-
-      m_fileleveluserdatatree->Fill();
-    }
-  }
-  else if (inc.type() == "BeginInputFile") {
-    msg() << MSG::DEBUG << "UserDataSvc::BeginInputFile" << endreq;
-    if (m_doRead || m_doMerge) {
-      const FileIncident* fileInc = dynamic_cast<const FileIncident*> (&inc);
-      if (fileInc == 0) {
-        msg() << MSG::ERROR
-            << " Unable to get FileName from BeginInputFile incident" << endreq;
-        return;
-      }
-      msg() << MSG::DEBUG << "UserDataSvc::BeginInputFile::Filename:" << fileInc->fileName() << endreq;
-
-      //FIXME: THistSvc will not close the files
-      m_r_inputfilename = fileInc->fileName();
-      m_r_fileopened = false;
-      m_r_inputfilecounter++;
-      m_doRead = true;
-    }
-
-    if (m_doMerge) {
-      // fill the read tree member variables from the current file
-      doOpenFile();
-
-      // copy the read trees to the transient trees (read trees can be NULL)
-
-
-      // file level (currently not used: this should probably become some kind
-      // of addition of the contents rather than a straight collection of the
-      // tree entries)
-      if (m_r_fileleveluserdatatree) {
-        // there is no reason to believe that the following will work ...
-        m_r_fileleveluserdatatree->CopyAddresses(m_fileleveluserdatatree);
-        m_fileleveluserdatatree->CopyEntries(m_r_fileleveluserdatatree);
-      }
-
-      // the associations contain type definitions and should be unique (i.e.
-      // same labels should be the same association), which will be caveat
-      // emptor. To allow the prevention of dupes, the read associations are
-      // copied into the current associations, which are then saved only at
-      // the end of the run.
-      // Note that that is wrong, since EndRun can happen multiple times in a
-      // job, but the assumption is that it doesn't happen in a merge job.
-
-      // m_r_associationtree collected in m_associations through m_r_associations
-      if (m_associations.empty()) {
-        m_associations.swap(m_r_associations);
-      } else {
-        m_associations.reserve(m_associations.size()+m_r_associations.size());
-        for (std::vector<UserDataAssociation>::iterator ias = m_r_associations.begin();
-               ias != m_r_associations.end(); ++ias ) {
-          if (std::find(m_associations.begin(), m_associations.end(), *ias) == m_associations.end()) {
-            m_associations.push_back(*ias);
-          }
-        }
-        m_r_associations.clear();
-      }
-
-      // element level (both need to exist, or both not exist)
-      assert((m_r_userdatatree && m_r_el_tree) || (!m_r_userdatatree && !m_r_el_tree));
-      if (m_r_userdatatree && m_r_el_tree) {
-
-        // these are the actual element level decorations; the assumption is that
-        // the used addresses for branches are still valid as set
-        Long64_t deco_offset = m_el_tree->GetEntriesFast();
-        m_r_el_tree->CopyAddresses(m_el_tree);
-        m_el_tree->CopyEntries(m_r_el_tree);
-
-        // userdatatree is special in that its contents depend on the arrangement
-        // of the element level tree; I'm assuming here that the arrangement is
-        // completely linear and thus that a fixed offset will do
-        UInt_t runnum = 0, evnum = 0;
-        Int_t decobegin = 0, decoend = 0;
-
-        // although the userdatatree layout is known a priori, it isn't actually
-        // constructed in full when it is created, so fix it up if need be (and
-        // only set the address if already existing):
-        ConditionalBranchCreate(m_userdatatree, "RunNumber", &runnum);
-        ConditionalBranchCreate(m_userdatatree, "EventNumber", &evnum);
-        ConditionalBranchCreate(m_userdatatree, "ElDecoBegin", &decobegin);
-        ConditionalBranchCreate(m_userdatatree, "ElDecoEnd", &decoend);
-
-	// associate the addresses with the read tree as well
-        m_r_userdatatree->SetBranchAddress("RunNumber", &runnum);
-        m_r_userdatatree->SetBranchAddress("EventNumber", &evnum);
-        m_r_userdatatree->SetBranchAddress("ElDecoBegin", &decobegin);
-        m_r_userdatatree->SetBranchAddress("ElDecoEnd", &decoend);
-
-        Long64_t uda_entries = m_r_userdatatree->GetEntriesFast();
-        for (Long64_t ne = 0; ne < uda_entries; ++ne ) {
-          m_r_userdatatree->GetEntry(ne);
-          decobegin += (Int_t)deco_offset;       // assume no overflow in cast
-          decoend += (Int_t)deco_offset;
-          m_userdatatree->Fill();
-        }
-      }
-    }
-  }
-  else if (inc.type() == "EndInputFile") {
-    msg() << MSG::DEBUG << "UserDataSvc::EndInputFile" << endreq;
-    if (m_doRead) {
-      const FileIncident* fileInc = dynamic_cast<const FileIncident*> (&inc);
-      if (fileInc == 0) {
-        msg() << MSG::ERROR
-            << " Unable to get FileName from EndInputFile incident" << endreq;
-        return;
-      }
-      msg() << MSG::DEBUG << "UserDataSvc::Filename:" << fileInc->fileName() << endreq;
-    }
-  }
-  else if (inc.type() == "BeginTagFile") {
-    msg() << MSG::DEBUG << "UserDataSvc::BeginTagFile" << endreq;
-    if (m_doRead) {
-      const FileIncident* fileInc = dynamic_cast<const FileIncident*> (&inc);
-      if (fileInc == 0) {
-        msg() << MSG::ERROR
-            << " Unable to get FileName from BeginTagFile/EndTagFile incident"
-            << endreq;
-        return;
-      }
-      msg() << MSG::DEBUG << "UserDataSvc::Filename:" << fileInc->fileName() << endreq;
-    }
-  }
-  else if (inc.type() == "EndTagFile") {
-    msg() << MSG::DEBUG << "UserDataSvc::EndTagFile" << endreq;
-    if (m_doRead) {
-      const FileIncident* fileInc = dynamic_cast<const FileIncident*> (&inc);
-      if (fileInc == 0) {
-        msg() << MSG::ERROR
-            << " Unable to get FileName from BeginTagFile/EndTagFile incident"
-            << endreq;
-        return;
-      }
-      msg() << MSG::DEBUG << "UserDataSvc::Filename:" << fileInc->fileName() << endreq;
-    }
-  }
-}
-
-int
-UserDataSvc::CreateAssociation(const std::string &label,
-    const UserDataAssociation::DecoLevel level,
-    const std::string &demangledname, const std::string &key, const CLID clid,
-    const UserDataAssociation::IndexType index) {
-
-  //new association
-  UserDataAssociation uda;
-  uda.setLabel(label);
-  uda.setLevel(level);
-  uda.setKey(key);
-  uda.setID(clid);
-  uda.setIndex(index);
-  //	uda.setType(decoinfo.name());
-  uda.setLongType(demangledname);
-
-  //add into vector
-  m_associations.push_back(uda);
-  std::vector<UserDataAssociation>::size_type mynumber = m_associations.size()
-      - 1;
-  m_label2number[label] = mynumber;
-  m_number2label[mynumber] = label;
-
-  return (int) mynumber;
-}
-
-void
-UserDataSvc::SaveAssociations() {
-  //Create Root TTree
-  m_associationtree = new TTree("UserDataAssociations",
-      "TTree associations between UserData and what they decorate");
-  //Reg the tree with THistSvc
-  if ((m_thistsvc->regTree(std::string("/userdataoutputstream_")+name()+"/UserDataAssociations",
-      m_associationtree)).isSuccess()) {
-
-    UserDataAssociation *uda = 0;
-    m_associationtree->Bronch("UDA.", "UserDataAssociation", &uda);
-
-    std::vector<UserDataAssociation>::iterator itr = m_associations.begin();
-    while (itr != m_associations.end()) {
-      uda = new UserDataAssociation(*itr);
-      m_associationtree->Fill();
-      delete uda;
-      uda = 0;
-
-      ++itr;
-    }
-  }
-  else {
-    msg() << MSG::ERROR << "Could not register UserDataAssociations tree"
-        << endreq;
-    //FIXME return StatusCode::FAILURE;
-  }
-}
-
-const std::string
-UserDataSvc::GetSimpleTypeString(const std::string &label,
-    const std::type_info &info) const {
-  std::string result("");
-  if (info == typeid(double))
-    result = label + "/D";
-  if (info == typeid(int))
-    result = label + "/I";
-  if (info == typeid(unsigned int))
-    result = label + "/i";
-  if (info == typeid(long))
-    result = label + "/L";
-  if (info == typeid(unsigned long))
-    result = label + "/l";
-  if (info == typeid(char))
-    result = label + "/B";
-  if (info == typeid(unsigned char))
-    result = label + "/b";
-  if (info == typeid(float))
-    result = label + "/F";
-  if (info == typeid(bool))
-    result = label + "/O";
-  if (info == typeid(char *))
-    result = label + "/C";
-  if (info == typeid(const char *))
-    result = label + "/C";
-  return result;
-}
-
-bool
-UserDataSvc::IsSimpleType(const std::type_info &info) const {
-  if (info == typeid(double))
-    return true;
-  if (info == typeid(int))
-    return true;
-  if (info == typeid(unsigned int))
-    return true;
-  if (info == typeid(long))
-    return true;
-  if (info == typeid(unsigned long))
-    return true;
-  if (info == typeid(char))
-    return true;
-  if (info == typeid(unsigned char))
-    return true;
-  if (info == typeid(float))
-    return true;
-  if (info == typeid(bool))
-    return true;
-  if (info == typeid(char *))
-    return true;
-  if (info == typeid(const char *))
-    return true;
-  return false;
-}
-bool
-UserDataSvc::IsSimpleType(const std::string &typenamedotname) const {
-  if (typenamedotname == "d")
-    return true;
-  if (typenamedotname == "i")
-    return true;
-  if (typenamedotname == "j")
-    return true;
-  if (typenamedotname == "l")
-    return true;
-  if (typenamedotname == "m")
-    return true;
-  if (typenamedotname == "c")
-    return true;
-  if (typenamedotname == "h")
-    return true;
-  if (typenamedotname == "f")
-    return true;
-  if (typenamedotname == "b")
-    return true;
-  if (typenamedotname == "Pc")
-    return true;
-  if (typenamedotname == "PKc")
-    return true;
-
-  return false;
-}
-
-const std::type_info &
-UserDataSvc::GetSimpleTypeInfoFromName(const std::string &typenamedotname) const {
-
-  if (typenamedotname == "d")
-    return typeid(double);
-  if (typenamedotname == "i")
-    return typeid(int);
-  if (typenamedotname == "j")
-    return typeid(unsigned int);
-  if (typenamedotname == "l")
-    return typeid(long);
-  if (typenamedotname == "m")
-    return typeid(unsigned long);
-  if (typenamedotname == "c")
-    return typeid(char);
-  if (typenamedotname == "h")
-    return typeid(unsigned char);
-  if (typenamedotname == "f")
-    return typeid(float);
-  if (typenamedotname == "b")
-    return typeid(bool);
-  if (typenamedotname == "Pc")
-    return typeid(char *);
-  if (typenamedotname == "PKc")
-    return typeid(const char *);
-
-  return typeid(void);
-
-}
-
-StoreGateSvc*
-UserDataSvc::eventStore() {
-  if (m_activeStoreSvc == 0) {
-    if (!m_activeStoreSvc.retrieve().isSuccess()) {
-      msg() << MSG::ERROR << "Cannot get ActiveStoreSvc" << endreq;
-      throw GaudiException("Cannot get ActiveStoreSvc", name(),
-          StatusCode::FAILURE);
-    }
-  }
-  return (m_activeStoreSvc->operator->());
-}
-
-const std::string
-UserDataSvc::GenerateLabel(const std::string& label,
-    const UserDataAssociation::DecoLevel& level, const CLID& clid,
-    const std::string & key) {
-  std::string ss;
-  if (level == UserDataAssociation::EVENT || level == UserDataAssociation::FILE) {
-    //Event level label is unique through out the file
-    ss = label;
-  }
-  else if (level == UserDataAssociation::COLLECTION) {
-    //Collection level, label is unique for each pair of <CLID,KEY>
-    ostringstream s1;
-    s1.fill('0');
-    s1.width(20);
-    s1 << clid;
-    ss = std::string("COLL_") + s1.str() + std::string("_") + key
-        + std::string("_") + label;
-  }
-  return ss;
-}
-
-int
-UserDataSvc::vdecorate(const std::string& lab, const std::type_info &decoinfo,
-    void* & deco, void* &defaultobj, void* &tobedeleted,
-    const UserDataAssociation::DecoLevel& level, const CLID& clid,
-    const std::string & key) {
-
-  // no new decoration in merge mode: only recycle old
-  if (m_doMerge)
-    return 0;
-
-  msg() << MSG::DEBUG << "UserDataSvc::vdecorate:" << "\tlabel=" << lab
-      << "\ttype_info.name()=" << decoinfo.name() << "\tdeco=" << deco
-      << "\tdefaultobj=" << defaultobj << "\tlevel=" << level << "\tclid="
-      << clid << "\tkey=" << key << endreq;
-
-  //Check if in the writing mode
-  if (!m_doWriteTransient) {
-    msg() << MSG::ERROR
-        << "UserDataSvc::Trying to decorate when not in writing mode. Check TheUserDataSvc.Output"
-        << endreq;
-    return -1;
-  }
-
-  //Problem with decorating strings, so check and return error
-  if (decoinfo == typeid(std::string) || decoinfo == typeid(char *) || decoinfo
-      == typeid(const char*) || decoinfo == typeid(TString)) {
-    msg() << MSG::ERROR
-        << "Decoration type 'std::string', 'TString', 'char *' or 'const char *' is not supported (Due to ROOT functionality)"
-        << "Please use vector of std::string instead (std::vector<std::string>)"
-        << endreq;
-    return -1;
-  }
-
-  //get the full demangled name of the type
-  int sta;
-  char * str;
-  str = abi::__cxa_demangle(decoinfo.name(), 0, 0, &sta);
-  if (sta != 0) {
-    msg() << MSG::ERROR << "Can not get demangled name for typeid.name()="
-        << decoinfo.name() << endreq;
-    return -1;
-  }
-  std::string demangledname(str);
-  msg() << MSG::DEBUG << "UserDataSvc::dis-mangled name:" << demangledname
-      << endreq;
-  free (str);
-
-  std::vector<UserDataAssociation>::size_type mynumber;
-  TBranch *mybranch = 0;
-
-  //generate a label for this decoration
-  std::string label = GenerateLabel(lab, level, clid, key);
-  msg() << MSG::DEBUG << "UserDataSvc::decorate:GeneratedLabel=" << label
-      << endreq;
-
-  TTree *treelevel =
-      ((level == UserDataAssociation::FILE) ? m_fileleveluserdatatree
-          : m_userdatatree);
-
-  //see if the decoration with the same label is already exist
-  std::map<std::string, std::vector<UserDataAssociation>::size_type>::iterator
-      itr = m_label2number.find(label);
-
-  if (itr == m_label2number.end()) {//label not exist yet
-    //One can only add new decoration in the first event (Or in initialize())
-    //In other events can only change the address of decoration
-    if (m_infirstevent) {
-      //See if deco is one of the simple types
-      if (!IsSimpleType(decoinfo)) {// not simple type
-        msg() << MSG::DEBUG << "UserDataSvc::not simple type:" << demangledname
-            << endreq;
-
-        //see if the class can be obtained by TClass
-        TClass *cl = TClass::GetClass(demangledname.c_str());
-        if (cl) { //Class definition found, can be added to TTree
-          msg() << MSG::DEBUG << "UserDataSvc::FIND CLASS:" << demangledname
-              << endreq;
-          void **defaultaddr = new void*((void*) defaultobj);
-          void **addr = new void*((void*) deco);
-
-          mybranch = treelevel->Bronch((label + ".").c_str(), cl->GetName(),
-              defaultaddr);//, 32000, 0); //Do not split it
-
-          if (!mybranch) {
-            msg() << MSG::DEBUG << "Can't call bronch" << endreq;
-          }
-
-          int result =
-              CreateAssociation(label, level, demangledname, key, clid);
-
-          if (result < 0) {
-            msg() << MSG::ERROR
-                << "UserDataSvc::vgetDecoration:Can not create association."
-                << endreq;
-            return -1;
-
-          }
-
-          mynumber = (std::vector<UserDataAssociation>::size_type) result;
-
-          m_number2branch[mynumber] = mybranch;
-          m_numberissimpletype[mynumber] = false;
-          m_number2address[mynumber] = addr;
-          m_number2defaultaddress[mynumber] = defaultaddr;
-          m_numbersetinthisevent[mynumber] = true;
-
-          return 1;
-        }
-        else {//Class definition not found
-          msg() << MSG::ERROR << "UserDataSvc::NOT FIND CLASS:"
-              << demangledname << endreq;
-          return -1;
-        }
-      }
-      else { //Is simple type
-        std::string rootstr(GetSimpleTypeString(label, decoinfo));
-        msg() << MSG::DEBUG << "Adding simple type:" << rootstr.c_str()
-            << endreq;
-        //FIXME: catch exceptions of branch
-
-        void **defaultaddr = new void*((void*) defaultobj);
-        void **addr = new void*((void*) deco);
-
-        mybranch = treelevel->Branch(label.c_str(), *defaultaddr,
-            rootstr.c_str());
-
-        if (!mybranch) {
-          msg() << MSG::DEBUG << "Can't call Branch" << endreq;
-        }
-
-        int result = CreateAssociation(label, level, demangledname, key, clid);
-
-        if (result < 0) {
-          msg() << MSG::ERROR
-              << "UserDataSvc::vgetDecoration:Can not create association."
-              << endreq;
-          return -1;
-
-        }
-
-        mynumber = (std::vector<UserDataAssociation>::size_type) result;
-
-        m_number2branch[mynumber] = mybranch;
-        m_numberissimpletype[mynumber] = true;
-        m_number2address[mynumber] = addr;
-        m_number2defaultaddress[mynumber] = defaultaddr;
-        m_numbersetinthisevent[mynumber] = true;
-
-        return 1;
-      }
-    }
-    else {//can't add new label after first event
-      msg() << MSG::ERROR
-          << "Label not Exists but can't change userdata configuration after first event. Label="
-          << label << endreq;
-      return -1;
-    }
-  }
-  else { //label already exist
-    msg() << MSG::DEBUG << "Label exist:" << label << endreq;
-
-    mynumber = itr->second;
-
-    if (m_numberissimpletype[mynumber]) {// simple type
-      msg() << MSG::DEBUG << "Simple type:"
-          << m_associations[mynumber].getLongType() << endreq;
-    }
-    else {// complex type
-      msg() << MSG::DEBUG << "Complex type:"
-          << m_associations[mynumber].getLongType() << endreq;
-    }
-
-    if (m_associations[mynumber].getLongType() != demangledname) {
-      msg() << MSG::ERROR << " Label Exists but type not the same. Label="
-          << label << "\tTypeRequested=" << demangledname << "\tTypeExist="
-          << m_associations[mynumber].getLongType() << endreq;
-
-      return -1;
-    }
-    else {//good to go, set address to current
-
-      void **addr = new void*((void*) deco);
-      //delete the old address holder
-      void **tmp = m_number2address[mynumber];
-
-      //pass the old address out to be freed.
-      tobedeleted = *tmp;
-      delete tmp;
-      tmp = 0;
-      m_number2address[mynumber] = addr;
-
-      m_numbersetinthisevent[mynumber] = true;
-
-      msg() << MSG::DEBUG << "Label Exists, address updated. Label=" << label
-          << endreq;
-
-      return 0;
-    }
-  }
-
-  //should not reach here;
-  return -1;
-
-}
-
-int
-UserDataSvc::vgetDecoration(const std::string& lab,
-    const std::type_info &decoinfo, void *&deco,
-    const UserDataAssociation::DecoLevel& level, const CLID& clid,
-    const std::string & key) {
-
-  //int UserDataSvc::vgetDecoration(const std::string& label,
-  //		const std::type_info &decoinfo, void *&deco) {
-
-  //see if it's in the reading mode
-  if (!m_doRead) {
-    msg() << MSG::ERROR
-        << "UserDataSvc::Trying to get decoration when no input file is set."
-        << endreq;
-    return -1;
-  }
-
-  if (decoinfo == typeid(std::string) || decoinfo == typeid(char *) || decoinfo
-      == typeid(const char*) || decoinfo == typeid(TString)) {
-    msg() << MSG::ERROR
-        << "Decoration type 'std::string', 'TString', 'char *' or 'const char *' is not supported (Due to ROOT functionality)"
-        << "Please use vector of std::string instead (std::vector<std::string>)"
-        << endreq;
-    return -1;
-  }
-
-  int sta;
-  char * str;
-  str = abi::__cxa_demangle(decoinfo.name(), 0, 0, &sta);
-  if (sta != 0) {
-    msg() << MSG::ERROR << "Can not get demangled name for typeid.name()="
-        << decoinfo.name() << endreq;
-    return -1;
-  }
-  std::string demangledname(str);
-  free(str);
-
-  std::string label = GenerateLabel(lab, level, clid, key);
-
-  msg() << MSG::DEBUG << "UserDataSvc::vgetDecoration('" << label << "','"
-      << demangledname << "')" << endreq;
-
-  msg() << MSG::DEBUG << "Demangled name=" << demangledname
-      << "\ttypeid.name()" << decoinfo.name() << endreq;
-
-  //see if the input file is opened
-  if (!m_r_fileopened) {
-    int result=doOpenFile();
-    if(result!=0) {
-      msg() << MSG::ERROR << "Can not open file for reading" << endreq;
-    }
-  }
-
-  //at this point the file should be opened
-  //** see if the label exist
-  std::map<std::string, std::vector<UserDataAssociation>::size_type>::iterator
-      itr = m_r_label2number.find(label);
-
-  if (itr == m_r_label2number.end()) {//label not exist yet
-    msg() << MSG::ERROR << "label not exist:" << label << endreq;
-    deco = 0;
-    return -1;
-  }
-
-  std::vector<UserDataAssociation>::size_type mynumber;
-  mynumber = itr->second;
-
-  msg() << MSG::DEBUG << "label found:"
-      << m_r_associations[mynumber].getLabel() << endreq;
-
-  //**first check if the data type matches
-  if (m_r_associations[mynumber].getLongType() == demangledname) {
-    msg() << MSG::DEBUG << "Type Match:"
-        << m_r_associations[mynumber].getLongType() << endreq;
-  }
-  else {
-    msg() << MSG::ERROR << "Type does not Match, in root file:"
-        << m_r_associations[mynumber].getLongType() << " Called with:"
-        << demangledname << endreq;
-    return -1;
-  }
-
-  if (level == UserDataAssociation::EVENT || level
-      == UserDataAssociation::COLLECTION) {
-    if (!m_r_synchronized) {
-      //**Synchronize with event selector
-      if (!m_r_userdatatree->FindBranch("RunNumber")
-          || !m_r_userdatatree->FindBranch("EventNumber")) {
-        msg() << MSG::WARNING
-            << "Not find RunNumber and EventNumber in UserDataTree, may not synchronize correctly with EventSelector"
-            << label << endreq;
-      }
-      else {
-        bool synchronized = false;
-        unsigned int runn;
-        unsigned int evtn;
-        m_r_userdatatree->SetBranchAddress("RunNumber", &runn);
-        m_r_userdatatree->SetBranchAddress("EventNumber", &evtn);
-        m_r_userdatatree->SetBranchStatus("*", 0); //disable all branches
-        m_r_userdatatree->SetBranchStatus("RunNumber", 1);
-        m_r_userdatatree->SetBranchStatus("EventNumber", 1);
-
-        /* Now trying to synchronize the UD tree to the input stream according to Event# and Run#
-		Assumption: 1. the Event# and Run# might not be in order in the input stream.
-					2. for the same entry# (row#), the Event# and Run# in the UserDataTree matches the Event# and Run# in the stream (EventInfo)
-		Method: look at the next entry (row) until Event# and Run# matches, or return failure if reach the last row
-				One it return failure once, it will never return success again, since the last row is reached.
-                                Updated with patch from Yushu: one second try from start if last row reached.
-         */
-
-        bool SecondTry=false;
-        while (m_r_currententry<m_r_userdatatree->GetEntries()) {
-          m_r_userdatatree->GetEntry(m_r_currententry);
-          msg() << MSG::DEBUG << "RunNumber=" << runn << "\tEventNumber="
-              << evtn << "\tm_currEventNumber=" << m_currEventNumber
-              << "\tm_r_currententry=" << m_r_currententry << endreq;
-          if (evtn == m_currEventNumber && runn == m_currRunNumber) { //correctly synchronized, can go ahead to read
-            synchronized = true;
-            break;
-          }
-          m_r_currententry++;
-        }
-
-        if (!synchronized && !SecondTry ) {
-          m_r_currententry=0;
-          while (m_r_currententry<m_r_userdatatree->GetEntries()) {
-            m_r_userdatatree->GetEntry(m_r_currententry);
-            if (evtn==m_currEventNumber && runn==m_currRunNumber) {
-              synchronized=true;
-              break;
-            }
-            m_r_currententry++;
-          }
-        }
-
-        if (!synchronized) {
-          msg() << MSG::ERROR
-              << "Can not synchronize event, input file might be corrupted:\n"
-              << "\tm_currRunNumber=" << m_currRunNumber
-              << "\tm_currEventNumber=" << m_currEventNumber << "\tlabel="
-              << label << "\tm_r_currententry=" << m_r_currententry << endreq;
-          return -1;
-        }
-        m_r_synchronized = true;
-      }
-    }
-  }
-
-  msg() << MSG::DEBUG << "Synchronized:\n" << "\tm_currRunNumber="
-      << m_currRunNumber << "\tm_currEventNumber=" << m_currEventNumber
-      << "\tm_r_currententry=" << m_r_currententry << "\tlabel=" << label
-      << endreq;
-
-  TTree *currenttree = 0;
-  unsigned int entrytoread = 0;
-
-  //set the proper tree and number of entry to read for different decoration level
-  if (level == UserDataAssociation::FILE) {
-    if (m_r_fileleveluserdatatree) {
-      entrytoread = 0;
-      currenttree = m_r_fileleveluserdatatree;
-    }
-    else {
-      msg() << MSG::ERROR
-          << "FileLevelUserDataTree does not exist in the input file while trying to get file level decoration."
-          << endreq;
-      return -1;
-    }
-  }
-  else if (level == UserDataAssociation::EVENT || level
-      == UserDataAssociation::COLLECTION) {
-    if (m_r_fileleveluserdatatree) {
-      entrytoread = m_r_currententry;
-      currenttree = m_r_userdatatree;
-    }
-    else {
-      msg() << MSG::ERROR
-          << "UserDataTree does not exist in the input file while trying to get event/collection level decoration."
-          << endreq;
-      return -1;
-    }
-  }
-
-  if (!currenttree)
-    return -1;
-
-  //Now start to read the decoration
-  if (IsSimpleType(decoinfo)) { //if is simple type
-
-    msg() << MSG::DEBUG << "Getting data from UserDataTree, longtype="
-        << demangledname << endreq;
-
-    void *data = 0;
-    currenttree->SetBranchStatus("*", 0); //disable all branches
-    currenttree->SetBranchStatus(label.c_str(), 1);
-
-    //Handle separately for different types
-    if (decoinfo == typeid(double)) {
-      double *tmpdata = new double();
-      currenttree->SetBranchAddress(label.c_str(), tmpdata);
-      currenttree->GetEntry(entrytoread);
-      if (tmpdata) {
-        data = static_cast<void*> (tmpdata);
-      }
-      else {
-        msg() << MSG::ERROR << "Can not get data for branch:" << label
-            << "\tentry#:" << entrytoread << endreq;
-        return -1;
-
-      }
-    }
-
-    if (decoinfo == typeid(int)) {
-      int *tmpdata = new int();
-      currenttree->SetBranchAddress(label.c_str(), tmpdata);
-      currenttree->GetEntry(entrytoread);
-      if (tmpdata) {
-        data = static_cast<void*> (tmpdata);
-      }
-      else {
-        msg() << MSG::ERROR << "Can not get data for branch:" << label
-            << "\tentry#:" << entrytoread << endreq;
-        return -1;
-
-      }
-    }
-
-    if (decoinfo == typeid(unsigned int)) {
-      unsigned int *tmpdata = new unsigned int();
-      currenttree->SetBranchAddress(label.c_str(), tmpdata);
-      currenttree->GetEntry(entrytoread);
-      if (tmpdata) {
-        data = static_cast<void*> (tmpdata);
-      }
-      else {
-        msg() << MSG::ERROR << "Can not get data for branch:" << label
-            << "\tentry#:" << entrytoread << endreq;
-        return -1;
-
-      }
-    }
-
-    if (decoinfo == typeid(long)) {
-      long *tmpdata = new long();
-      currenttree->SetBranchAddress(label.c_str(), tmpdata);
-      currenttree->GetEntry(entrytoread);
-      if (tmpdata) {
-        data = static_cast<void*> (tmpdata);
-      }
-      else {
-        msg() << MSG::ERROR << "Can not get data for branch:" << label
-            << "\tentry#:" << entrytoread << endreq;
-        return -1;
-
-      }
-    }
-
-    if (decoinfo == typeid(unsigned long)) {
-      unsigned long *tmpdata = new unsigned long();
-      currenttree->SetBranchAddress(label.c_str(), tmpdata);
-      currenttree->GetEntry(entrytoread);
-      if (tmpdata) {
-        data = static_cast<void*> (tmpdata);
-      }
-      else {
-        msg() << MSG::ERROR << "Can not get data for branch:" << label
-            << "\tentry#:" << entrytoread << endreq;
-        return -1;
-
-      }
-    }
-
-    if (decoinfo == typeid(char)) {
-      char *tmpdata = new char();
-      currenttree->SetBranchAddress(label.c_str(), tmpdata);
-      currenttree->GetEntry(entrytoread);
-      if (tmpdata) {
-        data = static_cast<void*> (tmpdata);
-      }
-      else {
-        msg() << MSG::ERROR << "Can not get data for branch:" << label
-            << "\tentry#:" << entrytoread << endreq;
-        return -1;
-
-      }
-    }
-
-    if (decoinfo == typeid(unsigned char)) {
-      unsigned char *tmpdata = new unsigned char();
-      currenttree->SetBranchAddress(label.c_str(), tmpdata);
-      currenttree->GetEntry(entrytoread);
-      if (tmpdata) {
-        data = static_cast<void*> (tmpdata);
-      }
-      else {
-        msg() << MSG::ERROR << "Can not get data for branch:" << label
-            << "\tentry#:" << entrytoread << endreq;
-        return -1;
-
-      }
-    }
-
-    if (decoinfo == typeid(float)) {
-      float *tmpdata = new float();
-      currenttree->SetBranchAddress(label.c_str(), tmpdata);
-      currenttree->GetEntry(entrytoread);
-      if (tmpdata) {
-        data = static_cast<void*> (tmpdata);
-      }
-      else {
-        msg() << MSG::ERROR << "Can not get data for branch:" << label
-            << "\tentry#:" << entrytoread << endreq;
-        return -1;
-
-      }
-    }
-
-    if (decoinfo == typeid(bool)) {
-      bool *tmpdata = new bool();
-      currenttree->SetBranchAddress(label.c_str(), tmpdata);
-      currenttree->GetEntry(entrytoread);
-      if (tmpdata) {
-        data = static_cast<void*> (tmpdata);
-      }
-      else {
-        msg() << MSG::ERROR << "Can not get data for branch:" << label
-            << "\tentry#:" << entrytoread << endreq;
-        return -1;
-
-      }
-    }
-
-    /*		 if (info==typeid(char *))
-     return true;
-     if (info==typeid(const char *))
-     return true;
-     */
-    msg() << MSG::DEBUG << "Trying to GetEntry #" << entrytoread << endreq;
-    msg() << MSG::DEBUG << "After GetEntry, data=" << data << endreq;
-
-    if (data) {
-      deco = data;
-    }
-    else {
-      msg() << MSG::ERROR << "Can not get data for branch:" << label
-          << "entry#" << entrytoread << endreq;
-      return -1;
-    }
-  }
-  else { //if is not simple type
-    //**then check if the data type (class) is accessable in ROOT
-    //get the name of the class
-    bool foundclass = false;
-    msg() << MSG::DEBUG << "UserDataSvc::dis-mangled name:" << demangledname
-        << endreq;
-    //see if the class can be obtained by TClass
-    TClass *cl = TClass::GetClass(demangledname.c_str());
-    if (cl) { //Class definition found, can be added to TTree
-      msg() << MSG::DEBUG << "UserDataSvc::FIND CLASS:" << demangledname
-          << endreq;
-      foundclass = true;
-    }
-    if (!foundclass) {
-      msg() << MSG::DEBUG << "Can not find class in ROOT" << demangledname
-          << endreq;
-      return -1;
-    }
-
-    //* check if the branch exists
-    std::string brname;
-    if (currenttree->GetBranch(label.c_str())) {
-      brname = label;
-    }
-    else if (currenttree->GetBranch((label + ".").c_str())) {
-      brname = label + ".";
-    }
-    else {
-      msg() << MSG::ERROR << "Can not find branch in UserDataTree. branchname:"
-          << label << endreq;
-      return -1;
-    }
-
-    msg() << MSG::DEBUG << "Using branch name:" << brname << endreq;
-
-    void *data = 0;
-    currenttree->SetBranchStatus("*", 0); //disable all branches
-    currenttree->SetBranchStatus((brname + "*").c_str(), 1);
-    currenttree->GetBranch(brname.c_str())->SetAddress(&data);
-    currenttree->GetEntry(entrytoread);
-
-    if (data) {
-      deco = data;
-      msg() << MSG::DEBUG << "data=" << data << " deco=" << deco << endreq;
-    }
-    else {
-      msg() << MSG::ERROR << "Can not get data for branch:" << label
-          << "entry#" << entrytoread << endreq;
-      return -1;
-    }
-  }
-
-  return 0;
-
-}
-
-int
-UserDataSvc::vgetInMemDecoration(const std::string& lab,
-    const std::type_info &decoinfo, void *&deco,
-    const UserDataAssociation::DecoLevel& level, const CLID& clid,
-    const std::string & key) {
-
-  if (decoinfo == typeid(std::string) || decoinfo == typeid(char *) || decoinfo
-      == typeid(const char*) || decoinfo == typeid(TString)) {
-    msg() << MSG::ERROR
-        << "Decoration type 'std::string', 'TString', 'char *' or 'const char *' is not supported (Due to ROOT functionality)"
-        << "Please use vector of std::string instead (std::vector<std::string>)"
-        << endreq;
-    return -1;
-  }
-
-  int sta;
-  char * str;
-  str = abi::__cxa_demangle(decoinfo.name(), 0, 0, &sta);
-  if (sta != 0) {
-    msg() << MSG::ERROR << "Can not get demangled name for typeid.name()="
-        << decoinfo.name() << endreq;
-    return -1;
-  }
-  std::string demangledname(str);
-  free(str);
-
-  std::string label = GenerateLabel(lab, level, clid, key);
-
-  msg() << MSG::DEBUG << "UserDataSvc::vgetInMemDecoration('" << label << "','"
-      << demangledname << "')" << endreq;
-
-  msg() << MSG::DEBUG << "Demangled name=" << demangledname
-      << "\ttypeid.name()" << decoinfo.name() << endreq;
-
-  //** see if the label exist
-  std::map<std::string, std::vector<UserDataAssociation>::size_type>::iterator
-      itr = m_label2number.find(label);
-
-  if (itr == m_label2number.end()) {//label not exist yet
-    msg() << MSG::ERROR << "label not exist:" << label << endreq;
-    deco = 0;
-    return -1;
-  }
-
-  std::vector<UserDataAssociation>::size_type mynumber;
-  mynumber = itr->second;
-  //now mynumber is the index of the decoration in the associations list
-
-  msg() << MSG::DEBUG << "label found:"
-      << m_associations[mynumber].getLabel() << endreq;
-
-  //**first check if the data type matches
-  if (m_associations[mynumber].getLongType() == demangledname) {
-    msg() << MSG::DEBUG << "Type Match:"
-        << m_associations[mynumber].getLongType() << endreq;
-  }
-  else {
-    msg() << MSG::ERROR << "Type does not Match, in root file:"
-        << m_associations[mynumber].getLongType() << " Called with:"
-        << demangledname << endreq;
-    return -1;
-  }
-
-  if (level == UserDataAssociation::EVENT || level
-      == UserDataAssociation::COLLECTION || level==UserDataAssociation::FILE) {
-    
-    void **addr = 0;
-    if (m_numbersetinthisevent[mynumber]) {//use new address
-      addr = m_number2address[mynumber];
-            }
-    else {//use default address
-      addr = m_number2defaultaddress[mynumber];
-    }
-    deco=*addr;
-    return 0;
-  } 
-
-  msg()<<MSG::WARNING<<"UserDataSvc::vgetInMemDecoration:wrong level"<<level<<endreq;
-  return -1;
-}
-
-int
-UserDataSvc::vdecorateElement(const IAthenaBarCode &abc,
-    const std::string& label, const std::type_info &decoinfo, void* & deco,
-    void* &defaultobj, void* &tobedeleted) {
-
-  // no new decoration in merge mode: only recycle old
-  if (m_doMerge)
-    return 0;
-
-  msg() << MSG::DEBUG << "UserDataSvc::vdecorateElement:" << "\tABC="
-      << abc.getAthenaBarCode() << "\tlabel=" << label << "\ttype_info.name()="
-      << decoinfo.name() << "\tdeco=" << deco << "\tdefaultobj=" << defaultobj
-      << endreq;
-
-  el_dump();
-
-  //Check if in the writing mode
-  if (!m_doWriteTransient) {
-    msg() << MSG::ERROR
-        << "vdecorateElement::Trying to decorate when not in writing mode. Check TheUserDataSvc.Output"
-        << endreq;
-    return -1;
-  }
-
-  //Return error when athenabarcode is not implemented
-  if (abc.getAthenaBarCode()==IAthenaBarCode::UNDEFINEDBARCODE) {
-    msg() << MSG::ERROR
-        << "vdecorateElement::AthenaBarCode is not implemented for the object to be decorated. Please contact the author of the object to implement AthenaBarCode"
-        << endreq;
-    return -1;
-  }
-
-  //Get a ReflexObject from the object deco&decoinfo
-  if (!m_dictLoaderSvc->load_type(decoinfo)) {
-    msg() << MSG::ERROR << "vdecorateElement::The type:" << decoinfo.name()
-        << " can't be loaded by reflex. Make sure the reflex library is properly generated for this type"
-        << endreq;
-    return -1;
-  }
-
-  REFLEX_NS::Type mytype = REFLEX_NS::Type::ByTypeInfo(decoinfo);
-  if (!mytype.IsComplete()) {
-    msg() << MSG::DEBUG << "vdecorateElement::The type:" << decoinfo.name()
-        << " is not complete. Make sure the reflex library is properly generated for this type"
-        << endreq;
-    //    return -1;
-  }
-
-  msg() << MSG::DEBUG << "Successfully obtained reflex dictionary. "
-      << "\tName=" << mytype.Name() << "\tIsFundamental="
-      << mytype.IsFundamental() << "\tSizeOf=" << mytype.SizeOf() << endl;
-
-  REFLEX_NS::Object myobject(mytype, deco);
-
-  int64_t myentryid = el_findEntryID(abc, label);
-
-  if (myentryid >= 0) {//found valid entry, overwriting the object
-    //pass this out to be deleted
-
-    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-    // DOREALWORK:already decorated abc&label, so overwriting
-    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-    tobedeleted = m_el_decodata[myentryid].m_object.Address();
-    m_el_decodata[myentryid].m_object = myobject;
-
-    el_dump();
-    return 0;
-
-  }
-  else /*myentryid <= -1*/ {
-
-    msg() << MSG::DEBUG << "el_newDecoration::" << endreq;
-
-    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-    // DOREALWORK:create a new entry
-    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-    std::vector<std::string>::size_type labelid = el_findOrAddLabel(label);
-    std::vector<ElDataEntry>::size_type entryid = el_newDataEntry(abc, label,
-        myobject);
-
-    if (myentryid == -1) {
-      //If not found abc, create a new map
-      std::map<uint32_t, uint32_t> mymap;
-      mymap[labelid] = entryid;
-      m_el_decomap[abc.getAthenaBarCode()] = mymap;
-    }
-    else {
-      ((*m_el_decomap.find(abc.getAthenaBarCode())).second)[labelid] = entryid;
-    }
-
-    // The caller is expecting us to take ownership of defaultobj in this case.
-    // We don't actually use it, so just go ahead and delete it.
-    // Might be better to just remove this from the interface entirely...
-    REFLEX_NS::Object defobject(mytype, defaultobj);
-    defobject.Destruct();
-
-    el_dump();
-    return 1;
-
-  }
-
-}
-
-int
-UserDataSvc::vgetElementDecoration(const IAthenaBarCode &abc,
-    const std::string& lab, const std::type_info &decoinfo, void *&deco) {
-
-  //see if it's in the reading mode
-  if (!m_doRead) {
-    msg() << MSG::ERROR
-        << "UserDataSvc::Trying to get decoration when no input file is set."
-        << endreq;
-    return -1;
-  }
-
-  if (r_el_init() < 0) {
-    return -1;
-  }
-
-  //Now locate the row and read the blob
-  //See if the same ABC can be found
-  int entryNumber = -1;
-
-  std::map<AthenaBarCode_t, std::map<uint32_t, uint32_t> >::iterator itRDecoMap;
-
-  itRDecoMap = m_r_el_decomap.find(abc.getAthenaBarCode());
-
-  if (itRDecoMap == m_r_el_decomap.end()) {
-    //If not found abc
-
-    msg() << MSG::WARNING << "UserDataSvc::AthenaBarCode requested not exist"
-        << endreq;
-
-    return -1;
-  }
-  else {
-    //If found abc
-    //Look to see if the label already exist
-    std::map<std::string, uint32_t>::iterator itLabel2id;
-    itLabel2id = m_r_el_label2id.find(lab);
-    if (itLabel2id == m_r_el_label2id.end()) {
-      //not exist
-      msg() << MSG::WARNING << "UserDataSvc::label requested not exist"
-          << endreq;
-
-      return -1;
-    }
-    else {
-      //good
-      std::vector<std::string>::size_type labelid = (*itLabel2id).second;
-      std::map<uint32_t, uint32_t>::iterator itLabelID2EntryID;
-      itLabelID2EntryID = (*itRDecoMap).second.find(labelid);
-      if (itLabelID2EntryID == (*itRDecoMap).second.end()) {
-        //not found the map<abc,map<labelid,entryid>>
-        msg() << MSG::WARNING
-            << "UserDataSvc::Label & AthenaBarCode pair requested not exist"
-            << endreq;
-
-        return -1;
-      }
-      else {
-        entryNumber = (*itLabelID2EntryID).second;
-      }
-    }
-  }
-
-  msg() << MSG::DEBUG << "UserDataSvc::entryNumber=" << entryNumber << endreq;
-
-  //read the blob
-  m_r_el_tree->SetBranchStatus("*", 0); //disable all branches
-  m_r_el_tree->SetBranchStatus("Blob", 1);
-  m_r_el_tree->SetBranchStatus("Type", 1);
-  m_r_el_tree->GetEntry(entryNumber);
-
-  //verify type
-
-  //Get a ReflexObject from the object deco&decoinfo
-  if (!m_dictLoaderSvc->load_type(decoinfo)) {
-    msg() << MSG::ERROR << "vdecorateElement::The type:" << decoinfo.name()
-        << " can't be loaded by reflex. Make sure the reflex library is properly generated for this type"
-        << endreq;
-    return -1;
-  }
-
-  REFLEX_NS::Type mytype = REFLEX_NS::Type::ByTypeInfo(decoinfo);
-  if (!mytype.IsComplete()) {
-    msg() << MSG::DEBUG << "vdecorateElement::The type:" << decoinfo.name()
-        << " is not complete. Make sure the reflex library is properly generated for this type"
-        << endreq;
-    //    return -1;
-  }
-
-  REFLEX_NS::Type readtype = REFLEX_NS::Type::ByName(*m_r_el_tree_type);