Belle II Software  release-08-01-10
collectortfinfo.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #include <framework/gearbox/Const.h>
9 #include <framework/logging/Logger.h>
10 #include <tracking/trackFindingVXD/displayInterfaceTF/CollectorTFInfo.h>
11 #include <gtest/gtest.h>
12 
13 namespace Belle2 {
20  class CollectorTFInfoTest : public ::testing::Test {
21 
27  public:
28  void import_sectors_loop();
31  void import_clusters_loop();
34  void import_hit_loop();
35  void import_hit_standard();
37  void import_cell_loop();
38  void import_cell_standard();
40  void import_tfc_loop();
41  void import_tfc_standard();
43  void getAllCells();
44  void getAllHits();
45  void getAllClusters();
46  void getAllTC();
47  void getAllSectors();
50  protected:
51  CollectorTFInfo m_collector = CollectorTFInfo();
52  // Pass Ids
53  std::vector<int> pass_sector_ids = {0, 1, 2};
57  };
58 
59 
60 //************** METHODES of the Collector
61 // virtual void initSectors (std::map<std::pair<unsigned int, unsigned int>, std::vector<int>> sectors);
62 // // Beginn Run, safe sectors here
63 //
64 // virtual void initPersistent (); // Init Persistence
65 // virtual void intEvent (); // Clusters import, Sector fill
66 //
67 // virtual int importCluster (int pass_index, std::string died_at, std::vector<int> accepted, std::vector<int> rejected, int detector_type);
68 //
69 // virtual void updateSectors (int sector_ID, int pass_index, std::string died_at, std::vector<int> accepted, std::vector<int> rejected, int deltaUseCounter); //Sector update
70 // virtual void updateClusters (int cluster_id, std::string died_at, std::vector<int> accepted, std::vector<int> rejected, int deltaUseCounter); //Cluster Update
71 //
72 // virtual int importHit (int pass_index, std::string died_at, std::vector<int> accepted, std::vector<int> rejected, std::vector<int> assigned_Cluster_IDs, int sec_id, B2Vector3D hit_position); // Hit import
73 // virtual void updateHit (int hit_id, std::string died_at, std::vector<int> accepted, std::vector<int> rejected, int deltaUseCounter_TCID, std::vector<int> deltaUseCounter_cell); // Hit update
74 //
75 // int getParticleIDfromRelations (int pass_index, int cluster_id);
76 //
77 // virtual int importCell (int pass_index, std::string died_at, std::vector<int> accepted, std::vector<int> rejected, std::vector<int> assigned_Hit_IDs); // Cell Import
78 // virtual void updateCell (int cellID, std::string died_at, std::vector<int> accepted, std::vector<int> rejected, int deltaUseCounter_TCID, int changeCellState, std::vector<int> neighbours); // Cell Update
79 //
80 // virtual int importTC (int pass_index, std::string died_at, std::vector<int> accepted, std::vector<int> rejected, std::vector<int> assigned_Cell_IDs); // TC Import
81 // virtual void updateTC (int tcid, std::string died_at, std::vector<int> accepted, std::vector<int> rejected); // TC Update
82 //
83 // virtual void silentKill (); // Für alle folgenden Updates
84 // virtual void safeInformation ();
85 //
86 //
87 
88 
89 
90 
92  {
93 
94 
95  uint sector_map_size = 40;
96 
97  // Create Test Sector
98  std::map<std::pair<unsigned int, unsigned int>, std::vector<int>> sectors_display_all_pass;
99  std::vector<int> sectors_display_friends;
100 
101 // B2INFO ("PassNr. " << pass_sector_id_single << "Size of Sector Map: " << sector_map_size );
102 
103  sectors_display_friends.clear();
104  sectors_display_all_pass.insert(std::make_pair(std::make_pair(pass_sector_id_single, 0), sectors_display_friends));
105 
106  sectors_display_friends.clear();
107  sectors_display_friends.push_back(0);
108  sectors_display_all_pass.insert(std::make_pair(std::make_pair(pass_sector_id_single, 1), sectors_display_friends));
109 
110  sectors_display_friends.clear();
111  sectors_display_friends.push_back(1);
112  sectors_display_all_pass.insert(std::make_pair(std::make_pair(pass_sector_id_single, 2), sectors_display_friends));
113 
114  // Sector 3 - 40
115  sectors_display_friends.clear();
116  for (uint u = 3; u < sector_map_size; u++) {
117  sectors_display_all_pass.insert(std::make_pair(std::make_pair(pass_sector_id_single, u), sectors_display_friends));
118  }
119 
120 
121 
122 
123  m_collector.initPersistent();
124  m_collector.intEvent();
125  // m_collector.initSectors (sectors_display_all_pass, std::vector<double>(), std::vector<double>());
126 
127  }
128 
129 
131  {
132 
133  uint anz_clusters_svd = 15;
134  uint anz_clusters_pxd = 15;
135 
136 
137  for (uint i = 0; i < anz_clusters_svd; i++) {
138  // importCluster (int pass_index, std::string died_at, int accepted, int rejected, int detector_type)
139  /*int akt_id =*/ m_collector.importCluster(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), Const::SVD, i);
140 
141 // B2INFO ("AKT ID SVD: " << akt_id);
142 
143  }
144 
145  for (uint i = 0; i < anz_clusters_pxd; i++) {
146  // importCluster (int pass_index, std::string died_at, int accepted, int rejected, int detector_type)
147  /*int akt_id = */m_collector.importCluster(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), Const::PXD, i);
148 
149 // B2INFO ("AKT ID PXD: " << akt_id);
150  }
151  }
152 
153 
155  {
156  // Create Test Sector
157  std::map<unsigned int, std::vector<int>> sector_map;
158  uint size_of_sectors = 10;
159 
160  for (uint i = 0; i < size_of_sectors; i++) {
161  sector_map.insert(std::make_pair(i, std::vector<int>()));
162  }
163 
164  // 1. Sectors init
165  //KeySectors dosn't function => so pair Int int
166  std::map<std::pair<unsigned int, unsigned int>, std::vector<int>> sectors_display_all_pass;
167  std::vector<int> sectors_display_friends;
168 
169  for (uint i = 0; i < pass_sector_ids.size(); i++) {
170 
171  B2DEBUG(1, "PassNr. " << i << "Size of Sector Map: " << sector_map.size());
172 
173  for (auto& akt_sector : sector_map) {
174  sectors_display_friends.clear();
175 
176  // Friends read and store in second vector
177  for (auto& akt_friend : akt_sector.second) {
178  sectors_display_friends.push_back(akt_friend);
179  }
180  sectors_display_all_pass.insert(std::make_pair(std::make_pair(i, akt_sector.first), sectors_display_friends));
181  }
182  }
183  m_collector.initPersistent();
184  m_collector.intEvent();
185  // m_collector.initSectors (sectors_display_all_pass, std::vector<double>(), std::vector<double>());
186  }
187 
188 
190  {
191  uint anz_clusters_svd = 10;
192  uint anz_clusters_pxd = 10;
193 
194  for (uint index = 0; index < pass_sector_ids.size(); index++) {
195  for (uint i = 0; i < anz_clusters_svd; i++) {
196  // importCluster (int pass_index, std::string died_at, int accepted, int rejected, int detector_type)
197  /*int akt_id =*/
198  m_collector.importCluster(index, "", -1, std::vector<int>(), std::vector<int>(), Const::SVD, i);
199  }
200  for (uint i = 0; i < anz_clusters_pxd; i++) {
201  // importCluster (int pass_index, std::string died_at, int accepted, int rejected, int detector_type)
202  /*int akt_id =*/
203  m_collector.importCluster(index, "", -1, std::vector<int>(), std::vector<int>(), Const::PXD, i);
204  }
205  }
206  }
207 
209  {
210  // virtual int importHit (int pass_index, std::string died_at, std::vector<int> accepted,
211  // std::vector<int> rejected, std::vector<int> assigned_Cluster_IDs,
212  // int sec_id, B2Vector3D hit_position); // Hit import_clusters
213 
214  // ID 0 - 4
215  // Sector Overlap => Hitid 3,4
216  // Cluster Overlap => Hitid 7,8
217  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>({1, 2, 3}), 0,
218  B2Vector3D(),
219  B2Vector3D());
220  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>({4}), 2, B2Vector3D(),
221  B2Vector3D());
222  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>({7}), 4, B2Vector3D(),
223  B2Vector3D());
224  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>({9}), 5, B2Vector3D(),
225  B2Vector3D());
226  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>({10}), 5,
227  B2Vector3D(),
228  B2Vector3D());
229 
230  // ID 5 - 9
231  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>({11, 12, 13}), 6,
232  B2Vector3D(),
233  B2Vector3D());
234  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>({14, 15}), 7,
235  B2Vector3D(),
236  B2Vector3D());
237  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>({17}), 8,
238  B2Vector3D(),
239  B2Vector3D());
240  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>({17}), 9,
241  B2Vector3D(),
242  B2Vector3D());
243  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>({18}), 1,
244  B2Vector3D(),
245  B2Vector3D());
246 
247  // ID 10 - 14
248  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>(), -1, B2Vector3D(),
249  B2Vector3D());
250  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>(), -1, B2Vector3D(),
251  B2Vector3D());
252  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>(), -1, B2Vector3D(),
253  B2Vector3D());
254  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>(), -1, B2Vector3D(),
255  B2Vector3D());
256  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>(), -1, B2Vector3D(),
257  B2Vector3D());
258 
259  // ID 15 - 19
260  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>(), 19, B2Vector3D(),
261  B2Vector3D());
262  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>(), 20, B2Vector3D(),
263  B2Vector3D());
264  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>(), 21, B2Vector3D(),
265  B2Vector3D());
266  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>(), 22, B2Vector3D(),
267  B2Vector3D());
268  m_collector.importHit(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>(), 23, B2Vector3D(),
269  B2Vector3D());
270  }
271 
272 
274  {
275  uint anz_hits = 10;
276 
277  // std::vector<int> clusters = {7, 8, 9};
278  for (uint index = 0; index < pass_sector_ids.size(); index++) {
279  for (uint i = 0; i < anz_hits; i++) {
280  // virtual int importHit (int pass_index, std::string died_at, std::vector<int> accepted,
281  // std::vector<int> rejected, std::vector<int> assigned_Cluster_IDs,
282  // int sec_id, B2Vector3D hit_position); // Hit import_clusters
283 
284  /*int akt_id =*/ m_collector.importHit(index, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>(), 1, B2Vector3D(),
285  B2Vector3D());
286  }
287  }
288  }
289 
290 
292  {
293  // ID 0 - 9
294  // Allowed Overlap => Cellid 2, 3 (same hit)
295  // Not allowed overlap => Cellid 7, 8 (other hit)
296 
297  // Cellid 1 => overlapped Sector
298  m_collector.importCell(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>({1, 2}));
299  m_collector.importCell(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>({4, 5}));
300  m_collector.importCell(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>({11, 9}));
301  m_collector.importCell(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>({9, 10}));
302  m_collector.importCell(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>());
303  m_collector.importCell(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>());
304  m_collector.importCell(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>());
305  m_collector.importCell(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>({15, 16}));
306  m_collector.importCell(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>({16, 17}));
307  m_collector.importCell(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), std::vector<int>());
308 
309  // virtual int importCell (int pass_index, std::string died_at, std::vector<int> accepted, std::vector<int> rejected, std::vector<int> assigned_Hit_IDs); // Cell Import
310  }
311 
312 
314  {
315  uint anz_cell = 10;
316  std::vector<int> hits = {1, 2, 3};
317 
318  for (uint index = 0; index < pass_sector_ids.size(); index++) {
319  for (uint i = 0; i < anz_cell; i++) {
320  // virtual int importCell (int pass_index, std::string died_at, std::vector<int> accepted,
321  // std::vector<int> rejected, std::vector<int> assigned_Hit_IDs); // Cell Import
322  /*int akt_id =*/ m_collector.importCell(index, "", -1, std::vector<int>(), std::vector<int>(), hits);
323  }
324  }
325  }
326 
328  {
329  std::vector<std::pair<int, unsigned int>> cells0 = {std::make_pair(0, 0)};
330  std::vector<std::pair<int, unsigned int>> cells1 = {std::make_pair(1, 1)};
331  std::vector<std::pair<int, unsigned int>> cells23 = {std::make_pair(2, 2), std::make_pair(3, 3)};
332  std::vector<std::pair<int, unsigned int>> cells79 = {std::make_pair(7, 7), std::make_pair(9, 9)};
333  std::vector<std::pair<int, unsigned int>> cells8 = {std::make_pair(8, 8)};
334 
335  // ID 1 = Sector overlapped
336  // ID 2 = allowed overlapping (Cells)
337  // ID 3, 4 = not allowed overlapping (Cells)
338  m_collector.importTC(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), cells0);
339  m_collector.importTC(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), cells1);
340  m_collector.importTC(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), cells23);
341  m_collector.importTC(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), cells79);
342  m_collector.importTC(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(), cells8);
343 
344  m_collector.importTC(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(),
345  std::vector<std::pair<int, unsigned int>>({}));
346  m_collector.importTC(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(),
347  std::vector<std::pair<int, unsigned int>>({}));
348  m_collector.importTC(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(),
349  std::vector<std::pair<int, unsigned int>>({}));
350  m_collector.importTC(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(),
351  std::vector<std::pair<int, unsigned int>>({}));
352  m_collector.importTC(pass_sector_id_single, "", -1, std::vector<int>(), std::vector<int>(),
353  std::vector<std::pair<int, unsigned int>>({}));
354  }
355 
356 
358  {
359  uint anz_tfc = 10;
360  std::vector<std::pair<int, unsigned int>> cells = {std::make_pair(1, 1), std::make_pair(2, 2), std::make_pair(3, 3)};
361 
362  for (uint index = 0; index < pass_sector_ids.size(); index++) {
363  for (uint i = 0; i < anz_tfc; i++) {
364  // int passIndex, std::string diedAt, int diedId, std::vector<int> accepted, std::vector<int> rejected,
365  // const std::vector<std::pair<int, unsigned int>> assignedCellIDs
366  // TC Import
367  /*int akt_id =*/ m_collector.importTC(index, "", -1, std::vector<int>(), std::vector<int>(), cells);
368  }
369  }
370  }
371 
372 
373  // Output of all interesting Information of Cells
375  {
376  for (uint i = 0; i < m_collector.m_cellTF.size(); i++) {
377  B2INFO("* Cell ID: " << i << "; active: " << m_collector.m_cellTF[i].getActive() << ", died_at: " <<
378  m_collector.m_cellTF[i].getDiedAt() << "; m_assigned_hits_ids - size: " << m_collector.m_cellTF[i].getAssignedHits().size() <<
379  "; Neighbours - size: " << m_collector.m_cellTF[i].getNeighbours().size() << "; State: " << m_collector.m_cellTF[i].getState() <<
380  "; use counter: " << m_collector.m_cellTF[i].getUseCounter());
381  }
382  }
383 
384 
385  // Output of all interesting Information of Hits
387  {
388  for (uint i = 0; i < m_collector.m_hitTF.size(); i++) {
389  B2INFO("* Hit ID: " << i << "; active: " << m_collector.m_hitTF[i].getActive() << ", died_at: " <<
390  m_collector.m_hitTF[i].getDiedAt() << "; m_assigned_cluster - size: " << m_collector.m_hitTF[i].getAssignedCluster().size() <<
391  "; UseTC IDs - size: " << m_collector.m_hitTF[i].getUseCounterTCIDs().size() <<
392  "; use counter: " << m_collector.m_hitTF[i].getUseCounter() << "; SectorID: " << m_collector.m_hitTF[i].getSectorID());
393  }
394  }
395 
396  // Output of all interesting Information of Clusters
398  {
399  for (uint i = 0; i < m_collector.m_clustersTF.size(); i++) {
400  B2INFO("* Cluster ID: " << i << "; active: " << m_collector.m_clustersTF[i].getActive() << ", died_at: " <<
401  m_collector.m_clustersTF[i].getDiedAt() << "; Real Cluster ID: " <<
402  m_collector.m_clustersTF[i].getRealClusterID() << "; Detector Type: "
403  << m_collector.m_clustersTF[i].getDetectorType() << "; use counter: " << m_collector.m_clustersTF[i].getUseCounter());
404  }
405  }
406 
407 
408  // Output of all interesting Information of TC
410  {
411  for (uint i = 0; i < m_collector.m_tfCandTF.size(); i++) {
412  B2INFO("* TC ID: " << i << "; active: " << m_collector.m_tfCandTF[i].getActive() << ", died_at: " <<
413  m_collector.m_tfCandTF[i].getDiedAt() << "; Own ID: " <<
414  m_collector.m_tfCandTF[i].getOwnID() << "; AssignedCells - size: " <<
415  m_collector.m_tfCandTF[i].getAssignedCell().size());
416  }
417  }
418 
419 
420  // Output of all interesting Information of Sectors
422  {
423  for (auto& akt_sector : m_collector.m_sectorTF) {
424  B2INFO("* Sector ID: " << akt_sector.second.getSectorID() << "; active: " << akt_sector.second.getActive() << ", died_at: " <<
425  akt_sector.second.getDiedAt() << "; is only friend: " <<
426  akt_sector.second.getIsOnlyFriend() << "; Friends - size: "
427  << akt_sector.second.getFriends().size() << "; use counter: " << akt_sector.second.getUseCounter());
428  }
429  }
430 
431 
432  /*
433  //TEST SILENT KILL
434  TEST_F(CollectorTFInfoTest, testSilentKill){
435 
436  import_sectors_standard();
437 
438  import_clusters_standard();
439 
440  import_hit_standard ();
441 
442  // virtual void updateHit (int hit_id, std::string died_at, std::vector<int> accepted, std::vector<int> rejected, int deltaUseCounter_TCID, std::vector<int> deltaUseCounter_cell); // Hit updateCell
443 
444  import_cell_standard();
445 
446  // for (int i = 0; i < m_collector.m_cellTF.size(); i++) {
447  // B2INFO ("cell => hits size: " << m_collector.m_cellTF[i].getAssignedHits().size() );
448  //
449  // }
450 
451 
452  // virtual void updateCell (int cellID, std::string died_at, std::vector<int> accepted, std::vector<int> rejected, int deltaUseCounter_TCID, int changeCellState, std::vector<int> neighbours); // Cell Updates
453 
454 
455  import_tfc_standard();
456 
457  // for (int i = 0; i < m_collector.m_tfCandTF.size(); i++) {
458  // B2INFO ("TfCand: " << i << "; active: " << m_collector.m_tfCandTF[i].getActive() << ", ass_cells - size: " << m_collector.m_tfCandTF[i].getAssignedCell().size() );
459  // }
460  //
461 
462  // for (int i = 0; i < m_collector.m_cellTF.size(); i++) {
463  // B2INFO ("Before Silent Kill Cell ID: " << i << "; active: " << m_collector.m_cellTF[i].getActive() );
464  // }
465  //
466  // for (int i = 0; i < m_collector.m_hitTF.size(); i++) {
467  // B2INFO ("Before Silent Kill Hit ID: " << i << "; active: " << m_collector.m_hitTF[i].getActive());
468  // }
469 
470  // for (int i = 0; i < m_collector.m_clustersTF.size(); i++) {
471  // B2INFO ("Before Silent Kill Cluster ID: " << i << "; active: " << m_collector.m_clustersTF[i].getActive() );
472  // }
473 
474  m_collector.silentKill();
475 
476  int cells_live = 0;
477 
478  for (uint i = 0; i < m_collector.m_cellTF.size(); i++) {
479  cells_live += m_collector.m_cellTF[i].getActive();
480  // B2INFO ("After Silent Kill Cell ID: " << i << "; active: " << m_collector.m_cellTF[i].getActive() );
481  }
482 
483  int hit_live = 0;
484  for (uint i = 0; i < m_collector.m_hitTF.size(); i++) {
485  hit_live += m_collector.m_hitTF[i].getActive();
486  // B2INFO ("After Silent Kill Hit ID: " << i << "; active: " << m_collector.m_hitTF[i].getActive() << ", diet_at: " << m_collector.m_hitTF[i].getDiedAt() );
487  }
488 
489  B2INFO ("hit_live " << hit_live);
490  B2INFO ("cells_live: " << cells_live);
491 
492  // Active Hits after Silent Kill
493  ASSERT_EQ(10, hit_live );
494 
495  // Active Cells after Silent Kill
496  ASSERT_EQ(7, cells_live );
497 
498  // for (int i = 0; i < m_collector.m_clustersTF.size(); i++) {
499  // B2INFO ("After Silent Kill Cluster ID: " << i << "; active: " << m_collector.m_clustersTF[i].getActive() );
500  // }
501 
502 
503  }
504 
505  */
506 
507 // //TESTs the overlapping logic
508 // TEST_F(CollectorTFInfoTest, testOverlapped){
509 //
510 // import_sectors_standard();
511 //
512 // import_clusters_standard();
513 //
514 // import_hit_standard ();
515 //
516 // import_cell_standard();
517 //
518 // import_tfc_standard();
519 //
520 // // Hit ID
521 // // ID 0 - 4
522 // // Sector Overlap => Hitid 3,4
523 // // Cluster Overlap => Hitid 7,8
524 //
525 // bool false_item = false;
526 // bool true_item = true;
527 //
528 // ASSERT_EQ(false_item, m_collector.isHitOverlapped(1) );
529 // ASSERT_EQ(false_item, m_collector.isHitOverlapped(2) );
530 // ASSERT_EQ(true_item, m_collector.isHitOverlapped(3) );
531 // ASSERT_EQ(true_item, m_collector.isHitOverlapped(4) );
532 // ASSERT_EQ(true_item, m_collector.isHitOverlapped(7) );
533 // ASSERT_EQ(true_item, m_collector.isHitOverlapped(8) );
534 //
535 // for (uint i = 0; i < m_collector.m_hitTF.size(); i++) {
536 // B2INFO ("Hit ID: " << i << "; overlapped: " << m_collector.isHitOverlapped(i));
537 // }
538 //
539 // // Cell IDs
540 // // Allowed Overlap => Cellid 2, 3 (same hit)
541 // // Not allowed overlap => Cellid 7, 8 (other hit)
542 //
543 // ASSERT_EQ(false_item, m_collector.isCellOverlapped(2) );
544 // ASSERT_EQ(false_item, m_collector.isCellOverlapped(3) );
545 // ASSERT_EQ(true_item, m_collector.isCellOverlapped(7) );
546 // ASSERT_EQ(true_item, m_collector.isCellOverlapped(8) );
547 //
548 //
549 // for (uint i = 0; i < m_collector.m_cellTF.size(); i++) {
550 // B2INFO ("Cell ID: " << i << "; overlapped: " << m_collector.isCellOverlapped(i));
551 // }
552 //
553 // // TfCand
554 // // ID 1 = Sector overlapped
555 // // ID 2 = allowed overlapping (Cells)
556 // // ID 3, 4 = not allowed overlapping (Cells)
557 //
558 // ASSERT_EQ(true_item, m_collector.isTCOverlapped(1) );
559 // ASSERT_EQ(false_item, m_collector.isTCOverlapped(2) );
560 // ASSERT_EQ(true_item, m_collector.isTCOverlapped(3) );
561 // ASSERT_EQ(true_item, m_collector.isTCOverlapped(4) );
562 //
563 // for (uint i = 0; i < m_collector.m_tfCandTF.size(); i++) {
564 // B2INFO ("TC ID: " << i << "; overlapped: " << m_collector.isTCOverlapped(i));
565 // }
566 //
567 // // getAllSectors ();
568 // // getAllClusters ();
569 // // getAllHits ();
570 // // getAllCells();
571 // // getAllTC ();
572 //
573 //
574 //
575 // }
576 //
577 
579  TEST_F(CollectorTFInfoTest, testAllInformationLoop)
580  {
581  bool false_item = false;
582  bool true_item = true;
583 
584  import_sectors_loop();
585 
586  import_clusters_loop();
587 
588  m_collector.updateSectors(4, 1, "geloescht", 0, std::vector<int>(), std::vector<int>(), 0);
589 
590  m_collector.updateClusters(3, "geloescht", 0, std::vector<int>(), std::vector<int>(), 0);
591 
592  ASSERT_EQ("geloescht", m_collector.m_clustersTF[3].getDiedAt());
593  ASSERT_EQ(false_item, m_collector.m_clustersTF[3].getActive());
594 
595  import_hit_loop();
596 
597  m_collector.updateHit(1, "geloescht", 0, std::vector<int>(), std::vector<int>(), -1, -1, std::vector<int>());
598 
599  ASSERT_EQ("geloescht", m_collector.m_hitTF[1].getDiedAt());
600  ASSERT_EQ(false_item, m_collector.m_hitTF[1].getActive());
601  ASSERT_EQ(true_item, m_collector.m_hitTF[2].getActive());
602 
603  import_cell_loop();
604  m_collector.updateCell(3, "geloescht", 2, std::vector<int>(), std::vector<int>(), -1, -1, 0, std::vector<int>());
605 
606  ASSERT_EQ("geloescht", m_collector.m_cellTF[3].getDiedAt());
607  ASSERT_EQ(false_item, m_collector.m_cellTF[3].getActive());
608  ASSERT_EQ(true_item, m_collector.m_cellTF[1].getActive());
609 
610  import_tfc_loop();
611 
612  m_collector.updateTC(2, "geloescht", 4, std::vector<int>(), std::vector<int>());
613 
614  ASSERT_EQ("geloescht", m_collector.m_tfCandTF[2].getDiedAt());
615  ASSERT_EQ(false_item, m_collector.m_tfCandTF[2].getActive());
616  ASSERT_EQ(true_item, m_collector.m_tfCandTF[1].getActive());
617  }
619 }
Set up a few arrays and objects in the datastore.
std::vector< int > pass_sector_ids
fixed vector of pass indices (values are never used)
CollectorTFInfo m_collector
cached ref to CollectorTFInfo()
int pass_sector_id_single
fixed index for beginning pass
TEST_F(GlobalLabelTest, LargeNumberOfTimeDependentParameters)
Test large number of time-dep params for registration and retrieval.
Definition: globalLabel.cc:72
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition: B2Vector3.h:516
void import_hit_standard()
dummy comment: import_hit_standard
void import_clusters_standard()
dummy comment: import_clusters_standard
void import_clusters_loop()
dummy comment: import_clusters_loop
void getAllSectors()
Output of all interesting Information of Sectors.
void import_tfc_standard()
dummy comment: import_tfc_standard
void import_sectors_standard()
dummy comment: import_sectors_standard
void import_cell_loop()
dummy comment: import_cell_loop
void getAllTC()
Output of all interesting Information of TC.
void import_hit_loop()
dummy comment: import_hit_loop
void import_tfc_loop()
dummy comment: import_tfc_loop
void import_cell_standard()
dummy comment: import_cell_standard
void import_sectors_loop()
Documentation Comment Jakob Lettenbichler: this was written by a student and will be removed after fi...
void getAllClusters()
Output of all interesting Information of Clusters.
void getAllHits()
Output of all interesting Information of Hits.
void getAllCells()
Output of all interesting Information of Cells.
Abstract base class for different kinds of events.