ATLAS Offline Software
Public Member Functions | Private Types | Private Attributes | List of all members
CaloCellVolumes Class Reference

#include <CaloCellVolumes.h>

Collaboration diagram for CaloCellVolumes:

Public Member Functions

 CaloCellVolumes (ISvcLocator *svcLocator, const CaloCell_ID *calocell_id)
 
 ~CaloCellVolumes ()
 
double CellVolume (Identifier cell_id)
 
const std::string & layout ()
 
double getFcalTubeSpacing (int sampling)
 
void print ()
 

Private Types

typedef std::map< int, double > TubeSpacingMap
 

Private Attributes

const CaloCell_IDm_calocell_id {nullptr}
 
CaloCellVolumeVector m_cellVolumes
 
std::string m_geometryLayout
 
TubeSpacingMap m_fcalTubeSpacings
 

Detailed Description

Definition at line 24 of file CaloCellVolumes.h.

Member Typedef Documentation

◆ TubeSpacingMap

typedef std::map<int, double> CaloCellVolumes::TubeSpacingMap
private

Definition at line 45 of file CaloCellVolumes.h.

Constructor & Destructor Documentation

◆ CaloCellVolumes()

CaloCellVolumes::CaloCellVolumes ( ISvcLocator *  svcLocator,
const CaloCell_ID calocell_id 
)

Definition at line 32 of file CaloCellVolumes.cxx.

