361 Log(3,
"EdbShowAlg_GS::FindPairs",
"FindPairs()");
364 Int_t RecoShowerArrayN=0;
365 TArrayI* SegmentPIDArray =
new TArrayI(9999);
366 TArrayI* SegmentIDArray =
new TArrayI(9999);
367 TArrayI* Segment2PIDArray =
new TArrayI(9999);
368 TArrayI* Segment2IDArray =
new TArrayI(9999);
371 Float_t x_av,y_av,z_av,tx_av,ty_av,distZ;
374 Float_t IP_Pair_To_InBT=0;
375 Int_t IP_Pair_To_InBT_SegSmaller=0;
378 if (
NULL==InitiatorBT) {
381 InBT->
SetX(pat->
X());
382 InBT->
SetY(pat->
Y());
383 InBT->
SetZ(pat->
Z());
386 InBT->
SetMC(-999,-999);
387 cout <<
"WARNING EdbShowAlg_GS::FindPairs InBT==NULL. Create a dummy InBT:" << endl;
420 Int_t pat_one_bt_cnt_max,pat_two_bt_cnt_max=0;
424 for (Int_t pat_one_cnt=0; pat_one_cnt<
npat; ++pat_one_cnt) {
429 distZ=pat_one->
Z()-InBT->
Z();
431 cout <<
"EdbShowerAlg_GS::FindPairs Check if dist Z to vtx (BT) is ok: distZ=" << distZ << endl;
434 if (distZ<0)
continue;
436 if (
gEDBDEBUGLEVEL>2) cout <<
"Searching patterns: pat_one_cnt=" << pat_one_cnt <<
" pat_one->Z() = " << pat_one->
Z() <<
" pat_one_bt_cnt_max= "<< pat_one_bt_cnt_max <<endl;
439 for (Int_t pat_two_cnt=0; pat_two_cnt<
npat; ++pat_two_cnt) {
442 if (TMath::Abs(pat_one_cnt-pat_two_cnt)>
eParaValue[5])
continue;
448 if (
gEDBDEBUGLEVEL>2) cout <<
" Searching patterns: pat_two_cnt=" << pat_two_cnt <<
" pat_two->Z() = " << pat_two->
Z() <<
" pat_two_bt_cnt_max= "<< pat_two_bt_cnt_max <<endl;
450 for (Int_t pat_one_bt_cnt=0; pat_one_bt_cnt<pat_one_bt_cnt_max; ++pat_one_bt_cnt) {
453 Float_t IP_Pair_To_InBT_Seg =
CalcIP(Segment, InBT->
X(),InBT->
Y(),InBT->
Z());
458 for (Int_t pat_two_bt_cnt=0; pat_two_bt_cnt<pat_two_bt_cnt_max; ++pat_two_bt_cnt) {
461 if (Segment2==Segment)
continue;
462 if (Segment2->
ID()==Segment->
ID()&&Segment2->
PID()==Segment->
PID())
continue;
465 if (
CheckPairDuplications(Segment->
PID(),Segment->
ID(),Segment2->
PID(),Segment2->
ID(), SegmentPIDArray,SegmentIDArray,Segment2PIDArray,Segment2IDArray, RecoShowerArrayN))
continue;
476 if (Segment->
MCEvt()>0&&Segment2->
MCEvt()>0) {
477 if ((Segment2->
Flag()+Segment->
Flag())!=0)
continue;
489 distZ=Segment->
Z()-InBT->
Z();
492 x_av=Segment2->
X()+(Segment->
X()-Segment2->
X())/2.0;
493 y_av=Segment2->
Y()+(Segment->
Y()-Segment2->
Y())/2.0;
494 z_av=Segment2->
Z()+(Segment->
Z()-Segment2->
Z())/2.0;
495 tx_av=Segment2->
TX()+(Segment->
TX()-Segment2->
TX())/2.0;
496 ty_av=Segment2->
TY()+(Segment->
TY()-Segment2->
TY())/2.0;
497 Segment_Sum->
SetX(x_av);
498 Segment_Sum->
SetY(y_av);
499 Segment_Sum->
SetTX(tx_av);
500 Segment_Sum->
SetTY(ty_av);
501 Segment_Sum->
SetZ(z_av);
505 Float_t IP_Pair_To_InBT_Seg2 =
CalcIP(Segment2, InBT->
X(),InBT->
Y(),InBT->
Z());
506 if (IP_Pair_To_InBT_Seg2>
eParaValue[0])
continue;
510 Float_t IP_Pair_To_InBT_SegSum=
CalcIP(Segment_Sum, InBT->
X(),InBT->
Y(),InBT->
Z());
511 Float_t IP_Pair_To_InBT_SegSmaller=0;
518 if ( IP_Pair_To_InBT_Seg>IP_Pair_To_InBT_Seg2 ) {
519 IP_Pair_To_InBT_SegSmaller=0;
522 IP_Pair_To_InBT_SegSmaller=1;
541 Float_t GammaChi2 = ((IP_Pair_To_InBT-80)*(IP_Pair_To_InBT-80)/60/60)+((dminDist-3.5)*(dminDist-3.5)/4.7/4.7)+((dtheta-0.021)*(dtheta-0.021)/0.012/0.012);
542 GammaChi2=GammaChi2/3.0;
546 cout <<
"EdbShowAlg_GS::FindPairs Pair (" << Segment->
PID() <<
"," << Segment->
ID()<<
";"<< Segment2->
PID() <<
"," << Segment2->
ID() <<
") has passed all cuts w.r.t to InBT:" << endl;
547 cout <<
"EdbShowAlg_GS::FindPairs IP_Pair_To_InBT = " << IP_Pair_To_InBT << endl;
548 cout <<
"EdbShowAlg_GS::FindPairs (IP_Pair_To_InBT==0 can mean that there was no InVtxArray and Vtx has been extrapolated from tracks.)" << endl;
549 cout <<
"EdbShowAlg_GS::FindPairs GetMinimumDist(Segment,Segment2) = " <<
GetMinimumDist(Segment,Segment2) << endl;
550 cout <<
"EdbShowAlg_GS::FindPairs CalcIP(BetterSegment,InBT) = " << IP_Pair_To_InBT << endl;
551 cout <<
"EdbShowAlg_GS::FindPairs CalcIP(Segment_Sum,InBT) = " << IP_Pair_To_InBT_SegSum << endl;
552 cout <<
"EdbShowAlg_GS::FindPairs GetSpatialDist(Segment_Sum,InBT) = " <<
GetSpatialDist(Segment_Sum,InBT) << endl;
553 cout <<
"EdbShowAlg_GS::FindPairs GammaChi2 = " << GammaChi2 << endl;
558 SegmentPIDArray->AddAt(Segment->
PID(),RecoShowerArrayN);
559 SegmentIDArray->AddAt(Segment->
ID(),RecoShowerArrayN);
560 Segment2PIDArray->AddAt(Segment2->
PID(),RecoShowerArrayN);
561 Segment2IDArray->AddAt(Segment2->
ID(),RecoShowerArrayN);
565 if (IP_Pair_To_InBT_SegSmaller==0) {
566 RecoShower -> AddSegment(Segment);
567 RecoShower -> AddSegment(Segment2);
570 RecoShower -> AddSegment(Segment2);
571 RecoShower -> AddSegment(Segment);
574 RecoShower->
SetZ(TMath::Min(Segment->
Z(),Segment2->
Z()));
575 RecoShower->
SetX(Segment_Sum->
X());
576 RecoShower->
SetY(Segment_Sum->
Y());
577 RecoShower->
SetTX(Segment_Sum->
TX());
578 RecoShower->
SetTY(Segment_Sum->
TY());
580 RecoShower->
SetID(RecoShowerArrayN);
597 cout <<
"EdbShowAlg_GS::FindPairs For the InBT/Vtx at __" << InBT <<
"__, we have found " <<
RecoShowerArray->GetEntries() <<
" compatible pairs in the PVRec volume." << endl;
601 delete SegmentPIDArray;
602 delete Segment2PIDArray;
603 delete SegmentIDArray;
604 delete Segment2IDArray;
606 Log(3,
"EdbShowAlg_GS::FindPairs",
"FindPairs()....done.");
Int_t npat
Definition: Xi2HatStartScript.C:33
Definition: EdbPattern.h:280
EdbPattern * GetPatternZLowestHighest(Bool_t lowestZ=kTRUE) const
Definition: EdbPattern.cxx:1982
Int_t Npatterns() const
Definition: EdbPattern.h:380
EdbPattern * GetPattern(int id) const
Definition: EdbPattern.cxx:1887
void SetPID(int pid)
Definition: EdbSegP.h:126
void SetY(Float_t y)
Definition: EdbSegP.h:175
Int_t ID() const
Definition: EdbSegP.h:144
void SetID(int id)
Definition: EdbSegP.h:125
void SetX(Float_t x)
Definition: EdbSegP.h:174
Int_t PID() const
Definition: EdbSegP.h:145
Float_t Z() const
Definition: EdbPattern.h:87
Float_t Y() const
Definition: EdbPattern.h:86
Int_t GetN() const
Definition: EdbPattern.h:65
EdbSegP * GetSegment(int i) const
Definition: EdbPattern.h:66
Float_t X() const
Definition: EdbPattern.h:85
Bool_t IsPossibleFakeDoublet(EdbSegP *s1, EdbSegP *s2)
Definition: EdbShowAlg_GS.cxx:722
Bool_t CheckPairDuplications(Int_t SegPID, Int_t SegID, Int_t Seg2PID, Int_t Seg2ID, TArrayI *SegmentPIDArray, TArrayI *SegmentIDArray, TArrayI *Segment2PIDArray, TArrayI *Segment2IDArray, int RecoShowerArrayN)
Definition: EdbShowAlg_GS.cxx:236
Float_t eParaValue[10]
Definition: EdbShowAlg.h:52
Double_t GetSpatialDist(EdbSegP *s1, EdbSegP *s2)
Definition: EdbShowAlg.cxx:463
Double_t GetMinimumDist(EdbSegP *seg1, EdbSegP *seg2)
Definition: EdbShowAlg.cxx:1943
Double_t DeltaR_WithPropagation(EdbSegP *s, EdbSegP *stest)
Definition: EdbShowAlg.cxx:411