1515#ifndef QC_MODULE_MID_DIGITSHELPER_H
1616#define QC_MODULE_MID_DIGITSHELPER_H
1717
18+ #include < array>
1819#include < memory>
1920#include < string>
2021#include < vector>
@@ -50,12 +51,26 @@ class DigitsHelper
5051 // / @return Histogram 2D
5152 TH2F makeStripMapHisto (std::string name, std::string title, int cathode) const ;
5253
54+ // / @brief Make 4 histograms with the 2D representation of the fired strips per chamber
55+ // / @param name Base histogram name
56+ // / @param title Base histogram title
57+ // / @param cathode Bending (0) or Non-bending (1) plane
58+ // / @return Array of unique pointer to histograms
59+ std::array<std::unique_ptr<TH2F >, 4 > makeStripMapHistos (std::string name, std::string title, int cathode) const ;
60+
5361 // / @brief Make the histogram with the 2D representation of the fired boards
5462 // / @param name Histogram name
5563 // / @param title Histogram title
5664 // / @return Histogram 2D
5765 TH2F makeBoardMapHisto (std::string name, std::string title) const ;
5866
67+ // / @brief Make 4 histograms with the 2D representation of the fired boards per chamber
68+ // / @param name Base histogram name
69+ // / @param title Base histogram title
70+ // / @param cathode Bending (0) or Non-bending (1) plane
71+ // / @return Array of unique pointer to histograms
72+ std::array<std::unique_ptr<TH2F >, 4 > makeBoardMapHistos (std::string name, std::string title) const ;
73+
5974 // / @brief Count the number of fired strips
6075 // / @param col Column Data
6176 // / @param cathode Bending (0) or Non-bending (1) plane
@@ -67,48 +82,52 @@ class DigitsHelper
6782 // / @param histo Pointer to the histogram
6883 void fillStripHisto (const o2::mid::ColumnData& col, TH1 * histo) const ;
6984
70- // / @brief Fill the 2D representation of the fired strips/boards from the 1D histogram
71- // / @param stripHisto Input 1D histogram
72- // / @param stripHistosB Array with the 2D representation of the fired strips in the bending plane per chamber
73- // / @param stripHistosNB Array with the 2D representation of the fired strips in the non-bending plane per chamber
74- // / @param boardHistos Array with the 2D representation of the fired boards per chamber. Last histogram is the sum of the previous four
75- void fillMapHistos (const TH1 * stripHisto, std::array<std::unique_ptr<TH2F >, 4 >& stripHistosB, std::array<std::unique_ptr<TH2F >, 4 >& stripHistosNB, std::array<std::unique_ptr<TH2F >, 5 >& boardHistos) const ;
85+ // / @brief Fill the 2D representation of the fired boards from the 1D strip histogram
86+ // / @param histo Input 1D histogram with fired strips
87+ // / @param histosB Array with the 2D representation of the fired boards per chamber. Last histogram is the sum of the previous four
88+ void fillBoardMapHistosFromStrips (const TH1 * histo, std::array<std::unique_ptr<TH2F >, 4 >& histosB, std::array<std::unique_ptr<TH2F >, 4 >& histosNB) const ;
7689
7790 // / @brief Fill the 2D representation of the fired strips from the 1D histogram
78- // / @param stripHisto Input 1D histogram
79- // / @param stripHistosB Array with the 2D representation of the fired strips in the bending plane per chamber
80- // / @param stripHistosNB Array with the 2D representation of the fired strips in the non-bending plane per chamber
81- void fillMapHistos (const TH1 * stripHisto, std::array<std::unique_ptr<TH2F >, 4 >& stripHistosB, std::array<std::unique_ptr<TH2F >, 4 >& stripHistosNB) const ;
82-
83- // / @brief Fill the 2D representation of the fired strips/boards from the 1D histogram for a specific chamber
84- // / @param stripHisto Input 1D histogram
85- // / @param stripHistosB 2D representation of the fired strips in the bending plane
86- // / @param stripHistosNB 2D representation of the fired strips in the non-bending plane
87- // / @param boardHistos 2D representation of the fired boards per chamber
88- // / @param chamber Selected chamber
89- void fillMapHistos (const TH1 * stripHisto, TH2 * stripHistosB, TH2 * stripHistosNB, TH2 * boardHistos, int chamber) const ;
90-
91- struct StripInfo {
92- int deId; // /< Detection element ID
93- int columnId; // /< Column ID
94- int lineId; // /< Line ID
95- int stripId; // /< Strip ID
96- int cathode; // /< Bending (0) or Non-bending (1) plane
97- int xwidth; // /< Width X
98- int ywidth; // /< Width y
91+ // / @param histo Input 1D histogram with fired strips
92+ // / @param histosB Array with the 2D representation of the fired strips in the bending plane per chamber
93+ // / @param histosNB Array with the 2D representation of the fired strips in the non-bending plane per chamber
94+ void fillStripMapHistos (const TH1 * histo, std::array<std::unique_ptr<TH2F >, 4 >& stripHistosB, std::array<std::unique_ptr<TH2F >, 4 >& stripHistosNB) const ;
95+
96+ struct MapInfo {
97+ int cathode = 0 ; // /! Cathode
98+ int chamber = 0 ; // /! Chamber
99+ std::vector<int > bins{}; // /! Bins in the 2D map histograms
99100 };
100101
101102 struct ColumnInfo {
102- int firstLine; // /< First line in column
103- int lastLine; // /< Last line in column
104- int nStripsNB; // /< Number of strips in the NB plane
103+ int firstLine; // /! First line in column
104+ int lastLine; // /! Last line in column
105+ int nStripsNB; // /! Number of strips in the NB plane
105106 };
106107
107108 private:
108- std::unordered_map<int , int > mStripsMap {}; // /! Map from id to index
109- std::vector<StripInfo> mStripsInfo ; // /! Strips info
109+ std::unordered_map<int , int > mStripsMap {}; // /! Strip id to strip idx
110+
111+ std::vector<MapInfo> mStripIdxToStripMap {}; // /! Strip index to strip map bins
112+ std::vector<MapInfo> mStripIdxToBoardMap {}; // /! Strip index to board map bins
113+
110114 std::array<ColumnInfo, 72 * 7 > mColumnInfo ; // /! Column info
111- void fillMapHistos (const StripInfo& info, TH2 * stripHistoB, TH2 * stripHistoNB, TH2 * boardHisto, int wgt) const ;
115+
116+ // / @brief Initializes inner maps
117+ void initMaps ();
118+
119+ // / @brief Fills one bin in a quick way
120+ // / @param ibin Bin to fill
121+ // / @param wgt Weight
122+ // / @param histo Histogram to fill
123+ void FillBin (TH1 * histo, int ibin, double wgt = 1 .) const ;
124+
125+ // / @brief Fill the 2D map histogram from the 1D histogram
126+ // / @param histo 1D histogram
127+ // / @param histoMapB 2D map histogram for the bending plane
128+ // / @param histoMapNB 2D map histogram for the non-bending plane
129+ // / @param infoMap Correspondence between histogram bins
130+ void fillMapHistos (const TH1 * histo, std::array<std::unique_ptr<TH2F >, 4 >& histoMapB, std::array<std::unique_ptr<TH2F >, 4 >& histoMapNB, const std::vector<MapInfo>& infoMap) const ;
112131
113132 inline int getColumnIdx (int columnId, int deId) const { return 7 * deId + columnId; }
114133};
0 commit comments