ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_ReClustering.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Paul Bell 23/7/04
6/* This utility class performs a reclustering of SCT hits necessary
7 to take account of dead or noisy channels.
8 For now the philosophy is that
9 BAD CHANNELS DO NOT BECOME CLUSTERS
10 Later we may want to distinguish between dead and noisy
11*/
13
14#include <iostream>
15#include <vector>
16
17#include "GaudiKernel/MsgStream.h"
18#include "Identifier/Identifier.h"
21
22// Constructor
23//--------------------------------------------------------------------------
24std::vector<std::vector<Identifier> > SCT_ReClustering::recluster(
25 std::vector<std::vector<Identifier> >& idGroups, const SCT_ID& sctID) {
26
27 /*
28 From SCT_ClusteringTool we have a matrix of identifiers - hits on
29 neighboring strips are grouped togther (vector of identifiers) and
30 these are grouped into one big vector (idGroups) for that event.
31 Most of these clusters are just single channels and are now
32 excluded if dead/noisy. In the rarer case of several neighbouring
33 channels being hit, the cluster gets split up into smaller clusters.
34 idGroups is then remade into newidGroups and the original destroyed
35 */
36 std::vector<ID_Vector> newidGroups;
37
38 // Make a vector of iterators. These will point to any discontinuties
39 // in the vectors of identifiers
40 std::vector<Discont> discontV;
41
42 // The vectors of identifiers are copied to new vectors of identifiers
43 // and the old ones destroyed
44 ID_Vector newvector;
45
46 // Need one loop over the group members of idGroups
47 std::vector<ID_Vector>::iterator firstGroup = idGroups.begin();
48 std::vector<ID_Vector>::iterator lastGroup = idGroups.end();
49 for (; firstGroup != lastGroup; ++firstGroup) {
50
51 // Need a second loop over the identifiers within each idGroups member
52 std::vector<Identifier>::iterator fst = (*firstGroup).begin();
53 std::vector<Identifier>::iterator lst = (*firstGroup).end();
54 std::vector<Identifier>::iterator prt;
55 int prev = sctID.strip(*fst);
56
57 // ONE/3 Store an iterator pointing to 1st strip
58 discontV.clear();
59 discontV.push_back((*firstGroup).begin());
60
61 // now look at rest of strips
62 prt = fst;
63 ++fst;
64 for (; fst != lst; ++fst) {
65 int current = sctID.strip(*fst);
66
67 //**CHECK STRIPS ARE CONSECUTIVE**
68
69 // TWO/3 If not store an iterator pointing either side of the
70 // discontinuity
71 if (current != prev + 1) {
72 discontV.push_back(prt);
73 discontV.push_back(fst);
74 prt = fst;
75 }
76 prev = current;
77 }
78 // THREE/3 Store an iterator pointing to last strip
79 discontV.push_back((*firstGroup).end() - 1);
80
81 /*
82 Now we have a vector of pointers discontV to the first and last
83 member of each idGroups member and to any discontinuties within
84 */
85
86 std::vector<Discont>::iterator fst_d = discontV.begin();
87 // NB: *fst_d refers to the element pointed to by fst_d, and that
88 // element is an iterator!
89
90 // Copy the old vector of identifiers into however many new ones
91 // are needed. If there were no discontinutities, discontV is
92 // of size 2 so we are just making a copy
93 for (unsigned int sg = 1; sg < discontV.size(); sg += 2) {
94 newvector.clear();
95 newvector.assign(*fst_d, (*(fst_d + 1)) + 1);
96 newidGroups.push_back(newvector);
97 fst_d += 2;
98 }
99 }
100 // delete the old idGroups and return the new one
101 idGroups.clear();
102 newvector.clear();
103 return newidGroups;
104}
105
Header file for SCT_ClusteringTool.
This is an Identifier helper class for the SCT subdetector.
header file for SCT_ReClustering class
This is an Identifier helper class for the SCT subdetector.
Definition SCT_ID.h:68
int strip(const Identifier &id) const
Definition SCT_ID.h:717
static std::vector< std::vector< Identifier > > recluster(std::vector< std::vector< Identifier > > &, const SCT_ID &)
called by SCT_ClusteringTool.
std::vector< Identifier > ID_Vector