Skip to content
Snippets Groups Projects
ForDetEnvelopeTool.cxx 1.61 KiB
Newer Older
  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
Vakhtang Tsulaia's avatar
Vakhtang Tsulaia committed
#include "ForDetEnvelopeTool.h"
#include "ForDetEnvelopeFactory.h"
#include "GeoModelEnvelopes/ForDetEnvelopeManager.h"
#include "GeoModelUtilities/GeoModelExperiment.h"

#include "StoreGate/StoreGateSvc.h"

#include "AthenaKernel/ClassID_traits.h"
#include "SGTools/DataProxy.h"

ForDetEnvelopeTool::ForDetEnvelopeTool(const std::string& type,
				       const std::string& name,
				       const IInterface* parent):
  GeoModelTool(type,name,parent),
Vakhtang Tsulaia's avatar
Vakhtang Tsulaia committed
StatusCode ForDetEnvelopeTool::create()
  ATH_MSG_INFO("Building Forward Detectors Envelope");
  GeoModelExperiment* theExpt;
  if (StatusCode::SUCCESS != detStore()->retrieve(theExpt,"ATLAS")) {
    ATH_MSG_ERROR("Could not find GeoModelExperiment ATLAS");
    return StatusCode::FAILURE;
  }
  if(nullptr==m_manager) {
    GeoPhysVol *world=&*theExpt->getPhysVol();

Vakhtang Tsulaia's avatar
Vakhtang Tsulaia committed
    ForDetEnvelopeFactory theFactory(detStore().operator->());
    theFactory.create(world);

    m_manager = theFactory.getDetectorManager();
    theExpt->addManager(m_manager);
Vakhtang Tsulaia's avatar
Vakhtang Tsulaia committed
    StatusCode sc = detStore()->record(m_manager,
      ATH_MSG_ERROR("Could not register ForDetEnvelope detector manager");
      return StatusCode::FAILURE;
    }
    return StatusCode::SUCCESS;
  }
  return StatusCode::FAILURE;
}

Vakhtang Tsulaia's avatar
Vakhtang Tsulaia committed
StatusCode ForDetEnvelopeTool::clear()
  SG::DataProxy* proxy = detStore()->proxy(ClassID_traits<ForDetEnvelopeManager>::ID(),m_manager->getName());
  if(proxy) {
    proxy->reset();
  }
  return StatusCode::SUCCESS;
}