ATLAS Offline Software
ClusterAnalysis.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 #include "GaudiKernel/MsgStream.h"
12 #include "TTree.h"
13 #include <set>
14 #include <cmath>
15 #include <iostream>
16 #include <cstdlib>
17 #include <algorithm>
18 #include <utility>
19 #include "TMath.h" // for TMath::Sign()
20 
21 namespace ClusterSeg {
22 
23  bool sortfunctionTGC (Cluster* i, Cluster* j) { return (i->z() < j->z()); }
24  bool sortfunctionRPC (Cluster* i, Cluster* j) { return (i->rCyl() < j->rCyl()); }
25 
27  m_tree(nullptr),
28  m_ncalls(-1),
29  m_writeOut(false),
30  m_ang_cut(0.5),
31  m_ang2_cut(1.0),
32  m_dist_cut(100.0)
33  {
34  m_ntuple.init();
35  }
36 
38  m_tree(&tree),
39  m_writeOut(false),
40  m_ang_cut(0.5),
41  m_ang2_cut(1.0),
42  m_dist_cut(100.0)
43  {
45  }
46 
47 
49  MsgStream log(Athena::getMessageSvc(),"ClusterAnalysis::analyseWrite");
50  m_h_barcodes = std::make_unique<TH2F>("barcodes","",1000,0,1000,1000,0,1000);
51  m_h_barcodes->GetXaxis()->SetTitle("layer 1");
52  m_h_barcodes->GetYaxis()->SetTitle("layer 3");
53 
54  m_h_corr = std::make_unique<TH2F>("phi_theta_corr","",100,0.,M_PI_2,100,0,M_PI_2);
55  m_h_corr->GetXaxis()->SetTitle("|#Delta #phi| [rad]");
56  m_h_corr->GetYaxis()->SetTitle("|#Delta #theta| [rad]");
57  m_h_rz = std::make_unique<TH2F>("rz_spacePoints","",1000,0,12000,3000,1000,13000);
58  m_h_rz->GetXaxis()->SetTitle("Z [mm]");
59  m_h_rz->GetYaxis()->SetTitle("R [mm]");
60  m_h_xy = std::make_unique<TH2F>("xy_spacePoints","",3000,-13000,13000,3000,-13000,13000);
61  m_h_xy->GetXaxis()->SetTitle("X [mm]");
62  m_h_xy->GetYaxis()->SetTitle("Y [mm]");
63 
64  m_h_miss_RZ = std::make_unique<TH2F>("rz_missing_spacePoints","",1000,12000,16000,3000,1000,13000);
65  m_h_miss_RZ->GetXaxis()->SetTitle("Z [mm]");
66  m_h_miss_RZ->GetYaxis()->SetTitle("R [mm]");
67  m_h_miss_XY = std::make_unique<TH2F>("xy_missing_spacePoints","",3000,-13000,13000,3000,-13000,13000);
68  m_h_miss_XY->GetXaxis()->SetTitle("X [mm]");
69  m_h_miss_XY->GetYaxis()->SetTitle("Y [mm]");
70 
71  m_h_phi = std::make_unique<TH1F>("phi","",100,0,M_PI_2);
72  m_h_phi->GetXaxis()->SetTitle("|#Delta #phi| [rad]");
73  m_h_phi->GetYaxis()->SetTitle("Number of Entries");
74  m_h_theta = std::make_unique<TH1F>("theta","",100,0,M_PI_2);
75  m_h_theta->GetXaxis()->SetTitle("|#Delta #theta| [rad]");
76  m_h_theta->GetYaxis()->SetTitle("Number of Entries");
77  m_h_angle = std::make_unique<TH1F>("angle","",100,0,M_PI);
78  m_h_angle->GetXaxis()->SetTitle("#theta [rad]");
79  m_h_angle->GetYaxis()->SetTitle("Number of Entries");
80 
81  m_h_phi12 = std::make_unique<TH1F>("phi12","",100,0,M_PI_2);
82  m_h_phi12->GetXaxis()->SetTitle("|#Delta #phi| [rad]");
83  m_h_phi12->GetYaxis()->SetTitle("Number of Entries");
84  m_h_theta12 = std::make_unique<TH1F>("theta12","",100,0,M_PI_2);
85  m_h_theta12->GetXaxis()->SetTitle("|#Delta #theta| [rad]");
86  m_h_theta12->GetYaxis()->SetTitle("Number of Entries");
87  m_h_angle12 = std::make_unique<TH1F>("angle12","",100,0,M_PI);
88  m_h_angle12->GetXaxis()->SetTitle("#theta [rad]");
89  m_h_angle12->GetYaxis()->SetTitle("Number of Entries");
90 
91  m_h_phi13 = std::make_unique<TH1F>("phi13","",100,0,M_PI_2);
92  m_h_phi13->GetXaxis()->SetTitle("|#Delta #phi| [rad]");
93  m_h_phi13->GetYaxis()->SetTitle("Number of Entries");
94  m_h_theta13 = std::make_unique<TH1F>("theta13","",100,0,M_PI_2);
95  m_h_theta13->GetXaxis()->SetTitle("|#Delta #theta| [rad]");
96  m_h_theta13->GetYaxis()->SetTitle("Number of Entries");
97  m_h_angle13 = std::make_unique<TH1F>("angle13","",100,0,M_PI);
98  m_h_angle13->GetXaxis()->SetTitle("#theta [rad]");
99  m_h_angle13->GetYaxis()->SetTitle("Number of Entries");
100 
101  m_h_phi23 = std::make_unique<TH1F>("phi23","",100,0,M_PI_2);
102  m_h_phi23->GetXaxis()->SetTitle("|#Delta #phi| [rad]");
103  m_h_phi23->GetYaxis()->SetTitle("Number of Entries");
104  m_h_theta23 = std::make_unique<TH1F>("theta23","",100,0,M_PI_2);
105  m_h_theta23->GetXaxis()->SetTitle("|#Delta #theta| [rad]");
106  m_h_theta23->GetYaxis()->SetTitle("Number of Entries");
107  m_h_angle23 = std::make_unique<TH1F>("angle23","",100,0,M_PI);
108  m_h_angle23->GetXaxis()->SetTitle("#theta [rad]");
109  m_h_angle23->GetYaxis()->SetTitle("Number of Entries");
110 
111  m_h_R = std::make_unique<TH1F>("R","",100,0,1000);
112  m_h_R->GetXaxis()->SetTitle("|#Delta R|");
113  m_h_R->GetYaxis()->SetTitle("Number of Entries");
114  m_h_XY = std::make_unique<TH1F>("XY","",100,0,1000);
115  m_h_XY->GetXaxis()->SetTitle("|#Delta XY|");
116  m_h_XY->GetYaxis()->SetTitle("Number of Entries");
117  m_h_R_t = std::make_unique<TH1F>("R_t","",100,0,1000);
118  m_h_R_t->GetXaxis()->SetTitle("|#Delta R|");
119  m_h_R_t->GetYaxis()->SetTitle("Number of Entries");
120  m_h_XY_t = std::make_unique<TH1F>("XY_t","",100,0,1000);
121  m_h_XY_t->GetXaxis()->SetTitle("|#Delta XY|");
122  m_h_XY_t->GetYaxis()->SetTitle("Number of Entries");
123 
124  m_h_numseeds = std::make_unique<TH1F>("num_seeds","",200,0,200);
125  m_h_numseeds->GetXaxis()->SetTitle("Number of Seeds");
126  m_h_numseeds->GetYaxis()->SetTitle("Number of Entries");
127 
128  m_h_phi_t = std::make_unique<TH1F>("phi_t","",100,0,M_PI_2);
129  m_h_phi_t->GetXaxis()->SetTitle("|#Delta #phi| [rad]");
130  m_h_phi_t->GetYaxis()->SetTitle("Number of Entries");
131  m_h_theta_t = std::make_unique<TH1F>("theta_t","",100,0,M_PI_2);
132  m_h_theta_t->GetXaxis()->SetTitle("|#Delta #theta| [rad]");
133  m_h_theta_t->GetYaxis()->SetTitle("Number of Entries");
134  m_h_angle_t = std::make_unique<TH1F>("angle_t","",100,0,M_PI);
135  m_h_angle_t->GetXaxis()->SetTitle("#theta [rad]");
136  m_h_angle_t->GetYaxis()->SetTitle("Number of Entries");
137 
138  m_h_phi_t12 = std::make_unique<TH1F>("phi_t12","",100,0,M_PI_2);
139  m_h_phi_t12->GetXaxis()->SetTitle("|#Delta #phi| [rad]");
140  m_h_phi_t12->GetYaxis()->SetTitle("Number of Entries");
141  m_h_theta_t12 = std::make_unique<TH1F>("theta_t12","",100,0,M_PI_2);
142  m_h_theta_t12->GetXaxis()->SetTitle("|#Delta #theta| [rad]");
143  m_h_theta_t12->GetYaxis()->SetTitle("Number of Entries");
144  m_h_angle_t12 = std::make_unique<TH1F>("angle_t12","",100,0,M_PI);
145  m_h_angle_t12->GetXaxis()->SetTitle("#theta [rad]");
146  m_h_angle_t12->GetYaxis()->SetTitle("Number of Entries");
147 
148  m_h_phi_t13 = std::make_unique<TH1F>("phi_t13","",100,0,M_PI_2);
149  m_h_phi_t13->GetXaxis()->SetTitle("|#Delta #phi| [rad]");
150  m_h_phi_t13->GetYaxis()->SetTitle("Number of Entries");
151  m_h_theta_t13 = std::make_unique<TH1F>("theta_t13","",100,0,M_PI_2);
152  m_h_theta_t13->GetXaxis()->SetTitle("|#Delta #theta| [rad]");
153  m_h_theta_t13->GetYaxis()->SetTitle("Number of Entries");
154  m_h_angle_t13 = std::make_unique<TH1F>("angle_t13","",100,0,M_PI);
155  m_h_angle_t13->GetXaxis()->SetTitle("#theta [rad]");
156  m_h_angle_t13->GetYaxis()->SetTitle("Number of Entries");
157 
158  m_h_phi_t23 = std::make_unique<TH1F>("phi_t23","",100,0,M_PI_2);
159  m_h_phi_t23->GetXaxis()->SetTitle("|#Delta #phi| [rad]");
160  m_h_phi_t23->GetYaxis()->SetTitle("Number of Entries");
161  m_h_theta_t23 = std::make_unique<TH1F>("theta_t23","",100,0,M_PI_2);
162  m_h_theta_t23->GetXaxis()->SetTitle("|#Delta #theta| [rad]");
163  m_h_theta_t23->GetYaxis()->SetTitle("Number of Entries");
164  m_h_angle_t23 = std::make_unique<TH1F>("angle_t23","",100,0,M_PI);
165  m_h_angle_t23->GetXaxis()->SetTitle("#theta [rad]");
166  m_h_angle_t23->GetYaxis()->SetTitle("Number of Entries");
167 
168  m_h_sizeL1 = std::make_unique<TH1F>("sizeL1","",200,0,250);
169  m_h_sizeL1->GetXaxis()->SetTitle("Size of L1 Spacepoints");
170  m_h_sizeL1->GetYaxis()->SetTitle("Number of Entries");
171  m_h_sizeL2 = std::make_unique<TH1F>("sizeL2","",200,0,250);
172  m_h_sizeL2->GetXaxis()->SetTitle("Size of L2 Spacepoints");
173  m_h_sizeL2->GetYaxis()->SetTitle("Number of Entries");
174  m_h_sizeL3 = std::make_unique<TH1F>("sizeL3","",200,0,250);
175  m_h_sizeL3->GetXaxis()->SetTitle("Size of L3 Spacepoints");
176  m_h_sizeL3->GetYaxis()->SetTitle("Number of Entries");
177 
178  m_h_sizeL1L3 = std::make_unique<TH1F>("sizeL1L3","",10000,0,10000);
179  m_h_sizeL1L2L3 = std::make_unique<TH1F>("sizeL1L2L3","",20000,0,20000);
180 
181  m_h_XY121 = std::make_unique<TH1F>("XY121","",100,0,100);
182  m_h_XY122 = std::make_unique<TH1F>("XY122","",100,0,100);
183  m_h_XY121_t = std::make_unique<TH1F>("XY121_t","",100,0,100);
184  m_h_XY122_t = std::make_unique<TH1F>("XY122_t","",100,0,100);
185 
186  m_h_XY131 = std::make_unique<TH1F>("XY131","",100,0,100);
187  m_h_XY133 = std::make_unique<TH1F>("XY133","",100,0,100);
188  m_h_XY131_t = std::make_unique<TH1F>("XY131_t","",100,0,100);
189  m_h_XY133_t = std::make_unique<TH1F>("XY133_t","",100,0,100);
190 
191  m_h_XY232 = std::make_unique<TH1F>("XY232","",100,0,100);
192  m_h_XY233 = std::make_unique<TH1F>("XY233","",100,0,100);
193  m_h_XY232_t = std::make_unique<TH1F>("XY232_t","",100,0,100);
194  m_h_XY233_t = std::make_unique<TH1F>("XY233_t","",100,0,100);
195 
196  std::vector<SpacePoint> thePoints;
197 
198  Long64_t nentries = m_tree->GetEntries();
199  m_ncalls = 0;
200  for( Long64_t evt=0;evt<nentries;++evt ){
201  m_tree->LoadTree(evt);
202  m_tree->GetEntry(evt);
203 
204 
205  if (log.level()<=MSG::DEBUG && evt % 100 == 0) log << MSG::DEBUG << "event " << evt << "/" << nentries << endmsg;
206 
207  std::vector<Cluster*> clust;
208  m_ntuple.read(clust);
209 
210 
211  if (clust.at(0)->techIndex() == Muon::MuonStationIndex::TechnologyIndex::TGC){
212  std::sort (clust.begin(),clust.end(), sortfunctionTGC);
213  thePoints = createSpacePoints(clust);
214 
215  if(thePoints.empty()) continue;
216  std::vector<std::vector<SpacePoint>> seeds = createTGCSeeds(thePoints);
217  m_h_numseeds->Fill(seeds.size());
218  } else {
219  std::sort (clust.begin(),clust.end(), sortfunctionRPC);
220  thePoints = createSpacePoints(clust);
221 
222  if(thePoints.empty()) continue;
223  std::vector<std::vector<SpacePoint>> seeds = createRPCSeeds(thePoints);
224  m_h_numseeds->Fill(seeds.size());
225  }
226 
227  for(auto &it: thePoints){
228  m_h_rz->Fill(fabs(it.z()),it.rCyl());
229  m_h_xy->Fill(it.x(),it.y());
230  }
231  ++m_ncalls;
233  }
234  }
235 
236  std::vector<std::vector<SpacePoint>> ClusterAnalysis::analyse(const std::vector<Cluster*>& clust){
237  std::vector<std::vector<SpacePoint>> sPoints;
238  std::vector<SpacePoint> thePoints = createSpacePoints(clust);
239  if(thePoints.empty()) return sPoints;
240  std::vector<std::vector<SpacePoint>> seeds = (thePoints.at(0).techIndex() == Muon::MuonStationIndex::TechnologyIndex::TGC) ?
241  createTGCSeeds(thePoints) : createRPCSeeds(thePoints);
242  return seeds;
243  }
244 
245  std::vector<std::vector<SpacePoint>> ClusterAnalysis::createTGCSeeds( const std::vector<SpacePoint>& points){
246 
247  std::vector<SpacePoint> layer1Points;
248  std::vector<SpacePoint> layer2Points;
249  std::vector<SpacePoint> layer3Points;
250  std::vector<std::vector<SpacePoint>> seeds;
251 
252  for(const auto &it: points){
253  if (it.phiIndex() == Muon::MuonStationIndex::PhiIndex::T1) layer1Points.push_back(it);
254  else if(it.phiIndex() == Muon::MuonStationIndex::PhiIndex::T2) layer2Points.push_back(it);
255  else if(it.phiIndex() == Muon::MuonStationIndex::PhiIndex::T3) layer3Points.push_back(it);
256  }
257 
258  if(m_writeOut){
259  int L1size = layer1Points.size();
260  int L2size = layer2Points.size();
261  int L3size = layer3Points.size();
262 
263  m_h_sizeL1->Fill(L1size);
264  m_h_sizeL2->Fill(L2size);
265  m_h_sizeL3->Fill(L3size);
266  m_h_sizeL1L3->Fill(L1size*L3size);
267  m_h_sizeL1L2L3->Fill(L1size*L2size*L3size);
268  }
269 
270  if(m_writeOut && (layer1Points.empty() || layer2Points.empty() || layer3Points.empty())){
271  if(!layer1Points.empty()){
272  for(auto &it1: layer1Points){if(it1.isMatch()) m_h_miss_RZ->Fill(fabs(it1.z()),it1.rCyl()); m_h_miss_XY->Fill(it1.x(),it1.y());}
273  }
274  if(!layer2Points.empty()){
275  for(auto &it1: layer2Points){if(it1.isMatch()) m_h_miss_RZ->Fill(fabs(it1.z()),it1.rCyl()); m_h_miss_XY->Fill(it1.x(),it1.y());}
276  }
277  if(!layer3Points.empty()){
278  for(auto &it1: layer3Points){if(it1.isMatch()) m_h_miss_RZ->Fill(fabs(it1.z()),it1.rCyl()); m_h_miss_XY->Fill(it1.x(),it1.y());}
279  }
280  }
281 
282  createSeedsAllLayers(layer1Points,layer2Points,layer3Points,seeds);
283  if(seeds.size() < 25){
284  if(!layer1Points.empty() && !layer2Points.empty() && layer3Points.empty()) createSeedsTwoLayers(layer1Points,layer2Points,seeds);
285  if(!layer3Points.empty() && !layer1Points.empty() && layer2Points.empty()) createSeedsTwoLayers(layer1Points,layer3Points,seeds);
286  if(!layer2Points.empty() && !layer3Points.empty() && layer1Points.empty()) createSeedsTwoLayers(layer2Points,layer3Points,seeds);
287  }
288  return seeds;
289  }
290 
291  std::vector<std::vector<SpacePoint>> ClusterAnalysis::createRPCSeeds( const std::vector<SpacePoint>& points){
292 
293  std::vector<SpacePoint> layer1Points;
294  std::vector<SpacePoint> layer2Points;
295  std::vector<std::vector<SpacePoint>> seeds;
296 
297  for(const auto &it: points){
298  if (it.phiIndex() == Muon::MuonStationIndex::PhiIndex::BM1) layer1Points.push_back(it);
299  else if (it.phiIndex() == Muon::MuonStationIndex::PhiIndex::BM2) layer2Points.push_back(it);
300  }
301  if(m_writeOut){
302  int L1size = layer1Points.size();
303  int L2size = layer2Points.size();
304 
305  m_h_sizeL1->Fill(L1size);
306  m_h_sizeL2->Fill(L2size);
307  }
308 
309 
310  if(m_writeOut && (layer1Points.empty() || layer2Points.empty())){
311  if(!layer1Points.empty()){
312  for(auto &it1: layer1Points){if(it1.isMatch()) m_h_miss_RZ->Fill(fabs(it1.z()),it1.rCyl()); m_h_miss_XY->Fill(it1.x(),it1.y());}
313  }
314  if(!layer2Points.empty()){
315  for(auto &it1: layer2Points){if(it1.isMatch()) m_h_miss_RZ->Fill(fabs(it1.z()),it1.rCyl()); m_h_miss_XY->Fill(it1.x(),it1.y());}
316  }
317  }
318 
319  if(seeds.size() < 25 && !layer1Points.empty() && !layer2Points.empty()) createSeedsTwoLayers(layer1Points,layer2Points,seeds);
320 
321  return seeds;
322  }
323 
324 
325  void ClusterAnalysis::createSeedsAllLayers(const std::vector<SpacePoint>& layer1Points,
326  const std::vector<SpacePoint>& layer2Points,
327  const std::vector<SpacePoint>& layer3Points,
328  std::vector<std::vector<SpacePoint>>& seeds){
329 
330  if(!layer1Points.empty() && !layer3Points.empty()){
331  for(const auto &it1: layer1Points){
332  for(const auto &it3: layer3Points){
333  if (TMath::Sign(1.,it1.z()) != TMath::Sign(1.,it3.z())) continue;
334  std::vector<SpacePoint> theSeed;
335  Cluster point = Cluster(it3.x()-it1.x(),it3.y()-it1.y(),it3.z()-it1.z(),false,0,0,false,0);
336  double angle = acos((point.x()*it1.x()+point.y()*it1.y()+point.z()*it1.z())/(point.rSph()*it1.rSph()));
337  if(angle > M_PI) angle = 2*M_PI - angle;
338  double dphi = fabs(point.phi()-it1.phi());
339  if(dphi > M_PI_2 && dphi < 3*M_PI_2) dphi -= M_PI;
340  if(dphi > 3*M_PI_2) dphi -= 2*M_PI;
341  double dtheta = fabs(point.theta()-it1.theta());
342  if (m_writeOut) {
343  m_h_phi->Fill(fabs(dphi));
344  m_h_theta->Fill(dtheta);
345  m_h_corr->Fill(dphi,dtheta);
346  m_h_angle->Fill(angle);
347  }
348  if(m_writeOut && it3.isMatch() && it1.isMatch() && it3.barcode() == it1.barcode() && it1.barcode() != 0 ) {
349  m_h_barcodes->Fill(it1.barcode(),it3.barcode());
350  m_h_phi_t->Fill(fabs(dphi));
351  m_h_theta_t->Fill(dtheta);
352  m_h_angle_t->Fill(angle);
353  }
354 
355  if(angle < m_ang_cut) {
356  if(!layer2Points.empty()){
357  for(const auto &it2: layer2Points){
358  std::vector<SpacePoint> theSeed;
359  if (TMath::Sign(1.,it2.z()) != TMath::Sign(1.,it1.z())) continue;
360  double seedR = (it2.z()-it1.z())*tan(point.theta()) + it1.rCyl();
361  double spR = it2.rCyl();
362  double t = (it2.z() - it1.z())/point.z();
363  double seedX = it1.x() + t*point.x();
364  double seedY = it1.y() + t*point.y();
365  double XY = sqrt(pow(it2.x()-seedX,2)+pow(it2.y()-seedY,2));
366  if (m_writeOut) {
367  m_h_R->Fill(fabs(spR-seedR));
368  m_h_XY->Fill(XY);
369  }
370 
371  if(m_writeOut && it1.isMatch() && it3.isMatch() && it2.isMatch() && it1.barcode() == it3.barcode() && it1.barcode() == it2.barcode() && it1.barcode() != 0) {
372  m_h_R_t->Fill(fabs(spR-seedR));
373  m_h_XY_t->Fill(XY);
374 
375  }
376 
377  if( XY < m_dist_cut){
378  theSeed.push_back(it1);
379  theSeed.push_back(it2);
380  theSeed.push_back(it3);
381  seeds.push_back(theSeed);
382  }
383  } //end loop of layer2points
384  }
385  } // check that seed passes IP pointing constraint
386  } //end loop over layer3points
387  } //end loop over layer1points
388  }//end if statement
389  }
390 
391  void ClusterAnalysis::createSeedsTwoLayers(const std::vector<SpacePoint>& layer1Points,const std::vector<SpacePoint>& layer2Points,
392  std::vector<std::vector<SpacePoint>>& seeds){
393  for(const auto &it1: layer1Points){
394  for(const auto &it3: layer2Points){
395  if (TMath::Sign(1.,it1.z()) != TMath::Sign(1.,it3.z())) continue;
396  std::vector<SpacePoint> theSeed;
397  Cluster point = Cluster(it3.x()-it1.x(),it3.y()-it1.y(),it3.z()-it1.z(),false,0,0,false,0);
398  double angle = acos((point.x()*it1.x()+point.y()*it1.y()+point.z()*it1.z())/(point.rSph()*it1.rSph()));
399  if(angle > M_PI) angle = 2*M_PI - angle;
400  double dphi = fabs(point.phi()-it1.phi());
401  if(dphi > M_PI_2 && dphi < 3*M_PI_2) dphi -= M_PI;
402  if(dphi > 3*M_PI_2) dphi -= 2*M_PI;
403  double dtheta = fabs(point.theta()-it1.theta());
404  if (m_writeOut) {
405  m_h_phi12->Fill(fabs(dphi));
406  m_h_theta12->Fill(dtheta);
407  m_h_angle12->Fill(angle);
408  }
409  if(m_writeOut && it3.isMatch() && it1.isMatch() && it3.barcode() == it1.barcode() && it1.barcode() != 0 ) {
410  m_h_phi_t12->Fill(fabs(dphi));
411  m_h_theta_t12->Fill(dtheta);
412  m_h_angle_t12->Fill(angle);
413  }
414  if (angle < m_ang2_cut){
415  theSeed.push_back(it1);
416  theSeed.push_back(it3);
417  seeds.push_back(theSeed);
418  }
419  }//layer2Points
420  } //layer1Points
421  }
422 
423  std::vector<SpacePoint> ClusterAnalysis::createSpacePoints( const std::vector<Cluster*>& clust) {
424 
425  std::vector<std::pair<Cluster*,int>> phiClusters;
426  std::vector<std::pair<Cluster*,int>> etaClusters;
427  std::vector<SpacePoint> spacePoints;
428 
429  int citer(0);
430  for(auto *it: clust){
431  if(it->isPhi()) phiClusters.emplace_back(it,citer);
432  else etaClusters.emplace_back(it,citer);
433  citer++;
434  }
435  for(auto &pit: phiClusters){
436  for(auto &eit: etaClusters){
437  bool tbool = false;
438  if (eit.first->isMatch() && pit.first->isMatch() && eit.first->barcode() == pit.first->barcode()) tbool = true;
439  if(pit.first->phiIndex() == eit.first->phiIndex() && eit.first->isSideA() == pit.first->isSideA()) {
440  SpacePoint thePoint = SpacePoint(eit.first->eta(),pit.first->phi(),eit.first->z(),eit.first->techIndex(),eit.first->phiIndex(),tbool,eit.first->barcode(),eit.second,pit.second);
441  spacePoints.push_back(thePoint);
442  }
443  }
444  }
445  return spacePoints;
446  }
447 }
448 
ClusterSeg::Cluster::theta
double theta() const
Definition: MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:25
TGC
@ TGC
Definition: RegSelEnums.h:33
ClusterSeg::ClusterAnalysis::m_h_theta13
std::unique_ptr< TH1F > m_h_theta13
Definition: ClusterAnalysis.h:68
ClusterSeg::SpacePoint
Definition: MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:48
ClusterSeg::sortfunctionRPC
bool sortfunctionRPC(Cluster *i, Cluster *j)
Definition: ClusterAnalysis.cxx:24
ClusterSeg::ClusterAnalysis::m_h_numseeds
std::unique_ptr< TH1F > m_h_numseeds
Definition: ClusterAnalysis.h:106
ClusterSeg::ClusterAnalysis::m_h_angle
std::unique_ptr< TH1F > m_h_angle
Definition: ClusterAnalysis.h:55
ClusterSeg::Cluster::z
double z() const
Definition: MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:21
ClusterSeg::ClusterAnalysis::m_h_barcodes
std::unique_ptr< TH2F > m_h_barcodes
Definition: ClusterAnalysis.h:107
ClusterSeg::ClusterAnalysis::m_h_angle_t
std::unique_ptr< TH1F > m_h_angle_t
Definition: ClusterAnalysis.h:58
ClusterSeg::ClusterAnalysis::m_h_XY131
std::unique_ptr< TH1F > m_h_XY131
Definition: ClusterAnalysis.h:96
ClusterSeg::Cluster::x
double x() const
Definition: MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:19
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
ClusterSeg::ClusterAnalysis::m_h_rz
std::unique_ptr< TH2F > m_h_rz
Definition: ClusterAnalysis.h:50
ClusterSeg::ClusterNtuple::clean
static void clean(std::vector< Cluster * > &clusters)
Definition: ClusterNtuple.cxx:117
ClusterSeg::ClusterAnalysis::m_ang_cut
double m_ang_cut
Definition: ClusterAnalysis.h:44
ClusterSeg::ClusterAnalysis::createSpacePoints
static std::vector< SpacePoint > createSpacePoints(const std::vector< Cluster * > &clust)
Definition: ClusterAnalysis.cxx:423
ClusterSeg::ClusterAnalysis::createSeedsTwoLayers
void createSeedsTwoLayers(const std::vector< SpacePoint > &layer1Points, const std::vector< SpacePoint > &layer2Points, std::vector< std::vector< SpacePoint >> &seeds)
Definition: ClusterAnalysis.cxx:391
ClusterSeg::ClusterAnalysis::m_ncalls
int m_ncalls
Definition: ClusterAnalysis.h:41
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
tree
TChain * tree
Definition: tile_monitor.h:30
ClusterSeg::ClusterAnalysis::m_h_theta_t13
std::unique_ptr< TH1F > m_h_theta_t13
Definition: ClusterAnalysis.h:71
skel.it
it
Definition: skel.GENtoEVGEN.py:423
M_PI
#define M_PI
Definition: ActiveFraction.h:11
ClusterSeg::ClusterAnalysis::m_h_XY131_t
std::unique_ptr< TH1F > m_h_XY131_t
Definition: ClusterAnalysis.h:98
ClusterSeg::ClusterAnalysis::m_h_xy
std::unique_ptr< TH2F > m_h_xy
Definition: ClusterAnalysis.h:51
ClusterSeg::ClusterAnalysis::analyseWrite
void analyseWrite()
Definition: ClusterAnalysis.cxx:48
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
xAOD::SpacePoint
SpacePoint_v1 SpacePoint
Definition: Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/SpacePoint.h:12
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ClusterSeg::ClusterAnalysis::m_h_XY232
std::unique_ptr< TH1F > m_h_XY232
Definition: ClusterAnalysis.h:101
ClusterSeg::ClusterAnalysis::m_h_angle_t13
std::unique_ptr< TH1F > m_h_angle_t13
Definition: ClusterAnalysis.h:72
ClusterSeg::ClusterAnalysis::m_h_phi_t12
std::unique_ptr< TH1F > m_h_phi_t12
Definition: ClusterAnalysis.h:63
ClusterSeg::ClusterAnalysis::m_h_phi_t13
std::unique_ptr< TH1F > m_h_phi_t13
Definition: ClusterAnalysis.h:70
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
ClusterSeg::ClusterAnalysis::m_h_phi23
std::unique_ptr< TH1F > m_h_phi23
Definition: ClusterAnalysis.h:74
ClusterSeg
Definition: MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:12
ClusterSeg::ClusterAnalysis::m_h_XY122_t
std::unique_ptr< TH1F > m_h_XY122_t
Definition: ClusterAnalysis.h:94
ClusterSeg::ClusterAnalysis::m_h_corr
std::unique_ptr< TH2F > m_h_corr
Definition: ClusterAnalysis.h:52
ClusterSeg::ClusterAnalysis::m_h_phi_t23
std::unique_ptr< TH1F > m_h_phi_t23
Definition: ClusterAnalysis.h:77
ClusterSeg::ClusterAnalysis::m_h_XY121_t
std::unique_ptr< TH1F > m_h_XY121_t
Definition: ClusterAnalysis.h:93
ClusterSeg::Cluster::rCyl
double rCyl() const
Definition: MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:23
ClusterSeg::ClusterAnalysis::m_h_XY133
std::unique_ptr< TH1F > m_h_XY133
Definition: ClusterAnalysis.h:97
ClusterSeg::ClusterAnalysis::analyse
std::vector< std::vector< SpacePoint > > analyse(const std::vector< Cluster * > &clust)
Definition: ClusterAnalysis.cxx:236
ClusterSeg::ClusterAnalysis::m_dist_cut
double m_dist_cut
Definition: ClusterAnalysis.h:46
ClusterSeg::Cluster::y
double y() const
Definition: MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:20
ClusterSeg::ClusterAnalysis::m_h_sizeL2
std::unique_ptr< TH1F > m_h_sizeL2
Definition: ClusterAnalysis.h:86
ClusterSeg::ClusterAnalysis::m_h_angle13
std::unique_ptr< TH1F > m_h_angle13
Definition: ClusterAnalysis.h:69
ClusterSeg::ClusterAnalysis::createTGCSeeds
std::vector< std::vector< SpacePoint > > createTGCSeeds(const std::vector< SpacePoint > &points)
Definition: ClusterAnalysis.cxx:245
PlotCalibFromCool.nentries
nentries
Definition: PlotCalibFromCool.py:798
ClusterSeg::ClusterAnalysis::m_h_XY133_t
std::unique_ptr< TH1F > m_h_XY133_t
Definition: ClusterAnalysis.h:99
ClusterSeg::ClusterAnalysis::m_h_theta_t
std::unique_ptr< TH1F > m_h_theta_t
Definition: ClusterAnalysis.h:57
ClusterSeg::ClusterAnalysis::m_h_sizeL3
std::unique_ptr< TH1F > m_h_sizeL3
Definition: ClusterAnalysis.h:87
ClusterSeg::ClusterAnalysis::createRPCSeeds
std::vector< std::vector< SpacePoint > > createRPCSeeds(const std::vector< SpacePoint > &points)
Definition: ClusterAnalysis.cxx:291
lumiFormat.i
int i
Definition: lumiFormat.py:92
ClusterSeg::ClusterAnalysis::m_h_angle_t12
std::unique_ptr< TH1F > m_h_angle_t12
Definition: ClusterAnalysis.h:65
ClusterSeg::ClusterNtuple::init
void init()
Definition: ClusterNtuple.cxx:121
DetDescrDictionaryDict::it1
std::vector< HWIdentifier >::iterator it1
Definition: DetDescrDictionaryDict.h:17
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ClusterSeg::ClusterAnalysis::m_h_angle23
std::unique_ptr< TH1F > m_h_angle23
Definition: ClusterAnalysis.h:76
angle
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
Definition: TRTDetectorFactory_Full.cxx:73
ClusterSeg::Cluster
Definition: MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:14
ClusterSeg::ClusterAnalysis::m_h_XY_t
std::unique_ptr< TH1F > m_h_XY_t
Definition: ClusterAnalysis.h:84
ClusterSeg::ClusterAnalysis::m_h_R
std::unique_ptr< TH1F > m_h_R
Definition: ClusterAnalysis.h:81
ClusterSeg::ClusterAnalysis::m_h_phi12
std::unique_ptr< TH1F > m_h_phi12
Definition: ClusterAnalysis.h:60
ClusterSeg::ClusterAnalysis::m_h_sizeL1L3
std::unique_ptr< TH1F > m_h_sizeL1L3
Definition: ClusterAnalysis.h:88
ClusterSeg::ClusterAnalysis::m_h_theta23
std::unique_ptr< TH1F > m_h_theta23
Definition: ClusterAnalysis.h:75
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
ClusterSeg::ClusterAnalysis::m_h_miss_RZ
std::unique_ptr< TH2F > m_h_miss_RZ
Definition: ClusterAnalysis.h:48
ClusterSeg::ClusterAnalysis::m_h_XY233_t
std::unique_ptr< TH1F > m_h_XY233_t
Definition: ClusterAnalysis.h:104
ClusterSeg::ClusterAnalysis::m_h_phi13
std::unique_ptr< TH1F > m_h_phi13
Definition: ClusterAnalysis.h:67
ClusterSeg::ClusterAnalysis::m_tree
TTree * m_tree
Definition: ClusterAnalysis.h:39
ClusterSeg::ClusterAnalysis::m_h_XY122
std::unique_ptr< TH1F > m_h_XY122
Definition: ClusterAnalysis.h:92
ClusterSeg::Cluster::rSph
double rSph() const
Definition: MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:22
ClusterSeg::sortfunctionTGC
bool sortfunctionTGC(Cluster *i, Cluster *j)
Definition: ClusterAnalysis.cxx:23
ClusterSeg::ClusterAnalysis::m_h_sizeL1
std::unique_ptr< TH1F > m_h_sizeL1
Definition: ClusterAnalysis.h:85
ClusterSeg::ClusterAnalysis::m_h_XY
std::unique_ptr< TH1F > m_h_XY
Definition: ClusterAnalysis.h:82
ClusterAnalysis.h
ClusterSeg::Cluster::phi
double phi() const
Definition: MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLinearSegmentMakerUtilities/MuonLinearSegmentMakerUtilities/Cluster.h:24
ClusterSeg::ClusterAnalysis::m_h_theta_t12
std::unique_ptr< TH1F > m_h_theta_t12
Definition: ClusterAnalysis.h:64
ClusterSeg::ClusterAnalysis::m_ntuple
ClusterNtuple m_ntuple
Definition: ClusterAnalysis.h:40
ClusterSeg::ClusterNtuple::read
bool read(std::vector< Cluster * > &clusters)
Definition: ClusterNtuple.cxx:102
ClusterSeg::ClusterAnalysis::m_h_phi
std::unique_ptr< TH1F > m_h_phi
Definition: ClusterAnalysis.h:53
ClusterSeg::ClusterAnalysis::m_h_theta
std::unique_ptr< TH1F > m_h_theta
Definition: ClusterAnalysis.h:54
ClusterSeg::ClusterAnalysis::m_ang2_cut
double m_ang2_cut
Definition: ClusterAnalysis.h:45
ClusterSeg::ClusterAnalysis::m_h_angle_t23
std::unique_ptr< TH1F > m_h_angle_t23
Definition: ClusterAnalysis.h:79
DEBUG
#define DEBUG
Definition: page_access.h:11
ClusterSeg::ClusterAnalysis::ClusterAnalysis
ClusterAnalysis()
Definition: ClusterAnalysis.cxx:26
ClusterSeg::ClusterAnalysis::m_h_R_t
std::unique_ptr< TH1F > m_h_R_t
Definition: ClusterAnalysis.h:83
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
ClusterSeg::ClusterAnalysis::m_h_XY121
std::unique_ptr< TH1F > m_h_XY121
Definition: ClusterAnalysis.h:91
ClusterSeg::ClusterAnalysis::m_writeOut
bool m_writeOut
Definition: ClusterAnalysis.h:43
ClusterSeg::ClusterAnalysis::createSeedsAllLayers
void createSeedsAllLayers(const std::vector< SpacePoint > &layer1Points, const std::vector< SpacePoint > &layer2Points, const std::vector< SpacePoint > &layer3Points, std::vector< std::vector< SpacePoint >> &seeds)
Definition: ClusterAnalysis.cxx:325
ClusterSeg::ClusterAnalysis::m_h_sizeL1L2L3
std::unique_ptr< TH1F > m_h_sizeL1L2L3
Definition: ClusterAnalysis.h:89
ClusterSeg::ClusterAnalysis::m_h_theta12
std::unique_ptr< TH1F > m_h_theta12
Definition: ClusterAnalysis.h:61
ClusterSeg::ClusterAnalysis::m_h_XY233
std::unique_ptr< TH1F > m_h_XY233
Definition: ClusterAnalysis.h:102
ClusterSeg::ClusterAnalysis::m_h_phi_t
std::unique_ptr< TH1F > m_h_phi_t
Definition: ClusterAnalysis.h:56
ClusterSeg::ClusterAnalysis::m_h_theta_t23
std::unique_ptr< TH1F > m_h_theta_t23
Definition: ClusterAnalysis.h:78
ClusterSeg::ClusterAnalysis::m_h_miss_XY
std::unique_ptr< TH2F > m_h_miss_XY
Definition: ClusterAnalysis.h:49
ClusterSeg::ClusterAnalysis::m_h_angle12
std::unique_ptr< TH1F > m_h_angle12
Definition: ClusterAnalysis.h:62
ClusterSeg::ClusterNtuple::initForRead
void initForRead(TTree &tree)
Definition: ClusterNtuple.cxx:38
ClusterSeg::ClusterAnalysis::m_h_XY232_t
std::unique_ptr< TH1F > m_h_XY232_t
Definition: ClusterAnalysis.h:103