ATLAS Offline Software
Loading...
Searching...
No Matches
CaloCompactCellTool.h
Go to the documentation of this file.
1//Dear emacs, this is -*-c++-*-
2/*
3 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
4*/
5
6#ifndef CALOTPCNV_CALOCOMPACTCELLTOOL_H
7#define CALOTPCNV_CALOCOMPACTCELLTOOL_H
8
14
18#include "CLHEP/Units/SystemOfUnits.h"
19
20#include <math.h>
21
22
23class IChronoStatSvc;
24namespace SG {
26}
27
29{
30 public:
38
39 // Select the latest version.
41 };
42
44
45 StatusCode getTransient(const CaloCompactCellContainer & theCompactContainer,
46 CaloCellContainer * theCellContainer);
47 // fills a CaloCellContainer ; caller has the responsibility
48 // of creating and deleting the object again
49
50 StatusCode getPersistent(const CaloCellContainer & theCellContainer,
51 CaloCompactCellContainer * theCompactContainer,
52 const SG::ThinningDecisionBase* dec,
53 int theVersion = VERSION_LATEST);
54 // fills a CaloCompactCellContainer ; caller has the responsibility
55 // of creating and deleting the object again
56
57 private:
58
59 int getLogCompact(const double & x, const double & log_x0, const double & log_x1, const int & n);
60
61 double unpackLog(const int & log_x, const double & log_x0, const double & log_x1, const int & n);
62
63 int getCubRootCompact(const double & x, const double & cbrt_x1, const int & n);
64
65 double unpackCubRoot(const int & cbrt_x, const double & cbrt_x1, const int & n);
66
67};
68
69inline int CaloCompactCellTool::getLogCompact(const double & x,
70 const double & log_x0,
71 const double & log_x1,
72 const int & n)
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}
87
88inline int CaloCompactCellTool::getCubRootCompact(const double & x,
89 const double & cbrt_x1,
90 const int & n){
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}
101
102inline double CaloCompactCellTool::unpackLog(const int & log_x,
103 const double & log_x0,
104 const double & log_x1,
105 const int & n){
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}
113
114inline double CaloCompactCellTool::unpackCubRoot(const int & cbrt_x,
115 const double & cbrt_x1,
116 const int & n){
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}
125
126
127#endif
128
const int nmax(200)
#define x
Container class for CaloCell.
container class for CaloCompactCell objects
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)
double unpackCubRoot(const int &cbrt_x, const double &cbrt_x1, const int &n)
int getCubRootCompact(const double &x, const double &cbrt_x1, const int &n)
StatusCode getPersistent(const CaloCellContainer &theCellContainer, CaloCompactCellContainer *theCompactContainer, const SG::ThinningDecisionBase *dec, int theVersion=VERSION_LATEST)
StatusCode getTransient(const CaloCompactCellContainer &theCompactContainer, CaloCellContainer *theCellContainer)
Hold thinning decisions for one container.
int r
Definition globals.cxx:22
Forward declaration.