Exemple #1
0
// ===========================================================================
// execute the handler
// ===========================================================================
StatusCode
DataOnDemandSvc::execHandler(const std::string& tag, Leaf& l)
{
  Gaudi::Utils::LockedChrono timer ( m_timer_algs ,  m_locked_algs ) ;
  //
  if ( l.executing ) { return StatusCode::FAILURE ; }             // RETURN
  //
  if ( 0 == l.algorithm )
  {
    StatusCode sc = configureHandler ( l ) ;
    if ( sc.isFailure() )
    {
      stream()
        << MSG::ERROR
        << "Failed to configure handler for: "
        << l.name << "[" << l.type << "] " << tag << endmsg;
      return sc ;                                                 // RETURN
    }
  }
  //
  Chrono atimer ( m_total ) ;
  //
  Protection p(l.executing);
  StatusCode sc = l.algorithm->sysExecute();
  if ( sc.isFailure() )
  {
    stream() << MSG::ERROR
             << "Failed to execute the algorithm:"
             << l.algorithm->name() << " for location:" << tag << endmsg;
    return sc ;                                                       // RETURN
  }
  ++l.num ;
  //
  return StatusCode::SUCCESS ;
}
Exemple #2
0
//------------------------------------------------------------------------------
DataObject* HistogramSvc::createDirectory(CSTR parentDir,CSTR subDir) {
  DataObject*  directory = new DataObject();
  if (0 != directory)  {
    DataObject* pnode;
    StatusCode status = DataSvc::retrieveObject(parentDir, pnode);
    if(status.isSuccess()) {
      status = DataSvc::registerObject(pnode, subDir, directory);
      if (!status.isSuccess())   {
        MsgStream log(msgSvc(), name());
        log << MSG::ERROR << "Unable to create the histogram directory: "
                          << parentDir << "/" << subDir << endmsg;
        delete directory;
        return 0;
      }
    }
    else {
      MsgStream log(msgSvc(), name());
      log << MSG::ERROR << "Unable to create the histogram directory: "
                        << parentDir << "/" << subDir << endmsg;
      delete directory;
      return 0;
    }
  }
  return directory;
}
StatusCode QueryOperatorImpl::Remove(IMetadataNode* expression)
{
	if(NULL == expression)
		return WINI_ERROR_INVALID_PARAMETER;

	INode* parent = expression->GetParent();

	StatusCode status = WINI_OK;

	if(parent)
	{
		switch(parent->GetType())
		{
		case WINI_QUERY:			//is root expression. delete from query, query is now invalid
			status = ((QueryNodeImpl*)parent)->RemoveChild(expression);
			break;
		case WINI_METADATA:		//delete from metadata, metadata must be fixed
			status = ((MetadataNodeImpl*)parent)->DeleteChild2(expression);
			break;
		default:				//do not remove nodes of collections, datasets, etc.
			return WINI_ERROR;
		}
		//remove query from parent
	};

	if(status.isOk())
		delete expression;

	return status;
}
StatusCode CellPositionsCaloDiscsTool::initialize() {
  StatusCode sc = GaudiTool::initialize();
  if (sc.isFailure()) return sc;
  m_geoSvc = service("GeoSvc");
  if (!m_geoSvc) {
    error() << "Unable to locate Geometry service." << endmsg;
    return StatusCode::FAILURE;
  }
  // get PhiEta segmentation
  m_segmentation = dynamic_cast<dd4hep::DDSegmentation::FCCSWGridPhiEta*>(
      m_geoSvc->lcdd()->readout(m_readoutName).segmentation().segmentation());
  if (m_segmentation == nullptr) {
    error() << "There is no phi-eta segmentation!!!!" << endmsg;
    return StatusCode::FAILURE;
  }
  // Take readout bitfield decoder from GeoSvc
  m_decoder = m_geoSvc->lcdd()->readout(m_readoutName).idSpec().decoder();
  m_volman = m_geoSvc->lcdd()->volumeManager();
  // check if decoder contains "layer"
  std::vector<std::string> fields;
  for (uint itField = 0; itField < m_decoder->size(); itField++) {
    fields.push_back((*m_decoder)[itField].name());
  }
  auto iter = std::find(fields.begin(), fields.end(), "layer");
  if (iter == fields.end()) {
    error() << "Readout does not contain field: 'layer'" << endmsg;
  }
  return sc;
}
/* ****************************************************************************
*
* deleteIndividualContextEntityAttribute - 
*
* DELETE /v1/contextEntities/{entityId::id}/attributes/{attributeName}
* DELETE /ngsi10/contextEntities/{entityId::id}/attributes/{attributeName}
*
* Payload In:  None
* Payload Out: StatusCode
*
* URI parameters:
*   - entity::type=TYPE
*   - note that '!exist=entity::type' and 'exist=entity::type' are not supported by convenience operations
*     that use the standard operation UpdateContext as there is no restriction within UpdateContext.
*   [ attributesFormat=object: makes no sense for this operation as StatusCode is returned ]
*   
* 0. Take care of URI params
* 1. Fill in UpdateContextRequest from URL-path components
* 2. Call postUpdateContext standard service routine
* 3. Translate UpdateContextResponse to StatusCode
* 4. Cleanup and return result
*/
std::string deleteIndividualContextEntityAttribute
(
  ConnectionInfo*            ciP,
  int                        components,
  std::vector<std::string>&  compV,
  ParseData*                 parseDataP
)
{
  std::string  answer;
  std::string  entityId      = compV[2];
  std::string  entityType    = ciP->uriParam[URI_PARAM_ENTITY_TYPE];
  std::string  attributeName = compV[4];
  StatusCode   response;


  // 1. Fill in UpdateContextRequest from URL-path components
  parseDataP->upcr.res.fill(entityId, entityType, "false", attributeName, "", "DELETE");


  // 2. Call postUpdateContext standard service routine
  postUpdateContext(ciP, components, compV, parseDataP);


  // 3. Translate UpdateContextResponse to StatusCode
  response.fill(parseDataP->upcrs.res);


  // 4. Cleanup and return result
  TIMED_RENDER(answer = response.render("", false, false));

  response.release();
  parseDataP->upcr.res.release();

  return answer;
}
Exemple #6
0
/// Initialize Particle Gun parameters
StatusCode ConstPtParticleGun::initialize() {
  StatusCode sc = GaudiTool::initialize();
  if (!sc.isSuccess()) return sc;

  IRndmGenSvc* randSvc = svc<IRndmGenSvc>("RndmGenSvc", true);
  sc = m_flatGenerator.initialize(randSvc, Rndm::Flat(0., 1.));
  if (!sc.isSuccess()) return Error("Cannot initialize flat generator");

  // check momentum and angles
  if ((m_minEta > m_maxEta) || (m_minPhi > m_maxPhi)) return Error("Incorrect values for eta or phi!");

  m_deltaPhi = m_maxPhi - m_minPhi;
  m_deltaEta = m_maxEta - m_minEta;

  // setup particle information
  m_masses.clear();
  auto pd = Pythia8::ParticleData();

  info() << "Particle type chosen randomly from :";
  PIDs::iterator icode;
  for (icode = m_pdgCodes.begin(); icode != m_pdgCodes.end(); ++icode) {
    info() << " " << *icode;
    m_masses.push_back(pd.m0(*icode));
  }

  info() << endmsg;

  info() << "Eta range: " << m_minEta << "  <-> " << m_maxEta << endmsg;
  info() << "Phi range: " << m_minPhi / Gaudi::Units::rad << " rad <-> " << m_maxPhi / Gaudi::Units::rad << " rad"
         << endmsg;

  return sc;
}
Exemple #7
0
 /// initialize the algorithm
 StatusCode initialize () 
 {
   StatusCode sc = GaudiAlgorithm::initialize () ;
   if ( sc.isFailure() ) { return sc ; }                      // RETURN 
   m_stat = svc<IStatSvc> ( "ChronoStatSvc" , true ) ;
   return StatusCode::SUCCESS ;
 }
