]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDReconstructor.cxx
Update of reco param by Alex
[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] = 1.156; // r1
60   fTCParams[5] = 0.130; // r2
61   fTCParams[6] = 0.114; // c1
62   fTCParams[7] = 0.624; // c2
63 }
64
65 //_____________________________________________________________________________
66 AliTRDReconstructor::AliTRDReconstructor(const AliTRDReconstructor &r)
67   :AliReconstructor(r)
68   ,fSteerParam(0x00000007)
69 {
70   memcpy(fStreamLevel, r.fStreamLevel, 5*sizeof(UChar_t));
71   memcpy(fTCParams, r.fTCParams, 8*sizeof(Double_t));
72 }
73
74
75 //_____________________________________________________________________________
76 void AliTRDReconstructor::ConvertDigits(AliRawReader *rawReader
77                                       , TTree *digitsTree) const
78 {
79   //
80   // Convert raw data digits into digit objects in a root tree
81   //
82
83   AliInfo("Convert raw data digits into digit objects [RawReader -> Digit TTree]");
84
85   AliTRDrawData rawData;
86   rawReader->Reset();
87   rawReader->Select("TRD");
88   AliTRDdigitsManager *manager = rawData.Raw2Digits(rawReader);
89   manager->MakeBranch(digitsTree);
90   manager->WriteDigits();
91   delete manager;
92
93 }
94
95 //_____________________________________________________________________________
96 void AliTRDReconstructor::Reconstruct(AliRawReader *rawReader
97                                     , TTree *clusterTree) const
98 {
99   //
100   // Reconstruct clusters
101   //
102
103   AliInfo("Reconstruct TRD clusters from RAW data [RawReader -> Cluster TTree]");
104
105
106   rawReader->Reset();
107   rawReader->Select("TRD");
108
109   // New (fast) cluster finder
110   AliTRDclusterizer clusterer("clusterer","TRD clusterizer");
111   clusterer.SetReconstructor(this);
112   clusterer.OpenOutput(clusterTree);
113   clusterer.SetAddLabels(kFALSE);
114   clusterer.Raw2ClustersChamber(rawReader);
115
116 }
117
118 //_____________________________________________________________________________
119 void AliTRDReconstructor::Reconstruct(TTree *digitsTree
120                                     , TTree *clusterTree) const
121 {
122   //
123   // Reconstruct clusters
124   //
125
126   AliInfo("Reconstruct TRD clusters from Digits [Digit TTree -> Cluster TTree]");
127
128   AliTRDclusterizer clusterer("clusterer","TRD clusterizer");
129   clusterer.SetReconstructor(this);
130   clusterer.OpenOutput(clusterTree);
131   clusterer.ReadDigits(digitsTree);
132   clusterer.MakeClusters();
133
134 }
135
136 //_____________________________________________________________________________
137 AliTracker *AliTRDReconstructor::CreateTracker() const
138 {
139   //
140   // Create a TRD tracker
141   //
142
143   //return new AliTRDtracker(NULL);
144   AliTRDtrackerV1 *tracker = new AliTRDtrackerV1();
145   tracker->SetReconstructor(this);
146   return tracker;
147
148 }
149
150 //_____________________________________________________________________________
151 void AliTRDReconstructor::FillESD(TTree* /*digitsTree*/
152                                 , TTree* /*clusterTree*/
153                                 , AliESDEvent* /*esd*/) const
154 {
155   //
156   // Fill ESD
157   //
158
159 }
160
161
162 //_____________________________________________________________________________
163 void AliTRDReconstructor::SetOption(Option_t *opt)
164 {
165 // Read option string into the steer param.
166 //
167 // Default steer param values
168 //
169 // write clusters [cw] = true
170 // track seeding (stand alone tracking) [sa] = true
171 // PID method in reconstruction (NN) [nn] = true
172 // write online tracklets [tw] = false
173 // drift gas [ar] = false
174 //
175   fSteerParam = 0x00000007;
176
177   TString s(opt);
178   TObjArray *opar = s.Tokenize(",");
179   for(Int_t ipar=0; ipar<opar->GetEntriesFast(); ipar++){
180     TString sopt(((TObjString*)(*opar)[ipar])->String());
181     if(sopt.Contains("!cw")){ 
182       fSteerParam &= ~kWriteClusters;
183       continue;
184     } else if(sopt.Contains("!sa")){
185       fSteerParam &= ~kSeeding;
186       continue;
187     } else if(sopt.Contains("!nn")){
188       fSteerParam &= ~kSteerPID;
189       continue;
190     } else if(sopt.Contains("tw")){
191       fSteerParam |= kWriteTracklets;
192       continue; 
193     } else if(sopt.Contains("ar")){
194       fSteerParam |= kDriftGas;
195       continue; 
196     }
197   }
198 }
199