]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDReconstructor.cxx
Modifications concerning the tail cancellation
[u/mrichter/AliRoot.git] / TRD / AliTRDReconstructor.cxx
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 //                                                                           //
20 // Class for TRD reconstruction                                              //
21 //                                                                           //
22 ///////////////////////////////////////////////////////////////////////////////
23
24 #include <TFile.h>
25 #include <TObjString.h>
26 #include <TObjArray.h>
27
28 #include "AliRunLoader.h"
29 #include "AliRawReader.h"
30 #include "AliLog.h"
31 #include "AliESDTrdTrack.h"
32 #include "AliESDEvent.h"
33
34 #include "AliTRDReconstructor.h"
35 #include "AliTRDclusterizer.h"
36 #include "AliTRDtracker.h"
37 #include "AliTRDpidESD.h"
38 #include "AliTRDgtuTrack.h"
39 #include "AliTRDrawData.h"
40 #include "AliTRDdigitsManager.h"
41 #include "AliTRDtrackerV1.h"
42 #include "AliTRDrecoParam.h"
43
44 ClassImp(AliTRDReconstructor)
45
46
47 //_____________________________________________________________________________
48 AliTRDReconstructor::AliTRDReconstructor()
49   :AliReconstructor()
50   ,fSteerParam(0x00000007)
51 {
52   memset(fStreamLevel, 0, 5*sizeof(UChar_t));
53   // Xe tail cancellation parameters
54   fTCParams[0] = 1.156; // r1
55   fTCParams[1] = 0.130; // r2
56   fTCParams[2] = 0.114; // c1
57   fTCParams[3] = 0.624; // c2
58   // Ar tail cancellation parameters
59   fTCParams[4] = 6.;    // r1
60   fTCParams[5] = 0.62;  // r2
61   fTCParams[6] = 0.0087;// c1
62   fTCParams[7] = 0.07;  // c2
63 }
64
65 //_____________________________________________________________________________
66 AliTRDReconstructor::AliTRDReconstructor(const AliTRDReconstructor &r)
67   :AliReconstructor(r)
68   ,fSteerParam(r.fSteerParam)
69 {
70   memcpy(fStreamLevel, r.fStreamLevel, 5*sizeof(UChar_t));
71   memcpy(fTCParams, r.fTCParams, 8*sizeof(Double_t));
72 }
73
74 //_____________________________________________________________________________
75 void AliTRDReconstructor::Init(){
76         //
77         // Init Options
78         //
79         SetOption(GetOption());
80 }
81
82 //_____________________________________________________________________________
83 void AliTRDReconstructor::ConvertDigits(AliRawReader *rawReader
84                                       , TTree *digitsTree) const
85 {
86   //
87   // Convert raw data digits into digit objects in a root tree
88   //
89
90   AliInfo("Convert raw data digits into digit objects [RawReader -> Digit TTree]");
91
92   AliTRDrawData rawData;
93   rawReader->Reset();
94   rawReader->Select("TRD");
95   AliTRDdigitsManager *manager = rawData.Raw2Digits(rawReader);
96   manager->MakeBranch(digitsTree);
97   manager->WriteDigits();
98   delete manager;
99
100 }
101
102 //_____________________________________________________________________________
103 void AliTRDReconstructor::Reconstruct(AliRawReader *rawReader
104                                     , TTree *clusterTree) const
105 {
106   //
107   // Reconstruct clusters
108   //
109
110   AliInfo("Reconstruct TRD clusters from RAW data [RawReader -> Cluster TTree]");
111
112
113   rawReader->Reset();
114   rawReader->Select("TRD");
115
116   // New (fast) cluster finder
117   AliTRDclusterizer clusterer("clusterer","TRD clusterizer");
118   clusterer.SetReconstructor(this);
119   clusterer.OpenOutput(clusterTree);
120   clusterer.SetAddLabels(kFALSE);
121   clusterer.Raw2ClustersChamber(rawReader);
122
123 }
124
125 //_____________________________________________________________________________
126 void AliTRDReconstructor::Reconstruct(TTree *digitsTree
127                                     , TTree *clusterTree) const
128 {
129   //
130   // Reconstruct clusters
131   //
132
133   AliInfo("Reconstruct TRD clusters from Digits [Digit TTree -> Cluster TTree]");
134
135   AliTRDclusterizer clusterer("clusterer","TRD clusterizer");
136   clusterer.SetReconstructor(this);
137   clusterer.OpenOutput(clusterTree);
138   clusterer.ReadDigits(digitsTree);
139   clusterer.MakeClusters();
140
141 }
142
143 //_____________________________________________________________________________
144 AliTracker *AliTRDReconstructor::CreateTracker() const
145 {
146   //
147   // Create a TRD tracker
148   //
149
150   //return new AliTRDtracker(NULL);
151   AliTRDtrackerV1 *tracker = new AliTRDtrackerV1();
152   tracker->SetReconstructor(this);
153   return tracker;
154
155 }
156
157 //_____________________________________________________________________________
158 void AliTRDReconstructor::FillESD(TTree* /*digitsTree*/
159                                 , TTree* /*clusterTree*/
160                                 , AliESDEvent* /*esd*/) const
161 {
162   //
163   // Fill ESD
164   //
165
166 }
167
168
169 //_____________________________________________________________________________
170 void AliTRDReconstructor::SetOption(Option_t *opt)
171 {
172 // Read option string into the steer param.
173 //
174 // Default steer param values
175 //
176 // write clusters [cw] = true
177 // track seeding (stand alone tracking) [sa] = true
178 // PID method in reconstruction (NN) [nn] = true
179 // write online tracklets [tw] = false
180 // drift gas [ar] = false
181 //
182   fSteerParam = 0x00000007;
183
184   TString s(opt);
185   TObjArray *opar = s.Tokenize(",");
186   for(Int_t ipar=0; ipar<opar->GetEntriesFast(); ipar++){
187     TString sopt(((TObjString*)(*opar)[ipar])->String());
188     if(sopt.Contains("!cw")){ 
189       fSteerParam &= ~kWriteClusters;
190       continue;
191     } else if(sopt.Contains("!sa")){
192       fSteerParam &= ~kSeeding;
193       continue;
194     } else if(sopt.Contains("!nn")){
195       fSteerParam &= ~kSteerPID;
196       continue;
197     } else if(sopt.Contains("tw")){
198       fSteerParam |= kWriteTracklets;
199       continue; 
200     } else if(sopt.Contains("ar")){
201       fSteerParam |= kDriftGas;
202       continue; 
203     } else if(sopt.Contains("sl")){
204         TObjArray *stl = sopt.Tokenize("_");
205         if(stl->GetEntriesFast() < 3) continue;
206                         TString taskstr(((TObjString*)(*stl)[1])->String());
207                         TString levelstring(((TObjString*)(*stl)[2])->String());
208         // Set the stream Level
209         Int_t level = levelstring.Atoi();
210         AliTRDReconstructorTask task = kTracker;
211         if(taskstr.CompareTo("cl") == 0) task = kClusterizer;   
212         else if(taskstr.CompareTo("tr") == 0) task = kTracker;
213         else if(taskstr.CompareTo("pi") == 0) task = kPID;
214         SetStreamLevel(level, task);
215         continue;
216                 }
217   }
218 }
219
220 //_____________________________________________________________________________
221 void AliTRDReconstructor::SetStreamLevel(Int_t level, AliTRDReconstructorTask task){
222         //
223         // Set the Stream Level for one of the tasks Clusterizer, Tracker or PID
224         //
225         TString taskname;
226         switch(task){
227                 case kClusterizer: taskname = "Clusterizer";
228                                                                                          break;
229                 case kTracker: taskname = "Tracker";
230                                                                          break;
231                 case kPID: taskname = "PID";
232                                                          break;
233         }
234         AliInfo(Form("Setting Stream Level for Task %s to %d", taskname.Data(),level));
235         fStreamLevel[(Int_t)task] = level;
236 }