]>
Commit | Line | Data |
---|---|---|
121a60bd | 1 | /************************************************************************** |
91834b8d | 2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
121a60bd | 15 | |
16 | /* $Id$ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
4fad09c9 | 20 | // Class for TRD reconstruction // |
121a60bd | 21 | // // |
22 | /////////////////////////////////////////////////////////////////////////////// | |
23 | ||
e3b2b5e5 | 24 | #include <TFile.h> |
3a039a31 | 25 | #include <TObjString.h> |
26 | #include <TObjArray.h> | |
66f6bfd9 | 27 | #include <TClonesArray.h> |
121a60bd | 28 | |
121a60bd | 29 | #include "AliRunLoader.h" |
3bc9d03e | 30 | #include "AliRawReader.h" |
31 | #include "AliLog.h" | |
3bc9d03e | 32 | #include "AliESDTrdTrack.h" |
af885e0f | 33 | #include "AliESDEvent.h" |
3bc9d03e | 34 | |
35 | #include "AliTRDReconstructor.h" | |
3fe61b77 | 36 | #include "AliTRDclusterizer.h" |
121a60bd | 37 | #include "AliTRDtracker.h" |
b0f03c34 | 38 | #include "AliTRDpidESD.h" |
e3b2b5e5 | 39 | #include "AliTRDgtuTrack.h" |
a8fbb161 | 40 | #include "AliTRDrawData.h" |
41 | #include "AliTRDdigitsManager.h" | |
e4f2f73d | 42 | #include "AliTRDtrackerV1.h" |
43 | #include "AliTRDrecoParam.h" | |
121a60bd | 44 | |
29f95561 | 45 | #include "TTreeStream.h" |
46 | ||
97b6dfac | 47 | #define SETFLG(n,f) ((n) |= f) |
48 | #define CLRFLG(n,f) ((n) &= ~f) | |
49 | ||
121a60bd | 50 | ClassImp(AliTRDReconstructor) |
51 | ||
66f6bfd9 | 52 | TClonesArray *AliTRDReconstructor::fgClusters = 0x0; |
b72f4eaf | 53 | Char_t* AliTRDReconstructor::fgSteerNames[kNsteer] = { |
54 | "DigitsConversion " | |
55 | ,"Tail Cancellation " | |
56 | ,"Clusters LUT " | |
57 | ,"Clusters GAUSS " | |
58 | ,"Clusters Sharing " | |
59 | ,"NN PID " | |
60 | ,"8 dEdx slices in ESD " | |
61 | ,"Write Clusters " | |
62 | ,"Write Online Tracklets " | |
63 | ,"Drift Gas Argon " | |
64 | ,"Stand Alone Tracking " | |
65 | ,"Vertex Constrain " | |
66 | ,"Tracklet Improve " | |
67 | ,"HLT Mode " | |
68 | ,"Cosmic Reconstruction " | |
69 | }; | |
70 | Char_t* AliTRDReconstructor::fgSteerFlags[kNsteer] = { | |
71 | "dc"// digits conversion [false] | |
72 | ,"tc"// apply tail cancellation [true] | |
73 | ,"lt"// look-up-table for cluster shape in the r-phi direction | |
74 | ,"gs"// gauss cluster shape in the r-phi direction | |
75 | ,"sh"// cluster sharing between tracks | |
76 | ,"nn"// PID method in reconstruction (NN) [true] | |
77 | ,"8s"// 8 dEdx slices in ESD [true] | |
78 | ,"cw"// write clusters [true] | |
79 | ,"tw"// write online tracklets [false] | |
80 | ,"ar"// drift gas [false] - do not update the number of exponentials in the TC ! | |
81 | ,"sa"// track seeding (stand alone tracking) [true] | |
82 | ,"vc"// vertex constrain on stand alone track finder [false] | |
83 | ,"ti"// improve tracklets in stand alone track finder [true] | |
84 | ,"hlt"// HLT reconstruction [false] | |
85 | ,"cos"// Cosmic Reconstruction [false] | |
86 | }; | |
87 | Char_t* AliTRDReconstructor::fgTaskNames[kNtasks] = { | |
88 | "RawReader" | |
89 | ,"Clusterizer" | |
90 | ,"Tracker" | |
91 | ,"PID" | |
92 | }; | |
93 | Char_t* AliTRDReconstructor::fgTaskFlags[kNtasks] = { | |
94 | "rr" | |
95 | ,"cl" | |
96 | ,"tr" | |
97 | ,"pd" | |
98 | }; | |
99 | ||
eb38ed55 | 100 | //_____________________________________________________________________________ |
3a039a31 | 101 | AliTRDReconstructor::AliTRDReconstructor() |
102 | :AliReconstructor() | |
97b6dfac | 103 | ,fSteerParam(0) |
3a039a31 | 104 | { |
97b6dfac | 105 | // setting default "ON" steering parameters |
89971837 | 106 | // owner of debug streamers |
107 | SETFLG(fSteerParam, kOwner); | |
97b6dfac | 108 | // write clusters [cw] |
109 | SETFLG(fSteerParam, kWriteClusters); | |
110 | // track seeding (stand alone tracking) [sa] | |
111 | SETFLG(fSteerParam, kSeeding); | |
112 | // PID method in reconstruction (NN) [nn] | |
113 | SETFLG(fSteerParam, kSteerPID); | |
89971837 | 114 | // number of dEdx slices in the ESD track [8s] |
b72f4eaf | 115 | SETFLG(fSteerParam, kEightSlices); |
116 | // vertex constrain for stand alone track finder | |
117 | SETFLG(fSteerParam, kVertexConstrained); | |
118 | // improve tracklets for stand alone track finder | |
119 | SETFLG(fSteerParam, kImproveTracklet); | |
120 | // use look up table for cluster r-phi position | |
121 | SETFLG(fSteerParam, kLUT); | |
122 | // use tail cancellation | |
123 | SETFLG(fSteerParam, kTC); | |
97b6dfac | 124 | |
89971837 | 125 | memset(fStreamLevel, 0, kNtasks*sizeof(UChar_t)); |
126 | memset(fDebugStream, 0, sizeof(TTreeSRedirector *) * kNtasks); | |
3a039a31 | 127 | // Xe tail cancellation parameters |
128 | fTCParams[0] = 1.156; // r1 | |
129 | fTCParams[1] = 0.130; // r2 | |
130 | fTCParams[2] = 0.114; // c1 | |
131 | fTCParams[3] = 0.624; // c2 | |
132 | // Ar tail cancellation parameters | |
181c7f7e | 133 | fTCParams[4] = 6.; // r1 |
134 | fTCParams[5] = 0.62; // r2 | |
135 | fTCParams[6] = 0.0087;// c1 | |
136 | fTCParams[7] = 0.07; // c2 | |
eb38ed55 | 137 | } |
138 | ||
3a039a31 | 139 | //_____________________________________________________________________________ |
140 | AliTRDReconstructor::AliTRDReconstructor(const AliTRDReconstructor &r) | |
141 | :AliReconstructor(r) | |
181c7f7e | 142 | ,fSteerParam(r.fSteerParam) |
3a039a31 | 143 | { |
89971837 | 144 | memcpy(fStreamLevel, r.fStreamLevel, kNtasks*sizeof(UChar_t)); |
91834b8d | 145 | memcpy(fTCParams, r.fTCParams, 8*sizeof(Double_t)); |
89971837 | 146 | memcpy(fDebugStream, r.fDebugStream, sizeof(TTreeSRedirector *) *kNtasks); |
147 | // ownership of debug streamers is not taken | |
148 | CLRFLG(fSteerParam, kOwner); | |
3a039a31 | 149 | } |
eb38ed55 | 150 | |
48f8adf3 | 151 | //_____________________________________________________________________________ |
152 | AliTRDReconstructor::~AliTRDReconstructor() | |
153 | { | |
154 | if(fgClusters) { | |
155 | fgClusters->Delete(); delete fgClusters; | |
156 | } | |
f29f13a6 | 157 | if(fSteerParam&kOwner){ |
89971837 | 158 | for(Int_t itask = 0; itask < kNtasks; itask++) |
29f95561 | 159 | if(fDebugStream[itask]) delete fDebugStream[itask]; |
160 | } | |
18c05eb3 | 161 | } |
48f8adf3 | 162 | |
91834b8d | 163 | |
acd241e9 | 164 | //_____________________________________________________________________________ |
91834b8d | 165 | void AliTRDReconstructor::Init(){ |
18c05eb3 | 166 | // |
167 | // Init Options | |
168 | // | |
18c05eb3 | 169 | SetOption(GetOption()); |
b72f4eaf | 170 | Options(fSteerParam, fStreamLevel); |
acd241e9 | 171 | } |
0397ce53 | 172 | |
121a60bd | 173 | //_____________________________________________________________________________ |
a8fbb161 | 174 | void AliTRDReconstructor::ConvertDigits(AliRawReader *rawReader |
91834b8d | 175 | , TTree *digitsTree) const |
121a60bd | 176 | { |
3bc9d03e | 177 | // |
25ca55ce | 178 | // Convert raw data digits into digit objects in a root tree |
3bc9d03e | 179 | // |
9926e335 | 180 | AliInfo("Feature not available for the moment."); return; |
121a60bd | 181 | |
91834b8d | 182 | AliInfo("Convert raw data digits into digit objects [RawReader -> Digit TTree]"); |
183 | ||
a8fbb161 | 184 | AliTRDrawData rawData; |
3a0f6479 | 185 | rawReader->Reset(); |
186 | rawReader->Select("TRD"); | |
a8fbb161 | 187 | AliTRDdigitsManager *manager = rawData.Raw2Digits(rawReader); |
188 | manager->MakeBranch(digitsTree); | |
189 | manager->WriteDigits(); | |
c0ab62ff | 190 | delete manager; |
0ee00e25 | 191 | |
121a60bd | 192 | } |
193 | ||
25ca55ce | 194 | //_____________________________________________________________________________ |
195 | void AliTRDReconstructor::Reconstruct(AliRawReader *rawReader | |
196 | , TTree *clusterTree) const | |
197 | { | |
198 | // | |
199 | // Reconstruct clusters | |
200 | // | |
201 | ||
91834b8d | 202 | //AliInfo("Reconstruct TRD clusters from RAW data [RawReader -> Cluster TTree]"); |
203 | ||
204 | ||
3a0f6479 | 205 | rawReader->Reset(); |
206 | rawReader->Select("TRD"); | |
207 | ||
ca21baaa | 208 | // New (fast) cluster finder |
b72f4eaf | 209 | AliTRDclusterizer clusterer(fgTaskNames[kClusterizer], fgTaskNames[kClusterizer]); |
3d0c7d6d | 210 | clusterer.SetReconstructor(this); |
211 | clusterer.OpenOutput(clusterTree); | |
b72f4eaf | 212 | clusterer.SetUseLabels(kFALSE); |
ca21baaa | 213 | clusterer.Raw2ClustersChamber(rawReader); |
66f6bfd9 | 214 | |
215 | if(IsWritingClusters()) return; | |
d6e36038 | 216 | |
66f6bfd9 | 217 | // take over ownership of clusters |
218 | fgClusters = clusterer.RecPoints(); | |
219 | clusterer.SetClustersOwner(kFALSE); | |
25ca55ce | 220 | } |
221 | ||
222 | //_____________________________________________________________________________ | |
a8fbb161 | 223 | void AliTRDReconstructor::Reconstruct(TTree *digitsTree |
224 | , TTree *clusterTree) const | |
25ca55ce | 225 | { |
226 | // | |
227 | // Reconstruct clusters | |
228 | // | |
e4f2f73d | 229 | |
91834b8d | 230 | //AliInfo("Reconstruct TRD clusters from Digits [Digit TTree -> Cluster TTree]"); |
231 | ||
b72f4eaf | 232 | AliTRDclusterizer clusterer(fgTaskNames[kClusterizer], fgTaskNames[kClusterizer]); |
3d0c7d6d | 233 | clusterer.SetReconstructor(this); |
234 | clusterer.OpenOutput(clusterTree); | |
25ca55ce | 235 | clusterer.ReadDigits(digitsTree); |
236 | clusterer.MakeClusters(); | |
d6e36038 | 237 | |
66f6bfd9 | 238 | if(IsWritingClusters()) return; |
239 | ||
240 | // take over ownership of clusters | |
241 | fgClusters = clusterer.RecPoints(); | |
242 | clusterer.SetClustersOwner(kFALSE); | |
25ca55ce | 243 | } |
244 | ||
245 | //_____________________________________________________________________________ | |
44dbae42 | 246 | AliTracker *AliTRDReconstructor::CreateTracker() const |
121a60bd | 247 | { |
3bc9d03e | 248 | // |
249 | // Create a TRD tracker | |
250 | // | |
121a60bd | 251 | |
e4f2f73d | 252 | //return new AliTRDtracker(NULL); |
3a039a31 | 253 | AliTRDtrackerV1 *tracker = new AliTRDtrackerV1(); |
254 | tracker->SetReconstructor(this); | |
255 | return tracker; | |
25ca55ce | 256 | |
25ca55ce | 257 | } |
258 | ||
259 | //_____________________________________________________________________________ | |
260 | void AliTRDReconstructor::FillESD(TTree* /*digitsTree*/ | |
91834b8d | 261 | , TTree* /*clusterTree*/ |
262 | , AliESDEvent* /*esd*/) const | |
25ca55ce | 263 | { |
264 | // | |
af26ce80 | 265 | // Fill ESD |
25ca55ce | 266 | // |
267 | ||
25ca55ce | 268 | } |
3a039a31 | 269 | |
91834b8d | 270 | |
3a039a31 | 271 | //_____________________________________________________________________________ |
272 | void AliTRDReconstructor::SetOption(Option_t *opt) | |
273 | { | |
91834b8d | 274 | // Read option string into the steer param. |
91834b8d | 275 | // |
97b6dfac | 276 | |
277 | AliReconstructor::SetOption(opt); | |
3a039a31 | 278 | |
279 | TString s(opt); | |
280 | TObjArray *opar = s.Tokenize(","); | |
281 | for(Int_t ipar=0; ipar<opar->GetEntriesFast(); ipar++){ | |
b72f4eaf | 282 | Bool_t PROCESSED = kFALSE; |
3a039a31 | 283 | TString sopt(((TObjString*)(*opar)[ipar])->String()); |
b72f4eaf | 284 | for(Int_t iopt=0; iopt<kNsteer; iopt++){ |
285 | if(!sopt.Contains(fgSteerFlags[iopt])) continue; | |
286 | SETFLG(fSteerParam, BIT(iopt)); | |
287 | if(sopt.Contains("!")) CLRFLG(fSteerParam, BIT(iopt)); | |
288 | PROCESSED = kTRUE; | |
289 | break; | |
290 | } | |
291 | if(PROCESSED) continue; | |
292 | ||
293 | if(sopt.Contains("sl")){ | |
91834b8d | 294 | TObjArray *stl = sopt.Tokenize("_"); |
295 | if(stl->GetEntriesFast() < 3) continue; | |
296 | TString taskstr(((TObjString*)(*stl)[1])->String()); | |
297 | TString levelstring(((TObjString*)(*stl)[2])->String()); | |
91834b8d | 298 | Int_t level = levelstring.Atoi(); |
b72f4eaf | 299 | |
300 | // Set the stream Level | |
301 | PROCESSED = kFALSE; | |
302 | for(Int_t it=0; it<kNtasks; it++){ | |
303 | if(taskstr.CompareTo(fgTaskFlags[it]) != 0) continue; | |
304 | SetStreamLevel(level, ETRDReconstructorTask(it)); | |
305 | PROCESSED = kTRUE; | |
306 | } | |
307 | } | |
308 | if(PROCESSED) continue; | |
309 | ||
310 | AliWarning(Form("Unknown option flag %s.", sopt.Data())); | |
3a039a31 | 311 | } |
312 | } | |
313 | ||
acd241e9 | 314 | //_____________________________________________________________________________ |
89971837 | 315 | void AliTRDReconstructor::SetStreamLevel(Int_t level, ETRDReconstructorTask task){ |
18c05eb3 | 316 | // |
317 | // Set the Stream Level for one of the tasks Clusterizer, Tracker or PID | |
318 | // | |
29f95561 | 319 | const Int_t minLevel[4] = {1, 1, 2, 1}; // the minimum debug level upon which a debug stream is created for different tasks |
91834b8d | 320 | //AliInfo(Form("Setting Stream Level for Task %s to %d", taskname.Data(),level)); |
18c05eb3 | 321 | fStreamLevel[(Int_t)task] = level; |
29f95561 | 322 | // Initialize DebugStreamer if not yet done |
323 | if(level >= minLevel[task] && !fDebugStream[task]){ | |
324 | TDirectory *savedir = gDirectory; | |
b72f4eaf | 325 | fDebugStream[task] = new TTreeSRedirector(Form("TRD.Debug%s.root", fgTaskNames[task])); |
29f95561 | 326 | savedir->cd(); |
89971837 | 327 | SETFLG(fSteerParam, kOwner); |
29f95561 | 328 | } |
acd241e9 | 329 | } |
b72f4eaf | 330 | |
331 | //_____________________________________________________________________________ | |
332 | void AliTRDReconstructor::Options(UInt_t steer, UChar_t *stream) | |
333 | { | |
334 | for(Int_t iopt=0; iopt<kNsteer; iopt++){ | |
335 | AliInfoGeneral("AliTRDReconstructor", Form(" %s[%s]%s", fgSteerNames[iopt], fgSteerFlags[iopt], steer ?(((steer>>iopt)&1)?" : ON":" : OFF"):"")); | |
336 | } | |
337 | AliInfoGeneral("AliTRDReconstructor", " Debug Streaming"); | |
338 | for(Int_t it=0; it<kNtasks; it++) | |
339 | AliInfoGeneral("AliTRDReconstructor", Form(" %s [sl_%s] %d", fgTaskNames[it], fgTaskFlags[it], stream ? stream[it] : 0)); | |
340 | } | |
341 |