Exemple #8
0
//-----------------------------------------------------------------------------
StatusCode RootHistCnv::PersSvc::initialize()
//-----------------------------------------------------------------------------
{
  MsgStream log( msgSvc(), name() );

  StatusCode status = ConversionSvc::initialize();
  if( status.isFailure() ) return status;

  // Get my properties from the JobOptionsSvc
  if (setProperties().isFailure()) {
    log << MSG::ERROR << "Could not set my properties" << endmsg;
    return StatusCode::FAILURE;
  }
  if (m_outputEnabled) {
    // Initialize ROOT if output file name is defined
    if( undefFileName != m_defFileName ) {
      m_hfile = TFile::Open(m_defFileName.c_str(),"RECREATE","GAUDI Histograms");
    } else {
      m_hfile = 0;
    }
    log << MSG::INFO << "Writing ROOT histograms to: " << m_defFileName
        << endmsg;
  }
  else {
    log << MSG::INFO << "Writing ROOT histograms disabled." << endmsg;
  }
  return StatusCode(StatusCode::SUCCESS,true);
}
Exemple #9
0
/// Initialization.
StatusCode CpuHungryAlg::initialize() {
  StatusCode sc = GaudiAlgorithm::initialize(); // must be executed first
  if ( sc.isFailure() ) return sc; // error printed already by GaudiAlgorithm

  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Initialize" << endmsg;
  return StatusCode::SUCCESS;
}
//=============================================================================
// init
//=============================================================================
StatusCode TupleToolSelResults::initialize()
{
  StatusCode sc = TupleToolBase::initialize();
  if ( sc.isFailure() ) return sc;
  m_selTool = tool<ICheckSelResults>("CheckSelResultsTool",this);
  return sc ;
}
Exemple #11
0
    /// Initialize
    virtual StatusCode initialize()
    {
      MsgStream log(msgSvc(), name());
      StatusCode sc = service("CounterSvc", m_cntSvc, true);
      if ( !sc.isSuccess() )    {
        log << MSG::ERROR << "Could not connect to CounterSvc." << endmsg;
        return sc;
      }
      sc = m_cntSvc->create(m_counterBaseName, "EventCount", 1000, m_evtCount);
      if ( !sc.isSuccess() )    {
        log << MSG::ERROR << "Could not create counter CounterTest::EventCount." << endmsg;
        return sc;
      }
      m_total = m_cntSvc->create(m_counterBaseName, "TotalCount").counter();
      try  {
        m_total = m_cntSvc->create(m_counterBaseName, "TotalCount").counter();
      }
      catch( std::exception& e)  {
        log << MSG::ALWAYS << "Exception: " << e.what() << endmsg;
      }
      ICounterSvc::Printout p(m_cntSvc);
      m_cntSvc->print(m_counterBaseName, "EventCount", p).ignore();
      m_cntSvc->print(m_counterBaseName, p).ignore();
      //
      m_cntSvc->create(m_counterBaseName, "Eff1") ;
      m_cntSvc->create(m_counterBaseName, "Eff2") ;
      m_cntSvc->create(m_counterBaseName, "Sum") ;

      return sc ;
    }
