From e08376add8e639b9f0cc473be341c901f3d04b21 Mon Sep 17 00:00:00 2001 From: scott snyder <sss@karma> Date: Sat, 2 May 2020 18:29:15 +0200 Subject: [PATCH] CaloIdentifier: Add command-line utility to translate cell hashes. Add a simple command-line utility to translate cell ID hashes into something readable. --- Calorimeter/CaloIdentifier/CMakeLists.txt | 5 ++ .../CaloIdentifier/utils/caloCellLookup.cxx | 79 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 Calorimeter/CaloIdentifier/utils/caloCellLookup.cxx diff --git a/Calorimeter/CaloIdentifier/CMakeLists.txt b/Calorimeter/CaloIdentifier/CMakeLists.txt index 1d748db4bca..9a645822a8b 100644 --- a/Calorimeter/CaloIdentifier/CMakeLists.txt +++ b/Calorimeter/CaloIdentifier/CMakeLists.txt @@ -59,6 +59,11 @@ atlas_add_executable( test_lvl1_id INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} CaloGeoHelpers AthenaKernel AtlasDetDescr IdDict Identifier GaudiKernel TestTools CxxUtils StoreGateLib SGtests IdDictParser PathResolver CaloIdentifier ) +atlas_add_executable( caloCellLookup + utils/caloCellLookup.cxx + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} CaloGeoHelpers AthenaKernel AtlasDetDescr IdDict Identifier GaudiKernel TestTools CxxUtils StoreGateLib SGtests IdDictParser PathResolver CaloIdentifier ) + #atlas_add_test( GTower_ID_test # SOURCES # test/GTower_ID_test.cxx diff --git a/Calorimeter/CaloIdentifier/utils/caloCellLookup.cxx b/Calorimeter/CaloIdentifier/utils/caloCellLookup.cxx new file mode 100644 index 00000000000..d2e2e6464a3 --- /dev/null +++ b/Calorimeter/CaloIdentifier/utils/caloCellLookup.cxx @@ -0,0 +1,79 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +/** + * @file CaloIdentifier/utils/caloCellLookup.cxx + * @author scott snyder + * @date Apr 2020 + * @brief Command-line utility to decode a calorimeter cell hash. + */ + + +#include "CaloIdentifier/CaloHelpersTest.h" +#include <cstdlib> +#include <iostream> + + +int main (int argc, char** argv) +{ + CaloHelpersTest helpers; + const CaloCell_ID& caloID = helpers.caloID(); + + for (int i=1; i < argc; i++) { + int hash = atoi (argv[i]); + Identifier id = caloID.cell_id (hash); + std::cout << hash << " " << id << " "; + int subcalo = caloID.sub_calo (hash); + switch (subcalo) { + case CaloCell_ID::LAREM: + std::cout << "LAREM " << + "BEC: " << helpers.emID().barrel_ec(id) << " " + "Samp: " << helpers.emID().sampling(id) << " " + "Reg: " << helpers.emID().region(id) << " " + "Eta: " << helpers.emID().eta(id) << " " + "Phi: " << helpers.emID().phi(id) << " " + "SC: " << helpers.emID().is_supercell(id) << std::endl; + break; + case CaloCell_ID::LARHEC: + std::cout << "LARHEC " << + "P/N: " << helpers.hecID().pos_neg(id) << " " + "Samp: " << helpers.hecID().sampling(id) << " " + "Reg: " << helpers.hecID().region(id) << " " + "Eta: " << helpers.hecID().eta(id) << " " + "Phi: " << helpers.hecID().phi(id) << " " + "SC: " << helpers.hecID().is_supercell(id) << std::endl; + break; + case CaloCell_ID::LARFCAL: + std::cout << "LARFCAL " << + "P/N: " << helpers.fcalID().pos_neg(id) << " " + "Mod: " << helpers.fcalID().module(id) << " " + "Eta: " << helpers.fcalID().eta(id) << " " + "Phi: " << helpers.fcalID().phi(id) << " " + "SC: " << helpers.fcalID().is_supercell(id) << std::endl; + break; + case CaloCell_ID::TILE: + std::cout << "TILE " << + "Reg: " << helpers.tileID().region(id) << " " + "Syst: " << helpers.tileID().system(id) << " " + "Sect: " << helpers.tileID().section(id) << " " + "Side: " << helpers.tileID().side(id) << " " + "Mod: " << helpers.tileID().module(id) << " " + "Tow: " << helpers.tileID().tower(id) << " " + "Samp: " << helpers.tileID().sample(id) << " " + "PMT: " << helpers.tileID().pmt(id) << std::endl; + break; + case CaloCell_ID::LARMINIFCAL: + std::cout << "LARMINIFCAL " + "P/N: " << helpers.minifcalID().pos_neg(id) << " " + "Mod: " << helpers.minifcalID().module(id) << " " + "Dep: " << helpers.minifcalID().depth(id) << " " + "Eta: " << helpers.minifcalID().eta(id) << " " + "Phi: " << helpers.minifcalID().phi(id) << std::endl; + break; + default: + std::cout << "UNKNOWN "; + } + } + + return 0; +} -- GitLab