]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCReconstructor.cxx
Coverity fix
[u/mrichter/AliRoot.git] / TPC / AliTPCReconstructor.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 //          Options for the TPC Reconstruction in rec.C
20 //
21 //  4 options can be set to change the input for TPC reconstruction
22 //  which overwrites the usage of fUseHLTClusters of the AliTPCRecoParam
23 //
24 //  1) useRAW        - use RAW, if not present -> do nothing
25 //  2) useRAWorHLT   - use RAW, if not present -> use HLT clusters
26 //  3) useHLT        - use HLT clusters, if not present -> do nothing
27 //  4) useHLTorRAW   - use HLT clusters, if not present -> use RAW
28 //
29 //  -> The current default is useHLTorRAW
30 //--------------------------------------------------------------------
31
32 ///////////////////////////////////////////////////////////////////////////////
33 //                                                                           //
34 // class for TPC reconstruction                                              //
35 //                                                                           //
36 ///////////////////////////////////////////////////////////////////////////////
37
38
39 #include "AliTPCReconstructor.h"
40 #include "AliRunLoader.h"
41 #include "AliRun.h"
42 #include "AliRawReader.h"
43 #include "AliTPCclustererMI.h"
44 #include "AliTPCtrackerMI.h"
45 //#include "AliTPCpidESD.h"
46 #include "AliTPCParam.h"
47 #include "AliTPCParamSR.h"
48 #include "AliTPCcalibDB.h"
49 #include "AliTracker.h"
50 #include "AliMagF.h"
51
52 ClassImp(AliTPCReconstructor)
53
54
55 Int_t    AliTPCReconstructor::fgStreamLevel     = 1;        // stream (debug) level
56 AliTPCAltroEmulator *  AliTPCReconstructor::fAltroEmulator=0;    // ALTRO emulator
57
58 AliTPCReconstructor::AliTPCReconstructor():
59 AliReconstructor(),
60 fClusterer(NULL)
61 {
62   //
63   // default constructor
64   //
65   //
66   //
67   AliTPCcalibDB * calib = AliTPCcalibDB::Instance();
68   const AliMagF * field = (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
69   calib->SetExBField(field);
70   AliTPCParam* param = GetTPCParam();
71   if (!param) {
72     AliWarning("Loading default TPC parameters !");
73     param = new AliTPCParamSR;
74   }
75   fClusterer = new AliTPCclustererMI(param);
76 }
77
78 AliTPCReconstructor::AliTPCReconstructor(const AliTPCReconstructor& /*rec*/):
79 AliReconstructor(),
80 fClusterer(NULL)
81 {
82   //
83   // Dummy copu constructor
84   //
85 }
86
87 AliTPCReconstructor& AliTPCReconstructor::operator=(const AliTPCReconstructor&){
88   //
89   // dummy operator
90   //
91   return *this;
92 }
93
94 //_____________________________________________________________________________
95 AliTPCReconstructor::~AliTPCReconstructor()
96 {
97   if (fClusterer)   delete fClusterer;
98 }
99
100 //_____________________________________________________________________________
101 void AliTPCReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const {
102   // single event local reconstruction
103   // of TPC data
104   fClusterer->SetInput(digitsTree);
105   fClusterer->SetOutput(clustersTree);
106   fClusterer->Digits2Clusters();
107 }
108
109 //_____________________________________________________________________________
110 void AliTPCReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const {
111   // single event local reconstruction
112   // of TPC data starting from raw data
113
114   fClusterer->SetOutput(clustersTree);
115   fClusterer->Digits2Clusters(rawReader);
116 }
117
118 //_____________________________________________________________________________
119 AliTracker* AliTPCReconstructor::CreateTracker() const
120 {
121 // create a TPC tracker
122
123   AliTPCParam* param = GetTPCParam();
124   if (!param) {
125     AliWarning("Loading default TPC parameters !");
126     param = new AliTPCParamSR;
127   }
128   param->ReadGeoMatrices();
129   
130   AliTPCtrackerMI* tracker = new AliTPCtrackerMI(param);
131
132   ParseOptions(tracker);
133
134   return tracker;
135 }
136
137 //_____________________________________________________________________________
138 void AliTPCReconstructor::FillESD(TTree */*digitsTree*/, TTree */*clustersTree*/,
139                                   AliESDEvent* /*esd*/) const
140 {
141 // make PID
142 /*  Now done in AliESDpid
143   Double_t parTPC[] = {50., 0.07, 5.};  // MIP nnormalized to channel 50 -MI
144   AliTPCpidESD tpcPID(parTPC);
145   tpcPID.MakePID(esd);
146 */
147 }
148
149
150 //_____________________________________________________________________________
151 AliTPCParam* AliTPCReconstructor::GetTPCParam() const
152 {
153 // get the TPC parameters
154
155   AliTPCParam* param = AliTPCcalibDB::Instance()->GetParameters();
156
157   return param;
158 }
159
160
161 //_____________________________________________________________________________
162 void AliTPCReconstructor::ParseOptions( AliTPCtrackerMI* tracker ) const
163 {
164 // parse options from rec.C and set in clusterer and tracker
165   
166   TString option = GetOption();
167   
168   Int_t useHLTClusters = 3;
169
170   if (option.Contains("use")) {
171     
172     AliInfo(Form("Overide TPC RecoParam with option %s",option.Data()));
173     
174     if (!option.CompareTo("useRAW"))
175       useHLTClusters = 1;
176     if (!option.CompareTo("useRAWorHLT"))
177       useHLTClusters = 2;
178     if (!option.CompareTo("useHLT"))
179       useHLTClusters = 3;
180     if (!option.CompareTo("useHLTorRAW"))
181       useHLTClusters = 4;
182   }
183   else {
184     const AliTPCRecoParam* param = GetRecoParam();
185     useHLTClusters = param->GetUseHLTClusters();
186   }
187
188   AliInfo(Form("Usage of HLT clusters in TPC reconstruction : %d", useHLTClusters));
189
190   fClusterer->SetUseHLTClusters(useHLTClusters);
191   tracker->SetUseHLTClusters(useHLTClusters);
192
193   return;
194 }