Skip to content
Snippets Groups Projects
Commit e0854f09 authored by John Derek Chapman's avatar John Derek Chapman
Browse files

Merge branch '21.3-ATLASSIM-3903' into '21.3'

SCT RDO updates to reduce size for overlay MC (ATLASSIM-3903)

See merge request atlas/athena!20374
parents dc80c0b6 3ac79cb7
No related branches found
No related tags found
No related merge requests found
Showing
with 317 additions and 126 deletions
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "SCT_FrontEnd.h"
......@@ -21,10 +21,10 @@
// C++ Standard Library
#include <algorithm>
#include <iostream>
// #define SCT_DIG_DEBUG
#include <iostream>
using namespace std;
// ---------------
......@@ -1383,25 +1383,36 @@ StatusCode SCT_FrontEnd::doClustering(SiChargedDiodeCollection &collection)
} while (strip < m_strip_max);
}
else {
do { // Expanded read out mode, one RDO/strip per cluster
if (m_StripHitsOnWafer[strip] > 0) {
clusterSize = 1;
hitStrip = m_sct_id->strip_id(collection.identify(), strip);
SiChargedDiode &HitDiode = *(collection.find(hitStrip));
SiHelper::SetStripNum(HitDiode, clusterSize);
// Expanded read out mode, basically one RDO/strip per cluster
// But if consecutively fired strips have the same time bin, those are converted into one cluster.
do {
clusterSize = 1;
if (m_StripHitsOnWafer[strip] > 0) {
hitStrip = m_sct_id->strip_id(collection.identify(), strip);
SiChargedDiode& hitDiode = *(collection.find(hitStrip));
int timeBin = SiHelper::GetTimeBin(hitDiode);
SiChargedDiode* previousHitDiode = &hitDiode;
// Check if consecutively fired strips have the same time bin
for (int newStrip=strip+1; newStrip<m_strip_max; newStrip++) {
if (not (m_StripHitsOnWafer[newStrip]>0)) break;
Identifier newHitStrip = m_sct_id->strip_id(collection.identify(), newStrip);
SiChargedDiode& newHitDiode = *(collection.find(newHitStrip));
if (timeBin!=SiHelper::GetTimeBin(newHitDiode)) break;
SiHelper::ClusterUsed(newHitDiode, true);
previousHitDiode->setNextInCluster(&newHitDiode);
previousHitDiode = &newHitDiode;
clusterSize++;
}
SiHelper::SetStripNum(hitDiode, clusterSize);
#ifdef SCT_DIG_DEBUG
ATH_MSG_DEBUG("RDO Strip = " << strip << ", tbin = " <<
SiHelper::GetTimeBin(HitDiode) <<
", HitInfo(1=real, 2=crosstalk, 3=noise): " <<
m_StripHitsOnWafer[strip]);
ATH_MSG_DEBUG("RDO Strip = " << strip << ", tbin = " <<
SiHelper::GetTimeBin(hitDiode) <<
", HitInfo(1=real, 2=crosstalk, 3=noise): " <<
m_StripHitsOnWafer[strip]);
#endif
}
++strip; // !< This is the starting point of the next
// cluster within this collection
} while (strip < m_strip_max);
}
strip += clusterSize; // If more than one strip fires, those following strips are skipped.
} while (strip < m_strip_max);
}
// clusters below threshold, only from pre-digits that existed before no
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef INDETEVENTATHENAPOOLDICT_H
......@@ -14,12 +14,14 @@
#include "InDetEventAthenaPool/SCT3_RawData_p1.h"
#include "InDetEventAthenaPool/SCT3_RawData_p2.h"
#include "InDetEventAthenaPool/SCT3_RawData_p3.h"
#include "InDetEventAthenaPool/SCT3_RawData_p4.h"
#include "InDetEventAthenaPool/InDetRawDataCollection_p1.h"
#include "InDetEventAthenaPool/InDetRawDataContainer_p1.h"
#include "InDetEventAthenaPool/InDetRawDataContainer_p2.h"
#include "InDetEventAthenaPool/SCT_RawDataContainer_p1.h"
#include "InDetEventAthenaPool/SCT_RawDataContainer_p2.h"
#include "InDetEventAthenaPool/SCT_RawDataContainer_p3.h"
#include "InDetEventAthenaPool/SCT_RawDataContainer_p4.h"
namespace InDetEventAthenaPoolCnvDict
{
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
/** S.Oda, Oct 2018
* replace Identifier::value_type by Identifier32::value_type and
unsigned int by unsigned short for
for the premixing samples for Overlay MC. */
#ifndef SCT3_RAWDATA_P4_H
#define SCT3_RAWDATA_P4_H
#include "Identifier/Identifier32.h"
class SCT3_RawData_p4 {
public:
SCT3_RawData_p4() {};
// List of Cnv classes that convert this into Rdo objects
friend class SCT3_RawDataCnv_p4;
//private:
unsigned short m_rowStrip; // row and strip numbers from Identifier. Bits 0-12 for strip, Bits 13-15 for row
unsigned short m_word; // raw data word. Bits 0-10 for group size, Bits 11-13 for time bin
void setRowStrip(const int row, const int strip) {
m_rowStrip = (static_cast<unsigned int>(strip) & 0x1FFF);
m_rowStrip |= ((static_cast<unsigned int>(row) & 0x7) << 13);
}
int getRow() const {
return ((m_rowStrip >> 13) & 0x7);
}
int getStrip() const {
return (m_rowStrip & 0x1FFF);
}
};
#endif // SCT3_RAWDATA_P4_H
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef SCT_RAWDATACONTAINER_P4_H
#define SCT_RAWDATACONTAINER_P4_H
/**
* Persistent represenation of an SCT_RawDataContainer.
* New version to deal with SCT_RawData_p4
* Susumu Oda Oct 2018.
*/
#include <vector>
#include <string>
#include "InDetEventAthenaPool/SCT3_RawData_p4.h"
#include "InDetEventAthenaPool/InDetRawData_p2.h"
#include "InDetEventAthenaPool/InDetRawDataCollection_p1.h"
class SCT_RawDataContainer_p4
{
public:
/// Default constructor
SCT_RawDataContainer_p4();
friend class SCT_RawDataContainerCnv_p4;
private:
std::vector<InDetRawDataCollection_p1> m_collections;
std::vector<InDetRawData_p2> m_rawdata;
std::vector<SCT3_RawData_p4> m_sct3data;
/** because ROOT isn't good at storing vectors of vectors,
* store the individual strip errors in the persistent container
* rather than in the persistent SCT3_RawData_p4 itself..
*/
};
/** inlines */
inline
SCT_RawDataContainer_p4::SCT_RawDataContainer_p4() {}
#endif // SCT_RAWDATACONTAINER_P4_H
......@@ -19,16 +19,19 @@
<class name="SCT3_RawData_p1" />
<class name="SCT3_RawData_p2" />
<class name="SCT3_RawData_p3" />
<class name="SCT3_RawData_p4" />
<class name="InDetRawDataCollection_p1" />
<class name="std::vector<InDetRawData_p1>" />
<class name="std::vector<InDetRawData_p2>" />
<class name="std::vector<SCT3_RawData_p1>" />
<class name="std::vector<SCT3_RawData_p2>" />
<class name="std::vector<SCT3_RawData_p3>" />
<class name="std::vector<SCT3_RawData_p4>" />
<class name="InDetRawDataContainer_p1" id="DA76970C-E019-43D2-B2F9-25660DCECD9D" />
<class name="InDetRawDataContainer_p2" id="7138342E-0A80-4A32-A387-2842A01C2539" />
<class name="SCT_RawDataContainer_p1" id="8E13963E-13E5-4D10-AA8B-73F00AFF8FA8" />
<class name="SCT_RawDataContainer_p2" id="D1258125-2CBA-476E-8578-E09D54F477E1" />
<class name="SCT_RawDataContainer_p3" id="5FBC8D4D-7B4D-433A-8487-0EA0C870CBDB" />
<class name="SCT_RawDataContainer_p4" id="6C7540BE-E85C-4777-BC1C-A9FF11460F54" />
<class name="std::vector<InDetRawDataCollection_p1>" />
</lcgdict>
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "InDetRawData/SCT1_RawData.h"
......@@ -17,15 +17,15 @@
void
SCT1_RawDataCnv_p1::persToTrans(const InDetRawData_p1* persObj, SCT1_RawData* transObj, MsgStream &log)
{
MSG_VERBOSE(log,"SCT1_RawDataCnv_p1::persToTrans called ");
*transObj = SCT1_RawData (Identifier(persObj->m_rdoId),
persObj->m_word);
MSG_VERBOSE(log,"SCT1_RawDataCnv_p1::persToTrans called ");
*transObj = SCT1_RawData(Identifier(persObj->m_rdoId),
persObj->m_word);
}
void
SCT1_RawDataCnv_p1::transToPers(const SCT1_RawData* transObj, InDetRawData_p1* persObj, MsgStream &log)
{
MSG_VERBOSE(log,"SCT1_RawDataCnv_p1::transToPers called ");
persObj->m_rdoId = transObj->identify().get_compact();
persObj->m_word = transObj->getWord();
MSG_VERBOSE(log,"SCT1_RawDataCnv_p1::transToPers called ");
persObj->m_rdoId = transObj->identify().get_compact();
persObj->m_word = transObj->getWord();
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "InDetRawData/SCT1_RawData.h"
......@@ -17,15 +17,15 @@
void
SCT1_RawDataCnv_p2::persToTrans(const InDetRawData_p2* persObj, SCT1_RawData* transObj, MsgStream &log)
{
MSG_VERBOSE(log,"SCT1_RawDataCnv_p2::persToTrans called ");
*transObj = SCT1_RawData (Identifier(persObj->m_rdoId),
persObj->m_word);
MSG_VERBOSE(log,"SCT1_RawDataCnv_p2::persToTrans called ");
*transObj = SCT1_RawData(Identifier(persObj->m_rdoId),
persObj->m_word);
}
void
SCT1_RawDataCnv_p2::transToPers(const SCT1_RawData* transObj, InDetRawData_p2* persObj, MsgStream &log)
{
MSG_VERBOSE(log,"SCT1_RawDataCnv_p2::transToPers called ");
persObj->m_rdoId = transObj->identify().get_compact();
persObj->m_word = transObj->getWord();
MSG_VERBOSE(log,"SCT1_RawDataCnv_p2::transToPers called ");
persObj->m_rdoId = transObj->identify().get_compact();
persObj->m_word = transObj->getWord();
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "InDetRawData/SCT3_RawData.h"
......@@ -13,25 +13,25 @@
void
SCT3_RawDataCnv_p1::persToTrans(const SCT3_RawData_p1* persObj, SCT3_RawData* transObj, MsgStream &log)
SCT3_RawDataCnv_p1::persToTrans(const SCT3_RawData_p1* persObj, SCT3_RawData* transObj, MsgStream& log)
{
//#ifdef SCT_DEBUG
MSG_DEBUG(log,"SCT3_RawDataCnv_p1::persToTrans called ");
//#endif
std::vector<int> errHit;
errHit.reserve(20);
for (int ii=0; ii<20; ii++) {
if (persObj->m_errCH[ii] > 0 )
errHit.push_back(ii);
}
MSG_DEBUG(log,"SCT3_RawDataCnv_p1::persToTrans called ");
*transObj = SCT3_RawData (Identifier(persObj->m_rdoId),
persObj->m_word,
std::move(errHit));
std::vector<int> errHit;
errHit.reserve(20);
for (int ii=0; ii<20; ii++) {
if (persObj->m_errCH[ii] > 0) {
errHit.push_back(ii);
}
}
*transObj = SCT3_RawData(Identifier(persObj->m_rdoId),
persObj->m_word,
std::move(errHit));
}
void
SCT3_RawDataCnv_p1::transToPers(const SCT3_RawData*, SCT3_RawData_p1*, MsgStream &log)
SCT3_RawDataCnv_p1::transToPers(const SCT3_RawData*, SCT3_RawData_p1*, MsgStream& log)
{
log << MSG::ERROR << "SCT3_RawDataCnv_p1::transToPers is deprecated. " << endreq;
log << MSG::ERROR << "SCT3_RawDataCnv_p1::transToPers is deprecated. " << endmsg;
}
......@@ -23,8 +23,8 @@ class SCT3_RawDataCnv_p1 : public T_AthenaPoolTPCnvBase<SCT3_RawData, SCT3_RawD
public:
SCT3_RawDataCnv_p1() {}
virtual void persToTrans(const SCT3_RawData_p1* persObj, SCT3_RawData* transObj, MsgStream &log);
virtual void transToPers(const SCT3_RawData* transObj, SCT3_RawData_p1* persObj, MsgStream &log);
virtual void persToTrans(const SCT3_RawData_p1* persObj, SCT3_RawData* transObj, MsgStream& log);
virtual void transToPers(const SCT3_RawData* transObj, SCT3_RawData_p1* persObj, MsgStream& log);
};
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "InDetRawData/SCT3_RawData.h"
......@@ -15,24 +15,20 @@
void
SCT3_RawDataCnv_p2::persToTrans(const SCT3_RawData_p2* persObj, SCT3_RawData* transObj, MsgStream &log)
SCT3_RawDataCnv_p2::persToTrans(const SCT3_RawData_p2* persObj, SCT3_RawData* transObj, MsgStream& log)
{
//#ifdef SCT_DEBUG
MSG_DEBUG(log,"SCT3_RawDataCnv_p2::persToTrans called ");
//#endif
*transObj = SCT3_RawData (Identifier(persObj->m_rdoId),
persObj->m_word,
std::vector<int>());
*transObj = SCT3_RawData(Identifier(persObj->m_rdoId),
persObj->m_word,
std::vector<int>());
}
void
SCT3_RawDataCnv_p2::transToPers(const SCT3_RawData* transObj, SCT3_RawData_p2* persObj, MsgStream &log)
SCT3_RawDataCnv_p2::transToPers(const SCT3_RawData* transObj, SCT3_RawData_p2* persObj, MsgStream& log)
{
//#ifdef SCT_DEBUG
MSG_DEBUG(log,"SCT3_RawDataCnv_p2::transToPers called ");
//#endif
persObj->m_rdoId = transObj->identify().get_compact();
persObj->m_word = transObj->getWord();
MSG_DEBUG(log,"SCT3_RawDataCnv_p2::transToPers called ");
persObj->m_rdoId = transObj->identify().get_compact();
persObj->m_word = transObj->getWord();
}
......@@ -22,8 +22,8 @@ class SCT3_RawDataCnv_p2 : public T_AthenaPoolTPCnvBase<SCT3_RawData, SCT3_RawD
public:
SCT3_RawDataCnv_p2() {}
virtual void persToTrans(const SCT3_RawData_p2* persObj, SCT3_RawData* transObj, MsgStream &log);
virtual void transToPers(const SCT3_RawData* transObj, SCT3_RawData_p2* persObj, MsgStream &log);
virtual void persToTrans(const SCT3_RawData_p2* persObj, SCT3_RawData* transObj, MsgStream& log);
virtual void transToPers(const SCT3_RawData* transObj, SCT3_RawData_p2* persObj, MsgStream& log);
};
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "InDetRawData/SCT3_RawData.h"
......@@ -15,24 +15,20 @@
void
SCT3_RawDataCnv_p3::persToTrans(const SCT3_RawData_p3* persObj, SCT3_RawData* transObj, MsgStream &log)
SCT3_RawDataCnv_p3::persToTrans(const SCT3_RawData_p3* persObj, SCT3_RawData* transObj, MsgStream& log)
{
//#ifdef SCT_DEBUG
MSG_DEBUG(log,"SCT3_RawDataCnv_p3::persToTrans called ");
//#endif
*transObj = SCT3_RawData (Identifier(persObj->m_rdoId),
persObj->m_word,
std::vector<int>());
*transObj = SCT3_RawData(Identifier(persObj->m_rdoId),
persObj->m_word,
std::vector<int>());
}
void
SCT3_RawDataCnv_p3::transToPers(const SCT3_RawData* transObj, SCT3_RawData_p3* persObj, MsgStream &log)
SCT3_RawDataCnv_p3::transToPers(const SCT3_RawData* transObj, SCT3_RawData_p3* persObj, MsgStream& log)
{
//#ifdef SCT_DEBUG
MSG_DEBUG(log,"SCT3_RawDataCnv_p3::transToPers called ");
//#endif
persObj->m_rdoId = transObj->identify().get_compact();
persObj->m_word = transObj->getWord();
MSG_DEBUG(log,"SCT3_RawDataCnv_p3::transToPers called ");
persObj->m_rdoId = transObj->identify().get_compact();
persObj->m_word = transObj->getWord();
}
......@@ -22,8 +22,8 @@ class SCT3_RawDataCnv_p3 : public T_AthenaPoolTPCnvBase<SCT3_RawData, SCT3_RawD
public:
SCT3_RawDataCnv_p3() {}
virtual void persToTrans(const SCT3_RawData_p3* persObj, SCT3_RawData* transObj, MsgStream &log);
virtual void transToPers(const SCT3_RawData* transObj, SCT3_RawData_p3* persObj, MsgStream &log);
virtual void persToTrans(const SCT3_RawData_p3* persObj, SCT3_RawData* transObj, MsgStream& log);
virtual void transToPers(const SCT3_RawData* transObj, SCT3_RawData_p3* persObj, MsgStream& log);
};
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "SCT3_RawDataCnv_p4.h"
#include "MsgUtil.h"
#include "InDetEventAthenaPool/SCT3_RawData_p4.h"
#include "InDetIdentifier/SCT_ID.h"
#include "InDetRawData/SCT3_RawData.h"
#include <vector>
void
SCT3_RawDataCnv_p4::persToTrans(const SCT3_RawData_p4* persObj, SCT3_RawData* transObj, MsgStream& log)
{
MSG_DEBUG(log, "SCT3_RawDataCnv_p4::persToTrans called");
// Convert unsigned short to unsigned int
// P: Bits 0-10 for group size, Bits 11-13 for time bin
// T: Bits 0-10 for group size, Bits 22-24 for time bin
unsigned int word = static_cast<unsigned int>(persObj->m_word);
word = ((word & 0x7FF) | (((word >> 11) & 0x7) << 22));
// Convert row and strip numbers to strip Identifeir using wafer Identifer
Identifier stripId = m_sctId->strip_id(m_waferId,
persObj->getRow(),
persObj->getStrip());
*transObj = SCT3_RawData(stripId,
word,
std::vector<int>());
}
void
SCT3_RawDataCnv_p4::transToPers(const SCT3_RawData* transObj, SCT3_RawData_p4* persObj, MsgStream& log)
{
MSG_DEBUG(log, "SCT3_RawDataCnv_p4::transToPers called");
// Set row and strip numbers
persObj->setRowStrip(m_sctId->row(transObj->identify()), m_sctId->strip(transObj->identify()));
// Convert unsigned int to unsigned short
// T: Bits 0-10 for group size, Bits 22-24 for time bin
// P: Bits 0-10 for group size, Bits 11-13 for time bin
unsigned int word = transObj->getWord();
word = ((word & 0x7FF) | (((word >> 22) & 0x7) << 11));
persObj->m_word = static_cast<unsigned short>(word);
}
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef SCT3_RAWDATACNV_P4_H
#define SCT3_RAWDATACNV_P4_H
/*
Transient/Persistent converter for SCT3_RawData class
*/
#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h"
#include "Identifier/Identifier.h"
#include "InDetRawData/SCT3_RawData.h"
#include "InDetEventAthenaPool/SCT3_RawData_p4.h"
class MsgStream;
class SCT_ID;
class SCT3_RawDataCnv_p4 : public T_AthenaPoolTPCnvBase<SCT3_RawData, SCT3_RawData_p4>
{
public:
SCT3_RawDataCnv_p4(const SCT_ID* sctId) { m_sctId = sctId; }
virtual void persToTrans(const SCT3_RawData_p4* persObj, SCT3_RawData* transObj, MsgStream& log);
virtual void transToPers(const SCT3_RawData* transObj, SCT3_RawData_p4* persObj, MsgStream& log);
void setWaferId(const Identifier waferId) { m_waferId = waferId; }
private:
const SCT_ID* m_sctId;
Identifier m_waferId;
};
#endif // SCT3_RAWDATACNV_P4_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
......@@ -42,7 +42,7 @@ StatusCode SCT_ClusterContainerCnv::initialize() {
}
// get DetectorStore service
StoreGateSvc *detStore(0);
StoreGateSvc* detStore(nullptr);
if (service("DetectorStore", detStore).isFailure()) {
ATH_MSG_FATAL("DetectorStore service not found !");
return StatusCode::FAILURE;
......@@ -51,7 +51,7 @@ StatusCode SCT_ClusterContainerCnv::initialize() {
}
// Get the SCT helper from the detector store
const SCT_ID* idhelper(0);
const SCT_ID* idhelper(nullptr);
if (detStore->retrieve(idhelper, "SCT_ID").isFailure()) {
ATH_MSG_FATAL("Could not get SCT_ID helper !");
return StatusCode::FAILURE;
......@@ -79,7 +79,7 @@ InDet::SCT_ClusterContainer* SCT_ClusterContainerCnv::createTransient() {
static pool::Guid p3_guid("623F5836-369F-4A94-9DD4-DAD728E93C13"); // with SCT_Cluster_p3
//ATH_MSG_DEBUG("createTransient(): main converter");
InDet::SCT_ClusterContainer* p_collection(0);
InDet::SCT_ClusterContainer* p_collection(nullptr);
if( compareClassGuid(p3_guid) ) {
//ATH_MSG_DEBUG("createTransient(): T/P version 3 detected");
std::unique_ptr< SCT_ClusterContainer_PERS > p_coll( poolReadObject< SCT_ClusterContainer_PERS >() );
......@@ -115,7 +115,7 @@ InDet::SCT_ClusterContainer* SCT_ClusterContainerCnv::createTransient() {
SCT_ClusterContainer_PERS* SCT_ClusterContainerCnv::createPersistent (InDet::SCT_ClusterContainer* transCont) {
SCT_ClusterContainer_PERS *sctdc_p= m_TPConverter_p3.createPersistent( transCont, msg() );
SCT_ClusterContainer_PERS* sctdc_p= m_TPConverter_p3.createPersistent( transCont, msg() );
return sctdc_p;
}
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "SCT_RDO_ContainerCnv.h"
......@@ -15,7 +15,7 @@
//================================================================
namespace {
#ifdef SCT_DEBUG
std::string shortPrint(const SCT_RDO_Container *main_input_SCT, unsigned maxprint=25) {
std::string shortPrint(const SCT_RDO_Container* main_input_SCT, unsigned maxprint=25) {
std::ostringstream os;
if(main_input_SCT) {
for(unsigned i=0; i<maxprint; i++) {
......@@ -64,7 +64,7 @@ StatusCode SCT_RDO_ContainerCnv::initialize() {
}
// get DetectorStore service
StoreGateSvc *detStore(0);
StoreGateSvc* detStore(nullptr);
if (service("DetectorStore", detStore).isFailure()) {
ATH_MSG_FATAL("DetectorStore service not found !");
return StatusCode::FAILURE;
......@@ -73,7 +73,7 @@ StatusCode SCT_RDO_ContainerCnv::initialize() {
}
// Get the sct helper from the detector store
const SCT_ID* idhelper(0);
const SCT_ID* idhelper(nullptr);
if (detStore->retrieve(idhelper, "SCT_ID").isFailure()) {
ATH_MSG_FATAL("Could not get SCT_ID helper !");
return StatusCode::FAILURE;
......@@ -86,6 +86,7 @@ StatusCode SCT_RDO_ContainerCnv::initialize() {
m_converter_SCT_TP1.initialize(idhelper);
m_converter_SCT_TP2.initialize(idhelper);
m_converter_SCT_TP3.initialize(idhelper);
m_converter_SCT_TP4.initialize(idhelper);
m_converter_PERS.initialize(idhelper);
// ATH_MSG_DEBUG("Converter initialized");
......@@ -110,7 +111,7 @@ SCT_RDO_Container_PERS* SCT_RDO_ContainerCnv::createPersistent(SCT_RDO_Container
if(it_Coll != it_CollEnd) {
while (it_Coll != it_CollEnd && (*it_Coll)->size() == 0 ) it_Coll++;
if(it_Coll != it_CollEnd) {
const SCT_RDORawData *test((**it_Coll)[0]);
const SCT_RDORawData* test((**it_Coll)[0]);
if(dynamic_cast<const SCT1_RawData*>(test) != 0 ) {
//ATH_MSG_DEBUG("Found container with SCT1_RawData concrete type objects");
converter_num=1;
......@@ -129,7 +130,7 @@ SCT_RDO_Container_PERS* SCT_RDO_ContainerCnv::createPersistent(SCT_RDO_Container
}
// Switch facility depending on the concrete data type of the contained objects
// Should do by getting the type_info of one of the contained objects
SCT_RDO_Container_PERS *persObj(0);
SCT_RDO_Container_PERS* persObj(nullptr);
if(converter_num == 1 || converter_num == 3) {
m_converter_PERS.setType(converter_num);
persObj = m_converter_PERS.createPersistent( transCont, msg() );
......@@ -150,17 +151,31 @@ SCT_RDO_Container* SCT_RDO_ContainerCnv::createTransient() {
static pool::Guid SCT_TP1_guid("8E13963E-13E5-4D10-AA8B-73F00AFF8FA8"); // for t/p separated version with SCT_RawDataContainer_p1
static pool::Guid SCT_TP2_guid("D1258125-2CBA-476E-8578-E09D54F477E1"); // for t/p separated version with SCT_RawDataContainer_p2
static pool::Guid SCT_TP3_guid("5FBC8D4D-7B4D-433A-8487-0EA0C870CBDB"); // for t/p separated version with SCT_RawDataContainer_p3
static pool::Guid SCT_TP4_guid("6C7540BE-E85C-4777-BC1C-A9FF11460F54"); // for t/p separated version with SCT_RawDataContainer_p4
#ifdef SCT_DEBUG
ATH_MSG_DEBUG("createTransient(): main converter");
#endif
if( compareClassGuid(SCT_TP3_guid) ) {
if( compareClassGuid(SCT_TP4_guid) ) {
#ifdef SCT_DEBUG
ATH_MSG_DEBUG("createTransient(): New TP version - TP4 branch");
#endif
std::unique_ptr< SCT_RawDataContainer_p4 > col_vect( poolReadObject< SCT_RawDataContainer_p4 >() );
SCT_RDO_Container* res = m_converter_SCT_TP4.createTransient( col_vect.get(), msg() );
#ifdef SCT_DEBUG
ATH_MSG_DEBUG("createTransient(), TP4 branch: returns TRANS = "<<shortPrint(res));
#endif
return res;
}
else if( compareClassGuid(SCT_TP3_guid) ) {
#ifdef SCT_DEBUG
ATH_MSG_DEBUG("createTransient(): New TP version - TP3 branch");
#endif
std::unique_ptr< SCT_RawDataContainer_p3 > col_vect( poolReadObject< SCT_RawDataContainer_p3 >() );
SCT_RDO_Container *res = m_converter_SCT_TP3.createTransient( col_vect.get(), msg() );
SCT_RDO_Container* res = m_converter_SCT_TP3.createTransient( col_vect.get(), msg() );
#ifdef SCT_DEBUG
ATH_MSG_DEBUG("createTransient(), TP3 branch: returns TRANS = "<<shortPrint(res));
#endif
......@@ -173,7 +188,7 @@ SCT_RDO_Container* SCT_RDO_ContainerCnv::createTransient() {
#endif
std::unique_ptr< SCT_RawDataContainer_p2 > col_vect( poolReadObject< SCT_RawDataContainer_p2 >() );
SCT_RDO_Container *res = m_converter_SCT_TP2.createTransient( col_vect.get(), msg() );
SCT_RDO_Container* res = m_converter_SCT_TP2.createTransient( col_vect.get(), msg() );
#ifdef SCT_DEBUG
ATH_MSG_DEBUG("createTransient(), TP2 branch: returns TRANS = "<<shortPrint(res));
#endif
......@@ -185,7 +200,7 @@ SCT_RDO_Container* SCT_RDO_ContainerCnv::createTransient() {
ATH_MSG_DEBUG("createTransient(): New TP version - TP1 branch");
#endif
std::unique_ptr< SCT_RawDataContainer_p1 > col_vect( poolReadObject< SCT_RawDataContainer_p1 >() );
SCT_RDO_Container *res = m_converter_SCT_TP1.createTransient( col_vect.get(), msg() );
SCT_RDO_Container* res = m_converter_SCT_TP1.createTransient( col_vect.get(), msg() );
#ifdef SCT_DEBUG
ATH_MSG_DEBUG("createTransient(), TP1 branch: returns TRANS = "<<shortPrint(res));
#endif
......@@ -197,7 +212,7 @@ SCT_RDO_Container* SCT_RDO_ContainerCnv::createTransient() {
ATH_MSG_DEBUG("createTransient(): New TP version - TP1 branch");
std::unique_ptr< InDetRawDataContainer_p1 > col_vect( poolReadObject< InDetRawDataContainer_p1 >() );
SCT_RDO_Container *res = m_converter_TP1.createTransient( col_vect.get(), msg() );
SCT_RDO_Container* res = m_converter_TP1.createTransient( col_vect.get(), msg() );
#ifdef SCT_DEBUG
ATH_MSG_DEBUG("createTransient(), TP1 branch: returns TRANS = "<<shortPrint(res));
#endif
......@@ -210,7 +225,7 @@ SCT_RDO_Container* SCT_RDO_ContainerCnv::createTransient() {
ATH_MSG_DEBUG("createTransient(): Old input file - p0 branch");
#endif
std::unique_ptr< SCT_RDO_Container_p0 > col_vect( poolReadObject< SCT_RDO_Container_p0 >() );
SCT_RDO_Container *res = m_converter_p0.createTransient( col_vect.get(), msg() );
SCT_RDO_Container* res = m_converter_p0.createTransient( col_vect.get(), msg() );
#ifdef SCT_DEBUG
ATH_MSG_DEBUG("createTransient(), p0 branch: returns TRANS = "<<shortPrint(res));
#endif
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef SCT_RDO_CONTAINERCNV_H
......@@ -18,10 +18,11 @@
#include "SCT_RawDataContainerCnv_p1.h"
#include "SCT_RawDataContainerCnv_p2.h"
#include "SCT_RawDataContainerCnv_p3.h"
#include "SCT_RawDataContainerCnv_p4.h"
// the latest persistent representation type of DataCollection:
typedef SCT_RawDataContainer_p3 SCT_RDO_Container_PERS;
typedef SCT_RawDataContainerCnv_p3 SCT_RDO_ContainerCnv_PERS;
typedef SCT_RawDataContainer_p4 SCT_RDO_Container_PERS;
typedef SCT_RawDataContainerCnv_p4 SCT_RDO_ContainerCnv_PERS;
typedef T_AthenaPoolCustomCnv<SCT_RDO_Container, SCT_RDO_Container_PERS > SCT_RDO_ContainerCnvBase;
......@@ -35,6 +36,7 @@ class SCT_RDO_ContainerCnv : public SCT_RDO_ContainerCnvBase {
SCT_RawDataContainerCnv_p1 m_converter_SCT_TP1;
SCT_RawDataContainerCnv_p2 m_converter_SCT_TP2;
SCT_RawDataContainerCnv_p3 m_converter_SCT_TP3;
SCT_RawDataContainerCnv_p4 m_converter_SCT_TP4;
SCT_RDO_ContainerCnv_PERS m_converter_PERS;
// Should not be needed at some point.
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "InDetRawData/SCT3_RawData.h"
......@@ -13,6 +13,8 @@
#include "SCT3_RawDataCnv_p1.h"
#include "SCT_RawDataContainerCnv_p1.h"
#include <memory>
void SCT_RawDataContainerCnv_p1::transToPers(const SCT_RDO_Container* transCont, SCT_RawDataContainer_p1* persCont, MsgStream& log)
{
......@@ -57,7 +59,7 @@ void SCT_RawDataContainerCnv_p1::transToPers(const SCT_RDO_Container* transCont,
chanEnd += collection.size();
InDetRawDataCollection_p1& pcollection = persCont->m_collections[collIndex];
pcollection.m_id = collection.identify().get_compact();
pcollection.m_hashId = (unsigned int) collection.identifyHash();
pcollection.m_hashId = static_cast<unsigned int>(collection.identifyHash());
pcollection.m_begin = chanBegin;
pcollection.m_end = chanEnd;
// MSG_VERBOSE(log,"Writing collection number " << collIndex << " with hash" << pcollection.m_hashId);
......@@ -81,7 +83,7 @@ void SCT_RawDataContainerCnv_p1::transToPers(const SCT_RDO_Container* transCont,
// MSG_DEBUG(log," *** Writing SCT_RDO_Container (SCT1/3_RawData concrete type)");
}
void SCT_RawDataContainerCnv_p1::persToTrans(const SCT_RawDataContainer_p1* persCont, SCT_RDO_Container* transCont, MsgStream &log)
void SCT_RawDataContainerCnv_p1::persToTrans(const SCT_RawDataContainer_p1* persCont, SCT_RDO_Container* transCont, MsgStream& log)
{
// The transient model has a container holding collections and the
......@@ -99,8 +101,6 @@ void SCT_RawDataContainerCnv_p1::persToTrans(const SCT_RawDataContainer_p1* per
// from the vector.
SCT_RDO_Collection* coll = 0;
SCT1_RawDataCnv_p1 chan1Cnv;
SCT3_RawDataCnv_p1 chan3Cnv;
// check for the type of the contained objects:
......@@ -117,7 +117,7 @@ void SCT_RawDataContainerCnv_p1::persToTrans(const SCT_RawDataContainer_p1* per
const InDetRawDataCollection_p1& pcoll = persCont->m_collections[icoll];
Identifier collID(pcoll.m_id);
IdentifierHash collIDHash(IdentifierHash(pcoll.m_hashId));
coll = new SCT_RDO_Collection(collIDHash );
std::unique_ptr<SCT_RDO_Collection> coll = std::make_unique<SCT_RDO_Collection>(collIDHash);
coll->setIdentifier(collID);
unsigned int nchans = pcoll.m_end - pcoll.m_begin;
coll->resize(nchans);
......@@ -126,24 +126,24 @@ void SCT_RawDataContainerCnv_p1::persToTrans(const SCT_RawDataContainer_p1* per
for (unsigned int ichan = 0; ichan < nchans; ++ ichan) {
if(m_type == 1) {
const InDetRawData_p1* pchan = &(persCont->m_rawdata[ichan + pcoll.m_begin]);
SCT1_RawData* chan = new SCT1_RawData();
chan1Cnv.persToTrans(pchan, chan, log);
(*coll)[ichan] = chan;
std::unique_ptr<SCT1_RawData> chan = std::make_unique<SCT1_RawData>();
chan1Cnv.persToTrans(pchan, chan.get(), log);
(*coll)[ichan] = chan.release();
} else if (m_type == 3) {
const SCT3_RawData_p1* pchan = &(persCont->m_sct3data[ichan + pcoll.m_begin]);
SCT3_RawData* chan = new SCT3_RawData();
chan3Cnv.persToTrans(pchan, chan, log);
(*coll)[ichan] = chan;
std::unique_ptr<SCT3_RawData> chan = std::make_unique<SCT3_RawData>();
chan3Cnv.persToTrans(pchan, chan.get(), log);
(*coll)[ichan] = chan.release();
}
}
// register the rdo collection in IDC with hash - faster addCollection
StatusCode sc = transCont->addCollection(coll, collIDHash);
if (sc.isFailure()) {
throw std::runtime_error("Failed to add collection to ID Container");
}
MSG_VERBOSE(log,"AthenaPoolTPCnvIDCont::persToTrans, collection, hash_id/coll id = "
<< (int) collIDHash << " / " << collID.get_compact() << ", added to Identifiable container.");
StatusCode sc = transCont->addCollection(coll.release(), collIDHash);
if (sc.isFailure()) {
throw std::runtime_error("Failed to add collection to ID Container");
}
MSG_VERBOSE(log,"AthenaPoolTPCnvIDCont::persToTrans, collection, hash_id/coll id = "
<< collIDHash.value() << " / " << collID.get_compact() << ", added to Identifiable container.");
}
// MSG_DEBUG(log," *** Reading SCT_RDO_Container (SCT1/3_RawData concrete type)");
......@@ -151,8 +151,8 @@ void SCT_RawDataContainerCnv_p1::persToTrans(const SCT_RawDataContainer_p1* per
//================================================================
SCT_RDO_Container* SCT_RawDataContainerCnv_p1::createTransient(const SCT_RawDataContainer_p1* persObj, MsgStream& log) {
std::unique_ptr<SCT_RDO_Container> trans(new SCT_RDO_Container(m_sctId->wafer_hash_max()));
std::unique_ptr<SCT_RDO_Container> trans(std::make_unique<SCT_RDO_Container>(m_sctId->wafer_hash_max()));
persToTrans(persObj, trans.get(), log);
return(trans.release());
return trans.release();
}
......@@ -25,22 +25,22 @@ class SCT_ID;
class SCT_RawDataContainerCnv_p1 : public T_AthenaPoolTPCnvBase<SCT_RDO_Container, SCT_RawDataContainer_p1>
{
private:
const SCT_ID *m_sctId = nullptr;
const SCT_ID* m_sctId = nullptr;
int m_type;
public:
SCT_RawDataContainerCnv_p1() :m_type(0) {};
virtual void persToTrans(const SCT_RawDataContainer_p1* persCont,
SCT_RDO_Container* transCont,
MsgStream &log) ;
MsgStream& log) ;
virtual void transToPers(const SCT_RDO_Container* transCont,
SCT_RawDataContainer_p1* persCont,
MsgStream &log) ;
MsgStream& log) ;
virtual SCT_RDO_Container* createTransient(const SCT_RawDataContainer_p1* persObj, MsgStream& log) ;
// ID helper can't be used in the constructor, need initialize()
void initialize(const SCT_ID *idhelper) { m_sctId = idhelper; }
void initialize(const SCT_ID* idhelper) { m_sctId = idhelper; }
void setType(int type) {m_type = type; }
};
......
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