]>
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; |
eb38ed55 | 53 | //_____________________________________________________________________________ |
3a039a31 | 54 | AliTRDReconstructor::AliTRDReconstructor() |
55 | :AliReconstructor() | |
97b6dfac | 56 | ,fSteerParam(0) |
3a039a31 | 57 | { |
97b6dfac | 58 | // setting default "ON" steering parameters |
89971837 | 59 | // owner of debug streamers |
60 | SETFLG(fSteerParam, kOwner); | |
97b6dfac | 61 | // write clusters [cw] |
62 | SETFLG(fSteerParam, kWriteClusters); | |
63 | // track seeding (stand alone tracking) [sa] | |
64 | SETFLG(fSteerParam, kSeeding); | |
65 | // PID method in reconstruction (NN) [nn] | |
66 | SETFLG(fSteerParam, kSteerPID); | |
89971837 | 67 | // number of dEdx slices in the ESD track [8s] |
68 | //SETFLG(fSteerParam, kEightSlices); | |
97b6dfac | 69 | |
89971837 | 70 | memset(fStreamLevel, 0, kNtasks*sizeof(UChar_t)); |
71 | memset(fDebugStream, 0, sizeof(TTreeSRedirector *) * kNtasks); | |
3a039a31 | 72 | // Xe tail cancellation parameters |
73 | fTCParams[0] = 1.156; // r1 | |
74 | fTCParams[1] = 0.130; // r2 | |
75 | fTCParams[2] = 0.114; // c1 | |
76 | fTCParams[3] = 0.624; // c2 | |
77 | // Ar tail cancellation parameters | |
181c7f7e | 78 | fTCParams[4] = 6.; // r1 |
79 | fTCParams[5] = 0.62; // r2 | |
80 | fTCParams[6] = 0.0087;// c1 | |
81 | fTCParams[7] = 0.07; // c2 | |
eb38ed55 | 82 | } |
83 | ||
3a039a31 | 84 | //_____________________________________________________________________________ |
85 | AliTRDReconstructor::AliTRDReconstructor(const AliTRDReconstructor &r) | |
86 | :AliReconstructor(r) | |
181c7f7e | 87 | ,fSteerParam(r.fSteerParam) |
3a039a31 | 88 | { |
89971837 | 89 | memcpy(fStreamLevel, r.fStreamLevel, kNtasks*sizeof(UChar_t)); |
91834b8d | 90 | memcpy(fTCParams, r.fTCParams, 8*sizeof(Double_t)); |
89971837 | 91 | memcpy(fDebugStream, r.fDebugStream, sizeof(TTreeSRedirector *) *kNtasks); |
92 | // ownership of debug streamers is not taken | |
93 | CLRFLG(fSteerParam, kOwner); | |
3a039a31 | 94 | } |
eb38ed55 | 95 | |
48f8adf3 | 96 | //_____________________________________________________________________________ |
97 | AliTRDReconstructor::~AliTRDReconstructor() | |
98 | { | |
99 | if(fgClusters) { | |
100 | fgClusters->Delete(); delete fgClusters; | |
101 | } | |
f29f13a6 | 102 | if(fSteerParam&kOwner){ |
89971837 | 103 | for(Int_t itask = 0; itask < kNtasks; itask++) |
29f95561 | 104 | if(fDebugStream[itask]) delete fDebugStream[itask]; |
105 | } | |
18c05eb3 | 106 | } |
48f8adf3 | 107 | |
91834b8d | 108 | |
acd241e9 | 109 | //_____________________________________________________________________________ |
91834b8d | 110 | void AliTRDReconstructor::Init(){ |
18c05eb3 | 111 | // |
112 | // Init Options | |
113 | // | |
18c05eb3 | 114 | SetOption(GetOption()); |
20bcdcc4 | 115 | |
c2cd1e8f | 116 | AliInfo(Form("\tDigitsConversion [dc] : %s", fSteerParam&kDigitsConversion?"yes":"no")); |
117 | AliInfo(Form("\tWrite Clusters [cw] : %s", fSteerParam&kWriteClusters?"yes":"no")); | |
118 | AliInfo(Form("\tWrite Online Tracklets [tw] : %s", fSteerParam&kWriteTracklets?"yes":"no")); | |
119 | AliInfo(Form("\tDrift Gas Argon [ar] : %s", fSteerParam&kDriftGas?"yes":"no")); | |
120 | AliInfo(Form("\tStand Alone Tracking [sa] : %s", fSteerParam&kSeeding?"yes":"no")); | |
121 | AliInfo(Form("\tHLT Tracking [hlt] : %s", fSteerParam&kHLT?"yes":"no")); | |
122 | AliInfo(Form("\tCosmic Reconstruction [cos] : %s", fSteerParam&kCosmic?"yes":"no")); | |
123 | AliInfo(Form("\tNN PID [nn] : %s", fSteerParam&kSteerPID?"yes":"no")); | |
124 | AliInfo(Form("\t8 dEdx slices in ESD [8s] : %s", fSteerParam&kEightSlices?"yes":"no")); | |
125 | AliInfo(Form("\tStreaming Levels : Clusterizer[%d] Tracker[%d] PID[%d]", fStreamLevel[kClusterizer], fStreamLevel[kTracker], fStreamLevel[kPID])); | |
acd241e9 | 126 | } |
0397ce53 | 127 | |
121a60bd | 128 | //_____________________________________________________________________________ |
a8fbb161 | 129 | void AliTRDReconstructor::ConvertDigits(AliRawReader *rawReader |
91834b8d | 130 | , TTree *digitsTree) const |
121a60bd | 131 | { |
3bc9d03e | 132 | // |
25ca55ce | 133 | // Convert raw data digits into digit objects in a root tree |
3bc9d03e | 134 | // |
9926e335 | 135 | AliInfo("Feature not available for the moment."); return; |
121a60bd | 136 | |
91834b8d | 137 | AliInfo("Convert raw data digits into digit objects [RawReader -> Digit TTree]"); |
138 | ||
a8fbb161 | 139 | AliTRDrawData rawData; |
3a0f6479 | 140 | rawReader->Reset(); |
141 | rawReader->Select("TRD"); | |
a8fbb161 | 142 | AliTRDdigitsManager *manager = rawData.Raw2Digits(rawReader); |
143 | manager->MakeBranch(digitsTree); | |
144 | manager->WriteDigits(); | |
c0ab62ff | 145 | delete manager; |
0ee00e25 | 146 | |
121a60bd | 147 | } |
148 | ||
25ca55ce | 149 | //_____________________________________________________________________________ |
150 | void AliTRDReconstructor::Reconstruct(AliRawReader *rawReader | |
151 | , TTree *clusterTree) const | |
152 | { | |
153 | // | |
154 | // Reconstruct clusters | |
155 | // | |
156 | ||
91834b8d | 157 | //AliInfo("Reconstruct TRD clusters from RAW data [RawReader -> Cluster TTree]"); |
158 | ||
159 | ||
3a0f6479 | 160 | rawReader->Reset(); |
161 | rawReader->Select("TRD"); | |
162 | ||
ca21baaa | 163 | // New (fast) cluster finder |
3d0c7d6d | 164 | AliTRDclusterizer clusterer("clusterer","TRD clusterizer"); |
165 | clusterer.SetReconstructor(this); | |
166 | clusterer.OpenOutput(clusterTree); | |
ca21baaa | 167 | clusterer.SetAddLabels(kFALSE); |
168 | clusterer.Raw2ClustersChamber(rawReader); | |
66f6bfd9 | 169 | |
170 | if(IsWritingClusters()) return; | |
d6e36038 | 171 | |
66f6bfd9 | 172 | // take over ownership of clusters |
173 | fgClusters = clusterer.RecPoints(); | |
174 | clusterer.SetClustersOwner(kFALSE); | |
25ca55ce | 175 | } |
176 | ||
177 | //_____________________________________________________________________________ | |
a8fbb161 | 178 | void AliTRDReconstructor::Reconstruct(TTree *digitsTree |
179 | , TTree *clusterTree) const | |
25ca55ce | 180 | { |
181 | // | |
182 | // Reconstruct clusters | |
183 | // | |
e4f2f73d | 184 | |
91834b8d | 185 | //AliInfo("Reconstruct TRD clusters from Digits [Digit TTree -> Cluster TTree]"); |
186 | ||
3fe61b77 | 187 | AliTRDclusterizer clusterer("clusterer","TRD clusterizer"); |
3d0c7d6d | 188 | clusterer.SetReconstructor(this); |
189 | clusterer.OpenOutput(clusterTree); | |
25ca55ce | 190 | clusterer.ReadDigits(digitsTree); |
191 | clusterer.MakeClusters(); | |
d6e36038 | 192 | |
66f6bfd9 | 193 | if(IsWritingClusters()) return; |
194 | ||
195 | // take over ownership of clusters | |
196 | fgClusters = clusterer.RecPoints(); | |
197 | clusterer.SetClustersOwner(kFALSE); | |
25ca55ce | 198 | } |
199 | ||
200 | //_____________________________________________________________________________ | |
44dbae42 | 201 | AliTracker *AliTRDReconstructor::CreateTracker() const |
121a60bd | 202 | { |
3bc9d03e | 203 | // |
204 | // Create a TRD tracker | |
205 | // | |
121a60bd | 206 | |
e4f2f73d | 207 | //return new AliTRDtracker(NULL); |
3a039a31 | 208 | AliTRDtrackerV1 *tracker = new AliTRDtrackerV1(); |
209 | tracker->SetReconstructor(this); | |
210 | return tracker; | |
25ca55ce | 211 | |
25ca55ce | 212 | } |
213 | ||
214 | //_____________________________________________________________________________ | |
215 | void AliTRDReconstructor::FillESD(TTree* /*digitsTree*/ | |
91834b8d | 216 | , TTree* /*clusterTree*/ |
217 | , AliESDEvent* /*esd*/) const | |
25ca55ce | 218 | { |
219 | // | |
af26ce80 | 220 | // Fill ESD |
25ca55ce | 221 | // |
222 | ||
25ca55ce | 223 | } |
3a039a31 | 224 | |
91834b8d | 225 | |
3a039a31 | 226 | //_____________________________________________________________________________ |
227 | void AliTRDReconstructor::SetOption(Option_t *opt) | |
228 | { | |
91834b8d | 229 | // Read option string into the steer param. |
230 | // | |
231 | // Default steer param values | |
232 | // | |
97b6dfac | 233 | // digits conversion [dc] = false |
56b32fd7 | 234 | // drift gas [ar] = false - do not update the number of exponentials in the TC ! |
91834b8d | 235 | // write clusters [cw] = true |
56b32fd7 | 236 | // write online tracklets [tw] = false |
91834b8d | 237 | // track seeding (stand alone tracking) [sa] = true |
238 | // PID method in reconstruction (NN) [nn] = true | |
56b32fd7 | 239 | // 8 dEdx slices in ESD [8s] = false |
91834b8d | 240 | // HLT tracking [hlt] = false |
241 | // Cosmic Reconstruction [cos] = false | |
242 | // | |
97b6dfac | 243 | |
244 | AliReconstructor::SetOption(opt); | |
3a039a31 | 245 | |
246 | TString s(opt); | |
247 | TObjArray *opar = s.Tokenize(","); | |
248 | for(Int_t ipar=0; ipar<opar->GetEntriesFast(); ipar++){ | |
249 | TString sopt(((TObjString*)(*opar)[ipar])->String()); | |
97b6dfac | 250 | if(sopt.Contains("dc")){ |
251 | SETFLG(fSteerParam, kDigitsConversion); | |
252 | if(sopt.Contains("!")) CLRFLG(fSteerParam, kDigitsConversion); | |
00872461 | 253 | continue; |
97b6dfac | 254 | } else if(sopt.Contains("cw")){ |
255 | SETFLG(fSteerParam, kWriteClusters); | |
256 | if(sopt.Contains("!")) CLRFLG(fSteerParam, kWriteClusters); | |
257 | continue; | |
258 | } else if(sopt.Contains("sa")){ | |
259 | SETFLG(fSteerParam, kSeeding); | |
260 | if(sopt.Contains("!")) CLRFLG(fSteerParam, kSeeding); | |
3a039a31 | 261 | continue; |
97b6dfac | 262 | } else if(sopt.Contains("nn")){ |
263 | SETFLG(fSteerParam, kSteerPID); | |
264 | if(sopt.Contains("!")) CLRFLG(fSteerParam, kSteerPID); | |
3a039a31 | 265 | continue; |
56b32fd7 | 266 | } else if(sopt.Contains("8s")){ |
267 | SETFLG(fSteerParam, kEightSlices); | |
268 | if(sopt.Contains("!")) CLRFLG(fSteerParam, kEightSlices); | |
269 | continue; | |
3a039a31 | 270 | } else if(sopt.Contains("tw")){ |
97b6dfac | 271 | SETFLG(fSteerParam, kWriteTracklets); |
272 | if(sopt.Contains("!")) CLRFLG(fSteerParam, kWriteTracklets); | |
3a039a31 | 273 | continue; |
274 | } else if(sopt.Contains("ar")){ | |
97b6dfac | 275 | SETFLG(fSteerParam, kDriftGas); |
276 | if(sopt.Contains("!")) CLRFLG(fSteerParam, kDriftGas); | |
3a039a31 | 277 | continue; |
4302c900 | 278 | } else if(sopt.Contains("hlt")){ |
97b6dfac | 279 | SETFLG(fSteerParam, kHLT); |
280 | if(sopt.Contains("!")) CLRFLG(fSteerParam, kHLT); | |
4302c900 | 281 | continue; |
91834b8d | 282 | } else if(sopt.Contains("cos")){ |
97b6dfac | 283 | SETFLG(fSteerParam, kCosmic); |
284 | if(sopt.Contains("!")) CLRFLG(fSteerParam, kCosmic); | |
acd241e9 | 285 | } else if(sopt.Contains("sl")){ |
91834b8d | 286 | TObjArray *stl = sopt.Tokenize("_"); |
287 | if(stl->GetEntriesFast() < 3) continue; | |
288 | TString taskstr(((TObjString*)(*stl)[1])->String()); | |
289 | TString levelstring(((TObjString*)(*stl)[2])->String()); | |
290 | // Set the stream Level | |
291 | Int_t level = levelstring.Atoi(); | |
89971837 | 292 | ETRDReconstructorTask task = kTracker; |
29f95561 | 293 | if(taskstr.CompareTo("raw") == 0) task = kRawReader; |
294 | else if(taskstr.CompareTo("cl") == 0) task = kClusterizer; | |
91834b8d | 295 | else if(taskstr.CompareTo("tr") == 0) task = kTracker; |
296 | else if(taskstr.CompareTo("pi") == 0) task = kPID; | |
297 | SetStreamLevel(level, task); | |
298 | continue; | |
299 | } | |
3a039a31 | 300 | } |
301 | } | |
302 | ||
acd241e9 | 303 | //_____________________________________________________________________________ |
89971837 | 304 | void AliTRDReconstructor::SetStreamLevel(Int_t level, ETRDReconstructorTask task){ |
18c05eb3 | 305 | // |
306 | // Set the Stream Level for one of the tasks Clusterizer, Tracker or PID | |
307 | // | |
29f95561 | 308 | TString taskname[4] = {"RawReader", "Clusterizer", "Tracker", "PID"}; |
309 | const Int_t minLevel[4] = {1, 1, 2, 1}; // the minimum debug level upon which a debug stream is created for different tasks | |
91834b8d | 310 | //AliInfo(Form("Setting Stream Level for Task %s to %d", taskname.Data(),level)); |
18c05eb3 | 311 | fStreamLevel[(Int_t)task] = level; |
29f95561 | 312 | // Initialize DebugStreamer if not yet done |
313 | if(level >= minLevel[task] && !fDebugStream[task]){ | |
314 | TDirectory *savedir = gDirectory; | |
315 | fDebugStream[task] = new TTreeSRedirector(Form("TRD.%sDebug.root", taskname[task].Data())); | |
316 | savedir->cd(); | |
89971837 | 317 | SETFLG(fSteerParam, kOwner); |
29f95561 | 318 | } |
acd241e9 | 319 | } |