PandaRoot
BSEmcFwEndcapDetIdToAlveoleMap.h
Go to the documentation of this file.
1 #ifndef BSEMCFWENDCAPDETIDTOALVEOLEMAP_HH
2 #define BSEMCFWENDCAPDETIDTOALVEOLEMAP_HH
3 
4 #include <map>
5 #include <vector>
6 
7 #include "TString.h"
8 
10  public:
12  Int_t fX{0}, fY{0}, fCrystal{-1};
13  };
14 
17  void SetFileName(const TString &t_filename)
18  {
19  fFilename = t_filename;
20  LoadMap();
21  }
22  BSEmcFwEndcapCrystal_t GetAlveoleId(const Int_t t_detectorId) const { return fDetIdToAlveole.at(t_detectorId); }
23  std::vector<Int_t> GetAlveoleCrystals(const Int_t t_xindex, const Int_t t_yindex) const { return GetAlveoleCrystals(ConvertToKey(t_xindex, t_yindex)); };
24  std::vector<Int_t> GetAlveoleCrystals(const TString t_key) const { return fAlveoleDetIds.at(t_key); }
25  std::vector<Int_t> GetAlveoleCrystals(const Int_t t_detectorId) const;
26 
27  TString ConvertToKey(const Int_t t_xindex, const Int_t t_yindex) const { return "X" + TString{std::to_string(t_xindex)} + "Y" + TString{std::to_string(t_yindex)}; }
28 
29  private:
30  void LoadMap();
31  std::map<Int_t, BSEmcFwEndcapCrystal_t> fDetIdToAlveole{};
32  std::map<TString, std::vector<Int_t>> fAlveoleDetIds{};
33  TString fFilename{"FwEndcapDetIdToAlveoleMap.txt"};
34  ClassDef(BSEmcFwEndcapDetIdToAlveoleMap, 1);
35 };
36 
37 #endif /*BSEMCFWENDCAPDETIDTOALVEOLEMAP_HH*/
std::vector< Int_t > GetAlveoleCrystals(const TString t_key) const
TString ConvertToKey(const Int_t t_xindex, const Int_t t_yindex) const
BSEmcFwEndcapCrystal_t GetAlveoleId(const Int_t t_detectorId) const
void SetFileName(const TString &t_filename)
std::vector< Int_t > GetAlveoleCrystals(const Int_t t_xindex, const Int_t t_yindex) const