]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDReconstructor.cxx
SDD QA updated in order to deal with acquisition through HLT (M. Siciliano)
[u/mrichter/AliRoot.git] / TRD / AliTRDReconstructor.cxx
CommitLineData
121a60bd 1/**************************************************************************
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 **************************************************************************/
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
45ClassImp(AliTRDReconstructor)
46
66f6bfd9 47TClonesArray *AliTRDReconstructor::fgClusters = 0x0;
eb38ed55 48//_____________________________________________________________________________
3a039a31 49AliTRDReconstructor::AliTRDReconstructor()
50 :AliReconstructor()
51 ,fSteerParam(0x00000007)
52{
18c05eb3 53 //
54 // Default constructor
55 //
56
3a039a31 57 memset(fStreamLevel, 0, 5*sizeof(UChar_t));
58 // Xe tail cancellation parameters
59 fTCParams[0] = 1.156; // r1
60 fTCParams[1] = 0.130; // r2
61 fTCParams[2] = 0.114; // c1
62 fTCParams[3] = 0.624; // c2
63 // Ar tail cancellation parameters
181c7f7e 64 fTCParams[4] = 6.; // r1
65 fTCParams[5] = 0.62; // r2
66 fTCParams[6] = 0.0087;// c1
67 fTCParams[7] = 0.07; // c2
18c05eb3 68
eb38ed55 69}
70
3a039a31 71//_____________________________________________________________________________
72AliTRDReconstructor::AliTRDReconstructor(const AliTRDReconstructor &r)
73 :AliReconstructor(r)
181c7f7e 74 ,fSteerParam(r.fSteerParam)
3a039a31 75{
18c05eb3 76 //
77 // Copy constructor
78 //
79
80 memcpy(fStreamLevel,r.fStreamLevel, 5*sizeof(UChar_t));
81 memcpy(fTCParams ,r.fTCParams , 8*sizeof(Double_t));
82
3a039a31 83}
eb38ed55 84
48f8adf3 85//_____________________________________________________________________________
86AliTRDReconstructor::~AliTRDReconstructor()
87{
18c05eb3 88 //
89 // Destructor
90 //
91
48f8adf3 92 if(fgClusters) {
93 fgClusters->Delete(); delete fgClusters;
94 }
48f8adf3 95
18c05eb3 96}
48f8adf3 97
acd241e9 98//_____________________________________________________________________________
18c05eb3 99void AliTRDReconstructor::Init()
100{
101 //
102 // Init Options
103 //
104
105 SetOption(GetOption());
20bcdcc4 106
107 AliInfo("TRD reconstruction will use the following settings:");
108 printf("\tWrite Clusters [cw] : %s\n", fSteerParam&kWriteClusters?"yes":"no");
109 printf("\tWrite Online Tracklets [tw] : %s\n", fSteerParam&kWriteTracklets?"yes":"no");
110 printf("\tDrift Gas Argon [ar] : %s\n", fSteerParam&kDriftGas?"yes":"no");
111 printf("\tStand Alone Tracking [sa] : %s\n", fSteerParam&kSeeding?"yes":"no");
4302c900 112 printf("\tHLT Tracking [hlt] : %s\n", fSteerParam&kHLT?"yes":"no");
20bcdcc4 113 printf("\tNN PID [nn] : %s\n", fSteerParam&kSteerPID?"yes":"no");
18c05eb3 114 printf("\tStreaming Levels : Clusterizer[%d] Tracker[%d] PID[%d]\n"
115 ,fStreamLevel[kClusterizer]
116 ,fStreamLevel[kTracker]
117 ,fStreamLevel[kPID]);
118
acd241e9 119}
0397ce53 120
121a60bd 121//_____________________________________________________________________________
a8fbb161 122void AliTRDReconstructor::ConvertDigits(AliRawReader *rawReader
123 , TTree *digitsTree) const
121a60bd 124{
3bc9d03e 125 //
25ca55ce 126 // Convert raw data digits into digit objects in a root tree
3bc9d03e 127 //
121a60bd 128
a8fbb161 129 AliTRDrawData rawData;
3a0f6479 130 rawReader->Reset();
131 rawReader->Select("TRD");
a8fbb161 132 AliTRDdigitsManager *manager = rawData.Raw2Digits(rawReader);
133 manager->MakeBranch(digitsTree);
134 manager->WriteDigits();
c0ab62ff 135 delete manager;
0ee00e25 136
121a60bd 137}
138
25ca55ce 139//_____________________________________________________________________________
140void AliTRDReconstructor::Reconstruct(AliRawReader *rawReader
141 , TTree *clusterTree) const
142{
143 //
144 // Reconstruct clusters
145 //
146
3a0f6479 147 rawReader->Reset();
148 rawReader->Select("TRD");
149
ca21baaa 150 // New (fast) cluster finder
3fe61b77 151 AliTRDclusterizer clusterer("clusterer","TRD clusterizer");
3a039a31 152 clusterer.SetReconstructor(this);
25ca55ce 153 clusterer.OpenOutput(clusterTree);
ca21baaa 154 clusterer.SetAddLabels(kFALSE);
155 clusterer.Raw2ClustersChamber(rawReader);
66f6bfd9 156
157 if(IsWritingClusters()) return;
d6e36038 158
66f6bfd9 159 // take over ownership of clusters
160 fgClusters = clusterer.RecPoints();
161 clusterer.SetClustersOwner(kFALSE);
18c05eb3 162
25ca55ce 163}
164
165//_____________________________________________________________________________
a8fbb161 166void AliTRDReconstructor::Reconstruct(TTree *digitsTree
167 , TTree *clusterTree) const
25ca55ce 168{
169 //
170 // Reconstruct clusters
171 //
e4f2f73d 172
3fe61b77 173 AliTRDclusterizer clusterer("clusterer","TRD clusterizer");
3a039a31 174 clusterer.SetReconstructor(this);
25ca55ce 175 clusterer.OpenOutput(clusterTree);
176 clusterer.ReadDigits(digitsTree);
177 clusterer.MakeClusters();
d6e36038 178
66f6bfd9 179 if(IsWritingClusters()) return;
180
181 // take over ownership of clusters
182 fgClusters = clusterer.RecPoints();
183 clusterer.SetClustersOwner(kFALSE);
18c05eb3 184
25ca55ce 185}
186
187//_____________________________________________________________________________
44dbae42 188AliTracker *AliTRDReconstructor::CreateTracker() const
121a60bd 189{
3bc9d03e 190 //
191 // Create a TRD tracker
192 //
121a60bd 193
e4f2f73d 194 //return new AliTRDtracker(NULL);
3a039a31 195 AliTRDtrackerV1 *tracker = new AliTRDtrackerV1();
196 tracker->SetReconstructor(this);
197 return tracker;
25ca55ce 198
25ca55ce 199}
200
201//_____________________________________________________________________________
202void AliTRDReconstructor::FillESD(TTree* /*digitsTree*/
203 , TTree* /*clusterTree*/
ca21baaa 204 , AliESDEvent* /*esd*/) const
25ca55ce 205{
206 //
af26ce80 207 // Fill ESD
25ca55ce 208 //
209
25ca55ce 210}
3a039a31 211
3a039a31 212//_____________________________________________________________________________
213void AliTRDReconstructor::SetOption(Option_t *opt)
214{
18c05eb3 215 //
216 // Read option string into the steer param.
217 //
218 // Default steer param values
219 //
220 // write clusters [cw] = true
221 // track seeding (stand alone tracking) [sa] = true
222 // PID method in reconstruction (NN) [nn] = true
223 // write online tracklets [tw] = false
224 // drift gas [ar] = false
225 // HLT tracking [hlt] = false
226 //
227
3a039a31 228 fSteerParam = 0x00000007;
229
230 TString s(opt);
231 TObjArray *opar = s.Tokenize(",");
232 for(Int_t ipar=0; ipar<opar->GetEntriesFast(); ipar++){
233 TString sopt(((TObjString*)(*opar)[ipar])->String());
234 if(sopt.Contains("!cw")){
235 fSteerParam &= ~kWriteClusters;
236 continue;
237 } else if(sopt.Contains("!sa")){
238 fSteerParam &= ~kSeeding;
239 continue;
240 } else if(sopt.Contains("!nn")){
241 fSteerParam &= ~kSteerPID;
242 continue;
243 } else if(sopt.Contains("tw")){
20bcdcc4 244 if(!sopt.Contains("!")) fSteerParam |= kWriteTracklets;
3a039a31 245 continue;
246 } else if(sopt.Contains("ar")){
20bcdcc4 247 if(!sopt.Contains("!")) fSteerParam |= kDriftGas;
3a039a31 248 continue;
4302c900 249 } else if(sopt.Contains("hlt")){
250 if(!sopt.Contains("!")) fSteerParam |= kHLT;
251 continue;
acd241e9 252 } else if(sopt.Contains("sl")){
253 TObjArray *stl = sopt.Tokenize("_");
254 if(stl->GetEntriesFast() < 3) continue;
255 TString taskstr(((TObjString*)(*stl)[1])->String());
256 TString levelstring(((TObjString*)(*stl)[2])->String());
257 // Set the stream Level
258 Int_t level = levelstring.Atoi();
259 AliTRDReconstructorTask task = kTracker;
260 if(taskstr.CompareTo("cl") == 0) task = kClusterizer;
261 else if(taskstr.CompareTo("tr") == 0) task = kTracker;
262 else if(taskstr.CompareTo("pi") == 0) task = kPID;
263 SetStreamLevel(level, task);
264 continue;
265 }
3a039a31 266 }
18c05eb3 267
3a039a31 268}
269
acd241e9 270//_____________________________________________________________________________
18c05eb3 271void AliTRDReconstructor::SetStreamLevel(Int_t level, AliTRDReconstructorTask task)
272{
273 //
274 // Set the Stream Level for one of the tasks Clusterizer, Tracker or PID
275 //
276
277 TString taskname;
278 switch(task) {
279 case kClusterizer:
280 taskname = "Clusterizer";
281 break;
282 case kTracker:
283 taskname = "Tracker";
284 break;
285 case kPID:
286 taskname = "PID";
287 break;
288 }
289
290 fStreamLevel[(Int_t)task] = level;
291
acd241e9 292}