00001 #ifndef TAUREC_TAUPROCESSORTOOL_H
00002 #define TAUREC_TAUPROCESSORTOOL_H
00003
00004 #include "tauRecTools/TauRecToolBase.h"
00005 #include "tauRecTools/ITauToolExecBase.h"
00006 #include "AsgTools/ToolHandleArray.h"
00007
00015 class TauProcessorTool : public asg::AsgTool, virtual public ITauToolExecBase {
00016 public:
00017
00018 ASG_TOOL_CLASS1( TauProcessorTool, ITauToolExecBase )
00019
00020 TauProcessorTool(const std::string& type);
00021 ~TauProcessorTool();
00022
00023 virtual StatusCode initialize();
00024 virtual StatusCode execute();
00025 virtual StatusCode finalize();
00026
00027 inline void setIsConfigured(bool v=true){ m_configured=v; }
00028
00029 private:
00030 std::string find_file(const std::string& fname) const;
00031 std :: string m_ConfigPath;
00032 std :: string m_tauContainerName;
00033 std :: string m_tauAuxContainerName;
00034 bool m_configured;
00035 bool m_AODmode;
00036 bool m_deep_copy_chargedPFOContainer;
00037 bool m_deep_copy_hadronicPFOContainer;
00038 bool m_deep_copy_neutralPFOContainer;
00039 bool m_deep_copy_SecVtxContainer;
00040 TauEventData m_data;
00041 ToolHandleArray<ITauToolBase> m_tools;
00042
00043 public:
00044
00045 StatusCode readConfig();
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 template<class T, class U, class V>
00056 StatusCode deepCopy(T*& containerOut, U*& containerStoreOut, const V* dummyContainerType,
00057 const std::string& containername, std::string containerNameAux="");
00058
00059
00060 };
00061
00062 template<class T, class U, class V>
00063 StatusCode TauProcessorTool::deepCopy(T*& container, U*& containerStore, const V* ,
00064 const std::string& containerName, std::string containerNameAux){
00065 if(containerNameAux=="") {
00066 containerNameAux=containerName;
00067 containerNameAux+="Aux.";
00068 }
00069
00070 const T* constContainer(0);
00071 const U* constAuxContainer(0);
00072
00073 ATH_CHECK( evtStore()->retrieve(constContainer, containerName) );
00074 ATH_CHECK( evtStore()->retrieve(constAuxContainer, containerNameAux) );
00075 if(container==0 && containerStore==0){
00076 container = new T();
00077 containerStore = new U();
00078 container->setStore(containerStore);
00079 }
00080 else{
00081 ATH_MSG_FATAL("Proviced non-null containters, not initializing please provide null containers: ");
00082 return StatusCode::FAILURE;
00083 }
00084 for( const V* v : *constContainer ){
00085 V* newV = new V();
00086 container->push_back(newV);
00087 *newV = *v;
00088 }
00089
00090 #ifdef ASGTOOL_STANDALONE
00091 ATH_CHECK( evtStore()->record(container, containerName+"Fix") );
00092 ATH_CHECK( evtStore()->record(containerStore, containerName+"FixAux.") );
00093 #else
00094 ATH_CHECK( evtStore()->overwrite(container, containerName, true, false) );
00095 ATH_CHECK( evtStore()->overwrite(containerStore, containerNameAux, true, false) );
00096 #endif
00097
00098 return StatusCode::SUCCESS;
00099 }
00100
00101
00102 #endif //TAUREC_TAUPROCESSORTOOL_H