Changed name of merger to AliL3HoughMerger
[u/mrichter/AliRoot.git] / HLT / hough / AliL3HoughMerge.cxx
1 #include <TH2.h>
2
3 #include "AliL3TrackArray.h"
4 #include "AliL3HoughTrack.h"
5 #include "AliL3HoughMerge.h"
6 #include "AliL3HoughTransformer.h"
7
8 ClassImp(AliL3HoughMerge)
9
10   
11 AliL3HoughMerge::AliL3HoughMerge()
12 {
13   //Default constructor
14
15   fInTracks = NULL;
16   fOutTracks = NULL;
17   fNPatches = 5;
18 }
19
20
21 AliL3HoughMerge::AliL3HoughMerge(Int_t slice,Int_t row_patches)
22 {
23   //Constructor
24
25   //fInTracks = (AliL3TrackArray**)new Byte_t[row_patches*sizeof(AliL3TrackArray*)];
26   fInTracks = new AliL3TrackArray*[row_patches];
27   fNPatches = row_patches;
28   for(Int_t i=0; i<row_patches; i++)
29     fInTracks[i] = new AliL3TrackArray("AliL3HoughTrack");
30
31   fOutTracks = new AliL3TrackArray("AliL3HoughTrack");
32 }
33
34
35 AliL3HoughMerge::~AliL3HoughMerge()
36 {
37   //Destructor
38   if(fInTracks)
39     delete fInTracks;
40   if(fOutTracks)
41     delete fOutTracks;
42   
43 }
44
45 void AliL3HoughMerge::FillTracks(AliL3TrackArray *tracks,Int_t patch)
46 {
47   fInTracks[patch]->AddTracks(tracks); //copies tracks to new trackarray. Does not delete the track objects.
48 }
49
50 void AliL3HoughMerge::FillHisto(TH2F *merge_hist)
51 {
52   
53   for(Int_t pat=0; pat < fNPatches; pat++)
54     {
55       for(Int_t t=0; t<fInTracks[pat]->GetNTracks(); t++)
56         {
57           AliL3HoughTrack *tr = (AliL3HoughTrack*)fInTracks[pat]->GetCheckedTrack(t);
58           if(!tr) {printf("AliL3HoughMerge NO TRACK\n"); continue;}
59           merge_hist->Fill(tr->GetKappa(),tr->GetPhi0(),tr->GetNHits());
60         }
61     }
62 }
63