TEST_F(testsCombinedBlockStore, Basic2IbpSetPutGetMemCheck) {
    std::string ibp1Path = std::string(MKTMPNAME()) + "_IBP1";
    FileTools::createDirectory(ibp1Path);

    std::string ibp2Path = std::string(MKTMPNAME()) + "_IBP2";
    FileTools::createDirectory(ibp2Path);

    std::vector<std::string> ibpsPath;
    ibpsPath.emplace_back(ibp1Path);
    ibpsPath.emplace_back(ibp2Path);

    CombinedBlockStore db(ibpsPath);
    EXPECT_TRUE(db.isClosed());
    db.open();
    EXPECT_FALSE(db.isClosed());

    StatusCode stPut = db.put("key", "data");
    EXPECT_TRUE(stPut.ok());

    std::string fetched;
    StatusCode stGet = db.get("key", &fetched);
    EXPECT_TRUE(stGet.ok());
    EXPECT_TRUE(fetched == "data");

    std::string stats;
    EXPECT_TRUE(db.getStats(stats));
    EXPECT_FALSE(stats.empty());
    EXPECT_FALSE(db.isClosed());
    db.close();
    EXPECT_TRUE(db.isClosed());
    EXPECT_TRUE(db.repair().ok());

    FileTools::removeDirectory(ibp1Path);
    FileTools::removeDirectory(ibp2Path);
}
StatusCode TrackTune::initialize() {

  static const std::string histoDir = "Track/" ;
  if ( "" == histoTopDir() ) setHistoTopDir(histoDir);

  // Mandatory initialization of GaudiAlgorithm
  StatusCode sc = GaudiTupleAlg::initialize();
  if ( sc.isFailure() ) { return sc; }

  LHCb::IParticlePropertySvc* propertysvc = 
    svc<LHCb::IParticlePropertySvc>("LHCb::ParticlePropertySvc",true) ;
  const LHCb::ParticleProperty* prop = propertysvc->find( m_resonanceName);
  if (prop != 0){
    m_minMass = prop->mass() - m_deltaMass; 
    m_maxMass  = prop->mass() + m_deltaMass;
  }
  else {
    return Error("Failed to find resonance", StatusCode::SUCCESS);
  } 
  propertysvc->release();  

  info() << "MinMass " << m_minMass << " MaxMass " << m_maxMass   << endmsg;

  return StatusCode::SUCCESS;

}
/// IService implementation: Db event selector override
StatusCode StagedIODataManager::initialize() {
  // Initialize base class
  StatusCode status = Service::initialize();
  MsgStream log(msgSvc(), name());
  log << MSG::DEBUG << "StagedIODataManager initializing..." << endmsg;
  if ( !status.isSuccess() ) {
    log << MSG::ERROR << "Error initializing base class Service!" << endmsg;
    return status;
  }
  // Retrieve conversion service handling event iteration
  m_catalog = serviceLocator()->service(m_catalogSvcName);
  if( !m_catalog.isValid() ) {
    log << MSG::ERROR
    << "Unable to localize interface IFileCatalog from service:"
    << m_catalogSvcName << endmsg;
    return StatusCode::FAILURE;
  }
  m_incSvc = serviceLocator()->service("IncidentSvc");
  if( !m_incSvc.isValid() ) {
    log << MSG::ERROR << "Error initializing IncidentSvc Service!" << endmsg;
    return status;
  }

  m_stager = serviceLocator()->service("FileStagerSvc", false);
  if( !m_stager.isValid() ) {
    log << MSG::ERROR << "Error initializing File Stager Service!" << endmsg;
    return status;
  }
  return status;
}
Exemple #15
0
//-----------------------------------------------------------------------------
/// Switch to object directory (=Parent directory)
TDirectory* RootHistCnv::RConverter::changeDirectory(DataObject* pObject)
//-----------------------------------------------------------------------------
{
  if ( pObject )    {
    IRegistry* pReg = pObject->registry();
    if ( pReg )    {
      SmartIF<IDataManagerSvc> dataMgr(dataProvider());
      if ( dataMgr.isValid() )    {
        IRegistry* pParentReg = 0;
        StatusCode status = dataMgr->objectParent(pReg, pParentReg);
        if ( status.isSuccess() )  {
          IOpaqueAddress* pParAddr = pParentReg->address();
          if ( pParAddr )   {
            TDirectory* pParentDir = (TDirectory*)pParAddr->ipar()[0];
            if ( pParentDir )   {
              gDirectory->cd(pParentDir->GetPath());
              return pParentDir;
            }
          }
        }
      }
    }
  }
  return 0;
}
Exemple #16
0
//=======================================================================
//  Finalize
//=======================================================================
StatusCode HTBlob::finalize()
{
    debug() << "Finalizing HTBlob..." << endmsg;
    StatusCode sc = this->MinervaHistoTool::finalize();
    if( sc.isFailure() ) { return Error( "Failed to finalize!", sc ); }
    return sc;
}
Exemple #17
0
StatusCode
StatusCodeSvc::initialize() {

  StatusCode sc = Service::initialize();
  if (!sc.isSuccess()) return sc;

  MsgStream log( msgSvc(), name() );
  log << MSG::INFO << "initialize" << endmsg;

  std::vector<std::string>::const_iterator itr;
  for (itr = m_pFilter.value().begin(); itr != m_pFilter.value().end(); ++itr) {
    // we need to do this if someone has gotten to regFnc before initialize

    string fnc,lib;
    parseFilter(*itr,fnc,lib);

    if (fnc != "") {
      filterFnc(fnc);
      m_filterfnc.insert(fnc);
    }

    if (lib != "") {
      filterLib(lib);
      m_filterlib.insert(lib);
    }

  }

  return StatusCode::SUCCESS;

}
//=========================================================================
// fill flight distance, angle...
//=========================================================================
StatusCode TupleToolGeometry::fillFlight( const VertexBase* oriVtx,
                                          const Particle* P,
                                          const std::string& prefix,
                                          Tuples::Tuple& tuple,
                                          const std::string& trail ) const
{
  bool test = true ;
  // --------------------------------------------------
  if ( !oriVtx )
  {
    test &= tuple->column( prefix + "_FD"+trail, -999. );
    test &= tuple->column( prefix + "_FDCHI2"+trail, -999. );
    test &= tuple->column( prefix + "_DIRA"+trail, -999.);
  }
  else
  {

    // flight distance
    double dist = 0;
    double chi2 = 0 ;
    StatusCode sc = m_dist->distance( oriVtx, P->endVertex(), dist, chi2 );
    if ( sc.isFailure() ) return sc ;

    test &= tuple->column( prefix + "_FD"+trail, dist );
    test &= tuple->column( prefix + "_FDCHI2"+trail, chi2 );
    // --------------------------------------------------
    // cosine of (flight distance) dot (momentum):
    // find the origin vertex. Either the primary or the origin in the
    // decay
    test &= tuple->column( prefix + "_DIRA"+trail, dira(oriVtx,P) );
  }

  if (!test) Warning("Error in fillFlight "+prefix,1).ignore();
  return StatusCode(test);
}
/* ****************************************************************************
*
* fill - 
*/
TEST(StatusCode, fill)
{
  StatusCode    sc;
  StatusCode    sc2(SccOk, "Details");
  StatusCode    ec(SccBadRequest, "Very bad request :-)");
  std::string   out;

  utInit();

  sc.fill(SccForbidden, "D");
  EXPECT_EQ(sc.code, SccForbidden);
  EXPECT_STREQ(sc.reasonPhrase.c_str(), "Forbidden");
  EXPECT_STREQ(sc.details.c_str(), "D");

  sc.fill(&sc2);
  EXPECT_EQ(sc.code, SccOk);
  EXPECT_STREQ(sc.reasonPhrase.c_str(), "OK");
  EXPECT_STREQ(sc.details.c_str(), "Details");

  sc.fill(&ec);
  EXPECT_EQ(sc.code, SccBadRequest);
  EXPECT_STREQ(sc.reasonPhrase.c_str(), "Bad Request");
  EXPECT_STREQ(sc.details.c_str(), "Very bad request :-)");

  utExit();
}
//=============================================================================
// Initialization
//=============================================================================
StatusCode PatPixelHitManager::initialize() {
	m_event_number = 0;
	m_max_hits = 0;
  StatusCode sc = GaudiTool::initialize(); // must be executed first
  if ( sc.isFailure() ) return sc;  // error printed already by GaudiAlgorithm

  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Initialize" << endmsg;

  m_veloPix      = getDet<DeVeloPix>( DeVeloPixLocation::Default );

  // make sure we are up-to-date on populated VELO stations
  registerCondition( (*(m_veloPix->leftSensorsBegin()))->geometry(), &PatPixelHitManager::rebuildGeometry );
  registerCondition( (*(m_veloPix->rightSensorsBegin()))->geometry(), &PatPixelHitManager::rebuildGeometry );

  // first update
  sc = updMgrSvc()->update(this);
  if(!sc.isSuccess()) {
    return Error( "Failed to update station structure." );
  }

  // invalidate measurements at the beginning of each event
  incSvc()->addListener(this, IncidentType::BeginEvent);

  m_pool.resize( 10000 );
  m_nextInPool = m_pool.begin();
  m_maxSize = 0;
  m_eventReady = false;

  return StatusCode::SUCCESS;
}
Exemple #21
0
// ============================================================================
StatusCode Tuples::TupleObj::fill( const char*  format ... )
{
  // check the underlying tuple
  if ( invalid()      ) { return InvalidTuple ; }
  // decode format string into tokens
  Tokens tokens ;
  tokenize( format , tokens , " ,;" );
  if ( tokens.empty() ) { return StatusCode::SUCCESS ; }
  /// decode arguments
  va_list valist ;
  va_start( valist , format ) ;
  // loop over all tokens
  StatusCode status = StatusCode::SUCCESS ;
  for( Tokens::const_iterator token = tokens.begin() ;
       tokens.end() != token && status.isSuccess() ; ++token )
  {
    const double val = va_arg( valist , double );
    status = column( *token , val );
    if( status.isFailure() )
    { Error ( "fill(): Can not add column '" + *token + "' " ) ; }
  }
  // mandatory !!!
  va_end( valist );
  //
  return status ;
}
TEST_F(testsLevelDbFacade, BasicLevelDbFacadePutGetMemCheck) {
    std::vector<bool> falseTrue = { false, true };
    for (bool param1 : falseTrue) {
        for (bool param2 : falseTrue) {
            for (bool param3 : falseTrue) {
                std::string dbPath = std::string(MKTMPNAME()) + "_IBP";
                FileTools::createDirectory(dbPath);

                LevelDbFacade db(dbPath, param1, param2, param3);
                EXPECT_TRUE(db.isClosed());
                db.open();
                EXPECT_FALSE(db.isClosed());

                StatusCode stPut = db.put("key", "data");
                EXPECT_TRUE(stPut.ok());

                std::string fetched;
                StatusCode stGet = db.get("key", &fetched);
                EXPECT_TRUE(stGet.ok());
                EXPECT_TRUE(fetched == "data");

                EXPECT_FALSE(db.isClosed());
                db.close();
                EXPECT_TRUE(db.isClosed());
                std::string output;
                db.getStats(output);

                FileTools::removeDirectory(dbPath);
            }
        }
    }
}
StatusCode CatalogOperatorImpl::GetChildren(CatalogNodeImpl* target, unsigned int mask)
{
	if(NULL == target)
		return WINI_ERROR_INVALID_PARAMETER;

	target->Clear();

	StatusCode status;
	
	unsigned int success = WINI_ALL ^ WINI_ZONE;

	if(WINI_ZONE & mask)
	{
		status = GetZones(target);
		if(status.isOk())
		{
			success |= WINI_ZONE;
		}
		else
		{
			target->SetOpen(success);
			return status;
		}
	}

	target->SetOpen(success);
	return status;
}
Exemple #24
0
// IService::sysInitialize
StatusCode Service::sysInitialize() {
  StatusCode sc;

  try {
    m_targetState = Gaudi::StateMachine::INITIALIZED;
    Gaudi::Guards::AuditorGuard guard(this,
                                      // check if we want to audit the initialize
                                      (m_auditorInitialize) ? auditorSvc().get() : 0,
                                      IAuditor::Initialize);
    if ((name() != "MessageSvc") && msgSvc().isValid()) // pre-set the outputLevel from the MessageSvc value
      m_outputLevel = msgSvc()->outputLevel(name());
    sc = initialize(); // This should change the state to Gaudi::StateMachine::CONFIGURED
    if (sc.isSuccess())
      m_state = m_targetState;
    return sc;
  }
  catch ( const GaudiException& Exception )  {
    fatal() << "in sysInitialize(): exception with tag=" << Exception.tag()
        << " is caught" << endmsg;
    error() << Exception  << endmsg;
    //	  Stat stat( chronoSvc() , Exception.tag() );
  }
  catch( const std::exception& Exception ) {
    fatal() << "in sysInitialize(): standard std::exception is caught" << endmsg;
    error() << Exception.what()  << endmsg;
    //	  Stat stat( chronoSvc() , "*std::exception*" );
  }
  catch(...) {
    fatal() << "in sysInitialize(): UNKNOWN Exception is caught" << endmsg;
    //	  Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
  }

  return StatusCode::FAILURE;
}
Exemple #25
0
//------------------------------------------------------------------------------
DataObject* HistogramSvc::createPath(CSTR newPath)  {
  std::string tmpPath = newPath;
  if (tmpPath[0] != SEPARATOR)    {
    tmpPath.insert(tmpPath.begin(), SEPARATOR);
    tmpPath.insert(tmpPath.begin(), m_rootName.begin(), m_rootName.end());
  }
  // Remove trailing "/" from newPath if it exists
  if (tmpPath.rfind(SEPARATOR) == tmpPath.length()-1) {
    tmpPath.erase(tmpPath.rfind(SEPARATOR),1);
  }
  DataObject* pObject = 0;
  StatusCode sc = DataSvc::findObject(tmpPath, pObject);
  if(sc.isSuccess()) {
    return pObject;
  }
  int sep = tmpPath.rfind(SEPARATOR);
  std::string rest(tmpPath, sep+1, tmpPath.length()-sep);
  std::string subPath(tmpPath, 0, sep);
  if(0 != sep) {
    createPath(subPath);
  }
  else {
    MsgStream log(msgSvc(), name());
    log << MSG::ERROR << "Unable to create the histogram path" << endmsg;
    return 0;
  }
  pObject = createDirectory(subPath, rest);
  return pObject;
}
Exemple #26
0
// IService::sysStart
StatusCode Service::sysStart() {
  StatusCode sc;

  try {
    m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::START,m_state);
    Gaudi::Guards::AuditorGuard guard(this,
                                      // check if we want to audit the initialize
                                      (m_auditorStart) ? auditorSvc().get() : 0,
                                      IAuditor::Start);
    sc = start();
    if (sc.isSuccess())
      m_state = m_targetState;
    return sc;
  }
  catch ( const GaudiException& Exception )  {
    fatal() << "in sysStart(): exception with tag=" << Exception.tag()
        << " is caught" << endmsg;
    error() << Exception  << endmsg;
    //    Stat stat( chronoSvc() , Exception.tag() );
  }
  catch( const std::exception& Exception ) {
    fatal() << "in sysStart(): standard std::exception is caught" << endmsg;
    fatal() << Exception.what()  << endmsg;
    //    Stat stat( chronoSvc() , "*std::exception*" );
  }
  catch(...) {
    fatal() << "in sysStart(): UNKNOWN Exception is caught" << endmsg;
    //    Stat stat( chronoSvc() , "*UNKNOWN Exception*" ) ;
  }

  return StatusCode::FAILURE;
}
/* ****************************************************************************
*
* check - 
*/
std::string UpdateContextAttributeRequest::check(RequestType requestType, Format format, std::string indent, std::string predetectedError, int counter)
{
  StatusCode       response;
  std::string      res;

  if (format == (Format) 0)
     format = XML;

  if (predetectedError != "")
  {
    response.code         = SccBadRequest;
    response.reasonPhrase = predetectedError;
  }
  else if (contextValue == "")
  {
    response.code         = SccBadRequest;
    response.reasonPhrase = "empty context value";
  }
  else if ((res = metadataVector.check(requestType, format, indent, predetectedError, counter)) != "OK")
  {
    response.code         = SccBadRequest;
    response.reasonPhrase = res;
  }
  else
    return "OK";
   
  return response.render(format, indent);
}
StatusCode CreatePositionedHit::initialize() {

  StatusCode sc = GaudiAlgorithm::initialize();
  if (sc.isFailure()) return sc;

  m_geoSvc = service ("GeoSvc");
  if (!m_geoSvc) {
    error() << "Unable to locate Geometry Service. "
            << "Make sure you have GeoSvc and SimSvc in the right order in the configuration." << endmsg;
    return StatusCode::FAILURE;
  }
  // check if readouts exist
  if(m_geoSvc->lcdd()->readouts().find(m_readoutName) == m_geoSvc->lcdd()->readouts().end()) {
    error()<<"Readout <<"<<m_readoutName<<">> does not exist."<<endmsg;
    return StatusCode::FAILURE;
  }

  // Get PhiEta segmentation
  m_segmentation = dynamic_cast<DD4hep::DDSegmentation::GridPhiEta*>(m_geoSvc->lcdd()->readout(m_readoutName).segmentation().segmentation());
  if(m_segmentation == nullptr) {
    error()<<"There is no phi-eta segmentation."<<endmsg;
    return StatusCode::FAILURE;
  }

  // Get the total number of active volumes in the geometry
  auto highestVol = gGeoManager->GetTopVolume();
  m_numLayers = det::utils::countPlacedVolumes(highestVol, m_activeVolumeName);
  debug() << "Number of active layers " << m_numLayers << endmsg;

  return sc;
}
StatusCode QueryOperatorImpl::LoadCollectionQuery(QueryNodeImpl* target)
{
#if 0
	ClearMCATScratch();
	m_selval[DATA_GRP_NAME] = 1;

	INode* ptr = target;
	IMetadataNode* ptr_meta;

	int count = 0;

	StatusCode status;

	while(WINI_QUERY == ptr->GetType())
	{
		ptr_meta = (IMetadataNode*)ptr->GetChild(0);

		status = LoadCollectionQuery2(ptr_meta, count);

		if(!status.isOk())
			break;

		ptr = ptr->GetParent();

		if(NULL == ptr)
			break;
	}

	return status;
#endif
	return WINI_ERROR;
}
Exemple #30
0
// ============================================================================
/// re-initialization of the service
// ============================================================================
StatusCode DataOnDemandSvc::reinitialize()
{
  // reinitialize the Service Base class
  if ( 0 != m_incSvc )
  {
    m_incSvc -> removeListener ( this , m_trapType );
    m_incSvc.reset();
  }
  m_algMgr.reset();
  m_dataSvc.reset();
  for(std::list<IDODNodeMapper*>::iterator i = m_nodeMappers.begin(); i != m_nodeMappers.end(); ++i)
      m_toolSvc->releaseTool(*i).ignore();
  m_nodeMappers.clear();
  for(std::list<IDODAlgMapper*>::iterator i = m_algMappers.begin(); i != m_algMappers.end(); ++i)
    m_toolSvc->releaseTool(*i).ignore();
  m_algMappers.clear();
  m_toolSvc.reset();
  if ( 0 != m_log     ) { delete m_log ; m_log = 0 ; }
  //
  StatusCode sc = Service::reinitialize();
  if ( sc.isFailure() )  { return sc; }
  //
  sc = setup() ;
  if ( sc.isFailure() )  { return sc; }
  //
  if ( m_dump ) { dump ( MSG::INFO ) ; }
  else if ( MSG::DEBUG >= outputLevel() ) { dump ( MSG::DEBUG  ) ; }
  //
  return StatusCode::SUCCESS ;
}