BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnNdetClusterFinder.h
Go to the documentation of this file.
1/** \file BmnNdetClusterFinder.h
2 ** \author Arseniy Shabanov <arseniy.shabanov@phystech.edu>
3 ** \date 19.01.2024
4 **/
5
6#ifndef BMNNDETCLUSTERFINDER_H
7#define BMNNDETCLUSTERFINDER_H
8
9#include "BmnNdetCluster.h"
10#include "TObject.h"
11
12#include <vector>
13
14using namespace std;
15
16/*! \class BmnNdetClusterFinder
17 * \brief Class for description of algorithm of recognition of clusters in Bmn Ndet detector
18 * \details BmnNdetClusterFinder must be run in the following order: \n
19 * -# create BmnNdetClusterFinder object
20 * -# initialize data with BmnNdetClusterFinder::Fill() method
21 * -# search for clusters with BmnNdetClusterFinder::FindClusters() method \n
22 * The recognized clusters can be obtained with BmnNdetClusterFinder::GetCluster() method
23 * \version 1.0
24 */
26{
27 public:
28 //! Flag if the cell belongs to any cluster
30 {
31 kIsNotUsed = 0, /*!< the cell doesn't belong to any cluster */
32 kIsUsed /*!< the cell belongs to some cluster */
33 };
34
35 //! Status of the cluster
37 {
38 kNoCluster = -1, /*!< there is no cluster */
39 kUnchecked = 0, /*!< the cluster is not checked yet */
40 kIsNeutron, /*!< the cluster is produced by neutron */
41 kNotNeutron /*!< the cluster can't be produced by neutron */
42 };
43
44 private:
45 //! Recognized clusters
46 vector<BmnNdetCluster*> fClusters;
47 //! Flag if cell belongs to some cluster
48 vector<eClusterStatus> fClusterStatus;
49
50 //! Number of fired cells in event
52 //! Number of recognized clusters
54 //! Number of cells not belonging to any cluster
56
57 //! Index of cells sorted by ascending time
58 vector<Int_t> fIndexTime;
59 //! Index of cells sorted by decending deposited energy
60 vector<Int_t> fIndexEdep;
61 //! Index of cells sorted by decending beta
62 vector<Int_t> fIndexBeta;
63
64 //! Flag if cell belongs to some cluster
65 vector<eCellStatus> fCellStatus;
66
67 //! Index of a cell in BmnNdetCell array in BmnNdetEvent object.
68 vector<Int_t> fCell;
69 //! Column index of a cell. It must be proportional to X coordinate in self coordinate system of a detector
70 vector<Int_t> fColumn;
71 //! Row index of a cell. It must be proportional to Y coordinate in self coordinate system of a detector
72 vector<Int_t> fRow;
73 //! Layer index of a cell. It must be proportional to Z coordinate in self coordinate system of a detector
74 vector<Int_t> fLayer;
75 //! X coordinate [cm]
76 vector<Double_t> fXcoord;
77 //! Y coordinate [cm]
78 vector<Double_t> fYcoord;
79 //! Z coordinate [cm]
80 vector<Double_t> fZcoord;
81 //! Time of actuation of the cell [ns]
82 vector<Double_t> fTime;
83 //! Energy deposited in the cell [GeV]
84 vector<Double_t> fEdep;
85 //! Beta = v/c, v = d/t
86 vector<Double_t> fBeta;
87
88 vector<vector<vector<Int_t>>> fIndexXYZ;
89
90 public:
91 //! Default constructor
92 BmnNdetClusterFinder(const Int_t kNColumns = 11, const Int_t kNRows = 11, const Int_t kNLayers = 16);
93 //! Default destructor
95
96 //! @returns Number of recognized clusters
98
99 //! @returns Number of cells in event
101
102 /*! Number of cells in event with deposited energy higher than threshold
103 * @param threshold minimal deposited energy in counted cells
104 * @returns number of cells with edep > threshold
105 */
106 Int_t GetNCells(Double_t threshold);
107
108 //! @returns Number of columns in detector. Used for iteration of cells along X coordinate.
110
111 //! @returns Number of rows in detector. Used for iteration of cells along Y coordinate.
112 Int_t GetNRows();
113
114 //! @returns Number of Layers in detector. Used for iteration of cells along Z coordinate.
116
117 //! @returns Vector of indices of all fired cells in event
118 vector<Int_t> GetCells();
119
120 //! @returns Vector of column numbers of all fired cells in event
121 vector<Int_t> GetColumns();
122
123 //! @returns Vector of row numbers of all fired cells in event
124 vector<Int_t> GetRows();
125
126 //! @returns Vector of layer numbers of all fired cells in event
127 vector<Int_t> GetLayers();
128
129 //! @returns Vector of X coordinates of all fired cells in event [cm]
130 vector<Double_t> GetX();
131
132 //! @returns Vector of Y coordinates of all fired cells in event [cm]
133 vector<Double_t> GetY();
134
135 //! @returns Vector of Z coordinates of all fired cells in event [cm]
136 vector<Double_t> GetZ();
137
138 //! @returns Vector of time of actuation of all fired cells in event [ns]
139 vector<Double_t> GetTime();
140
141 //! @returns Vector of energies deposited in all fired cells in event [GeV]
142 vector<Double_t> GetEdep();
143
144 //! @returns Vector of beta calculated as Beta = v/c, v = d/t
145 vector<Double_t> GetBeta();
146
147 /*! Status of a cluster. It is assigned to the cluster when applying BmnNdetClusterFinder::SelectNeutrons() method.
148 * @param i_cluster index of BmnNdetCluster object
149 * @returns status of a cluster (see eClusterStatus for details)
150 */
151 Int_t GetClusterStatus(Int_t i_cluster);
152
153 /*! Set status of a cluster.
154 * @param i_cluster index of BmnNdetCluster object
155 * @param status status of a cluster (see eClusterStatus for details)
156 */
157 void SetClusterStatus(Int_t i_cluster, eClusterStatus status);
158
159 /*! Add cell to the list of fired cells
160 * For correct work of the code it is needed that columns, rows and layers were enumerated from 0, not 1 !
161 * @param cell index of cell in BmnNdetCell array in BmnNdetEvent object.
162 * @param column index of column. It must be enumerated starting from 0. The column number must increase in the same
163 * direction as X axis.
164 * @param row index of row. It must be enumerated starting from 0. The row number must increase in the same
165 * direction as Y axis.
166 * @param layer index of layer. It must be enumerated starting from 0. The layer number must increase in the same
167 * direction as Z axis.
168 * @param x X coordinate of the fired cell
169 * @param y Y coordinate of the fired cell
170 * @param z Z coordinate of the fired cell
171 * @param t Time of actuation of the fired cell
172 * @param e_dep Energy deposited in cell [GeV]
173 */
174 void Fill(Int_t cell,
175 Int_t column,
176 Int_t row,
177 Int_t layer,
178 Double_t x,
179 Double_t y,
180 Double_t z,
181 Double_t t,
182 Double_t e_dep);
183
184 //! Clear all vectors, set fNCells=0
185 void Clear();
186
187 //! Print
188 void Print();
189
190 /*! Get BmnNdetCluster object
191 * @param i_cluster index of recognized cluster
192 * @returns pointer to BmnNdetCluster object
193 */
194 BmnNdetCluster* GetCluster(Int_t i_cluster);
195
196 /*! Add empty BmnNdetCluster to the list of clusters
197 * @returns pointer to the newly added cluster
198 */
200
201 /*! Mark a cell i_cell as belonging to cluster i_cluster
202 * @param i_cell index of cell in order of its filling with BmnNdetClusterFinder::Fill() method
203 * @param i_cluster index of cluster in order of its addition with BmnNdetClusterFinder::AddCluster() method. The
204 * last cluster is taken by default.
205 */
206 void AddCellToCluster(Int_t i_cell, Int_t i_cluster);
207
208 /*! Main method of a class.\n
209 * The clusters are groups of neighbouring cells. Time and deposited energies are not taken into account.\n
210 * Before you use it, you must fill data with BmnNdetClusterFinder::Fill() method.\n
211 * This algorithm loops over cells in order of ascending time.\n
212 * @returns number of recognized clusters
213 */
215
216 /*! Main method of a class.\n
217 * The clusters are groups of neighbouring cells. Time and deposited energies are not taken into account.\n
218 * Before you use it, you must fill data with BmnNdetClusterFinder::Fill() method.\n
219 * This algorithm loops over cells in order of ascending time.\n
220 * If the cluster starts from veto layer, include to cluster all cells with the same row and column
221 * @returns number of recognized clusters
222 */
224
225 /*! Main method of a class.\n
226 * The clusters are groups of neighbouring cells.\n
227 * Time and deposited energies are not taken into account.\n
228 * This algorithm loops over cells in order of descending speed.\n
229 * Before you use it, you must fill data with BmnNdetClusterFinder::Fill() method.\n
230 * @returns number of recognized clusters
231 */
233
234 /*! Main method of a class.\n
235 * The clusters are groups of neighbouring cells.\n
236 * One more layer is added for checking (the gap of 1 layer doesn't count)\n
237 * Time and deposited energies are not taken into account.\n
238 * This algorithm loops over cells in order of descending speed.\n
239 * Before you use it, you must fill data with BmnNdetClusterFinder::Fill() method.\n
240 * @returns number of recognized clusters
241 */
243
244 /*! Main method of a class.\n
245 * The clusters are groups of neighbouring cells.\n
246 * If difference of beta between cells > cut_beta, start a new cluster.
247 * Time and deposited energies are not taken into account.\n
248 * This algorithm loops over cells in order of descending speed.\n
249 * Before you use it, you must fill data with BmnNdetClusterFinder::Fill() method.\n
250 * @returns number of recognized clusters
251 */
252 Int_t FindClusters3(Double_t cut_beta = 0.03);
253
254 /*! Second method of searching for the clusters.\n
255 * Before you use it, you must fill data with BmnNdetClusterFinder::Fill() method.\n
256 * This algorithm loops over cells in order of ascending time.\n
257 * While checking neighbouring cell, the time of flight between cells is taken into account.
258 * The cell is added to the cluster, if the speed of propagation of the hadronic shower between the cells is the
259 * same as the speed of initial neutron.
260 * @param cut_beta maximum difference between beta of propagation of shower and beta calculated from the first cell
261 * in cluster.
262 * @returns number of recognized clusters
263 */
264 Int_t FindClusters4(Double_t cut_beta = 0.01);
265
266 /*! Select neutrons
267 * @param cut_angle accept, if BmnNdetCluster::AngleToTarget() < cut_angle
268 * @param cut_ncells accept, if BmnNdetCluster::GetNCells() >= cut_ncells
269 * @param check_border use BmnNdetCluster::StartsOnBorder() check
270 * @returns number of found neutrons
271 */
272 Int_t SelectNeutrons(Double_t cut_angle = 45., Int_t cut_ncells = 3, Bool_t check_border = kFALSE);
273
274 /*! Merge clusters\n
275 * The cells of cluster with maximal i_cluster are added to the cluster with minimal i_cluster\n
276 * The cluster with maximal i_cluster is destroyed.\n
277 * If i_cluster_1==i_cluster_2, cancel merging.
278 * @param i_cluster_1 first cluster
279 * @param i_cluster_2 second cluster
280 * @returns Number of clusters after merging
281 */
282 Int_t MergeClusters(Int_t i_cluster_1, Int_t i_cluster_2);
283
284 /*! Estimate number of neutrons based on:
285 * @param weight_edep * total deposited energy in accepted clusters\n
286 * @param weight_nclusters * number of accepted clusters\n
287 * @param weight_ncells * total number of cells in accepted clusters.\n
288 * If sum of weighed parameters exceeds @param threshold12 there is more than 1 neutron
289 * @returns Estimated number of neutrons
290 */
292 Double_t weight_ncells = 0.01,
293 Double_t weight_nclusters = 0.05,
294 Double_t threshold12 = 0.);
295
296 virtual const char* GetClassName() { return "BmnNdetClusterFinder"; }
298};
299
300#endif /* BMNNDETCLUSTERFINDER_H */
bool Bool_t
int Int_t
constexpr Bool_t kFALSE
double Double_t
#define ClassDef(name, id)
Class for description of algorithm of recognition of clusters in Bmn Ndet detector.
vector< Int_t > fRow
Row index of a cell. It must be proportional to Y coordinate in self coordinate system of a detector.
Int_t FindClusters1_2()
Main method of a class.
vector< eCellStatus > fCellStatus
Flag if cell belongs to some cluster.
vector< BmnNdetCluster * > fClusters
Recognized clusters.
Int_t fNClusters
Number of recognized clusters.
vector< Double_t > fEdep
Energy deposited in the cell [GeV].
vector< Double_t > GetZ()
void Clear()
Clear all vectors, set fNCells=0.
Int_t FindClusters2()
Main method of a class.
vector< vector< vector< Int_t > > > fIndexXYZ
Int_t fNUncheckedCellsInEvent
Number of cells not belonging to any cluster.
vector< Double_t > GetTime()
vector< Int_t > fIndexEdep
Index of cells sorted by decending deposited energy.
vector< Double_t > fTime
Time of actuation of the cell [ns].
vector< Double_t > GetEdep()
BmnNdetClusterFinder(const Int_t kNColumns=11, const Int_t kNRows=11, const Int_t kNLayers=16)
Default constructor.
eCellStatus
Flag if the cell belongs to any cluster.
@ kIsNotUsed
the cell doesn't belong to any cluster
@ kIsUsed
the cell belongs to some cluster
vector< Int_t > fColumn
Column index of a cell. It must be proportional to X coordinate in self coordinate system of a detect...
Int_t SelectNeutrons(Double_t cut_angle=45., Int_t cut_ncells=3, Bool_t check_border=kFALSE)
Select neutrons.
Int_t FindClusters1()
Main method of a class.
Int_t CalculateNumberOfNeutrons(Double_t weight_edep=1., Double_t weight_ncells=0.01, Double_t weight_nclusters=0.05, Double_t threshold12=0.)
Estimate number of neutrons based on:
Int_t FindClusters4(Double_t cut_beta=0.01)
Second method of searching for the clusters.
vector< Int_t > fLayer
Layer index of a cell. It must be proportional to Z coordinate in self coordinate system of a detecto...
vector< eClusterStatus > fClusterStatus
Flag if cell belongs to some cluster.
Int_t FindClusters3(Double_t cut_beta=0.03)
Main method of a class.
virtual const char * GetClassName()
vector< Double_t > GetY()
vector< Double_t > fBeta
Beta = v/c, v = d/t.
BmnNdetCluster * AddCluster()
Add empty BmnNdetCluster to the list of clusters.
Int_t GetClusterStatus(Int_t i_cluster)
Status of a cluster.
vector< Double_t > GetBeta()
vector< Int_t > fCell
Index of a cell in BmnNdetCell array in BmnNdetEvent object.
Int_t fNCells
Number of fired cells in event.
vector< Double_t > fZcoord
Z coordinate [cm].
vector< Double_t > fXcoord
X coordinate [cm].
vector< Double_t > fYcoord
Y coordinate [cm].
vector< Int_t > fIndexTime
Index of cells sorted by ascending time.
BmnNdetCluster * GetCluster(Int_t i_cluster)
Get BmnNdetCluster object.
eClusterStatus
Status of the cluster.
@ kNotNeutron
the cluster can't be produced by neutron
@ kUnchecked
the cluster is not checked yet
@ kIsNeutron
the cluster is produced by neutron
@ kNoCluster
there is no cluster
void SetClusterStatus(Int_t i_cluster, eClusterStatus status)
Set status of a cluster.
Int_t FindClusters2_2()
Main method of a class.
Int_t MergeClusters(Int_t i_cluster_1, Int_t i_cluster_2)
Merge clusters The cells of cluster with maximal i_cluster are added to the cluster with minimal i_cl...
vector< Double_t > GetX()
vector< Int_t > fIndexBeta
Index of cells sorted by decending beta.
void Fill(Int_t cell, Int_t column, Int_t row, Int_t layer, Double_t x, Double_t y, Double_t z, Double_t t, Double_t e_dep)
Add cell to the list of fired cells For correct work of the code it is needed that columns,...
void AddCellToCluster(Int_t i_cell, Int_t i_cluster)
Mark a cell i_cell as belonging to cluster i_cluster.
~BmnNdetClusterFinder()
Default destructor.
Class for description of recognized cluster in Bmn Ndet detector.
Definition json.hpp:4446