![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
6 #include "CLHEP/Units/SystemOfUnits.h"
8 #include "GaudiKernel/AlgTool.h"
10 #include "Gaudi/Property.h"
11 #include "GaudiKernel/Service.h"
12 #include "GaudiKernel/IToolSvc.h"
21 #include "CaloEvent/CaloTower.h"
22 #include "CaloEvent/CaloTowerContainer.h"
28 #include "CaloEvent/CaloCluster.h"
36 const std::string&
type,
41 declareInterface<ICaloTopoTowerBuilderToolBase>(
this);
58 return StatusCode::SUCCESS;
76 if (!towerContainer || !
clusters || !Cells) {
77 msg(MSG::WARNING) <<
" Missing input container : ";
78 if (!towerContainer)
msg(MSG::WARNING) <<
" no tower ";
79 if (!
clusters)
msg(MSG::WARNING) <<
" no TopoClusters ";
80 if (!Cells)
msg(MSG::WARNING) <<
" no Cells ";
81 msg(MSG::WARNING) <<
" .. no CaloTopoTowers are made " <<
endmsg;
82 return StatusCode::SUCCESS;
88 bool delete_cellToClusterMap=
false;
89 if(cellToClusterMap==
nullptr ){
91 delete_cellToClusterMap=
true;
102 ATH_MSG_DEBUG(
"Energy cuts " << minimumCellEnergy <<
" " << minimumClusterEnergy <<
" " << useCellWeights);
108 ATH_MSG_DEBUG(
"Noise cuts "<< noiseSigma0 <<
" " << cellESignificanceThreshold);
111 std::vector<CaloCell_ID::SUBCALO> caloIndices = theTowers->
GetCaloIndices();
114 ATH_MSG_DEBUG(
"caloSelection " << caloSelection <<
" " << caloIndices.size());
122 ATH_MSG_DEBUG(
"Starting loop over Navigable CaloCell2ClusterMap");
123 while ( clusterContainer ==
nullptr && fClusMap != lClusMap ){
131 const nav_t* pNav = (*fClusMap);
133 ATH_MSG_DEBUG(
"Successfully picked up CaloClusterContainer ");
139 if ( clusterContainer ==
nullptr ) {
140 if (!Cells->
empty() ) {
141 ATH_MSG_WARNING(
"No cluster found from CaloCell2ClusterMap, tool unusable" );
147 if(delete_cellToClusterMap){
149 delete cellToClusterMap;
153 return StatusCode::SUCCESS;
165 for (
const CaloTower* tower : *towerContainer)
167 int towerIndex = towerContainer->getTowerIndex(tower);
172 ATH_MSG_VERBOSE(
"In loop over tower grid: tower eta-phi" << tower->eta() <<
" " << tower->phi());
177 double energyTower = 0.0;
178 double totalAttachedClusterEnergy = 0.0;
179 int numberOfCellsInTower = 0;
180 int numberOfAttachedCellsInTower = 0;
181 int numberOfClustersInTower = 0;
182 int totalNumberOfCellsInAttachedClusters = 0;
185 for ( ; cellInTowerIter != lastCellInTower; cellInTowerIter++ ){
186 numberOfCellsInTower++;
190 double signedE = 0.0;
191 double weight = tower->getCellWeight(cellInTowerIter);
196 size_t globalIndex=0;
197 if (!(tower->getCellIndex(
cell,globalIndex)) ) {
204 std::vector<CaloCell_ID::SUBCALO>::const_iterator theFound =
205 find (caloIndices.begin(),caloIndices.end(),iCaloNum);
206 if (theFound==caloIndices.end()) continue ;
210 if (!useCellWeights)
weight = 1.0;
211 double cellEnergy =
weight * signedE;
216 float noiseSigma = 1.0;
217 if (cellESignificanceThreshold>=0.) {
218 noiseSigma = noiseSigma0;
219 if ( noiseSigma > 0. ) signedRatio = signedE/noiseSigma;
228 if ( (signedE > minimumCellEnergy) && ( fabs(signedRatio) > cellESignificanceThreshold) ){
230 size_t cellIndex(
cell->caloDDE()->calo_hash());
231 ATH_MSG_VERBOSE(
"Cell index from CaloCell2ClusterMap = " << cellIndex);
232 const nav_t* nav = (cellToClusterMap->operator[])(cellIndex);
243 for ( ; clusterIterator != lastCluster; clusterIterator++ ){
244 const CaloCluster* clusterFromCell = (*clusterIterator);
246 double eClus = clusterFromCell->
energy();
251 if ( eClusRaw > minimumClusterEnergy ){
254 numberOfAttachedCellsInTower++;
255 totalNumberOfCellsInAttachedClusters += clusterFromCell->
getNumberOfCells();
256 totalAttachedClusterEnergy += eClusRaw;
257 energyTower += cellEnergy;
258 numberOfClustersInTower++;
263 ATH_MSG_VERBOSE(
" -- Found at least one cluster passing cuts. 'break'");
275 newTower->
setE(energyTower);
280 ATH_MSG_VERBOSE(
"Old/ new TopoTower energy from all cells = " << tower->e() <<
" " << newTower->
e() );
281 ATH_MSG_VERBOSE(
"TopoTower energy adding all cells in clusters = " << energyTower );
282 ATH_MSG_VERBOSE(
"Total attached cluster energy = " << totalAttachedClusterEnergy );
283 ATH_MSG_VERBOSE(
"Total number of attached clusters = " << numberOfClustersInTower );
284 ATH_MSG_VERBOSE(
"Number of cells in attached clusters = " << totalNumberOfCellsInAttachedClusters );
285 ATH_MSG_VERBOSE(
"Total number of cells originally in tower = " << numberOfCellsInTower );
286 ATH_MSG_VERBOSE(
"Total number of cells from clusters = " << numberOfAttachedCellsInTower );
291 for ( ; cellInTowerIter != lastCellInTower; cellInTowerIter++ ) {
292 double weight = tower->getCellWeight(cellInTowerIter);
301 if(delete_cellToClusterMap){
303 delete cellToClusterMap;
308 return StatusCode::SUCCESS;
320 return StatusCode::SUCCESS;
333 cell2ClusterMap->
resize(maxRange);
335 ATH_MSG_DEBUG(
"CaloCluster container contains " << clusColl->
size() <<
" clusters");
340 if ((clust->getNumberOfCells()) == 0 ) {
341 ATH_MSG_DEBUG(
" no cells for this cluster... No reverse navigation possible...");
346 for( ;cellIter!=cellIterEnd;cellIter++) {
356 (*cell2ClusterMap)[myHashId] = theNav;
366 return cell2ClusterMap;
cell_iterator cell_begin() const
Retrieve a STL-type begin() iterator for the cell store.
DataLink< CaloClusterContainer > GetClusters() const
def retrieve(aClass, aKey=None)
map of CaloCluster objects each CaloCell belongs to
CaloTower * getTower(index_t eta, index_t phi)
Returns a pointer to a tower with given indices.
Const iterator class for DataVector/DataList.
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
cell_iterator cell_end() const
Retrieve a STL-type end() iterator for the cell store.
std::string find(const std::string &s)
return a remapped string
void putElement(const CONT *objectContainer, const constituent_type *constituentObject, const RPAR &objectParameter=RPAR(), size_t sizeHint=0)
Storable container for CaloCluster.
virtual object_iter begin() const
bool msgLvl(const MSG::Level lvl) const
virtual double getBasicEnergy() const
Access basic energy scale signal.
#define ATH_MSG_VERBOSE(x)
#define IOVSVC_CALLBACK_ARGS
short hand for IOVSvc call back argument list, to be used when no access to formal arguments is neede...
void addUniqueCellNoKine(const CaloCellContainer *theContainer, index_type theIndex, double weight, size_t size_hint=0)
Add a cell (very fast)
unsigned int getNumberOfCells() const
Return the number of cells in the store.
DataLink< CaloCellContainer > GetCells() const
virtual object_iter end() const
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual double energy() const
Return energy.
bool GetCaloSelection() const
CaloCompositeCellBase< CaloClusterNavigable >::cell_iterator cell_iterator
Iterator on CaloCell s.
Storable container class for CaloTower.
CaloEnergyCluster::cell_iterator cell_iterator
Iterator on CaloCell s.
bool GetUseCellWeights() const
::StatusCode StatusCode
StatusCode definition for legacy code.
double GetMinimumClusterEnergy() const
SUBCALO
enumeration of sub calorimeters
Storable container class for CaloTower.
Principal data class for CaloCell clusters.
CaloPhiRange class declaration.
float GetNoiseSigma() const
Data class for calorimeter cell towers.
virtual double e() const override final
get energy data member
void resize(size_type sz)
Resizes the collection to the specified number of elements.
const CONT * getContainer(const constituent_type *aConstituent) const
Container class for CaloCell.
std::vector< CaloCell_ID::SUBCALO > GetCaloIndices() const
Navigable template generalization to handle navigation.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
virtual unsigned int size() const
Data object for each calorimeter readout cell.
#define ATH_MSG_WARNING(x)
DataLink< CaloTowerContainer > GetTowers() const
double GetMinimumCellEnergy() const
virtual void setE(double theE)
set energy data member
const CaloCell2ClusterMap * GetCellToClusterMap() const
IDENTIFIER_TYPE size_type
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
float GetCellESignificanceThreshold() const
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type calo_cell_hash_max(void) const
cell 'global' hash table max size