示例#1
0
// ============================================================================
StatusCode GslErrorPrint::handle
( const GslError& error  ) const
{
  MsgStream log( msgSvc() , name() );
  log << MSG::ERROR
      << " GSL code " << error.code
      << " Message '" << error.reason << "'"
      << " File '"    << error.file   << "'"
      << " Line "     << error.line   << endmsg ;
  //
  return StatusCode::SUCCESS ;
}
示例#2
0
//-----------------------------------------------------------------------------
StatusCode RootHistCnv::PersSvc::finalize()
//-----------------------------------------------------------------------------
{
  // Close ROOT only if the output file name is defined
  MsgStream log( msgSvc(), name() );
  log << MSG::DEBUG << "RootHistCnv::PersSvc::finalize()" << endmsg;
  if( undefFileName != m_defFileName ) {
    m_hfile->Write("",TObject::kOverwrite);
    m_hfile->Close();
  }
  return ConversionSvc::finalize();
}
示例#3
0
//--------------------------------------------------------------------------------------------
// implementation of IService::reinitialize
//--------------------------------------------------------------------------------------------
StatusCode MTEventLoopMgr::reinitialize() {

  // initilaize the base class
  StatusCode sc = MinimalEventLoopMgr::reinitialize();

  MsgStream log(msgSvc(), name());
  if( sc.isFailure() ) {
    log << MSG::DEBUG << "Error Initializing base class MinimalEventLoopMgr." << endmsg;
    return sc;
  }

  // Check to see whether a new Event Selector has been specified
  setProperty(m_appMgrProperty->getProperty("EvtSel"));
  if( m_evtsel != "NONE" || m_evtsel.length() == 0) {
    IEvtSelector* theEvtSel;
    IService*     theSvc;
    sc = service( "EventSelector", theEvtSel );
    sc = service( "EventSelector", theSvc );
    if( sc.isSuccess() && ( theEvtSel != m_evtSelector ) ) {
      // Setup Event Selector
      m_evtSelector = theEvtSel;
      if (theSvc->state() == IService::INITIALIZED) {
        sc = theSvc->reinitialize();
        if( sc.isFailure() ){
          log << MSG::ERROR << "Failure Reinitializing EventSelector "
              << theSvc->name( ) << endmsg;
          return sc;
        }
      } else {
        sc = theSvc->initialize();
        if( sc.isFailure() ){
          log << MSG::ERROR << "Failure Initializing EventSelector "
              << theSvc->name( ) << endmsg;
          return sc;
        }
      }
      sc = theEvtSel->createContext(m_evtCtxt);
      if( !sc.isSuccess() ) {
        log << MSG::ERROR << "Can not create Context "
            << theSvc->name( ) << endmsg;
        return sc;
      }
      log << MSG::INFO << "EventSelector service changed to "
          << theSvc->name( ) << endmsg;
    }
  }
  else {
    m_evtSelector = 0;
    m_evtCtxt = 0;
  }
  return StatusCode::SUCCESS;
}
示例#4
0
//=============================================================================
// Check if a given LHCbID is associated to the MCParticle of the specified key
//=============================================================================
bool PrPixelDebugTool::matchKey(LHCb::LHCbID id, int key) {

  LinkedTo<LHCb::MCParticle> vLink(evtSvc(), msgSvc(),
                                   LHCb::VPClusterLocation::Default);
  LHCb::VPChannelID idV = id.vpID();
  LHCb::MCParticle* part = vLink.first(idV);
  while (part) {
    if (key == part->key()) return true;
    part = vLink.next();
  }
  return false;

}
示例#5
0
//=========================================================================
//  Check if a given LHCbID is associated to the MCParticle of the specified key
//=========================================================================
bool PrTStationDebugTool::matchKey ( LHCb::LHCbID id, int key ) {
  if ( id.isOT() ) {
    LinkedTo<LHCb::MCParticle> oLink( evtSvc(), msgSvc(), LHCb::OTTimeLocation::Default );
    LHCb::OTChannelID idO = id.otID();
    
    LHCb::MCParticle* part = oLink.first( idO );
    while ( 0 != part ) {
      if ( key == part->key() ) return true;
      part = oLink.next();
    }
  } else if ( id.isFT() ) {    
    LinkedTo<LHCb::MCParticle> fLink( evtSvc(), msgSvc(), LHCb::FTClusterLocation::Default );
    LHCb::FTChannelID idO = id.ftID();
    
    LHCb::MCParticle* part = fLink.first( idO );
    while ( 0 != part ) {
      if ( key == part->key() ) return true;
      part = fLink.next();
    }
  }
  return false;
}
示例#6
0
StatusCode 
FileMgrTest::allCloseAction(const Io::FileAttr* fa, const std::string& c) {

  MsgStream log(msgSvc(), name());

  log << MSG::INFO << "AllCloseAction called by " << c << "  for tech "
      << fa->tech() << " on " << fa
      << endmsg;

  return StatusCode::SUCCESS;


}
//=============================================================================
StatusCode InputStreamParser::initialize() {

  MsgStream logger(msgSvc(), name());

  StatusCode status = AlgTool::initialize();
  if( !status.isSuccess() ) {
    logger << MSG::FATAL << "Error. Cannot initialize base class." << endmsg;
    return status;
  }

  return StatusCode::SUCCESS;

}
示例#8
0
//------------------------------------------------------------------------------
StatusCode MyAlgorithm::finalize() {
//------------------------------------------------------------------------------
  MsgStream log(msgSvc(), name());
  log << MSG::INFO << "finalizing...." << endmsg;

  toolSvc()->releaseTool( m_publicTool ).ignore();
  toolSvc()->releaseTool( m_privateTool ).ignore();
  toolSvc()->releaseTool( m_publicGTool ).ignore();
  toolSvc()->releaseTool( m_privateGTool ).ignore();
  toolSvc()->releaseTool( m_privateToolWithName ).ignore();
  toolSvc()->releaseTool( m_privateOtherInterface ).ignore();

  return StatusCode::SUCCESS;
}
//====================================================
StatusCode InputStreamParser::extractStreams(const StreamSpecs & inputs, StreamSpecs & parsedInputs) {
  m_inCollection = & parsedInputs;
  StatusCode sc = StatusCode::FAILURE;
  MsgStream log(msgSvc(), name());
  for ( std::vector<std::string>::const_iterator itr = inputs.begin(); itr != inputs.end(); ++itr ) {
    sc = extractStream(*itr);
    if (!sc.isSuccess()) {
      log << MSG::ERROR << " Could not access the file(s). " << endmsg;
      ::abort();
    }
  }

  return sc;
}
示例#10
0
// Progress report
void EventSelector::printEvtInfo(const EvtSelectorContext* iter) const {
  if ( 0 != iter )  {
    long count = iter->numEvent();
    // Print an message every m_evtPrintFrequency events
    if ( 0 == iter->context() )   {
      MsgStream log(msgSvc(), name());
      log << MSG::INFO << "End of event input reached." << endmsg;
    }
    else if( iter->numStreamEvent() == -1 ) {
      // Intial value for this stream
    }
    else if( m_evtPrintFrequency != -1 && (count % m_evtPrintFrequency == 0))   {
      MsgStream log(msgSvc(), name());
      log << MSG::ALWAYS << "Reading Event record " << count+1
          << ". Record number within stream " << iter->ID()+1
          << ": " << iter->numStreamEvent()+1 << endmsg;
    }
  }
  else  {
    MsgStream log(msgSvc(), name());
    log << MSG::INFO << "End of event input reached." << endmsg;
  }
}
示例#11
0
// IEvtSelector::first()
StatusCode
EventSelector::lastOfPreviousStream(bool shutDown, EvtSelectorContext& iter) const {
  StatusCode status = StatusCode::SUCCESS;
  if ( shutDown )   {
    if ( iter.ID() >= 0 && iter.ID() < (long)m_streamtool->size() )   {
      const EventSelectorDataStream* s = m_streamtool->getStream(iter.ID());
      if ( s->isInitialized() )    {
        EventSelector* thisPtr = const_cast<EventSelector*>(this);
        if ( s->selector() && iter.context() )  {
          Context* ctxt = iter.context();
          s->selector()->releaseContext(ctxt);
          iter.set(0,0);
        }
        status = thisPtr->m_streamtool->finalizeStream(const_cast<EventSelectorDataStream*>(s));
        iter.set(0,0);
      }
    }
  }

  IDataStreamTool::size_type iter_id = iter.ID()-1;
  const EventSelectorDataStream* s ;
  status = m_streamtool->getPreviousStream( s , iter_id );

  if ( status.isSuccess() )   {

    if ( !s->isInitialized() )    {
      EventSelector* thisPtr = const_cast<EventSelector*>(this);
      status = thisPtr->m_streamtool->initializeStream(const_cast<EventSelectorDataStream*>(s));
    }
    if ( status.isSuccess() )   {
      const IEvtSelector* sel = s->selector();
      if ( sel )  {
        Context* ctxt = 0;
        status = sel->createContext(ctxt);
        if ( status.isSuccess() )   {
          status = sel->resetCriteria(s->criteria(), *ctxt);
          if ( status.isSuccess() )   {
            MsgStream log(msgSvc(), name());
            iter.set(this, iter_id, ctxt, 0);
            log << MSG::INFO << *s << endmsg;
            return StatusCode::SUCCESS;
          }
        }
      }
    }
  }

  iter.set(this, -1, 0, 0);
  return StatusCode::FAILURE;
}
示例#12
0
//------------------------------------------------------------------------------
StatusCode MyAlgorithm::execute() {
//------------------------------------------------------------------------------
  MsgStream         log( msgSvc(), name() );
  log << MSG::INFO << "executing...." << endmsg;

  m_publicTool->doIt();
  m_privateTool->doIt();
  m_publicGTool->doIt();
  m_privateGTool->doIt();
  m_privateToolWithName->doIt();
  m_privateOtherInterface->doItAgain();

  return StatusCode::SUCCESS;
}
示例#13
0
 /// Service initialisation
 virtual STATUS initialize()    {
   // Nothing to do: just call base class initialisation
   STATUS sc = Service::initialize();
   if ( !sc.isSuccess() )  {
     return sc;
   }
   sc = makePartitions();
   if (!sc.isSuccess()) {
     MsgStream log(msgSvc(), name());
     log << MSG::ERROR << "Failed to connect to all store partitions." << endmsg;
     return sc;
   }
   return attachServices();
 }