34  : m_calocell_id(calocell_id)
35 {
36  // Retrieve input parameters from the database
37  SmartIF<IGeoModelSvc> geoModel{svcLocator->service("GeoModelSvc")};
38  if(!geoModel)
39  throw std::runtime_error("CellVolumes error: cannot access GeoModelSvc");
40 
41  SmartIF<IGeoDbTagSvc> geoDbTagSvc{svcLocator->service("GeoDbTagSvc")};
42  if(!geoDbTagSvc)
43  throw std::runtime_error("CellVolumes error: cannot access GeoDbTagSvc");
44 
45  SmartIF<IRDBAccessSvc> rdbAccess{svcLocator->service(geoDbTagSvc->getParamSvcName())};
46  if(!rdbAccess)
47  throw std::runtime_error("CellVolumes error: cannot access RDBAccessSvc");
48 
49  std::string larKey, larNode;
50  if(geoDbTagSvc->getSqliteReader()==nullptr) {
51  DecodeVersionKey detectorKey = DecodeVersionKey(geoModel,"LAr");
52  larKey = detectorKey.tag();
53  larNode = detectorKey.node();
54  }
55 
56  IRDBRecordset_ptr cellVolRec = rdbAccess->getRecordsetPtr("LArCellVolumes",larKey,larNode);
57  if(cellVolRec->size()==0) {
58  cellVolRec = rdbAccess->getRecordsetPtr("LArCellVolumes","LArCellVolumes-00");
59  if(cellVolRec->size()==0) {
60  throw std::runtime_error("CaloCellVolumes error: 0 size of LArCellVolumes recordset");
61  }
62  }
63 
64  // get fcal tube spacings
65  IRDBRecordset_ptr fcalModRec = rdbAccess->getRecordsetPtr("FCalMod",larKey,larNode);
66  if(fcalModRec->size()==0) {
67  fcalModRec = rdbAccess->getRecordsetPtr("FCalMod","FCalMod-00");
68  if(fcalModRec->size()==0) {
69  throw std::runtime_error("CaloCellVolumes error: 0 size of FCalMod recordset");
70  }
71  }
72 
73  for(const IRDBRecord_ptr& rec : *fcalModRec) {
74  m_fcalTubeSpacings[rec->getInt("FCALSAMPLING")] = rec->getDouble("TUBESPACING");
75  }
76 
77  m_geometryLayout = "Atlas";
78  if(geoDbTagSvc->getSqliteReader()==nullptr) {
79  std::string LArTag = rdbAccess->getChildTag("LAr",larKey,larNode);
80  if(LArTag.find("H8")!=std::string::npos) {
81  m_geometryLayout = "H8";
82  }
83  else if(LArTag.find("H6")!=std::string::npos) {
84  m_geometryLayout = "H6";
85  }
86  else if(LArTag.find("G3")!=std::string::npos) {
87  m_geometryLayout = "G3";
88  }
89  }
90 
91  // Initialize m_cellVolumes vector
92  for(const IRDBRecord_ptr& rec : *cellVolRec) {
93 
94  int subcalo = rec->getInt("SUBCALO");
95  int posneg = rec->getInt("POSNEG");
96  int sampling = rec->getInt("SAMPLING");
97  int region = rec->getInt("REGION");
98  int eta = rec->getInt("ETA");
99  int phi = rec->getInt("PHI");
100 
101  Identifier channelID;
102  if(m_geometryLayout != "H6" || subcalo == CaloCell_ID::LARFCAL) {
103  channelID = m_calocell_id->cell_id (subcalo, posneg, sampling, region, eta, phi);
104  }
105  else {
106  Identifier reg_id = m_calocell_id->region_id(subcalo, posneg, sampling, region);
107  int phimin = m_calocell_id->phi_min(reg_id);
108  channelID = m_calocell_id->cell_id (subcalo, posneg, sampling, region, eta, phimin);
109  }
110 
111  CaloCellVolume cellVol;
112  cellVol.channelID = channelID;
113  cellVol.volume = rec->getDouble("VOLUME");
114  m_cellVolumes.push_back(cellVol);
115  }
116 
117  if (m_cellVolumes.empty()) {
118  throw std::runtime_error("CaloCellVolumes error: 0 volumes have been built!");
119  }
120 
121  std::sort (m_cellVolumes.begin(), m_cellVolumes.end(),
123 }

◆ ~CaloCellVolumes()

CaloCellVolumes::~CaloCellVolumes ( )

Definition at line 125 of file CaloCellVolumes.cxx.

126 {
127  m_cellVolumes.clear();
128 }

Member Function Documentation

◆ CellVolume()

double CaloCellVolumes::CellVolume ( Identifier  cell_id)

Definition at line 130 of file CaloCellVolumes.cxx.

131 {
132  // compute Identifier of Cell with same eta, but phi=0 and pos side
133  // (except for fcal)
134  Identifier volId;
135 
136  if (!m_calocell_id->is_fcal(cell_id)) {
137  int subCalo = m_calocell_id->sub_calo(cell_id);
138  int posneg = std::abs (m_calocell_id->pos_neg(cell_id));
139  int sampling = m_calocell_id->sampling(cell_id);
140  int region = m_calocell_id->region(cell_id);
141  int eta = m_calocell_id->eta(cell_id);
142 
143  if(m_geometryLayout != "H6") {
144  volId = m_calocell_id->cell_id(subCalo, posneg, sampling, region, eta, 0);
145  }
146  else {
147  Identifier reg_id = m_calocell_id->region_id(subCalo, posneg, sampling, region);
148  int phimin = m_calocell_id->phi_min(reg_id);
149  volId = m_calocell_id->cell_id(subCalo, posneg, sampling, region, eta, phimin);
150  }
151  }
152  else {
153  volId = cell_id;
154  }
155 
156  CaloCellVolumeVector::const_iterator it =
157  std::lower_bound (m_cellVolumes.begin(), m_cellVolumes.end(), volId,
159  if (it != m_cellVolumes.end() && it->channelID == volId) return it->volume;
160 
161  return 0.;
162 }

◆ getFcalTubeSpacing()

double CaloCellVolumes::getFcalTubeSpacing ( int  sampling)

Definition at line 181 of file CaloCellVolumes.cxx.

182 {
183  TubeSpacingMap::const_iterator it = m_fcalTubeSpacings.find(sampling);
184  if(it==m_fcalTubeSpacings.end())
185  throw std::runtime_error("CaloCellVolumes::getFcalTubeSpacing error: wrong sampling provided");
186 
187  return (*it).second;
188 }

◆ layout()

const std::string& CaloCellVolumes::layout ( )
inline

Definition at line 32 of file CaloCellVolumes.h.

32 { return m_geometryLayout; }

◆ print()

void CaloCellVolumes::print ( )

Definition at line 164 of file CaloCellVolumes.cxx.

165 {
166  if (m_cellVolumes.empty()) {
167  std::cerr << "CaloCellVolumes::print(). No cell volumes..." << std::endl;
168  }
169  else {
170  std::cout << "CaloCellVolumes::print(). Number of volumes found: "
171  << m_cellVolumes.size() << std::endl;
172 
173  for(const CaloCellVolume& vol : m_cellVolumes) {
174  m_calocell_id->print( (Identifier) vol.channelID );
175  std::cout << m_calocell_id->show_to_string( (Identifier) vol.channelID );
176  std::cout << " ==> vol= " << vol.volume << " mm3" << std::endl;
177  }
178  }
179 }

Member Data Documentation

◆ m_calocell_id

const CaloCell_ID* CaloCellVolumes::m_calocell_id {nullptr}
private

Definition at line 40 of file CaloCellVolumes.h.

◆ m_cellVolumes

CaloCellVolumeVector CaloCellVolumes::m_cellVolumes
private

Definition at line 41 of file CaloCellVolumes.h.

◆ m_fcalTubeSpacings

TubeSpacingMap CaloCellVolumes::m_fcalTubeSpacings
private
Initial value:
{
{1, 7.5}
, {2, 8.179}
, {3, 9.}
}

Definition at line 46 of file CaloCellVolumes.h.

◆ m_geometryLayout

std::string CaloCellVolumes::m_geometryLayout
private

Definition at line 42 of file CaloCellVolumes.h.


The documentation for this class was generated from the following files:
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition: CaloCell_Base_ID.h:46
CaloCellVolume::volume
float volume
Definition: CaloCellVolumes.h:19
CaloCell_Base_ID::region
int region(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
CaloCell_Base_ID::phi_min
int phi_min(const Identifier regId) const
min value of phi index (-999 == failure)
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
CaloCell_Base_ID::pos_neg
int pos_neg(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
CaloCell_Base_ID::region_id
Identifier region_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy) const
Make a region ID from constituting fields and subCalo index; for (Mini)FCAL and Tiles,...
skel.it
it
Definition: skel.GENtoEVGEN.py:396
DecodeVersionKey::node
const std::string & node() const
Return the version node.
Definition: DecodeVersionKey.cxx:97
CaloCellVolume::channelID
Identifier channelID
Definition: CaloCellVolumes.h:18
CaloCellVolume_Compare
Definition: CaloCellVolumes.cxx:24
CaloCellVolumes::m_cellVolumes
CaloCellVolumeVector m_cellVolumes
Definition: CaloCellVolumes.h:41
CaloCellVolumes::m_fcalTubeSpacings
TubeSpacingMap m_fcalTubeSpacings
Definition: CaloCellVolumes.h:46
CaloCell_Base_ID::is_fcal
bool is_fcal(const Identifier id) const
test if the id belongs to the FCAL - true also for MiniFCAL
CaloCell_Base_ID::sampling
int sampling(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
DecodeVersionKey
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
Definition: DecodeVersionKey.h:18
DecodeVersionKey::tag
const std::string & tag() const
Return version tag.
Definition: DecodeVersionKey.cxx:91
CaloCell_Base_ID::eta
int eta(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
CaloCell_Base_ID::sub_calo
int sub_calo(const Identifier id) const
returns an int taken from SUBCALO enum and describing the subCalo to which the Id belongs.
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
CaloCell_Base_ID::cell_id
Identifier cell_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy, const int eta, const int phi) const
Make a cell (== channel) ID from constituting fields and subCalo index; for (Mini)FCAL,...
AtlasDetectorID::print
void print(Identifier id, const IdContext *context=0) const
Expanded print out of any identifier.
Definition: AtlasDetectorID.cxx:648
AtlasDetectorID::show_to_string
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:574
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
IRDBRecord_ptr
std::unique_ptr< IRDBRecord > IRDBRecord_ptr
Definition: IRDBRecordset.h:23
CaloCellVolumes::m_calocell_id
const CaloCell_ID * m_calocell_id
Definition: CaloCellVolumes.h:40
CaloCellVolumes::m_geometryLayout
std::string m_geometryLayout
Definition: CaloCellVolumes.h:42
CaloCellVolume
Definition: CaloCellVolumes.h:17
Identifier
Definition: IdentifierFieldParser.cxx:14