/[PAMELA software]/DarthVader/TrackerLevel2/src/TrkHough.cpp
ViewVC logotype

Annotation of /DarthVader/TrackerLevel2/src/TrkHough.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations) (download)
Tue Feb 3 13:57:15 2009 UTC (15 years, 9 months ago) by pam-fi
Branch: MAIN
CVS Tags: v10REDr01, v10RED, v9r00, v9r01, HEAD
Changes since 1.3: +1 -1 lines
Upgrade of the tracking routine, to accept an arbitrary reference plane + change of method name (DoTrack insted of DoTrack2)

1 pam-fi 1.1 /**
2     * \file TrkHough.cpp
3     * \author David Fedele
4     */
5     #include <TrkHough.h>
6     #include <iostream>
7     using namespace std;
8    
9     //--------------------------------------
10     //
11     //
12     //--------------------------------------
13     TrkHough::TrkHough(){
14    
15     ndblt=0;
16     alfayz1=0;
17     alfayz2=0;
18     db_cloud=0;
19    
20     ntrpt=0;
21     alfaxz1=0;
22     alfaxz2=0;
23     alfaxz3=0;
24     tr_cloud=0;
25    
26     nclouds_yz=0;
27     alfayz1_av=0;
28     alfayz2_av=0;
29     ptcloud_yz=0;
30    
31     nclouds_xz=0;
32     alfaxz1_av=0;
33     alfaxz2_av=0;
34     alfaxz3_av=0;
35     ptcloud_xz=0;
36    
37     nclstr=0;
38     totaltime=0;
39     houghtime=0;
40     fittime=0;
41    
42 pam-fi 1.2 // ntracks=0;
43     // al0=0;
44     // al1=0;
45     // al2=0;
46     // al3=0;
47     // al4=0;
48    
49     Candidates = 0;
50    
51 pam-fi 1.1 };
52     //--------------------------------------
53     //
54     //
55     //--------------------------------------
56 pam-fi 1.3 void TrkHough::Set(){
57     if(!Candidates)Candidates = new TClonesArray("TrkTrack");
58     }
59     //--------------------------------------
60     //
61     //
62     //--------------------------------------
63 pam-fi 1.2 /**
64     * Fills a TrkHough object with values from a struct cTrkhough (to get data from F77 common).
65     */
66     void TrkHough::SetFromHoughStruct(cTrkHough *lh, cTrkCandidates *lc){
67    
68     if(!lh) return;
69     // -------------------------
70     // fill hough transform info
71     // -------------------------
72     ndblt = lh->ndblt_nt;
73     ntrpt = lh->ntrpt_nt;
74     nclouds_yz = lh->nclouds_yz_nt;
75     nclouds_xz = lh->nclouds_xz_nt;
76     nclstr = lh->nclstr;
77     totaltime = lh->totaltime;
78     houghtime = lh->houghtime;
79     fittime = lh->fittime;
80    
81     alfayz1 = new Float_t[ndblt];
82     alfayz2 = new Float_t[ndblt];
83     db_cloud = new Int_t[ndblt];
84     for(int i=0; i<ndblt; i++){
85     alfayz1[i] = (Float_t) lh->alfayz1_nt[i];
86     alfayz2[i] = (Float_t) lh->alfayz2_nt[i];
87     db_cloud[i] = (Int_t) lh->db_cloud_nt[i];
88     }
89    
90     alfaxz1 = new Float_t[ntrpt];
91     alfaxz2 = new Float_t[ntrpt];
92     alfaxz3 = new Float_t[ntrpt];
93     tr_cloud = new Int_t[ntrpt];
94     for(int i=0; i<ntrpt; i++){
95     alfaxz1[i] = (Float_t) lh->alfaxz1_nt[i];
96     alfaxz2[i] = (Float_t) lh->alfaxz2_nt[i];
97     alfaxz3[i] = (Float_t) lh->alfaxz3_nt[i];
98     tr_cloud[i] = (Int_t) lh->tr_cloud_nt[i];
99     }
100 pam-fi 1.1
101 pam-fi 1.2 alfayz1_av = new Float_t[nclouds_yz];
102     alfayz2_av = new Float_t[nclouds_yz];
103     ptcloud_yz = new Int_t[nclouds_yz];
104     for(int i=0; i<nclouds_yz; i++){
105     alfayz1_av[i] = (Float_t) lh->alfayz1_av_nt[i];
106     alfayz2_av[i] = (Float_t) lh->alfayz2_av_nt[i];
107     ptcloud_yz[i] = (Int_t) lh->ptcloud_yz_nt[i];
108     }
109 pam-fi 1.1
110 pam-fi 1.2 alfaxz1_av = new Float_t[nclouds_xz];
111     alfaxz2_av = new Float_t[nclouds_xz];
112     alfaxz3_av = new Float_t[nclouds_xz];
113     ptcloud_xz = new Int_t[nclouds_xz];
114     for(int i=0; i<nclouds_xz; i++){
115     alfaxz1_av[i] = (Float_t) lh->alfaxz1_av_nt[i] ;
116     alfaxz2_av[i] = (Float_t) lh->alfaxz2_av_nt[i];
117     alfaxz3_av[i] = (Float_t) lh->alfaxz3_av_nt[i];
118     ptcloud_xz[i] = (Int_t) lh->ptcloud_xz_nt[i];
119     }
120    
121     if(!lc) return;
122     // --------------------------
123     // fill track candidates info
124     // --------------------------
125     // ntracks = lc->ntracks;
126     // al0 = new Float_t[ntracks];
127     // al1 = new Float_t[ntracks];
128     // al2 = new Float_t[ntracks];
129     // al3 = new Float_t[ntracks];
130     // al4 = new Float_t[ntracks];
131     // for(int ii=0; ii<ntracks; ii++){
132     // al0[ii] = (Float_t) lc->al[ii][0];
133     // al1[ii] = (Float_t) lc->al[ii][1];
134     // al2[ii] = (Float_t) lc->al[ii][2];
135     // al3[ii] = (Float_t) lc->al[ii][3];
136     // al4[ii] = (Float_t) lc->al[ii][4];
137     // }
138     TrkTrack* t_track = new TrkTrack();
139 pam-fi 1.3 if(!Candidates) Candidates = new TClonesArray("TrkTrack");
140 pam-fi 1.2 TClonesArray &t = *Candidates;
141 pam-fi 1.3
142 pam-fi 1.2 for(int i=0; i<lc->ntracks; i++){
143 pam-fi 1.3 // cout << " - "<<i<<endl;
144 pam-fi 1.2 t_track->seqno = i;
145     t_track->image = 0;
146     t_track->chi2 = lc->chi2[i];
147     t_track->nstep = 0;
148     for(int it1=0;it1<5;it1++){
149     t_track->al[it1] = lc->al[i][it1];
150     for(int it2=0;it2<5;it2++)
151     t_track->coval[it1][it2] = 0.;
152     };
153     for(int ip=0;ip<6;ip++){
154     // ---------------------------------
155     // new implementation of xgood/ygood
156     // ---------------------------------
157     t_track->xgood[ip] = (Int_t) lc->xgood[i][ip];
158     t_track->ygood[ip] = (Int_t) lc->ygood[i][ip];
159     int ssensor = lc->sensor[i][ip];
160     int sladder = lc->ladder[i][ip];
161     if(ip==5&&ssensor!=0)ssensor = 3 - ssensor; //notazione paolo x align
162     t_track->xgood[ip] += 10000000*ssensor+10*sladder ; // ladder+sensor
163     t_track->ygood[ip] += 10000000*ssensor+10*sladder ; // ladder+sensor
164     // if(l2->xbad[i][ip]>0)t_track->xgood[ip]=-t_track->xgood[ip];
165     // if(l2->ybad[i][ip]>0)t_track->ygood[ip]=-t_track->ygood[ip];
166     t_track->xm[ip] = lc->xm[i][ip];
167     t_track->ym[ip] = lc->ym[i][ip];
168     t_track->zm[ip] = lc->zm[i][ip];
169     t_track->resx[ip] = lc->resx[i][ip];
170     t_track->resy[ip] = lc->resy[i][ip];
171     t_track->tailx[ip] = 0.;
172     t_track->taily[ip] = 0.;
173     t_track->xv[ip] = lc->xv[i][ip];
174     t_track->yv[ip] = lc->yv[i][ip];
175     t_track->zv[ip] = lc->zv[i][ip];
176     t_track->axv[ip] = lc->axv[i][ip];
177     t_track->ayv[ip] = lc->ayv[i][ip];
178     t_track->dedx_x[ip] = 0.;
179     t_track->dedx_y[ip] = 0.;
180     t_track->multmaxx[ip] = 0;
181     t_track->multmaxy[ip] = 0;
182     t_track->seedx[ip] = 0.;
183     t_track->seedy[ip] = 0.;
184     t_track->xpu[ip] = 0.;
185     t_track->ypu[ip] = 0.;
186     //-----------------------------------------------------
187     //-----------------------------------------------------
188     //-----------------------------------------------------
189     //-----------------------------------------------------
190     };
191 pam-fi 1.3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
192     // evaluated coordinates (to define GF)
193     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
194     int ngf = TrkParams::nGF;
195     float *zgf = TrkParams::zGF;
196     Trajectory tgf = Trajectory(ngf,zgf);
197 pam-fi 1.4 tgf.DoTrack(t_track->al);//<<<< integrate the trajectory
198 pam-fi 1.3 for(int ip=0; ip<ngf; ip++){
199     t_track->xGF[ip] = tgf.x[ip];
200     t_track->yGF[ip] = tgf.y[ip];
201     }
202 pam-fi 1.2 // if(t_track->IsSaturated())t_track->Dump();
203     new(t[i]) TrkTrack(*t_track);
204     t_track->Clear();
205     };
206 pam-fi 1.3 // cout << t.GetEntries() <<" <> "<< Candidates->GetEntries()<<endl;
207 pam-fi 1.2
208     delete t_track;
209    
210    
211 pam-fi 1.1 };
212     //--------------------------------------
213     //
214     //
215     //--------------------------------------
216 pam-fi 1.2 TrkTrack *TrkHough::GetCandidate(int it){
217    
218     if(it >= GetNCandidates()){
219     cout << "** TrkHough ** Track-candidate "<< it << "does not exits! " << endl;
220     cout << " n.candidates = "<< GetNCandidates() << endl;
221     return 0;
222     }
223     if(!Candidates){
224     cout << "TrkTrack *TrkHough::GetCandidate(int is) >> (TClonesArray*) Candidate ==0 "<<endl;
225     };
226    
227     TClonesArray &t = *(Candidates);
228     TrkTrack *track = (TrkTrack*)t[it];
229     return track;
230     }
231 pam-fi 1.1 //--------------------------------------
232     //
233     //
234     //--------------------------------------
235     void TrkHough::Clear(){
236    
237 pam-fi 1.2
238 pam-fi 1.1 ndblt = 0;
239     ntrpt = 0;
240     nclouds_yz = 0;
241     nclouds_xz = 0;
242     nclstr = 0;
243     totaltime = 0;
244     houghtime = 0;
245     fittime = 0;
246 pam-fi 1.2 // ntracks = 0;
247 pam-fi 1.1
248 pam-fi 1.2 if(Candidates)Candidates->Delete();
249 pam-fi 1.1 };
250     //--------------------------------------
251     //
252     //
253     //--------------------------------------
254     void TrkHough::Delete(){
255    
256 pam-fi 1.2 Clear();
257    
258     delete [] alfayz1;
259     delete [] alfayz2;
260     delete [] db_cloud;
261    
262     delete [] alfaxz1;
263     delete [] alfaxz2;
264     delete [] alfaxz3;
265     delete [] tr_cloud;
266    
267     delete [] alfayz1_av;
268     delete [] alfayz2_av;
269     delete [] ptcloud_yz;
270    
271     delete [] alfaxz1_av;
272     delete [] alfaxz2_av;
273     delete [] alfaxz3_av;
274     delete [] ptcloud_xz;
275    
276     // delete [] al0;
277     // delete [] al1;
278     // delete [] al2;
279     // delete [] al3;
280     // delete [] al4;
281 pam-fi 1.1
282 pam-fi 1.2 if(Candidates)delete Candidates;
283 pam-fi 1.1
284     };
285    
286    
287     ClassImp(TrkHough);

  ViewVC Help
Powered by ViewVC 1.1.23