ATLAS Offline Software
Loading...
Searching...
No Matches
caloCellLookup.cxx File Reference

Command-line utility to decode a calorimeter cell hash. More...

#include "CaloIdentifier/CaloHelpersTest.h"
#include "CxxUtils/checker_macros.h"
#include <cstdlib>
#include <iostream>
#include <memory>
Include dependency graph for caloCellLookup.cxx:

Go to the source code of this file.

Functions

int main ATLAS_NOT_THREAD_SAFE (int argc, char **argv)

Detailed Description

Command-line utility to decode a calorimeter cell hash.

Author
scott snyder
Date
Apr 2020

Definition in file caloCellLookup.cxx.

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

int main ATLAS_NOT_THREAD_SAFE ( int argc,
char ** argv )

Definition at line 19 of file caloCellLookup.cxx.

20{
21 std::unique_ptr<CaloHelpersTest> helpers;
22 try {
23 helpers = std::make_unique<CaloHelpersTest>();
24
25 const CaloCell_ID& caloID = helpers->caloID();
26
27 for (int i=1; i < argc; i++) {
28 int hash = atoi (argv[i]);
29 Identifier id = caloID.cell_id (hash);
30 std::cout << hash << " " << id << " ";
31 int subcalo = caloID.sub_calo (hash);
32 switch (subcalo) {
34 std::cout << "LAREM " <<
35 "BEC: " << helpers->emID().barrel_ec(id) << " "
36 "Samp: " << helpers->emID().sampling(id) << " "
37 "Reg: " << helpers->emID().region(id) << " "
38 "Eta: " << helpers->emID().eta(id) << " "
39 "Phi: " << helpers->emID().phi(id) << " "
40 "SC: " << helpers->emID().is_supercell(id) << std::endl;
41 break;
43 std::cout << "LARHEC " <<
44 "P/N: " << helpers->hecID().pos_neg(id) << " "
45 "Samp: " << helpers->hecID().sampling(id) << " "
46 "Reg: " << helpers->hecID().region(id) << " "
47 "Eta: " << helpers->hecID().eta(id) << " "
48 "Phi: " << helpers->hecID().phi(id) << " "
49 "SC: " << helpers->hecID().is_supercell(id) << std::endl;
50 break;
52 std::cout << "LARFCAL " <<
53 "P/N: " << helpers->fcalID().pos_neg(id) << " "
54 "Mod: " << helpers->fcalID().module(id) << " "
55 "Eta: " << helpers->fcalID().eta(id) << " "
56 "Phi: " << helpers->fcalID().phi(id) << " "
57 "SC: " << helpers->fcalID().is_supercell(id) << std::endl;
58 break;
60 std::cout << "TILE " <<
61 "Reg: " << helpers->tileID().region(id) << " "
62 "Syst: " << helpers->tileID().system(id) << " "
63 "Sect: " << helpers->tileID().section(id) << " "
64 "Side: " << helpers->tileID().side(id) << " "
65 "Mod: " << helpers->tileID().module(id) << " "
66 "Tow: " << helpers->tileID().tower(id) << " "
67 "Samp: " << helpers->tileID().sample(id) << " "
68 "PMT: " << helpers->tileID().pmt(id) << std::endl;
69 break;
71 std::cout << "LARMINIFCAL "
72 "P/N: " << helpers->minifcalID().pos_neg(id) << " "
73 "Mod: " << helpers->minifcalID().module(id) << " "
74 "Dep: " << helpers->minifcalID().depth(id) << " "
75 "Eta: " << helpers->minifcalID().eta(id) << " "
76 "Phi: " << helpers->minifcalID().phi(id) << std::endl;
77 break;
78 default:
79 std::cout << "UNKNOWN ";
80 }
81 }
82 }
83 catch (const LArID_Exception& e) {
84 std::cerr << "Caught exception: " << std::string(e) << "\n";
85 return 1;
86 }
87 catch (const std::exception& e) {
88 std::cerr << "Caught exception: " << e.what() << "\n";
89 return 1;
90 }
91 return 0;
92}
int sub_calo(const Identifier id) const
returns an int taken from SUBCALO enum and describing the subCalo to which the Id belongs.
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,...
Helper class for offline cell identifiers.
Definition CaloCell_ID.h:34
Exception class for LAr Identifiers.
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...