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