FairRoot/PandaRoot
PndModuleCombiner.cxx
Go to the documentation of this file.
1 /*
2  * PndModuleCombiner.cpp
3  *
4  * Created on: Jul 18, 2016
5  * Author: kibellus
6  */
7 
8 #include <PndModuleCombiner.h>
9 
13 
15  // TODO Auto-generated destructor stub
16 }
17 
18 vector<PndLineApproximation> PndModuleCombiner::combineModules(vector<PndLineApproximation> m1, vector<PndLineApproximation> m2){
19  vector<PndLineApproximation> result;
20  Bool_t usedM1[m1.size()];
21  Bool_t usedM2[m2.size()];
22  //init
23  for(size_t i=0;i<m1.size();i++) usedM1[i]=kFALSE;
24  for(size_t i=0;i<m2.size();i++) usedM2[i]=kFALSE;
25  //combine
26  for(size_t i=0;i<m1.size();i++){
27  PndLineApproximation a1 = m1[i];
28  PndLine l1 = a1.getLine();
29  for(size_t j=0;j<m2.size();j++){
30  PndLineApproximation a2 = m2[j];
31  PndLine l2 = a2.getLine();
32  Double_t zVal = (l1.getP1()[2]+l2.getP1()[2])/2;
34  if(fLineComparator.areEqual2D(l1,l2)){
35  PndLineApproximation newApprox = a1.newApproximation(a2);
36  result.push_back(newApprox);
37  usedM1[i]=kTRUE;
38  usedM2[j]=kTRUE;
39  }
40  }
41  }
42  //add not used tracks
43  for(size_t i=0;i<m1.size();i++){
44  if(!usedM1[i]) result.push_back(m1[i]);
45  }
46  for(size_t i=0;i<m2.size();i++){
47  if(!usedM2[i]) result.push_back(m2[i]);
48  }
49  return result;
50 }
51 
52 void PndModuleCombiner::combineModules(vector<PndTrackCollection> &c,vector<PndLineApproximation> a){
53  //Bool_t used[a.size()]; //unused?
54  for(size_t i=0;i<c.size();i++){
55  PndTrackCollection coll = c[i];
56  PndLine l1 = coll.getLastLine();
57 
59  best.getLine().setRating(-1);
60  Double_t bestVal = 999999999999;
61  //Int_t index; //unused?
62  for(size_t j=0;j<a.size();j++){
63  PndLineApproximation approx = a[j];
64  PndLine l2 = approx.getLine();
65  Double_t zVal = (l1.getP1()[2]+l2.getP1()[2])/2;
67  Double_t quali = fLineComparator.getQuality(l1,l2);
68  if(quali<bestVal){
69  bestVal = quali;
70  best = approx;
71  //index = j; //unused?
72  }
73  }
74  /*PndLine l2 = best.getLine();
75  Double_t dist = fLineComparator.getDist2D(l1.getP1(),l2.getP1(),l1.getDir(),l2.getDir());
76  Double_t angle = fLineComparator.getAngle(l1.getDir(),l2.getDir());
77  if(dist < 5 || angle < 30)
78  coll.add(best,best.HasYInfo());*/
79  if(bestVal<8000){
80  coll.add(best,best.HasYInfo());
81  //used[index] = kTRUE; //unused?
82  }
83  }
84  //add unused
85  /*for(int i=0;i<a.size();i++){
86  if(!used[i]){
87  PndTrackCollection newColl;
88  newColl.add(a[i],a[i].HasYInfo());
89  c.push_back(newColl);
90  }
91  }*/
92 }
93 
94 void PndModuleCombiner::addUnusedHits(vector<PndFtsHit*> hits,vector<PndTrackCollection> &c){
95  for(size_t i=0;i<c.size();i++){
96  //get all unused hits
97  vector<PndFtsHit*> unused;
98  vector<PndFtsHit*> collectionHits = c[i].getHits();
99  for(size_t j=0;j<hits.size();j++){
100  Bool_t inUse = kFALSE;
101  for(size_t k=0;k<collectionHits.size();k++){
102  if(collectionHits[k]->GetTubeID()==hits[j]->GetTubeID())
103  inUse = kTRUE;
104  }
105  if(!inUse) unused.push_back(hits[j]);
106  }
107  //check all unused hits
108  for(size_t j=0;j<unused.size();j++){
109  Int_t layer = (unused[j]->GetLayerID()-1)/2;
110  TVector3 pos;
111  unused[j]->Position(pos);
112  PndLine l(pos,layer);
113  Double_t dist = c[i].getDistTo(l,layer);
114  if(dist-hitAddT<unused[j]->GetIsochrone())
115  c[i].addHit(unused[j]);
116  }
117  }
118 }
TVector3 pos
PndFtsLineComparator fLineComparator
Int_t i
Definition: run_full.C:25
PndLineApproximation newApproximation(PndLineApproximation &approx2)
static Double_t compAngle
void setZValue(Double_t z)
Double_t getQuality(PndLine l1, PndLine l2)
TString m2(TString pts, TString exts="e px py pz")
Definition: invexp.C:117
void addUnusedHits(vector< PndFtsHit * > hits, vector< PndTrackCollection > &c)
Int_t a
Definition: anaLmdDigi.C:126
Double_t
void setRating(Int_t r)
Definition: PndLine.h:44
vector< PndLineApproximation > combineModules(vector< PndLineApproximation > m1, vector< PndLineApproximation > m2)
Bool_t areEqual2D(PndLine l1, PndLine l2)
static Double_t compDist
CbmHit * hits[nHits]
Definition: RiemannTest.C:19
void add(PndLineApproximation l, Bool_t skewed)
TVector3 getP1()
Definition: PndLine.h:32
static Double_t hitAddT