示例#14
0
//=========================================================================
//  Print the list of MCParticle keys associated to the specified LHCbID
//=========================================================================
void PrTStationDebugTool::printKey( MsgStream& msg, LHCb::LHCbID id ) {
  if ( id.isOT() ) {
    LinkedTo<LHCb::MCParticle> oLink( evtSvc(), msgSvc(), LHCb::OTTimeLocation::Default );
    LHCb::OTChannelID idO = id.otID();
  
    LHCb::MCParticle* part = oLink.first( idO );
    if ( 0 != part ) msg << " MC:";
    while ( 0 != part ) {
      msg << " " << part->key();
      part = oLink.next();
    }
  } else if ( id.isFT() ) {
    LinkedTo<LHCb::MCParticle> fLink( evtSvc(), msgSvc(), LHCb::FTClusterLocation::Default );
    LHCb::FTChannelID idO = id.ftID();
  
    LHCb::MCParticle* part = fLink.first( idO );
    if ( 0 != part ) msg << " MC:";
    while ( 0 != part ) {
      msg << " " << part->key();
      part = fLink.next();
    }
  }
}
示例#15
0
/// IService implementation: Db event selector override
StatusCode EventSelector::initialize()    {
  // Initialize base class
  StatusCode status = Service::initialize();
  MsgStream logger(msgSvc(), name());
  if ( !status.isSuccess() )    {
    logger << MSG::ERROR << "Error initializing base class Service!" << endmsg;
    return status;
  }
  // Get the references to the services that are needed by the ApplicationMgr itself
  m_incidentSvc = serviceLocator()->service("IncidentSvc");
  if( !m_incidentSvc.isValid() )  {
    logger << MSG::FATAL << "Error retrieving IncidentSvc." << endmsg;
    return StatusCode::FAILURE;
  }
  if ( m_evtMax != INT_MAX )   {
    logger << MSG::ERROR << "EvtMax is an obsolete property of the event selector." << endmsg;
    logger << MSG::ERROR << "Please set \"ApplicationMgr.EvtMax = " << m_evtMax
           << ";\" to process the requested number of events." << endmsg;
    return StatusCode::FAILURE;
  }

  m_toolSvc = serviceLocator()->service("ToolSvc");
  if ( !m_toolSvc.isValid() ) {
    logger << MSG::ERROR << " Could not locate the Tool Service! " << endmsg;
    return StatusCode::FAILURE;
  }

  status = m_toolSvc->retrieveTool(m_streamManager.c_str(), m_streamtool, this);

  if( status.isFailure() ) {
    logger << MSG::ERROR << "Error initializing "
           << m_streamManager << endmsg;
    return status;
  }

  status = m_streamtool->clear();
  if( status.isFailure() ) {
    // Message already printed by the tool
    return status;
  }

  status = m_streamtool->addStreams(m_streamSpecs);

  m_streamSpecsLast = m_streamSpecs;

  m_streamID          = 0;

  return status;
}
示例#16
0
void DataSvcFileEntriesTool::handle(const Incident& incident) {
  // Get the file id of the root node at every event
  IOpaqueAddress *addr = i_getRootNode()->address();
  if (addr)
    m_initialBase = addr->par()[0];
  else
    m_initialBase.clear(); // use empty file id if there is no address

  m_leaves.clear();
  if (m_scanOnBeginEvent) {
    MsgStream log(msgSvc(), name());
    log << MSG::VERBOSE << "::handle scanning on " << incident.type() << endmsg;
    i_collectLeaves();
  }
}
示例#17
0
 /// Finalize
 virtual StatusCode finalize()
 {
   MsgStream log(msgSvc(), name());
   ICounterSvc::Printout p(m_cntSvc);
   log << MSG::INFO << "Single counter:CounterTest::EventCount" << endmsg;
   m_cntSvc->print(m_counterBaseName, "EventCount", p).ignore();
   log << MSG::INFO << "Counter group: CounterTest" << endmsg;
   m_cntSvc->print(m_counterBaseName, p).ignore();
   m_cntSvc->remove(m_counterBaseName, "EventCount").ignore();
   log << MSG::INFO << "After removal CounterTest::EventCount:" << endmsg;
   m_cntSvc->print(p).ignore();
   if ( m_cntSvc ) m_cntSvc->release();
   m_cntSvc = 0;
   return StatusCode::SUCCESS;
 }
