Commit ea9ee8e4 authored by Scott Snyder's avatar Scott Snyder Committed by Graeme Stewart
Browse files

Merge from trunk: moving CaloCalibrationHit converters to CaloSimEventTPCnv...

Merge from trunk: moving CaloCalibrationHit converters  to CaloSimEventTPCnv (CaloTPCnv-00-01-20-01)

	* Tagging CaloTPCnv-00-01-20-01.
	* Merge from trunk:
	* Tagging CaloTPCnv-00-02-01
	fix requirements for checkreq warning.
	* Tagging CaloTPCnv-00-02-00
	moving CaloCalibrationHit converters  to CaloSimEventTPCnv
	(requested by J. Chapman)
parent 9d5e4d78
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef CALOCALIBRATIONHITCNV_P1_H
#define CALOCALIBRATIONHITCNV_P1_H
#include "CaloSimEvent/CaloCalibrationHit.h"
#include "CaloTPCnv/CaloCalibrationHit_p1.h"
#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h"
class MsgStream;
class CaloCalibrationHitCnv_p1 : public T_AthenaPoolTPCnvBase<CaloCalibrationHit, CaloCalibrationHit_p1>
{
public:
CaloCalibrationHitCnv_p1() {}
virtual void persToTrans(const CaloCalibrationHit_p1* persObj, CaloCalibrationHit* transObj, MsgStream &log);
virtual void transToPers(const CaloCalibrationHit* transObj, CaloCalibrationHit_p1* persObj, MsgStream &log);
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef CALOCALIBRATIONHITCNV_P2_H
#define CALOCALIBRATIONHITCNV_P2_H
#include "CaloSimEvent/CaloCalibrationHit.h"
#include "CaloTPCnv/CaloCalibrationHit_p2.h"
#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h"
class MsgStream;
class CaloCalibrationHitCnv_p2 : public T_AthenaPoolTPCnvBase<CaloCalibrationHit, CaloCalibrationHit_p2>
{
public:
CaloCalibrationHitCnv_p2() {}
virtual void persToTrans(const CaloCalibrationHit_p2* persObj, CaloCalibrationHit* transObj, MsgStream &log);
virtual void transToPers(const CaloCalibrationHit* transObj, CaloCalibrationHit_p2* persObj, MsgStream &log);
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef CALOTPCNV_CALOCALIBRATIONHITCONTAINERCNV_P1_H
#define CALOTPCNV_CALOCALIBRATIONHITCONTAINERCNV_P1_H
#define private public
#include "CaloTPCnv/CaloCalibrationHitContainer_p1.h"
#undef private
#include "CaloSimEvent/CaloCalibrationHitContainer.h"
#include "CaloCalibrationHitCnv_p1.h"
#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h"
typedef T_AthenaHitsVectorCnv< CaloCalibrationHitContainer, CaloCalibrationHitContainer_p1, CaloCalibrationHitCnv_p1 > CaloCalibrationHitContainerCnv_p1;
#endif // not CALOTPCNV_CALOCALIBRATIONHITCONTAINERCNV_P1_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef CALOTPCNV_CALOCALIBRATIONHITCONTAINERCNV_P2_H
#define CALOTPCNV_CALOCALIBRATIONHITCONTAINERCNV_P2_H
#define private public
#include "CaloTPCnv/CaloCalibrationHitContainer_p2.h"
#undef private
#include "CaloSimEvent/CaloCalibrationHitContainer.h"
#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h"
//typedef T_AthenaHitsVectorCnv< CaloCalibrationHitContainer, CaloCalibrationHitContainer_p1, CaloCalibrationHitCnv_p1 > CaloCalibrationHitContainerCnv_p1;
class CaloCalibrationHitContainerCnv_p2 : public T_AthenaPoolTPCnvBase<CaloCalibrationHitContainer, CaloCalibrationHitContainer_p2>
{
public:
CaloCalibrationHitContainerCnv_p2(){};
virtual void persToTrans(const CaloCalibrationHitContainer_p2* persColl, CaloCalibrationHitContainer* transColl, MsgStream &log);
virtual void transToPers(const CaloCalibrationHitContainer* transColl, CaloCalibrationHitContainer_p2* persColl, MsgStream &log);
private:
};
#endif // not CALOTPCNV_CALOCALIBRATIONHITCONTAINERCNV_P2_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef CALOTPCNV_CALOCALIBRATIONHITCONTAINERCNV_P3_H
#define CALOTPCNV_CALOCALIBRATIONHITCONTAINERCNV_P3_H
#define private public
#include "CaloTPCnv/CaloCalibrationHitContainer_p3.h"
#undef private
#include "CaloSimEvent/CaloCalibrationHitContainer.h"
#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h"
//typedef T_AthenaHitsVectorCnv< CaloCalibrationHitContainer, CaloCalibrationHitContainer_p1, CaloCalibrationHitCnv_p1 > CaloCalibrationHitContainerCnv_p1;
class CaloCalibrationHitContainerCnv_p3 : public T_AthenaPoolTPCnvBase<CaloCalibrationHitContainer, CaloCalibrationHitContainer_p3>
{
public:
CaloCalibrationHitContainerCnv_p3(){};
virtual void persToTrans(const CaloCalibrationHitContainer_p3* persColl, CaloCalibrationHitContainer* transColl, MsgStream &log);
virtual void transToPers(const CaloCalibrationHitContainer* transColl, CaloCalibrationHitContainer_p3* persColl, MsgStream &log);
private:
};
#endif // not CALOTPCNV_CALOCALIBRATIONHITCONTAINERCNV_P1_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef CALOTPCNV_CALOCALIBRATIONHITCONTAINER_P1_H
#define CALOTPCNV_CALOCALIBRATIONHITCONTAINER_P1_H
#include <vector>
#include <string>
#include "CaloTPCnv/CaloCalibrationHit_p1.h"
class CaloCalibrationHitContainer_p1
{
public:
/// typedefs
typedef std::vector<CaloCalibrationHit_p1> HitVector;
typedef HitVector::const_iterator const_iterator;
typedef HitVector::iterator iterator;
/// Default constructor
CaloCalibrationHitContainer_p1();
// Accessors
const std::string& name() const;
const HitVector& getVector() const;
private:
std::vector<CaloCalibrationHit_p1> m_cont;
std::string m_name;
};
// inlines
inline CaloCalibrationHitContainer_p1::CaloCalibrationHitContainer_p1() {}
inline const std::string& CaloCalibrationHitContainer_p1::name() const {return m_name;}
inline const std::vector<CaloCalibrationHit_p1>& CaloCalibrationHitContainer_p1::getVector() const {return m_cont;}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef CALOCALIBRATIONHITCONTAINER_P2_H
#define CALOCALIBRATIONHITCONTAINER_P2_H
/**
@class CaloCalibrationHitContainer_p2
@brief Persistent represenation of a CaloCalibrationContainer,
@author: Ilija Vukotic
*/
#include <vector>
#include <string>
class CaloCalibrationHitContainer_p2
{
public:
/// Default constructor
CaloCalibrationHitContainer_p2();
// Accessors
const std::string& name() const;
private:
std::vector<unsigned int> m_channelHash;
std::vector<unsigned int> m_energy; // 18 bits compressed - all four of them in the same array
// std::vector<unsigned int> m_energy1; // 18 bits compressed
// std::vector<unsigned int> m_energy2; // 18 bits compressed
// std::vector<unsigned int> m_energy3; // 18 bits compressed
std::string m_name;
};
// inlines
inline CaloCalibrationHitContainer_p2::CaloCalibrationHitContainer_p2() {}
inline const std::string& CaloCalibrationHitContainer_p2::name() const {return m_name;}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef CALOCALIBRATIONHITCONTAINER_P3_H
#define CALOCALIBRATIONHITCONTAINER_P3_H
/**
@class CaloCalibrationHitContainer_p3
@brief Persistent represenation of a CaloCalibrationContainer,
@author: Ilija Vukotic
*/
#include <vector>
#include <string>
class CaloCalibrationHitContainer_p3
{
public:
/// Default constructor
CaloCalibrationHitContainer_p3();
// Accessors
const std::string& name() const;
private:
std::vector<unsigned int> m_channelHash;
std::vector<unsigned int> m_energy; // 18 bits compressed - all four of them in the same array
// std::vector<unsigned int> m_energy1; // 18 bits compressed
// std::vector<unsigned int> m_energy2; // 18 bits compressed
// std::vector<unsigned int> m_energy3; // 18 bits compressed
std::string m_name;
std::vector<unsigned int> m_particleID;
};
// inlines
inline CaloCalibrationHitContainer_p3::CaloCalibrationHitContainer_p3() {}
inline const std::string& CaloCalibrationHitContainer_p3::name() const {return m_name;}
#endif
// This file's extension implies that it's C, but it's really -*- C++ -*-.
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef CALOCALIBRATIONHIT_P1_H
#define CALOCALIBRATIONHIT_P1_H
/** @class CaloCalibrationHit_p1
@brief Persistent CaloCalibrationHit class, version p1.
*/
#include "Identifier/Identifier.h"
class CaloCalibrationHit_p1
{
public:
CaloCalibrationHit_p1()
: m_energy0(0),
m_energy1(0),
m_energy2(0),
m_energy3(0)
{}
friend class CaloCalibrationHitCnv_p1;
private:
/** identifier of the cell in which this hit occured. */
Identifier m_ID;
/** energies (in MeV) deposited in this hit. In order, they represent:
* EM energy deposited
* non-EM energy deposited
* "invisible" energy deposited
* escaped energy */
float m_energy0;
float m_energy1;
float m_energy2;
float m_energy3;
};
#endif
// This file's extension implies that it's C, but it's really -*- C++ -*-.
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef CALOCALIBRATIONHIT_P2_H
#define CALOCALIBRATIONHIT_P2_H
/** @class CaloCalibrationHit_p2
@brief Persistent CaloCalibrationHit class, version p2.
*/
#include "Identifier/Identifier.h"
class CaloCalibrationHit_p2
{
public:
CaloCalibrationHit_p2()
: m_energy0(0),
m_energy1(0),
m_energy2(0),
m_energy3(0),
m_particleID(0)
{}
friend class CaloCalibrationHitCnv_p2;
private:
/** identifier of the cell in which this hit occured. */
Identifier m_ID;
/** energies (in MeV) deposited in this hit. In order, they represent:
* EM energy deposited
* non-EM energy deposited
* "invisible" energy deposited
* escaped energy */
float m_energy0;
float m_energy1;
float m_energy2;
float m_energy3;
/** identifier of Primary Particle which caused this hit */
unsigned int m_particleID;
};
#endif
......@@ -14,7 +14,6 @@
#include "CaloTPCnv/CaloClusterMomentStore_p1.h"
#include "CaloTPCnv/CaloTowerContainer_p1.h"
#include "CaloTPCnv/CaloTopoTowerContainer_p1.h"
#include "CaloTPCnv/CaloCalibrationHitContainer_p1.h"
//Version 2
#include "CaloTPCnv/CaloClusterContainer_p2.h"
......@@ -22,13 +21,10 @@
#include "CaloTPCnv/CaloClusterMomentContainer_p1.h"
#include "CaloTPCnv/CaloSamplingDataContainer_p1.h"
#include "CaloTPCnv/CaloCellLinkContainer_p2.h"
#include "CaloTPCnv/CaloCalibrationHitContainer_p2.h"
//Version 3
#include "CaloTPCnv/CaloClusterContainer_p3.h"
#include "CaloTPCnv/CaloClusterMomentContainer_p2.h"
#include "CaloTPCnv/CaloCalibrationHitContainer_p3.h"
#include "CaloTPCnv/CaloCalibrationHit_p2.h"
//Version 4
#include "CaloTPCnv/CaloClusterContainer_p4.h"
......
......@@ -48,19 +48,11 @@
<class name="CaloCalibrationHit_p1" />
<class name="std::vector<CaloCalibrationHit_p1>" />
<class name="CaloCalibrationHitContainer_p1" id="185FEF89-2350-4D1E-A1A7-9CB5A357232E" />
<class name="CaloCalibrationHitContainer_p2" id="4942B9D4-F545-4C68-BD2D-A8E5923C29F3" />
<!-- optimized version 4 -->
<class name="CaloClusterContainer_p4" id="330CE691-7151-46DC-892B-46176619540C" />
<class name="std::vector<CaloClusterContainer_p4::CaloCluster_p>" />
<class name="CaloClusterContainer_p4::CaloCluster_p" />
<class name="CaloCalibrationHit_p2" />
<class name="CaloCalibrationHitContainer_p3" id="D4E51325-2A55-41E4-B163-5224F2FA27CB" />
<!-- optimized version 5 -->
<class name="CaloClusterContainer_p5" id="2E505417-8246-4A1E-B35F-704663C530FD" />
<class name="std::vector<CaloClusterContainer_p5::CaloCluster_p>" />
......
......@@ -12,15 +12,12 @@ use AthenaKernel AthenaKernel-* Control
use AthenaPoolCnvSvc AthenaPoolCnvSvc-* Database/AthenaPOOL
use EventCommonTPCnv EventCommonTPCnv-* Event
use CaloEvent CaloEvent-* Calorimeter
use CaloSimEvent CaloSimEvent-* Calorimeter
use Identifier Identifier-* DetectorDescription
private
use AtlasReflex AtlasReflex-* External
use SGTools SGTools-* Control
use CaloConditions CaloConditions-* Calorimeter
use CaloInterface CaloInterface-* Calorimeter
use CaloIdentifier CaloIdentifier-* Calorimeter
use CaloUtils CaloUtils-* Calorimeter
use CaloGeoHelpers CaloGeoHelpers-* Calorimeter
end_private
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#define private public
#define protected public
#include "CaloSimEvent/CaloCalibrationHit.h"
#undef private
#undef protected
#include "Identifier/Identifier.h"
#include "CaloTPCnv/CaloCalibrationHit_p1.h"
#include "CaloTPCnv/CaloCalibrationHitCnv_p1.h"
void CaloCalibrationHitCnv_p1::persToTrans(const CaloCalibrationHit_p1* persObj, CaloCalibrationHit* transObj, MsgStream &log)
{
if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "CaloCalibrationHitCnv_p1::persToTrans called " << endreq;
transObj->m_ID = Identifier(persObj->m_ID);
transObj->m_energy0 = (double) persObj->m_energy0;
transObj->m_energy1 = (double) persObj->m_energy1;
transObj->m_energy2 = (double) persObj->m_energy2;
transObj->m_energy3 = (double) persObj->m_energy3;
}
void CaloCalibrationHitCnv_p1::transToPers(const CaloCalibrationHit* transObj, CaloCalibrationHit_p1* persObj, MsgStream &log)
{
if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "CaloCalibrationHitCnv_p1::transToPers called " << endreq;
persObj->m_ID = transObj->m_ID.get_compact();
persObj->m_energy0 = (float) transObj->m_energy0;
persObj->m_energy1 = (float) transObj->m_energy1;
persObj->m_energy2 = (float) transObj->m_energy2;
persObj->m_energy3 = (float) transObj->m_energy3;
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#define private public
#define protected public
#include "CaloSimEvent/CaloCalibrationHit.h"
#undef private
#undef protected
#include "Identifier/Identifier.h"
#include "CaloTPCnv/CaloCalibrationHit_p2.h"
#include "CaloTPCnv/CaloCalibrationHitCnv_p2.h"
void CaloCalibrationHitCnv_p2::persToTrans(const CaloCalibrationHit_p2* persObj, CaloCalibrationHit* transObj, MsgStream &log)
{
if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "CaloCalibrationHitCnv_p2::persToTrans called " << endreq;
transObj->m_ID = Identifier(persObj->m_ID);
transObj->m_energy0 = (double) persObj->m_energy0;
transObj->m_energy1 = (double) persObj->m_energy1;
transObj->m_energy2 = (double) persObj->m_energy2;
transObj->m_energy3 = (double) persObj->m_energy3;
transObj->m_particleID = (unsigned int) persObj->m_particleID;
}
void CaloCalibrationHitCnv_p2::transToPers(const CaloCalibrationHit* transObj, CaloCalibrationHit_p2* persObj, MsgStream &log)
{
if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "CaloCalibrationHitCnv_p2::transToPers called " << endreq;
persObj->m_ID = transObj->m_ID.get_compact();
persObj->m_energy0 = (float) transObj->m_energy0;
persObj->m_energy1 = (float) transObj->m_energy1;
persObj->m_energy2 = (float) transObj->m_energy2;
persObj->m_energy3 = (float) transObj->m_energy3;
persObj->m_particleID = (unsigned int) transObj->m_particleID;
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#define private public
#define protected public
#include "CaloSimEvent/CaloCalibrationHit.h"
#include "CaloSimEvent/CaloCalibrationHitContainer.h"
#undef private
#undef protected
#include "Identifier/Identifier.h"
#include "Identifier/IdentifierHash.h"
#include "CaloIdentifier/CaloCell_ID.h"
#include "CaloIdentifier/CaloDM_ID.h"
#include "CaloIdentifier/CaloIdManager.h"
#include "EventCommonTPCnv/Compressor.h"
// CaloCalibrationHitContainerCnv_p2, used for T/P separation
// author Ilija Vukotic
#include "CaloTPCnv/CaloCalibrationHitContainerCnv_p2.h"
#include "map"
void CaloCalibrationHitContainerCnv_p2::transToPers(const CaloCalibrationHitContainer* transCont, CaloCalibrationHitContainer_p2* persCont, MsgStream &log)
{
// static int ev=0;
size_t size = transCont->size();
if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << " *** Writing CaloCalibrationHitContainer_p2 of size:"<<size<<endreq;
persCont->m_channelHash.reserve(size);
std::vector<float> tempE; tempE.reserve(size*4);
// const CaloCell_ID* cellIdHelper = (CaloIdManager::instance())->getCaloCell_ID();
// const CaloDM_ID* cellIdHelper = (CaloIdManager::instance())->getDM_ID();
CaloCalibrationHitContainer::const_iterator it = transCont->begin();
std::multimap <unsigned int, unsigned int> map_hashPositions;// first hash ; second its position in container
for (unsigned int w=0;w<size;++w){
//IdentifierHash hashId = cellIdHelper->calo_cell_hash((*it)->m_ID);
unsigned int id = (*it)->m_ID.get_identifier32().get_compact();
/* when hash things are clear it could be usefull to change from storing ID to storing hash
IdentifierHash hashId = -1;
if (cellIdHelper->is_lar_dm(id))
hashId =cellIdHelper->lar_zone_hash(id);
else if (cellIdHelper->is_tile_dm(id))
hashId =cellIdHelper->tile_zone_hash(id)+cellIdHelper->lar_zone_hash_max();
*/
map_hashPositions.insert(std::pair<unsigned int, int>(id, w));
/* if (!ev){
if ( cellIdHelper->is_lar_dm(id) ) std::cout<<"LAR ";
if ( cellIdHelper->is_tile_dm(id)) std::cout<<"TILE ";
std::cout<<hashId;
std::cout<<"\t"<<id<<std::endl;
}*/
++it;
}
std::multimap<unsigned int, unsigned int>::const_iterator iter;
unsigned int old=0;
for (iter=map_hashPositions.begin(); iter != map_hashPositions.end(); ++iter) {
//cout <<"container position:"<< iter->second << " \t hash:" << iter->first << endl;
unsigned int pHash=(iter->first)-old; // to store as a difference
old=iter->first;
unsigned int pos=iter->second;
persCont->m_channelHash.push_back(pHash);
tempE.push_back( (float) (transCont->At(pos))->m_energy0 );
tempE.push_back( (float) (transCont->At(pos))->m_energy1 );
tempE.push_back( (float) (transCont->At(pos))->m_energy2 );
tempE.push_back( (float) (transCont->At(pos))->m_energy3 );
// if (!ev) std::cout<<"Writing Hash: "<<iter->first<<"\t E: "<< (float) (transCont->At(pos))->m_energy0<<std::endl;
}
Compressor A; A.setNrBits(18);
A.reduce(tempE,persCont->m_energy); // packs energy
persCont->m_name = transCont->Name(); //stores name
// ev++;
}
void CaloCalibrationHitContainerCnv_p2::persToTrans(const CaloCalibrationHitContainer_p2* persCont, CaloCalibrationHitContainer* transCont, MsgStream &log)
{
// static int dog=0;
size_t cells=persCont->m_channelHash.size();
if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << " *** Reading CaloCalibrationHitContainer of size: "<<cells<<endreq;
transCont->clear();
transCont->reserve(cells);
transCont->setName(persCont->name() );
//const CaloCell_ID* cellIdHelper = (CaloIdManager::instance())->getCaloCell_ID();
//const CaloDM_ID* cellIdHelper = (CaloIdManager::instance())->getDM_ID();
Compressor A;
std::vector<float> tempE; tempE.reserve(cells*4);
A.expandToFloat(persCont->m_energy,tempE);