]>
Commit | Line | Data |
---|---|---|
108615fc | 1 | |
2 | //Author: Uli Frankenfeld | |
3 | //Last Modified: 06.12.2000 | |
4 | ||
5 | #include <math.h> | |
6 | #include <iostream.h> | |
7 | #include "AliL3Logging.h" | |
8 | #include "AliL3GlobalMerger.h" | |
9 | #include "AliL3Track.h" | |
10 | #include "AliL3Transform.h" | |
11 | #include "AliL3TrackArray.h" | |
12 | //_____________________________________________________________ | |
13 | // | |
14 | // The L3 Slice merger | |
15 | // | |
16 | ||
17 | ClassImp(AliL3GlobalMerger) | |
18 | ||
19 | AliL3GlobalMerger::AliL3GlobalMerger(){ | |
20 | //Default constructor | |
21 | Is2Global(kTRUE); | |
22 | SetParameter(2,2,0.001,0.05,0.1); | |
23 | } | |
24 | ||
25 | ||
26 | AliL3GlobalMerger::AliL3GlobalMerger(Int_t first,Int_t last):AliL3Merger(last-first+1){ | |
27 | //Constructor. | |
28 | fNSlices = last-first+1; | |
29 | fFirst = first; | |
30 | fLast = last; | |
31 | Is2Global(kTRUE); | |
32 | SetParameter(2,2,0.001,0.1,0.4); | |
33 | } | |
34 | ||
35 | AliL3GlobalMerger::~AliL3GlobalMerger(){ | |
36 | //Destructor | |
37 | } | |
38 | ||
39 | void AliL3GlobalMerger::InitSlice(Int_t slice){ | |
40 | // | |
41 | // Select Sector The following FillTracks call will | |
42 | // fill this Sector | |
43 | // | |
44 | fSlice = slice; | |
45 | fCurrentTracks = fSlice - fFirst; | |
46 | } | |
47 | ||
48 | void AliL3GlobalMerger::SlowMerge(){ | |
49 | void* ntuple=GetNtuple(); | |
50 | AliL3Track *track[2]; | |
51 | AliL3TrackArray *tout = GetOutTracks(); | |
52 | if(fNSlices<2){ | |
53 | LOG(AliL3Log::kWarning,"AliL3GlobalMerger::SlowMerge","Slice Number") | |
54 | <<"Need more than one Slice!"<<ENDLOG; | |
55 | return; | |
56 | } | |
57 | for(Int_t i=0; i<fNSlices-1; i++){ | |
58 | Int_t slice = fFirst + i; | |
59 | AliL3TrackArray *ttt0=GetInTracks(i); | |
60 | AliL3TrackArray *ttt1=GetInTracks(i+1); | |
61 | Float_t angle = PI/18.; //10 degrees -> the border of the slices | |
62 | fTransformer->Local2GlobalAngle(&angle,slice); | |
63 | for(Int_t s0=0;s0<ttt0->GetNTracks();s0++){ | |
64 | AliL3Track *track0=ttt0->GetTrack(s0); | |
65 | track0->CalculateHelix(); | |
66 | track0->CalculateEdgePoint(angle); | |
67 | if(!track0->IsPoint()) ttt0->Remove(s0); | |
68 | } | |
69 | // ttt0->Compress(); | |
70 | for(Int_t s1=0;s1<ttt1->GetNTracks();s1++){ | |
71 | AliL3Track *track1=ttt1->GetTrack(s1); | |
72 | track1->CalculateHelix(); | |
73 | track1->CalculateEdgePoint(angle); | |
74 | if(!track1->IsPoint()) ttt1->Remove(s1); | |
75 | } | |
76 | // ttt1->Compress(); | |
77 | Bool_t merge = kTRUE; | |
78 | while(merge){ | |
79 | Int_t min0=-1,min1=-1; | |
80 | Double_t min=10; | |
81 | for(Int_t s0=0;s0<ttt0->GetNTracks();s0++){ | |
82 | AliL3Track *track0=ttt0->GetCheckedTrack(s0); | |
83 | if(!track0) continue; | |
84 | if(!track0->CalculateEdgePoint(angle)) continue; | |
85 | for(Int_t s1=0;s1<ttt1->GetNTracks();s1++){ | |
86 | AliL3Track *track1=ttt1->GetCheckedTrack(s1); | |
87 | if(!track1) continue; | |
88 | if(!track1->CalculateEdgePoint(angle)) continue; | |
89 | Double_t diff = TrackDiff(track0,track1); | |
90 | if(diff>=0&&diff<min){ | |
91 | min=diff; | |
92 | min0=s0; | |
93 | min1=s1; | |
94 | } | |
95 | } | |
96 | } | |
97 | if(min0>=0&&min1>=0){ | |
98 | AliL3Track *track0=ttt0->GetTrack(min0); | |
99 | AliL3Track *track1=ttt1->GetTrack(min1); | |
100 | track[0] = track0; | |
101 | track[1] = track1; | |
102 | SortGlobalTracks(track,2); | |
103 | MultiMerge(tout,track,2); | |
104 | track0->CalculateEdgePoint(angle); | |
105 | track1->CalculateEdgePoint(angle); | |
106 | track0->CalculateReferencePoint(angle); | |
107 | track1->CalculateReferencePoint(angle); | |
108 | PrintDiff(track0,track1); | |
109 | FillNtuple(ntuple,track0,track1); | |
110 | ttt0->Remove(min0); | |
111 | ttt1->Remove(min1); | |
112 | // ttt0->Compress(); | |
113 | // ttt1->Compress(); | |
114 | } | |
115 | else merge = kFALSE; | |
116 | } | |
117 | LOG(AliL3Log::kInformational,"AliL3GlobalMerger::SlowMerge","Result") | |
118 | <<AliL3Log::kDec<<"Merged Tracks: "<<tout->GetNTracks()<<ENDLOG; | |
119 | } | |
120 | WriteNtuple("ntuple_s.root",ntuple); | |
121 | } | |
122 | ||
123 | void AliL3GlobalMerger::Merge(){ | |
124 | AliL3Track *track[2]; | |
125 | AliL3TrackArray *tout = GetOutTracks(); | |
126 | if(fNSlices<2){ | |
127 | LOG(AliL3Log::kWarning,"AliL3GlobalMerger::Merge","Slice Number") | |
128 | <<"Need more than one Slice!"<<ENDLOG; | |
129 | return; | |
130 | } | |
131 | for(Int_t i=0; i<fNSlices-1; i++){ | |
132 | Int_t slice = fFirst + i; | |
133 | AliL3TrackArray *ttt0=GetInTracks(i); | |
134 | AliL3TrackArray *ttt1=GetInTracks(i+1); | |
135 | Float_t angle = PI/18.; //10 degrees -> the border of the slices | |
136 | fTransformer->Local2GlobalAngle(&angle,slice); | |
137 | if(i==0) | |
138 | ttt0->QSort(); | |
139 | ttt1->QSort(); | |
140 | Bool_t *ismatched0 = new Bool_t[ttt0->GetNTracks()]; | |
141 | Bool_t *ismatched1 = new Bool_t[ttt1->GetNTracks()]; | |
142 | Int_t n0=0,n1=0; | |
143 | for(Int_t s0=0;s0<ttt0->GetNTracks();s0++){ | |
144 | ismatched0[s0]=kFALSE; | |
145 | AliL3Track *track0=ttt0->GetCheckedTrack(s0); | |
146 | if(!track0) continue; | |
147 | track0->CalculateHelix(); | |
148 | track0->CalculateEdgePoint(angle); | |
149 | if(track0->IsPoint()) {n0++;track0->CalculateReferencePoint(angle);} | |
150 | } | |
151 | for(Int_t s1=0;s1<ttt1->GetNTracks();s1++){ | |
152 | ismatched1[s1]=kFALSE; | |
153 | AliL3Track *track1=ttt1->GetCheckedTrack(s1); | |
154 | if(!track1) continue; | |
155 | track1->CalculateHelix(); | |
156 | track1->CalculateEdgePoint(angle); | |
157 | if(track1->IsPoint()) {n1++;track1->CalculateReferencePoint(angle);} | |
158 | } | |
159 | for(Int_t s0=0;s0<ttt0->GetNTracks();s0++){ | |
160 | AliL3Track *track0=ttt0->GetCheckedTrack(s0); | |
161 | if(!track0) continue; | |
162 | if(!track0->IsPoint()) continue; | |
163 | for(Int_t s1=0;s1<ttt1->GetNTracks();s1++){ | |
164 | if(ismatched1[s1]) continue; | |
165 | AliL3Track *track1=ttt1->GetCheckedTrack(s1); | |
166 | if(!track1) continue; | |
167 | if(!track1->IsPoint()) continue; | |
168 | if(IsRTrack(track0,track1)){ | |
169 | track[0] = track0; | |
170 | track[1] = track1; | |
171 | SortGlobalTracks(track,2); | |
172 | MultiMerge(tout,track,2); | |
173 | ismatched0[s0]=kTRUE; | |
174 | ismatched1[s1]=kTRUE; | |
175 | ttt0->Remove(s0); | |
176 | ttt1->Remove(s1); | |
177 | } | |
178 | } | |
179 | } | |
180 | LOG(AliL3Log::kInformational,"AliL3GlobalMerger::Merge","Result") | |
181 | <<AliL3Log::kDec<<"slice0: "<<n0<<" slice1: "<<n1 | |
182 | <<" Merged Tracks: "<<tout->GetNTracks()<<ENDLOG; | |
183 | } | |
184 | } |