test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BXAnalyzer.h
Go to the documentation of this file.
1 
12 
13 std::vector<std::vector<ConvertedHit>> GroupBX(std::vector<ConvertedHit> ConvHits){
14 
15  std::vector<ConvertedHit> tmp;
16  std::vector<std::vector<ConvertedHit>> output (3,tmp);
17 
18  const int CentralBX = 6;
19 
20  for(std::vector<ConvertedHit>::iterator i = ConvHits.begin();i != ConvHits.end();i++){
21 
22  int diff = i->BX() - CentralBX;
23 
24  if((diff > -3) && (diff < 1))
25  output[0].push_back(*i);
26 
27  if((diff < 3) && (diff > -1))
28  output[2].push_back(*i);
29 
30  if(fabs(diff) < 2)
31  output[1].push_back(*i);
32  }
33 
34  for (int i = 1; i < 3; i++) {
35  unsigned int HasAllInNext = 0;
36  for (unsigned int it = 0; it != output[i-1].size(); it++) {
37  bool InNext = false;
38  for (unsigned int it2 = 0; it2 != output[i].size(); it2++) {
39  if( output[i-1][it].Phi() == output[i][it2].Phi() &&
40  output[i-1][it].Theta() == output[i][it2].Theta() &&
41  output[i-1][it].Ph_hit() == output[i][it2].Ph_hit() &&
42  output[i-1][it].Phzvl() == output[i][it2].Phzvl() &&
43  output[i-1][it].Station() == output[i][it2].Station() &&
44  output[i-1][it].Sub() == output[i][it2].Sub() &&
45  output[i-1][it].Id() == output[i][it2].Id() &&
46  output[i-1][it].Quality() == output[i][it2].Quality() &&
47  output[i-1][it].Pattern() == output[i][it2].Pattern() &&
48  output[i-1][it].Wire() == output[i][it2].Wire() &&
49  output[i-1][it].Strip() == output[i][it2].Strip() &&
50  output[i-1][it].BX() == output[i][it2].BX() ) InNext = true;
51  }
52  if (InNext) HasAllInNext++;
53  }
54  if (HasAllInNext == output[i-1].size()) output[i-1].clear();
55  }
56 
57  for(int i=0;i<3;i++){
58 
59  for(std::vector<ConvertedHit>::iterator it = output[i].begin();it != output[i].end();it++){
60  for(std::vector<ConvertedHit>::iterator it2 = it;it2 != output[i].end();it2++){
61 
62  if(it == it2) continue;
63 
64  //add that phis have to be equal if assuming that a phi position can have only 2 possible thetas
65  if(it->Station() == it2->Station() && it->Id() == it2->Id() && it->IsNeighbor() == it2->IsNeighbor()){
66 
67  it->SetTheta2(it2->Theta());
68  it2->SetTheta2(it->Theta());
69 
70  it->AddTheta(it2->Theta());
71  it2->AddTheta(it->Theta());
72  }
73 
74  }
75  }
76 
77  }
78 
79  return output;
80 }
81 
82 PatternOutput DeleteDuplicatePatterns(std::vector<PatternOutput> Pout){
83 
84  std::vector<int> tmp (192,0);//was 128
85  std::vector<std::vector<int>> rank (4,tmp), layer(4,tmp),straightness(4,tmp),bxgroup(4,tmp);
86  std::vector<ConvertedHit> Hits;
87 
88  for(int i=0;i<3;i++){
89 
90  bool set = 0;
91 
92  for(int zone=0;zone<4;zone++){
93  for(int strip=0;strip<192;strip++){//was 128
94 
95  if(Pout[i].detected.rank[zone][strip] > rank[zone][strip]){
96 
97  rank[zone][strip] = Pout[i].detected.rank[zone][strip];
98  layer[zone][strip] = Pout[i].detected.layer[zone][strip];
99  straightness[zone][strip] = Pout[i].detected.straightness[zone][strip];
100  bxgroup[zone][strip] = i+1;
101  set = 1;
102  }
103  }
104  }
105 
106  if(set ){/*//&& (Pout[i].hits.size() >= Hits.size())){*/
107 
108  std::vector<ConvertedHit> test = Pout[i].hits;
109 
110  for(std::vector<ConvertedHit>::iterator it = test.begin();it != test.end();it++){
111  Hits.push_back(*it);
112  }
113  }
114 
115  }
116 
117  QualityOutput qout;
118  qout.rank = rank;
119  qout.layer = layer;
120  qout.straightness = straightness;
121  qout.bxgroup = bxgroup;
122 
124  output.detected = qout;
125  output.hits = Hits;
126 
127  return output;
128 
129 }
int i
Definition: DBlmapReader.cc:9
list diff
Definition: mps_update.py:85
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:167
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
#define begin
Definition: vmac.h:30
PatternOutput DeleteDuplicatePatterns(std::vector< PatternOutput > Pout)
Definition: BXAnalyzer.h:82
std::vector< std::vector< ConvertedHit > > GroupBX(std::vector< ConvertedHit > ConvHits)
Definition: BXAnalyzer.h:13
QualityOutput detected
std::vector< ConvertedHit > hits
tuple size
Write out results.