示例#18
0
//------------------------------------------------------------------------------
StatusCode MyAlgorithm::initialize() {
//------------------------------------------------------------------------------

  MsgStream log(msgSvc(), name());
  StatusCode sc;
  log << MSG::INFO << "initializing...." << endmsg;

  sc = toolSvc()->retrieveTool(m_toolName, m_tool, this );
  if( sc.isFailure() ) {
    log << MSG::ERROR<< "Error retrieving the tool" << endmsg;
    return sc;
  }
  log << MSG::INFO << "....initialization done" << endmsg;

  return StatusCode::SUCCESS;
}
示例#19
0
// Re-initialize
StatusCode EventSelector::reinitialize() {
  if ( FSMState() != Gaudi::StateMachine::INITIALIZED ) {
    MsgStream logger(msgSvc(), name());
    logger << MSG::ERROR << "Cannot reinitialize: service not in state initialized" << endmsg;
    return StatusCode::FAILURE;
  }

  if( m_streamSpecsLast != m_streamSpecs ) {
    StatusCode status = m_streamtool->clear();
    if ( status.isFailure() ) return status;
    m_streamSpecsLast = m_streamSpecs;
    m_reconfigure = true;
    return m_streamtool->addStreams(m_streamSpecs);
  }

  return StatusCode::SUCCESS;
}
示例#20
0
//------------------------------------------------------------------------------
StatusCode MyAlgorithm::initialize() {
//------------------------------------------------------------------------------

  MsgStream log(msgSvc(), name());
  StatusCode sc;
  log << MSG::INFO << "initializing...." << endmsg;

  sc = toolSvc()->retrieveTool("MyTool", m_publicTool );
  if( sc.isFailure() ) {
    log << MSG::ERROR<< "Error retrieving the public tool" << endmsg;
    return sc;
  }
  sc = toolSvc()->retrieveTool("MyTool", m_privateTool, this );
  if( sc.isFailure() ) {
    log << MSG::ERROR<< "Error retrieving the private tool" << endmsg;
    return sc;
  }
  sc = toolSvc()->retrieveTool("MyGaudiTool", m_publicGTool );
  if( sc.isFailure() ) {
    log << MSG::ERROR<< "Error retrieving the Gaudi public tool" << endmsg;
    return sc;
  }
  sc = toolSvc()->retrieveTool("MyGaudiTool", m_privateGTool, this );
  if( sc.isFailure() ) {
    log << MSG::ERROR<< "Error retrieving the Gaudi private tool" << endmsg;
    return sc;
  }

  sc = toolSvc()->retrieveTool(m_privateToolType, "ToolWithName",
                               m_privateToolWithName, this );
  if( sc.isFailure() ) {
    log << MSG::ERROR<< "Error retrieving the private tool with name" << endmsg;
    return sc;
  }

  sc = toolSvc()->retrieveTool("MyGaudiTool", m_privateOtherInterface, this );
  if( sc.isFailure() ) {
    log << MSG::ERROR << "Error retrieving the Gaudi private tool with second interface" << endmsg;
    return sc;
  }

  log << MSG::INFO << "....initialization done" << endmsg;

  return StatusCode::SUCCESS;
}
示例#21
0
// Add item to output streamer list
void EvtCollectionStream::addItem(const std::string& descriptor)   {
  MsgStream log(msgSvc(), name());
  int sep = descriptor.rfind("#");
  int level = 0;
  std::string obj_path (descriptor,0,sep);
  std::string slevel   (descriptor,sep+1,descriptor.length());
  if ( slevel == "*" )  {
    level = 9999999;
  }
  else   {
    level = ::atoi(slevel.c_str());
  }
  DataStoreItem* item = new DataStoreItem(obj_path, level);
  log << MSG::INFO << "Adding OutputStream item " << item->path()
      << " with " << item->depth()
      << " level(s)." << endmsg;
  m_itemList.push_back( item );
}
示例#22
0
//------------------------------------------------------------------------------
StatusCode StopperAlg::execute() {
//------------------------------------------------------------------------------
  MsgStream         log( msgSvc(), name() );
  static int count = 0;

  if ( ++count >= m_stopcount ) {
    log << MSG::INFO << "scheduling a event processing stop...." << endmsg;
    IEventProcessor* evt = svc<IEventProcessor>("ApplicationMgr");
    if (evt->stopRun().isFailure()) {
      log << MSG::ERROR << "unable to issue a stopRun to the EventProcessor"
	  << endmsg;
      return StatusCode::FAILURE;
    }
    evt->release();
  }

  return StatusCode::SUCCESS;
}
static DD4hep::Geometry::Ref_t createCaloDiscs(DD4hep::Geometry::LCDD& aLcdd,
                                                     DD4hep::XML::Handle_t aXmlElement,
                                                     DD4hep::Geometry::SensitiveDetector aSensDet) {
  ServiceHandle<IMessageSvc> msgSvc("MessageSvc", "CalDiscsConstruction");
  MsgStream lLog(&(*msgSvc), "CalDiscsConstruction");

  DD4hep::XML::DetElement xmlDetElem = aXmlElement;
  std::string nameDet = xmlDetElem.nameStr();
  int idDet = xmlDetElem.id();
  DD4hep::XML::Dimension dim(xmlDetElem.dimensions());
  DD4hep::Geometry::DetElement caloDetElem(nameDet, idDet);

  // Create air envelope for the whole endcap
  DD4hep::Geometry::Cone envelopePositive(dim.dz(), dim.rmin1(), dim.rmax(), dim.rmin2(), dim.rmax());
  DD4hep::Geometry::Cone envelopeNegative(dim.dz(), dim.rmin2(), dim.rmax(), dim.rmin1(), dim.rmax());
  DD4hep::Geometry::UnionSolid envelopeShape(envelopePositive, envelopeNegative,
                                             DD4hep::Geometry::Position(0, 0, -2 * dim.z_offset()));
  DD4hep::Geometry::Volume envelopeVol(nameDet + "_vol", envelopeShape, aLcdd.material("Air"));
  DD4hep::Geometry::Volume envelopePositiveVol(nameDet + "_positive_vol", envelopePositive, aLcdd.material("Air"));
  DD4hep::Geometry::Volume envelopeNegativeVol(nameDet + "_negative_vol", envelopeNegative, aLcdd.material("Air"));

  lLog << MSG::DEBUG << "Placing dector on the positive side: (cm) " << dim.z_offset() << endmsg;
  buildOneSide(lLog, aLcdd, aSensDet, envelopePositiveVol, aXmlElement, 1);
  lLog << MSG::DEBUG << "Placing dector on the negative side: (cm) " << -dim.z_offset() << endmsg;
  buildOneSide(lLog, aLcdd, aSensDet, envelopeNegativeVol, aXmlElement, -1);

  // Place the envelope
  DD4hep::Geometry::PlacedVolume envelopePositivePhysVol = envelopeVol.placeVolume(envelopePositiveVol);
  envelopePositivePhysVol.addPhysVolID("subsystem", 0);
  DD4hep::Geometry::DetElement caloPositiveDetElem(caloDetElem, "positive", 0);
  caloPositiveDetElem.setPlacement(envelopePositivePhysVol);
  DD4hep::Geometry::PlacedVolume envelopeNegativePhysVol =
      envelopeVol.placeVolume(envelopeNegativeVol, DD4hep::Geometry::Position(0, 0, -2 * dim.z_offset()));
  envelopeNegativePhysVol.addPhysVolID("subsystem", 1);
  DD4hep::Geometry::DetElement caloNegativeDetElem(caloDetElem, "negative", 0);
  caloNegativeDetElem.setPlacement(envelopeNegativePhysVol);
  DD4hep::Geometry::Volume motherVol = aLcdd.pickMotherVolume(caloDetElem);
  DD4hep::Geometry::PlacedVolume envelopePhysVol =
      motherVol.placeVolume(envelopeVol, DD4hep::Geometry::Position(0., 0., dim.z_offset()));
  caloDetElem.setPlacement(envelopePhysVol);
  envelopePhysVol.addPhysVolID("system", idDet);
  return caloDetElem;
}
示例#24
0
/// Rewind the dataset
StatusCode EventSelector::rewind(Context& refCtxt) const  {
  EvtSelectorContext *ctxt  = dynamic_cast<EvtSelectorContext*>(&refCtxt);
  if ( ctxt )    {
    ctxt->set(0, -1, 0, 0);
    firstOfNextStream(true, *ctxt);
    long nskip = m_firstEvent;
    while( --nskip > 0 )    {
      StatusCode sc = next(*ctxt);
      if ( sc.isFailure() ) {
        MsgStream log(msgSvc(), name());
        log << MSG::ERROR << "rewind() failed to start with event number "
            << m_firstEvent << endmsg;
        return StatusCode::FAILURE;
      }
    }
    return StatusCode::SUCCESS;
  }
  return StatusCode::FAILURE;
}
示例#25
0
//------------------------------------------------------------------------------
StatusCode HelloWorld::initialize() {
//------------------------------------------------------------------------------
  // avoid calling initialize more than once
  if( m_initialized ) return StatusCode::SUCCESS;

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

  IntegerProperty m_int;
  DoubleProperty  m_double;
  StringProperty  m_string;

  declareInfo("int_value",t_int, "description");
  declareInfo("double_value",t_double, "description");
  declareInfo("string_value",t_string, "description");

  m_initialized = true;
  return StatusCode::SUCCESS;
}
示例#26
0
// initialize data writer
StatusCode EvtCollectionStream::initialize() {
  MsgStream log(msgSvc(), name());
  // Use the Job options service to set the Algorithm's parameters
  setProperties();
  // Get access to the DataManagerSvc
  m_pTupleSvc = serviceLocator()->service(m_storeName);
  if( !m_pTupleSvc.isValid() ) {
    log << MSG::FATAL << "Unable to locate IDataManagerSvc interface" << endmsg;
    return StatusCode::FAILURE;
  }
  // Clear the item list
  clearItems();
  // Take the new item list from the properties.
  for(ItemNames::iterator i = m_itemNames.begin(); i != m_itemNames.end(); i++)   {
    addItem( *i );
  }
  log << MSG::INFO << "Data source:             " << m_storeName  << endmsg;
  return StatusCode::SUCCESS;
}
示例#27
0
  // Initialize engine
  template <class TYPE> StatusCode Engine<TYPE>::initialize()          {
    m_seeds.erase(m_seeds.begin(), m_seeds.end());
    StatusCode status = RndmEngine::initialize();
    if ( m_seeds.size() == 0 )  {
      // Default seeds
      long theSeed = 1234567;
      m_seeds.push_back(theSeed);
      m_seeds.push_back(0);
    }
    MsgStream log(msgSvc(), name());
    if ( status.isSuccess() )   {
      status = initializeEngine();
      if ( status.isSuccess() )   {
        log << MSG::INFO << "Generator engine type:"
        	  << System::typeinfoName(typeid(TYPE))
	          << endmsg;
        if ( m_useTable )   {
          if ( m_row > 214 || m_col > 1 )   {
            log << MSG::ERROR << "Generator engine seed table has dimension [215][2], you gave:"
                << " Row=" << m_row << " Column:" << m_col << endmsg;
            status = StatusCode::FAILURE;
          }
          else    {
            log << MSG::INFO << "Generator engine seeds from table."
                << " Row=" << m_row << " Column:" << m_col << endmsg;
          }
        }
        log << "Current Seed:" << m_hepEngine->getSeed();
        log << " Luxury:" << m_lux;
        log << endmsg;
        // Use the default static engine if required (e.g. for GEANT4)
        if ( m_setSingleton )   {
            HepRandom::setTheEngine(m_hepEngine);
          log << "This is the GEANT4 engine!" << endmsg;
        }
        return status;
      }
    }
    log << MSG::ERROR << "Cannot initialze random engine of type:"
    	  << System::typeinfoName(typeid(TYPE))
        << endmsg;
    return status;
  }
