ATLAS Offline Software
Loading...
Searching...
No Matches
CaloCompactCellTool Class Reference

helper to convert from CaloCellContainer to CaloCompactCellContainer and back More...

#include <CaloCompactCellTool.h>

Collaboration diagram for CaloCompactCellTool:

Public Types

enum  KNOWN_VERSIONS {
  VERSION_400 = 400 , VERSION_500 = 500 , VERSION_501 = 501 , VERSION_502 = 502 ,
  VERSION_503 = 503 , VERSION_504 = 504 , VERSION_LATEST = -1
}

Public Member Functions

 CaloCompactCellTool ()
StatusCode getTransient (const CaloCompactCellContainer &theCompactContainer, CaloCellContainer *theCellContainer)
StatusCode getPersistent (const CaloCellContainer &theCellContainer, CaloCompactCellContainer *theCompactContainer, const SG::ThinningDecisionBase *dec, int theVersion=VERSION_LATEST)

Private Member Functions

int getLogCompact (const double &x, const double &log_x0, const double &log_x1, const int &n)
double unpackLog (const int &log_x, const double &log_x0, const double &log_x1, const int &n)
int getCubRootCompact (const double &x, const double &cbrt_x1, const int &n)
double unpackCubRoot (const int &cbrt_x, const double &cbrt_x1, const int &n)

Detailed Description

helper to convert from CaloCellContainer to CaloCompactCellContainer and back

Author
Sven Menke

Definition at line 28 of file CaloCompactCellTool.h.

Member Enumeration Documentation

◆ KNOWN_VERSIONS

Enumerator
VERSION_400 
VERSION_500 
VERSION_501 
VERSION_502 
VERSION_503 
VERSION_504 
VERSION_LATEST 

Definition at line 31 of file CaloCompactCellTool.h.

Constructor & Destructor Documentation

◆ CaloCompactCellTool()

CaloCompactCellTool::CaloCompactCellTool ( )

Definition at line 28 of file CaloCompactCellTool.cxx.

28{}

Member Function Documentation

◆ getCubRootCompact()

int CaloCompactCellTool::getCubRootCompact ( const double & x,
const double & cbrt_x1,
const int & n )
inlineprivate

Definition at line 88 of file CaloCompactCellTool.h.

90 {
91 int result = 0;
92 double cbrt_x=cbrt(x);
93 if ( cbrt_x >= cbrt_x1 ) {
94 result = (1<<n)-1;
95 } else {
96 int nmax=1<<n;
97 result = (int)(cbrt_x/cbrt_x1*nmax);
98 }
99 return result;
100}
const int nmax(200)
#define x

◆ getLogCompact()

int CaloCompactCellTool::getLogCompact ( const double & x,
const double & log_x0,
const double & log_x1,
const int & n )
inlineprivate

Definition at line 69 of file CaloCompactCellTool.h.

73{
74 int result = 0;
75 if ( x > 0 ) {
76 double log_x = log(x);
77 if ( log_x >= log_x1 ) {
78 result = (1<<n)-1;
79 }
80 else if ( log_x > log_x0 ) {
81 int nmax=1<<n;
82 result = (int)((log_x - log_x0)/(log_x1 - log_x0)*nmax);
83 }
84 }
85 return result;
86}

◆ getPersistent()

StatusCode CaloCompactCellTool::getPersistent ( const CaloCellContainer & theCellContainer,
CaloCompactCellContainer * theCompactContainer,
const SG::ThinningDecisionBase * dec,
int theVersion = VERSION_LATEST )

Definition at line 66 of file CaloCompactCellTool.cxx.

71{
72 //ATH_MSG_DEBUG( "CaloCell container contains " << theCellContainer.size() << " cells. Write compact Ver: " << theVersion );
73
74 if (theVersion == VERSION_LATEST)
75 theVersion = VERSION_504;
76
77 switch (theVersion ) {
78
79 case VERSION_400:
80 case VERSION_500:
81 case VERSION_501:
82 case VERSION_502:
83 case VERSION_503:
84 case VERSION_504:
85 {
86 CaloCellPacker_400_500 packer;
87
88 packer.pack (theCellContainer, *theCompactContainer, dec, theVersion);
89 }
90 break;
91
92 default:
93 MsgStream msg(Athena::getMessageSvc(), "CaloCompactCellTool");
94 msg << " unknown version " << theVersion
95 << " requested for packing the CaloCellContainer" << endmsg;
96 return StatusCode::FAILURE;
97 }
98 return StatusCode::SUCCESS;
99}
#define endmsg
void pack(const CaloCellContainer &cells, CaloCompactCellContainer &packed, const SG::ThinningDecisionBase *dec, int version) const
Pack cells.
IMessageSvc * getMessageSvc(bool quiet=false)
MsgStream & msg
Definition testRead.cxx:32

◆ getTransient()

StatusCode CaloCompactCellTool::getTransient ( const CaloCompactCellContainer & theCompactContainer,
CaloCellContainer * theCellContainer )

Definition at line 30 of file CaloCompactCellTool.cxx.

33{
34 const std::vector<CaloCompactCellContainer::value_type> theHeader = theCompactContainer.getHeader();
35 //ATH_MSG_DEBUG( " getTransient: using version: "<<theHeader[1] );
36
37 DataPool<LArCell> larCellsP(220000);//initialize for the default value will resize latter to full size
38 DataPool<TileCell> tileCellsP(13000);
39
40 switch (theHeader[1]) {
41
42 case VERSION_400:
43 case VERSION_500:
44 case VERSION_501:
45 case VERSION_502:
46 case VERSION_503:
47 case VERSION_504:
48 {
49 CaloCellPacker_400_500 packer;
50 packer.unpack (theCompactContainer, theHeader, *theCellContainer,
51 larCellsP, tileCellsP);
52 }
53 break;
54
55 default:
56 MsgStream msg(Athena::getMessageSvc(), "CaloCompactCellTool");
57 msg << " unknown version " << theHeader[1]
58 << " requested for unpacking the CaloCompactCellContainer" << endmsg;
59 return StatusCode::FAILURE;
60 }
61
62 return StatusCode::SUCCESS;
63}
void unpack(const CaloCompactCellContainer &packed, const std::vector< CaloCompactCellContainer::value_type > &vheader, CaloCellContainer &cells, DataPool< LArCell > &larpool, DataPool< TileCell > &tilepool) const
Unpack cells.
const std::vector< value_type > getHeader() const
returns header portion of the compact cell container

◆ unpackCubRoot()

double CaloCompactCellTool::unpackCubRoot ( const int & cbrt_x,
const double & cbrt_x1,
const int & n )
inlineprivate

Definition at line 114 of file CaloCompactCellTool.h.

116 {
117 double result = 0;
118 if ( cbrt_x > 0 ) {
119 int nmax=1<<n;
120 double r = (cbrt_x+0.5)*cbrt_x1/nmax;
121 result =r*r*r;
122 }
123 return result;
124}
int r
Definition globals.cxx:22

◆ unpackLog()

double CaloCompactCellTool::unpackLog ( const int & log_x,
const double & log_x0,
const double & log_x1,
const int & n )
inlineprivate

Definition at line 102 of file CaloCompactCellTool.h.

105 {
106 double result = 0;
107 if ( log_x > 0 ) {
108 int nmax=1<<n;
109 result = exp((log_x+0.5)*(log_x1-log_x0)/nmax+log_x0);
110 }
111 return result;
112}

The documentation for this class was generated from the following files: