Skip to content
Snippets Groups Projects
Commit 720722cf authored by Stewart Martin-Haugh's avatar Stewart Martin-Haugh Committed by Graeme Stewart
Browse files

'Use std::make_unique (only available with C++14), forgot two occurrences'...

'Use std::make_unique (only available with C++14), forgot two occurrences' (SCT_RawDataByteStreamCnv-00-03-70)

	* Use std::make_unique (only available with C++14)
	* Forgot two occurrences
	* tag SCT_RawDataByteStreamCnv-00-03-70

2016-11-25 Stewart Martin-Haugh <smh@cern.ch>
	* Use std::make_unique (only available with C++14)
	* tag SCT_RawDataByteStreamCnv-00-03-69

2016-11-25 Stewart Martin-Haugh <smh@cern.ch>
	* Convert to DataHandles
	* tag SCT_RawDataByteStreamCnv-00-03-68

2016-11-16 Susumu Oda <Susumu.Oda@cern.ch>
	* SCT_RawDataProviderTool: add code to set error flag in EventInfo
	  if >1000 ROBFragment errors.
	* Tag as SCT_RawDataByteStreamCnv-00-03-67


Former-commit-id: e4ffcd28cb3324877e8383b038b369bd59efe718
parent 3af120ab
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include <memory>
#include "SCTRawDataProvider.h"
#include "SCT_RawDataByteStreamCnv/ISCTRawDataProviderTool.h"
......@@ -18,10 +19,13 @@ SCTRawDataProvider::SCTRawDataProvider(const std::string& name,
m_rawDataTool ("SCTRawDataProviderTool",this),
m_cabling ("SCT_CablingSvc",name),
m_sct_id(nullptr),
m_LVL1Collection(nullptr),
m_BCIDCollection(nullptr)
m_rdoContainerKey(""),
m_lvl1CollectionKey(""),
m_bcidCollectionKey("")
{
declareProperty ("RDOKey" , m_RDO_Key = "SCT_RDOs");
declareProperty("RDOKey", m_rdoContainerKey = std::string("SCT_RDOs"));
declareProperty("LVL1IDKey", m_lvl1CollectionKey = std::string("SCT_LVL1ID"));
declareProperty("BCIDKey", m_bcidCollectionKey = std::string("SCT_BCID"));
declareProperty ("ProviderTool", m_rawDataTool);
declareProperty ("CablingSvc", m_cabling);
}
......@@ -38,6 +42,10 @@ StatusCode SCTRawDataProvider::initialize() {
ATH_CHECK(detStore()->retrieve(m_sct_id,"SCT_ID"));
/** Retrieve Cabling service */
ATH_CHECK(m_cabling.retrieve());
//Initialize
ATH_CHECK( m_rdoContainerKey.initialize() );
ATH_CHECK( m_lvl1CollectionKey.initialize() );
ATH_CHECK( m_bcidCollectionKey.initialize() );
return StatusCode::SUCCESS;
}
......@@ -45,11 +53,10 @@ StatusCode SCTRawDataProvider::initialize() {
/// Execute
StatusCode SCTRawDataProvider::execute() {
SCT_RDO_Container *container = new SCT_RDO_Container(m_sct_id->wafer_hash_max());
if (evtStore()->record(container, m_RDO_Key).isFailure()) {
msg(MSG::FATAL) << "Unable to record SCT RDO Container." << endmsg;
return StatusCode::FAILURE;
}
SG::WriteHandle<SCT_RDO_Container> rdoContainer(m_rdoContainerKey);
rdoContainer = std::make_unique<SCT_RDO_Container>(m_sct_id->wafer_hash_max());
ATH_CHECK(rdoContainer.isValid());
//// do we need this?? rdoIdc->cleanup();
......@@ -61,10 +68,13 @@ StatusCode SCTRawDataProvider::execute() {
if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Number of ROB fragments " << listOfRobf.size() << endmsg;
m_LVL1Collection = new InDetTimeCollection();
m_LVL1Collection->reserve(listOfRobf.size());
m_BCIDCollection = new InDetTimeCollection();
m_BCIDCollection->reserve(listOfRobf.size());
SG::WriteHandle<InDetTimeCollection> lvl1Collection(m_lvl1CollectionKey);
lvl1Collection = std::make_unique<InDetTimeCollection>(listOfRobf.size());
ATH_CHECK(lvl1Collection.isValid());
SG::WriteHandle<InDetTimeCollection> bcidCollection(m_bcidCollectionKey);
bcidCollection = std::make_unique<InDetTimeCollection>(listOfRobf.size());
ATH_CHECK(bcidCollection.isValid());
std::vector<const ROBFragment*>::const_iterator rob_it = listOfRobf.begin();
for(; rob_it!=listOfRobf.end(); ++rob_it) {
......@@ -78,31 +88,18 @@ StatusCode SCTRawDataProvider::execute() {
unsigned int lvl1id = (*rob_it)->rod_lvl1_id();
std::pair<uint32_t, unsigned int>* lvl1Pair = new std::pair<uint32_t, unsigned int>(std::make_pair(robid,lvl1id));
m_LVL1Collection->push_back(lvl1Pair) ;
lvl1Collection->push_back(lvl1Pair) ;
unsigned int bcid = (*rob_it)->rod_bc_id();
std::pair<uint32_t, unsigned int>* bcidPair = new std::pair<uint32_t, unsigned int>(std::make_pair(robid,bcid));
m_BCIDCollection->push_back(bcidPair);
bcidCollection->push_back(bcidPair);
if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<"Stored LVL1ID "<<lvl1id<<" and BCID "<<bcid<<" in InDetTimeCollections"<<endmsg;
}
StatusCode sc = evtStore()->record(m_LVL1Collection,"SCT_LVL1ID");
if (sc.isFailure() ) {
msg(MSG::ERROR) << "failed to record LVL1ID TimeCollection" << endmsg;
return sc;
}
sc = evtStore()->record(m_BCIDCollection,"SCT_BCID");
if (sc.isFailure() ) {
msg(MSG::ERROR) << "failed to record BCID TimeCollection" << endmsg;
return sc;
}
/** ask SCTRawDataProviderTool to decode it and to fill the IDC */
if (m_rawDataTool->convert(listOfRobf,container)==StatusCode::FAILURE)
if (m_rawDataTool->convert(listOfRobf,&(*rdoContainer))==StatusCode::FAILURE)
msg(MSG::ERROR) << "BS conversion into RDOs failed" << endmsg;
return StatusCode::SUCCESS;
......
......@@ -25,6 +25,8 @@
#include "GaudiKernel/ToolHandle.h"
/** other */
#include "InDetRawData/InDetTimeCollection.h"
#include "InDetRawData/SCT_RDO_Container.h"
#include "StoreGate/WriteHandleKey.h"
#include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h"
/** STL */
#include <string>
......@@ -61,10 +63,9 @@ class SCTRawDataProvider : public AthAlgorithm
ToolHandle<ISCTRawDataProviderTool> m_rawDataTool;
ServiceHandle<ISCT_CablingSvc> m_cabling;
const SCT_ID* m_sct_id;
std::string m_RDO_Key;
InDetTimeCollection* m_LVL1Collection;
InDetTimeCollection* m_BCIDCollection;
SG::WriteHandleKey<SCT_RDO_Container> m_rdoContainerKey;
SG::WriteHandleKey<InDetTimeCollection> m_lvl1CollectionKey;
SG::WriteHandleKey<InDetTimeCollection> m_bcidCollectionKey;
};
......
......@@ -128,8 +128,9 @@ StatusCode SCTRawDataProviderTool::convert( std::vector<const ROBFragment*>& vec
return sc;
}
int nLVL1ID = m_bsErrSvc->getErrorSet(SCT_ByteStreamErrors::LVL1IDError)->size();
int nROBFragment = m_bsErrSvc->getErrorSet(SCT_ByteStreamErrors::ROBFragmentError)->size();
if (nLVL1ID > 500) {
if (nLVL1ID > 500 or nROBFragment > 1000) {
//// retrieve EventInfo.
/// First the xAOD one
bool setOK_xAOD = false;
......@@ -157,7 +158,7 @@ StatusCode SCTRawDataProviderTool::convert( std::vector<const ROBFragment*>& vec
}
sc = StatusCode::SUCCESS;
} /// 500 LVL1ID errors
} /// 500 LVL1ID errors or 1000 ROBFragment errors
return sc;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment