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