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;
198 Long64_t nentries =
m_tree->GetEntries();
200 for( Long64_t evt=0;evt<nentries;++evt ){
201 auto retval =
m_tree->LoadTree(evt);
202 if (retval < 0)
continue;
206 if (log.level()<=MSG::DEBUG && evt % 100 == 0) log << MSG::DEBUG <<
"event " << evt <<
"/" << nentries <<
endmsg;
208 std::vector<Cluster*> clust;
216 if(thePoints.empty())
continue;
217 std::vector<std::vector<SpacePoint>> seeds =
createTGCSeeds(thePoints);
223 if(thePoints.empty())
continue;
224 std::vector<std::vector<SpacePoint>> seeds =
createRPCSeeds(thePoints);
228 for(
auto &it: thePoints){
229 m_h_rz->Fill(fabs(it.z()),it.rCyl());
230 m_h_xy->Fill(it.x(),it.y());
248 std::vector<SpacePoint> layer1Points;
249 std::vector<SpacePoint> layer2Points;
250 std::vector<SpacePoint> layer3Points;
251 std::vector<std::vector<SpacePoint>> seeds;
253 for(
const auto &it: points){
260 int L1size = layer1Points.size();
261 int L2size = layer2Points.size();
262 int L3size = layer3Points.size();
271 if(
m_writeOut && (layer1Points.empty() || layer2Points.empty() || layer3Points.empty())){
272 if(!layer1Points.empty()){
273 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());}
275 if(!layer2Points.empty()){
276 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());}
278 if(!layer3Points.empty()){
279 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());}
284 if(seeds.size() < 25){
285 if(!layer1Points.empty() && !layer2Points.empty() && layer3Points.empty())
createSeedsTwoLayers(layer1Points,layer2Points,seeds);
286 if(!layer3Points.empty() && !layer1Points.empty() && layer2Points.empty())
createSeedsTwoLayers(layer1Points,layer3Points,seeds);
287 if(!layer2Points.empty() && !layer3Points.empty() && layer1Points.empty())
createSeedsTwoLayers(layer2Points,layer3Points,seeds);
294 std::vector<SpacePoint> layer1Points;
295 std::vector<SpacePoint> layer2Points;
296 std::vector<std::vector<SpacePoint>> seeds;
298 for(
const auto &it: points){
303 int L1size = layer1Points.size();
304 int L2size = layer2Points.size();
311 if(
m_writeOut && (layer1Points.empty() || layer2Points.empty())){
312 if(!layer1Points.empty()){
313 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());}
315 if(!layer2Points.empty()){
316 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());}
320 if(seeds.size() < 25 && !layer1Points.empty() && !layer2Points.empty())
createSeedsTwoLayers(layer1Points,layer2Points,seeds);
327 const std::vector<SpacePoint>& layer2Points,
328 const std::vector<SpacePoint>& layer3Points,
329 std::vector<std::vector<SpacePoint>>& seeds){
331 if(!layer1Points.empty() && !layer3Points.empty()){
332 for(
const auto &it1: layer1Points){
333 for(
const auto &it3: layer3Points){
334 if (TMath::Sign(1.,it1.z()) != TMath::Sign(1.,it3.z()))
continue;
335 std::vector<SpacePoint> theSeed;
336 Cluster point =
Cluster(it3.x()-it1.x(),it3.y()-it1.y(),it3.z()-it1.z(),
false,0,0,
false,0);
337 double angle = acos((point.
x()*it1.x()+point.
y()*it1.y()+point.
z()*it1.z())/(point.
rSph()*it1.rSph()));
339 double dphi = fabs(point.
phi()-it1.phi());
340 if(dphi > M_PI_2 && dphi < 3*M_PI_2) dphi -=
M_PI;
341 if(dphi > 3*M_PI_2) dphi -= 2*
M_PI;
342 double dtheta = fabs(point.
theta()-it1.theta());
349 if(
m_writeOut && it3.isMatch() && it1.isMatch() && it3.barcode() == it1.barcode() && it1.barcode() != 0 ) {
357 if(!layer2Points.empty()){
358 for(
const auto &it2: layer2Points){
359 std::vector<SpacePoint> theSeed;
360 if (TMath::Sign(1.,it2.z()) != TMath::Sign(1.,it1.z()))
continue;
361 double seedR = (it2.z()-it1.z())*tan(point.
theta()) + it1.rCyl();
362 double spR = it2.rCyl();
363 double t = (it2.z() - it1.z())/point.
z();
364 double seedX = it1.x() + t*point.
x();
365 double seedY = it1.y() + t*point.
y();
366 double XY = sqrt(
pow(it2.x()-seedX,2)+
pow(it2.y()-seedY,2));
368 m_h_R->Fill(fabs(spR-seedR));
372 if(
m_writeOut && it1.isMatch() && it3.isMatch() && it2.isMatch() && it1.barcode() == it3.barcode() && it1.barcode() == it2.barcode() && it1.barcode() != 0) {
373 m_h_R_t->Fill(fabs(spR-seedR));
379 theSeed.push_back(it1);
380 theSeed.push_back(it2);
381 theSeed.push_back(it3);
382 seeds.push_back(std::move(theSeed));
393 std::vector<std::vector<SpacePoint>>& seeds){
394 for(
const auto &it1: layer1Points){
395 for(
const auto &it3: layer2Points){
396 if (TMath::Sign(1.,it1.z()) != TMath::Sign(1.,it3.z()))
continue;
397 std::vector<SpacePoint> theSeed;
398 Cluster point =
Cluster(it3.x()-it1.x(),it3.y()-it1.y(),it3.z()-it1.z(),
false,0,0,
false,0);
399 double angle = acos((point.
x()*it1.x()+point.
y()*it1.y()+point.
z()*it1.z())/(point.
rSph()*it1.rSph()));
401 double dphi = fabs(point.
phi()-it1.phi());
402 if(dphi > M_PI_2 && dphi < 3*M_PI_2) dphi -=
M_PI;
403 if(dphi > 3*M_PI_2) dphi -= 2*
M_PI;
404 double dtheta = fabs(point.
theta()-it1.theta());
410 if(
m_writeOut && it3.isMatch() && it1.isMatch() && it3.barcode() == it1.barcode() && it1.barcode() != 0 ) {
416 theSeed.push_back(it1);
417 theSeed.push_back(it3);
418 seeds.push_back(std::move(theSeed));
426 std::vector<std::pair<Cluster*,int>> phiClusters;
427 std::vector<std::pair<Cluster*,int>> etaClusters;
428 std::vector<SpacePoint> spacePoints;
431 for(
auto *it: clust){
432 if(it->isPhi()) phiClusters.emplace_back(it,citer);
433 else etaClusters.emplace_back(it,citer);
436 for(
auto &pit: phiClusters){
437 for(
auto &eit: etaClusters){
439 if (eit.first->isMatch() && pit.first->isMatch() && eit.first->barcode() == pit.first->barcode()) tbool =
true;
440 if(pit.first->phiIndex() == eit.first->phiIndex() && eit.first->isSideA() == pit.first->isSideA()) {
441 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);
442 spacePoints.push_back(thePoint);