9 #include "GaudiKernel/MsgStream.h"
50 m_h_barcodes = std::make_unique<TH2F>(
"barcodes",
"",1000,0,1000,1000,0,1000);
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]");
64 m_h_miss_RZ = std::make_unique<TH2F>(
"rz_missing_spacePoints",
"",1000,12000,16000,3000,1000,13000);
67 m_h_miss_XY = std::make_unique<TH2F>(
"xy_missing_spacePoints",
"",3000,-13000,13000,3000,-13000,13000);
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");
78 m_h_angle->GetXaxis()->SetTitle(
"#theta [rad]");
79 m_h_angle->GetYaxis()->SetTitle(
"Number of Entries");
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");
89 m_h_angle12->GetYaxis()->SetTitle(
"Number of Entries");
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");
99 m_h_angle13->GetYaxis()->SetTitle(
"Number of Entries");
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");
109 m_h_angle23->GetYaxis()->SetTitle(
"Number of Entries");
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");
124 m_h_numseeds = std::make_unique<TH1F>(
"num_seeds",
"",200,0,200);
126 m_h_numseeds->GetYaxis()->SetTitle(
"Number of Entries");
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");
136 m_h_angle_t->GetYaxis()->SetTitle(
"Number of Entries");
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]");
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]");
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]");
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");
178 m_h_sizeL1L3 = std::make_unique<TH1F>(
"sizeL1L3",
"",10000,0,10000);
179 m_h_sizeL1L2L3 = std::make_unique<TH1F>(
"sizeL1L2L3",
"",20000,0,20000);
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);
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);
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);
196 std::vector<SpacePoint> thePoints;
207 std::vector<Cluster*> clust;
215 if(thePoints.empty())
continue;
216 std::vector<std::vector<SpacePoint>> seeds =
createTGCSeeds(thePoints);
222 if(thePoints.empty())
continue;
223 std::vector<std::vector<SpacePoint>> seeds =
createRPCSeeds(thePoints);
227 for(
auto &
it: thePoints){
237 std::vector<std::vector<SpacePoint>> sPoints;
239 if(thePoints.empty())
return sPoints;
247 std::vector<SpacePoint> layer1Points;
248 std::vector<SpacePoint> layer2Points;
249 std::vector<SpacePoint> layer3Points;
250 std::vector<std::vector<SpacePoint>> seeds;
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);
259 int L1size = layer1Points.size();
260 int L2size = layer2Points.size();
261 int L3size = layer3Points.size();
270 if(
m_writeOut && (layer1Points.empty() || layer2Points.empty() || layer3Points.empty())){
271 if(!layer1Points.empty()){
274 if(!layer2Points.empty()){
277 if(!layer3Points.empty()){
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);
293 std::vector<SpacePoint> layer1Points;
294 std::vector<SpacePoint> layer2Points;
295 std::vector<std::vector<SpacePoint>> seeds;
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);
302 int L1size = layer1Points.size();
303 int L2size = layer2Points.size();
310 if(
m_writeOut && (layer1Points.empty() || layer2Points.empty())){
311 if(!layer1Points.empty()){
314 if(!layer2Points.empty()){
319 if(seeds.size() < 25 && !layer1Points.empty() && !layer2Points.empty())
createSeedsTwoLayers(layer1Points,layer2Points,seeds);
326 const std::vector<SpacePoint>& layer2Points,
327 const std::vector<SpacePoint>& layer3Points,
328 std::vector<std::vector<SpacePoint>>& seeds){
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;
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());
348 if(
m_writeOut && it3.isMatch() &&
it1.isMatch() && it3.barcode() ==
it1.barcode() &&
it1.barcode() != 0 ) {
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;
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));
367 m_h_R->Fill(fabs(spR-seedR));
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));
378 theSeed.push_back(
it1);
379 theSeed.push_back(it2);
380 theSeed.push_back(it3);
381 seeds.push_back(theSeed);
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;
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());
409 if(
m_writeOut && it3.isMatch() &&
it1.isMatch() && it3.barcode() ==
it1.barcode() &&
it1.barcode() != 0 ) {
415 theSeed.push_back(
it1);
416 theSeed.push_back(it3);
417 seeds.push_back(theSeed);
425 std::vector<std::pair<Cluster*,int>> phiClusters;
426 std::vector<std::pair<Cluster*,int>> etaClusters;
427 std::vector<SpacePoint> spacePoints;
430 for(
auto *
it: clust){
431 if(
it->isPhi()) phiClusters.emplace_back(
it,citer);
432 else etaClusters.emplace_back(
it,citer);
435 for(
auto &pit: phiClusters){
436 for(
auto &eit: etaClusters){
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);