36 for (Int_t iPot=0; iPot<
RPOTSCNT; iPot++)
42 m_faMD[iPot][iLayer][iFiber] = faMD[iPot][iLayer][iFiber];
43 m_fbMD[iPot][iLayer][iFiber] = fbMD[iPot][iLayer][iFiber];
57 std::fill_n(&
m_fOvU[0],
sizeof(
m_fOvU)/
sizeof(Float_t), -9999.0);
58 std::fill_n(&
m_fOvV[0],
sizeof(
m_fOvV)/
sizeof(Float_t), -9999.0);
61 return StatusCode::SUCCESS;
71 std::list<MDHIT>::const_iterator iter;
72 for (iter=ListMDHits.begin(); iter!=ListMDHits.end(); ++iter)
79 m_MapLayers.insert(std::pair<int, FIBERS>((*iter).iPlate, structFibers));
80 m_MapLayers[(*iter).iPlate].ListFibers.push_back((*iter).iFiber);
82 else m_MapLayers[(*iter).iPlate].ListFibers.push_back((*iter).iFiber);
87 std::vector<Float_t> b_p, b_n;
88 std::vector<Float_t> Ov_p, Ov_n;
89 std::vector<int> Num_p, Num_n;
93 std::vector<Int_t> GapsID;
100 Reco_Track(b_p, b_n, Ov_p, Ov_n, Num_p, Num_n, FSel_n, FSel_p, Gaps, GapsID, FGaps_p, FGaps_n, Gap_Fib_p, Gap_Fib_n);
103 for (UInt_t
i=0;
i< b_p.size();
i++)
141 return StatusCode::SUCCESS;
152 return StatusCode::SUCCESS;
161 Float_t fXInter, fYInter;
167 for (
int & iBin : iOver)
176 iIndex = 2*iLayer+iFiberSide;
177 for (intIter=
m_MapLayers[iIndex].ListFibers.begin(); intIter!=
m_MapLayers[iIndex].ListFibers.end(); ++intIter)
184 fFibCen = (fYInter-fSign*fXInter)/sqrt(2.0);
187 for (Int_t iBin=0; iBin<480; iBin++)
189 iOver[(
int)((fFibCen-0.24)*1000)+iBin+36000]++;
201 std::vector<int> iSizePlateau;
209 for (Int_t
i=0;
i<72000;
i++)
211 if (iOver[
i]>iNumFib) iNumFib=iOver[
i];
217 for (Int_t
i=0;
i<72000;
i++)
219 if (iOver[
i]==iNumFib)
221 iSizePlateau.push_back(
i);
226 p_min = -36.0 + Float_t(iSizePlateau.front())*1
e-3;
227 p_tmp_min = iSizePlateau.front();
229 p_max = -36.0 + Float_t(iSizePlateau.back())*1
e-3;
233 Int_t full_width = iSizePlateau.size();
235 for (Int_t
i=0;
i<full_width;
i++)
237 if (iSizePlateau[full_width-
i-1]-p_tmp_min < 500)
240 p_max = -36.0 + Float_t(iSizePlateau[full_width-
i-1])*1
e-3;
248 fb = fbRef+(p_min+p_max)/sqrt(2.0);
265 Float_t b_pos, b_neg;
266 Float_t
x,
y, x_tmp, y_tmp;
268 Float_t dist_x, dist_y;
284 x= (b_pos-b_neg)/2.0;
285 y= (b_neg+b_pos)/2.0;
287 for (
int & iLayer : iFSel) iLayer = 9999;
297 iIndex = 2*iLayer+iFiberSide;
298 for (intIter=
m_MapLayers[iIndex].ListFibers.begin(); intIter!=
m_MapLayers[iIndex].ListFibers.end(); ++intIter)
305 dist_x = TMath::Abs(
x-x_tmp);
306 dist_y = TMath::Abs(
y-y_tmp);
308 dist_full = sqrt(dist_x*dist_x+dist_y*dist_y);
309 fib_dist = sqrt(TMath::Power((dist_x+dist_y)/2.0,2)-TMath::Power(dist_full/2.0,2));
311 if (fib_dist <= min_dist)
316 iFSel[iLayer] = gFib;
328 std::vector<Float_t> &Ov_p, std::vector<Float_t> &Ov_n,
329 std::vector<int> &Num_p, std::vector<int> &Num_n,
336 Int_t Over_copy[72000];
339 Float_t b_ref_p = -127.0;
340 Float_t b_ref_n = -127.0;
349 Float_t b_pos_silent;
350 Float_t b_neg_silent;
351 Float_t b_pos_active;
352 Float_t b_neg_active;
355 memset(&FSel_n, 0,
sizeof(Int_t));
356 memset(&FSel_p, 0,
sizeof(Int_t));
357 memset(&FGaps_n,
false,
sizeof(Bool_t));
358 memset(&FGaps_p,
false,
sizeof(Bool_t));
359 memset(&Gap_Fib_n, 0,
sizeof(Int_t));
360 memset(&Gap_Fib_p, 0,
sizeof(Int_t));
361 std::fill_n(&Gap_Fib_n[0][0],
sizeof(Gap_Fib_n)/
sizeof(Int_t), 9999);
362 std::fill_n(&Gap_Fib_p[0][0],
sizeof(Gap_Fib_p)/
sizeof(Int_t), 9999);
380 Find_Proj(Over_p, b_ref_n, b_pos, OvU, NumU);
389 Find_Proj(Over_n, b_ref_p, b_neg, OvV, NumV);
397 Find_Proj(Over_p, b_neg, b_pos, OvU, NumU);
401 Find_Proj(Over_n, b_pos, b_neg, OvV, NumV);
407 Find_Proj(Over_p, b_neg, b_pos, OvU, NumU);
411 Find_Proj(Over_n, b_pos, b_neg, OvV, NumV);
414 b_p.push_back(b_pos);
416 Num_p.push_back(NumU);
418 b_n.push_back(b_neg);
420 Num_n.push_back(NumV);
434 Over_copy[
bin]=Over_p[
bin];
436 Gaps[0][0] =
Silent_Gap(Over_copy, b_neg, b_pos, FSel_p, FGaps_p, Gap_Fib_p, OvU, (Int_t)0);
437 Find_Proj(Over_copy, b_neg, b_pos_silent, OvU, NumU);
441 Over_copy[
bin]=Over_n[
bin];
443 Gaps[1][0] =
Silent_Gap(Over_copy, b_pos, b_neg, FSel_n, FGaps_n, Gap_Fib_n, OvV, 1);
444 Find_Proj(Over_copy, b_pos, b_neg_silent, OvV, NumV);
446 if (Gaps[0][0]>0 || Gaps[1][0]>0)
448 b_p.push_back(b_pos_silent);
450 Num_p.push_back(NumU);
452 b_n.push_back(b_neg_silent);
454 Num_n.push_back(NumV);
462 Over_copy[
bin]=Over_p[
bin];
464 Gaps[0][1] =
Active_Gap(0,Over_copy, b_neg, b_pos, FSel_p, OvU, 0);
465 Find_Proj(Over_copy, b_neg, b_pos_active, OvU, NumU);
469 Over_copy[
bin]=Over_n[
bin];
471 Gaps[1][1] =
Active_Gap(1,Over_copy, b_pos, b_neg, FSel_n, OvV, 1);
472 Find_Proj(Over_copy, b_pos, b_neg_active, OvV, NumV);
474 if (Gaps[0][1]>0 || Gaps[1][1]>0)
476 b_p.push_back(b_pos_active);
478 Num_p.push_back(NumU);
480 b_n.push_back(b_neg_active);
482 Num_n.push_back(NumV);
488 if ((Gaps[0][0]>0 || Gaps[1][0]>0) && (Gaps[0][1]>0 || Gaps[1][1]>0))
492 Over_copy[
bin]=Over_p[
bin];
494 Silent_Gap(Over_copy, b_neg, b_pos, FSel_p, FG_p, G_F_p, OvU, 0);
495 Active_Gap(0,Over_copy, b_neg, b_pos, FSel_p, OvU, 0);
496 Find_Proj(Over_copy, b_neg, b_pos_active, OvU, NumU);
500 Over_copy[
bin]=Over_n[
bin];
502 Silent_Gap(Over_copy, b_pos, b_neg, FSel_n, FG_n, G_F_n, OvV, 1);
503 Active_Gap(1,Over_copy, b_pos, b_neg, FSel_n, OvV, 1);
504 Find_Proj(Over_copy, b_pos, b_neg_active, OvV, NumV);
506 b_p.push_back(b_pos_active);
508 Num_p.push_back(NumU);
510 b_n.push_back(b_neg_active);
512 Num_n.push_back(NumV);
524 iNumU[iTrack] =
m_iNU[iTrack];
525 iNumV[iTrack] =
m_iNV[iTrack];
526 fOvU[iTrack] =
m_fOvU[iTrack];
527 fOvV[iTrack] =
m_fOvV[iTrack];
540 Float_t fXInter, fYInter;
541 Float_t fFibCen, fFibCen0, fFibCen1;
543 Float_t b_center, gap_size;
553 if (FSel[iLayer]==9999)
555 if (iSideFlag==0 || (iSideFlag==1 && iLayer!=4))
561 fFibCen0 = (fYInter-fSign*fXInter)/sqrt(2.);
565 fFibCen1 = (fYInter-fSign*fXInter)/sqrt(2.);
567 b_center = (fFibCen1+fFibCen0)/2.;
569 fXInter= fSign*(b_ref-b_rec)/2.;
570 fYInter= (b_ref+b_rec)/2.-b_ref;
571 fFibCen = (fYInter-fSign*fXInter)/sqrt(2.);
573 gap_size = TMath::Abs(fFibCen1-fFibCen0)-0.480;
574 Gap_Width =
int(gap_size*1000.);
576 if (((b_center+gap_size/2.)<fFibCen+OverLap/2. && (b_center+gap_size/2.)> fFibCen-OverLap/2.) || ((b_center-gap_size/2.)>fFibCen-OverLap/2. && (b_center-gap_size/2.)<fFibCen+OverLap/2.))
581 Gap_Fib[iLayer][0] = iFiber;
582 Gap_Fib[iLayer][1] = iFiber+1;
586 Over[(Int_t)((b_center-gap_size/2.)*1000)+
bin+36000]++;
600 Float_t fXInter, fYInter;
601 Float_t fFibCen, fFibCen0, fFibCen1;
603 Float_t b_center, gap_size;
618 iIndex = 2*iLayer+iFiberSide;
619 if (FSel[iLayer]!=9999)
626 if (*iHit==FSel[iLayer]+1) bHit[0]=
true;
627 if (*iHit==FSel[iLayer]-1) bHit[1]=
true;
630 for (UInt_t j=0;j<2;j++)
637 fXInter= fSign*(b_ref-
m_fbMD[
m_iRPot][iLayer*2+iSideFlag][FSel[iLayer]])/(1+fSign*
m_faMD[
m_iRPot][iLayer*2+iSideFlag][FSel[iLayer]]);
639 fFibCen0 = (fYInter-fSign*fXInter)/sqrt(2.);
641 fXInter= fSign*(b_ref-
m_fbMD[
m_iRPot][iLayer*2+iSideFlag][FSel[iLayer]+shift])/(1+fSign*
m_faMD[
m_iRPot][iLayer*2+iSideFlag][FSel[iLayer]+shift]);
642 fYInter= (fSign*
m_faMD[
m_iRPot][iLayer*2+iSideFlag][FSel[iLayer]+shift]*b_ref+
m_fbMD[
m_iRPot][iLayer*2+iSideFlag][FSel[iLayer]+shift])/(1+fSign*
m_faMD[
m_iRPot][iLayer*2+iSideFlag][FSel[iLayer]+shift])-b_ref;
643 fFibCen1 = (fYInter-fSign*fXInter)/sqrt(2.);
645 b_center = (fFibCen1+fFibCen0)/2.;
647 fXInter= fSign*(b_ref-b_rec)/2.;
648 fYInter= (b_ref+b_rec)/2.-b_ref;
649 fFibCen = (fYInter-fSign*fXInter)/sqrt(2.);
651 gap_size = TMath::Abs(fFibCen1-fFibCen0)-0.480;
652 Gap_Width =
int(gap_size*1000.);
654 if (((b_center+gap_size/2.)<fFibCen+OverLap/2. && (b_center+gap_size/2.)> fFibCen-OverLap/2.) || ((b_center-gap_size/2.)>fFibCen-OverLap/2. && (b_center-gap_size/2.)<fFibCen+OverLap/2.))
660 Over[(Int_t)((b_center-gap_size/2.)*1000)+
bin+36000]++;