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