示例#28
0
/// Create event address using event selector
StatusCode MTEventLoopMgr::getEventRoot(IOpaqueAddress*& refpAddr)  {
  refpAddr = 0;
  StatusCode sc = m_evtSelector->next(*m_evtCtxt);
  if ( !sc.isSuccess() )  {
    return sc;
  }
  // Create root address and assign address to data service
  sc = m_evtSelector->createAddress(*m_evtCtxt,refpAddr);
  if( !sc.isSuccess() )  {
    sc = m_evtSelector->next(*m_evtCtxt);
    if ( sc.isSuccess() )  {
      sc = m_evtSelector->createAddress(*m_evtCtxt,refpAddr);
      if ( !sc.isSuccess() )  {
        MsgStream log( msgSvc(), name() );
        log << MSG::WARNING << "Error creating IOpaqueAddress." << endmsg;
      }
    }
  }
  return sc;
}
示例#29
0
//-----------------------------------------------------------------------------
StatusCode RootHistCnv::RConverter::regTFile(const std::string id,
					     const TFile* tfile)
//-----------------------------------------------------------------------------
{

  MsgStream log(msgSvc(), "RConverter");

  std::map<std::string,TFile*>::const_iterator imap;
  imap = s_fileMap.find(id);

  if ( imap != s_fileMap.end() ) {
    log << MSG::ERROR << "cannot register TTree " << id
        << ": already exists" << endmsg;
    return StatusCode::FAILURE;
  }

  s_fileMap[id] = const_cast<TFile*>(tfile);

  return StatusCode::SUCCESS;
}
//=============================================================================
StatusCode InputStreamParser::extractFileReferences(std::string input) {
  MsgStream log(msgSvc(), name());
  TFile *f(0);
  f = TFile::Open(input.c_str(),"READ");
  if (f ==0) {
    log << MSG::ERROR << "Couldn't access the file: "<< input <<endmsg;
    return StatusCode::FAILURE;
  }
  if (!f->IsOpen()) {
    log << MSG::ERROR << "File "<<input <<" cannot be "
    << "opened for reading."<< endmsg;
    return StatusCode::FAILURE;
  }

  std::string sre = "([=]*)DB=([^\\]\\[]*)";
  boost::smatch matches;
  boost::match_flag_type flags = boost::match_default;
  char text[16000];
  TBranch* b=0;
  int i;
  b = ((TTree*)f->Get("##Links"))->GetBranch("db_string");
  Tokenizer tok(true);
  for(i=0,b->SetAddress(text); i < b->GetEntries(); ++i) {
    b->GetEvent(i);
    const std::string text1(text);
    //         log << MSG::INFO <<"The text: "<< text <<endmsg;
    if(!boost::find_first(text, "CNT=/Event"))
      continue;
    else {
      m_regex.assign (sre, boost::regex_constants::icase);
      if(boost::regex_search(text1.begin(),text1.end(), matches, m_regex, flags)) {
        std::string match_db(matches[2].first, matches[2].second);
        m_inCollection->push_back("gfal:guid:"+match_db);
        log << MSG::DEBUG << "Match db: " << match_db << endmsg ;
      }
    }
  }
  f->Close("R");
  return StatusCode::SUCCESS;
}