]>
Commit | Line | Data |
---|---|---|
f80b98cb | 1 | //Author: Anders Strand Vestbo |
2 | //Last Modified: 28.6.01 | |
3 | ||
99e7186b | 4 | #include "AliL3HoughEval.h" |
4de874d1 | 5 | #include "AliL3HoughTransformer.h" |
99e7186b | 6 | #include "AliL3DigitData.h" |
4de874d1 | 7 | #include "AliL3HoughTrack.h" |
99e7186b | 8 | #include "AliL3Transform.h" |
9 | #include "AliL3Histogram.h" | |
10 | #include "AliL3Defs.h" | |
4de874d1 | 11 | |
12 | ClassImp(AliL3HoughEval) | |
13 | ||
4de874d1 | 14 | AliL3HoughEval::AliL3HoughEval() |
15 | { | |
4fc9a6a4 | 16 | |
99e7186b | 17 | } |
4de874d1 | 18 | |
19 | AliL3HoughEval::AliL3HoughEval(AliL3HoughTransformer *transformer) | |
20 | { | |
4fc9a6a4 | 21 | |
4de874d1 | 22 | fHoughTransformer = transformer; |
23 | fTransform = new AliL3Transform(); | |
99e7186b | 24 | |
25 | fSlice = fHoughTransformer->GetSlice(); | |
26 | fPatch = fHoughTransformer->GetPatch(); | |
27 | fNrows = NRows[fPatch][1] - NRows[fPatch][0] + 1; | |
28 | fNEtaSegments = fHoughTransformer->GetNEtaSegments(); | |
29 | fEtaMin = fHoughTransformer->GetEtaMin(); | |
30 | fEtaMax = fHoughTransformer->GetEtaMax(); | |
31 | fRemoveFoundTracks = kFALSE; | |
f80b98cb | 32 | fNumOfPadsToLook = 1; |
99e7186b | 33 | fNumOfRowsToMiss = 1; |
34 | GenerateLUT(); | |
4de874d1 | 35 | } |
36 | ||
4de874d1 | 37 | AliL3HoughEval::~AliL3HoughEval() |
38 | { | |
4de874d1 | 39 | if(fTransform) |
40 | delete fTransform; | |
99e7186b | 41 | if(fRowPointers) |
42 | delete [] fRowPointers; | |
4de874d1 | 43 | } |
44 | ||
99e7186b | 45 | void AliL3HoughEval::GenerateLUT() |
4de874d1 | 46 | { |
99e7186b | 47 | //Generate a LUT, to limit the access to raw data |
48 | ||
49 | fRowPointers = new AliL3DigitRowData*[fNrows]; | |
50 | ||
51 | AliL3DigitRowData *tempPt = (AliL3DigitRowData*)fHoughTransformer->GetDataPointer(); | |
52 | if(!tempPt) | |
53 | printf("AliL3HoughEval::GenerateLUT : Zero data pointer\n"); | |
f80b98cb | 54 | |
99e7186b | 55 | for(Int_t i=NRows[fPatch][0]; i<=NRows[fPatch][1]; i++) |
f80b98cb | 56 | { |
99e7186b | 57 | Int_t prow = i - NRows[fPatch][0]; |
58 | fRowPointers[prow] = tempPt; | |
4fc9a6a4 | 59 | fHoughTransformer->UpdateDataPointer(tempPt); |
f80b98cb | 60 | } |
61 | ||
99e7186b | 62 | } |
f80b98cb | 63 | |
99e7186b | 64 | Bool_t AliL3HoughEval::LookInsideRoad(AliL3HoughTrack *track,Int_t eta_index,Bool_t remove) |
65 | { | |
66 | //Look at rawdata along the road specified by the track candidates. | |
67 | //If track is good, return true, if not return false. | |
68 | ||
f80b98cb | 69 | Int_t sector,row; |
99e7186b | 70 | |
f80b98cb | 71 | Int_t nrow=0,npixs=0; |
72 | Float_t xyz[3]; | |
99e7186b | 73 | |
74 | Double_t etaslice = (fEtaMax - fEtaMin)/fNEtaSegments; | |
75 | for(Int_t padrow = NRows[fPatch][0]; padrow <= NRows[fPatch][1]; padrow++) | |
f80b98cb | 76 | { |
99e7186b | 77 | Int_t prow = padrow - NRows[fPatch][0]; |
78 | ||
f80b98cb | 79 | if(!track->GetCrossingPoint(padrow,xyz)) |
80 | { | |
81 | printf("AliL3HoughEval::LookInsideRoad : Track does not cross line!!\n"); | |
82 | continue; | |
83 | } | |
84 | ||
99e7186b | 85 | fTransform->Slice2Sector(fSlice,padrow,sector,row); |
f80b98cb | 86 | fTransform->Local2Raw(xyz,sector,row); |
87 | npixs=0; | |
99e7186b | 88 | |
89 | //Get the timebins for this pad | |
90 | AliL3DigitRowData *tempPt = fRowPointers[prow]; | |
91 | if(!tempPt) | |
f80b98cb | 92 | { |
99e7186b | 93 | printf("AliL3HoughEval::LookInsideRoad : Zero data pointer\n"); |
94 | continue; | |
f80b98cb | 95 | } |
96 | ||
99e7186b | 97 | //Look at both sides of the pad: |
98 | for(Int_t p=(Int_t)xyz[1]-fNumOfPadsToLook; p<=(Int_t)xyz[1]+fNumOfPadsToLook; p++) | |
99 | { | |
100 | AliL3DigitData *digPt = tempPt->fDigitData; | |
101 | for(UInt_t j=0; j<tempPt->fNDigit; j++) | |
102 | { | |
103 | UChar_t pad = digPt[j].fPad; | |
104 | if(pad < p) continue; | |
105 | if(pad > p) break; | |
106 | UShort_t time = digPt[j].fTime; | |
107 | Double_t eta = fTransform->GetEta(row,pad,time); | |
108 | Int_t pixel_index = (Int_t)(eta/etaslice); | |
109 | if(pixel_index > eta_index) continue; | |
110 | if(pixel_index != eta_index) break; | |
111 | if(remove) | |
112 | digPt[j].fCharge = 0; //Delete the track from image | |
113 | npixs++; | |
114 | } | |
115 | } | |
116 | ||
f80b98cb | 117 | if(npixs > 0) |
118 | { | |
119 | nrow++; | |
120 | } | |
121 | } | |
99e7186b | 122 | if(remove) |
123 | return kTRUE; | |
124 | ||
125 | if(nrow >= fNrows - fNumOfRowsToMiss)//this was a good track | |
f80b98cb | 126 | { |
127 | track->SetEtaIndex(eta_index); | |
99e7186b | 128 | if(fRemoveFoundTracks) |
129 | LookInsideRoad(track,eta_index,kTRUE); | |
f80b98cb | 130 | return kTRUE; |
131 | } | |
132 | else | |
133 | return kFALSE; | |
134 | } | |
135 | ||
99e7186b | 136 | void AliL3HoughEval::DisplayEtaSlice(Int_t eta_index,AliL3Histogram *hist) |
f80b98cb | 137 | { |
99e7186b | 138 | //Display the current raw data inside the slice |
4de874d1 | 139 | |
99e7186b | 140 | if(!hist) |
4de874d1 | 141 | { |
99e7186b | 142 | printf("AliL3HoughEval::DisplayEtaSlice : No input histogram!\n"); |
4de874d1 | 143 | return; |
144 | } | |
145 | ||
99e7186b | 146 | Double_t etaslice = (fEtaMax - fEtaMin)/fNEtaSegments; |
147 | for(Int_t padrow = NRows[fPatch][0]; padrow <= NRows[fPatch][1]; padrow++) | |
f80b98cb | 148 | { |
99e7186b | 149 | Int_t prow = padrow - NRows[fPatch][0]; |
150 | ||
151 | AliL3DigitRowData *tempPt = fRowPointers[prow]; | |
152 | if(!tempPt) | |
f80b98cb | 153 | { |
99e7186b | 154 | printf("AliL3HoughEval::DisplayEtaSlice : Zero data pointer\n"); |
f80b98cb | 155 | continue; |
156 | } | |
157 | ||
99e7186b | 158 | AliL3DigitData *digPt = tempPt->fDigitData; |
159 | for(UInt_t j=0; j<tempPt->fNDigit; j++) | |
f80b98cb | 160 | { |
99e7186b | 161 | UChar_t pad = digPt[j].fPad; |
162 | UChar_t charge = digPt[j].fCharge; | |
163 | UShort_t time = digPt[j].fTime; | |
4fc9a6a4 | 164 | if(charge < fHoughTransformer->GetThreshold()) continue; |
99e7186b | 165 | Float_t xyz[3]; |
4de874d1 | 166 | Int_t sector,row; |
99e7186b | 167 | fTransform->Slice2Sector(fSlice,padrow,sector,row); |
168 | fTransform->Raw2Local(xyz,sector,row,pad,time); | |
169 | Double_t eta = fTransform->GetEta(xyz); | |
170 | Int_t pixel_index = (Int_t)(eta/etaslice); | |
171 | if(pixel_index != eta_index) continue; | |
172 | hist->Fill(xyz[0],xyz[1],charge); | |
f80b98cb | 173 | } |
174 | } | |
f80b98cb | 175 | |
4de874d1 | 176 | } |