CbmRoot
Loading...
Searching...
No Matches
CbmRichGeoHandler.h
Go to the documentation of this file.
1/* Copyright (C) 2015-2024 GSI/JINR-LIT, Darmstadt/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Semen Lebedev, Martin Beyer, Andrey Lebedev [committer], Florian Uhlig */
4
13
14#pragma once
15
16#include "CbmRichDetectorData.h"
17
18#include <RtypesCore.h>
19#include <TString.h>
20
21#include <iostream>
22#include <map>
23#include <vector>
24
26 enum class CbmRichGeoSetup
27 {
30 };
31
32 private:
35
36 public:
38 virtual ~CbmRichGeoHandler() = default;
39
42
45
48 {
49 static CbmRichGeoHandler instance;
50 return instance;
51 }
52
54 std::vector<Int_t> GetPixelAddresses() { return fPixelAddresses; }
55
57 Int_t GetPixelAddressByPath(const std::string& path);
58
61
64
66 std::vector<Int_t> GetPmtIds() { return fPmtIds; }
67
70
79 std::vector<Int_t> GetNeighbourPixels(Int_t address, Int_t N, Bool_t horizontal = true, Bool_t vertical = true,
80 Bool_t diagonal = true);
81
86 std::vector<Int_t> GetDirectNeighbourPixels(Int_t address, Bool_t horizontal = true, Bool_t vertical = true)
87 {
88 return GetNeighbourPixels(address, 1, horizontal, vertical, false);
89 }
90
95 std::vector<Int_t> GetDiagonalNeighbourPixels(Int_t address)
96 {
97 return GetNeighbourPixels(address, 1, false, false, true);
98 }
99
108 std::vector<Int_t> GetNxNNeighbourPixels(Int_t address, Int_t n)
109 {
110 return GetNeighbourPixels(address, n, true, true, true);
111 }
112
113 private:
114 bool fFallback{false}; // Fallback mode for deriving CBM RICH addresses
115
116 std::map<std::string, Int_t> fPixelPathToAddress{};
117 std::map<Int_t, std::unique_ptr<CbmRichPixelData>> fPixelAddressToData{};
118 std::vector<Int_t> fPixelAddresses{};
119
120 std::map<std::string, Int_t> fPmtPathToId{};
121 std::map<Int_t, std::unique_ptr<CbmRichPmtData>> fPmtIdToData{};
122 std::vector<Int_t> fPmtIds{};
123
127 void Init();
128
133 CbmRichGeoSetup GetDetectorSetup(const TString& nodePath)
134 {
135 return nodePath.Contains("mcbm") ? CbmRichGeoSetup::MiniRich : CbmRichGeoSetup::Rich;
136 }
137
143 Int_t CreateAddressRich(const std::string& nodePath, Int_t& channelAddr, Int_t& pmtId);
144
150 Int_t CreateAddressMiniRich(const std::string& nodePath, Int_t& channelAddr, Int_t& pmtId);
151};
int Int_t
bool Bool_t
std::vector< Int_t > GetDirectNeighbourPixels(Int_t address, Bool_t horizontal=true, Bool_t vertical=true)
Return the addresses of the direct neighbour pixels.
Int_t CreateAddressRich(const std::string &nodePath, Int_t &channelAddr, Int_t &pmtId)
Create channel address & pmt Id from node path for RICH.
CbmRichGeoHandler(const CbmRichGeoHandler &)=delete
CbmRichGeoHandler & operator=(const CbmRichGeoHandler &)=delete
std::vector< Int_t > fPmtIds
std::vector< Int_t > GetDiagonalNeighbourPixels(Int_t address)
Return the addresses of the diagonal neighbour pixels.
CbmRichGeoSetup GetDetectorSetup(const TString &nodePath)
Identify detector setup (RICH or mRICH) by node path.
CbmRichPmtData * GetPmtDataById(Int_t id)
Int_t CreateAddressMiniRich(const std::string &nodePath, Int_t &channelAddr, Int_t &pmtId)
Create channel address & pmt Id from node path for mRICH.
std::vector< Int_t > GetNeighbourPixels(Int_t address, Int_t N, Bool_t horizontal=true, Bool_t vertical=true, Bool_t diagonal=true)
Return the addresses of the neighbour pixels.
std::vector< Int_t > GetNxNNeighbourPixels(Int_t address, Int_t n)
Return the addresses of pixels in a (2n+1)*(2n+1) grid, with the address pixel in the center of the g...
std::vector< Int_t > GetPixelAddresses()
Int_t GetPixelAddressByPath(const std::string &path)
static CbmRichGeoHandler & GetInstance()
void Init()
Initialize maps.
CbmRichPixelData * GetPixelDataByAddress(Int_t address)
std::vector< Int_t > GetPmtIds()
std::vector< Int_t > fPixelAddresses
std::map< Int_t, std::unique_ptr< CbmRichPmtData > > fPmtIdToData
std::map< std::string, Int_t > fPmtPathToId
std::map< std::string, Int_t > fPixelPathToAddress
virtual ~CbmRichGeoHandler()=default
std::map< Int_t, std::unique_ptr< CbmRichPixelData > > fPixelAddressToData