]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCReconstructor.cxx
Memory leaks fix (Silvia)
[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 //                                                                           //
20 // class for TPC reconstruction                                              //
21 //                                                                           //
22 ///////////////////////////////////////////////////////////////////////////////
23
24
25 #include "AliTPCReconstructor.h"
26 #include "AliRunLoader.h"
27 #include "AliRun.h"
28 #include "AliRawReader.h"
29 #include "AliTPCclustererMI.h"
30 #include "AliTPCtrackerMI.h"
31 #include "AliTPCpidESD.h"
32 #include "AliTPCParam.h"
33 #include "AliTPCParamSR.h"
34 #include "AliTPCcalibDB.h"
35
36 ClassImp(AliTPCReconstructor)
37
38
39 AliTPCRecoParam *    AliTPCReconstructor::fgkRecoParam =0;  // reconstruction parameters
40 Int_t    AliTPCReconstructor::fgStreamLevel     = 0;        // stream (debug) level
41
42
43 AliTPCReconstructor::AliTPCReconstructor():
44 AliReconstructor(),
45 fClusterer(NULL)
46 {
47   //
48   // default constructor
49   //
50   if (!fgkRecoParam) {
51     AliError("The Reconstruction parameters nonitialized - Used default one");
52     fgkRecoParam = AliTPCRecoParam::GetHighFluxParam();
53   }
54
55   AliTPCParam* param = GetTPCParam();
56   if (!param) {
57     AliWarning("Loading default TPC parameters !");
58     param = new AliTPCParamSR;
59   }
60   fClusterer = new AliTPCclustererMI(param);
61 }
62
63 //_____________________________________________________________________________
64 AliTPCReconstructor::~AliTPCReconstructor()
65 {
66   if (fgkRecoParam) delete fgkRecoParam;
67   if (fClusterer)   delete fClusterer;
68 }
69
70 //_____________________________________________________________________________
71 void AliTPCReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const {
72   // single event local reconstruction
73   // of TPC data
74   fClusterer->SetInput(digitsTree);
75   fClusterer->SetOutput(clustersTree);
76   fClusterer->Digits2Clusters();
77 }
78
79 //_____________________________________________________________________________
80 void AliTPCReconstructor::Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const {
81   // single event local reconstruction
82   // of TPC data starting from raw data
83   TString option = GetOption();
84   if (option.Contains("OldRCUFormat"))
85     fClusterer->SetOldRCUFormat(kTRUE);
86
87   fClusterer->SetOutput(clustersTree);
88   fClusterer->Digits2Clusters(rawReader);
89 }
90
91 //_____________________________________________________________________________
92 AliTracker* AliTPCReconstructor::CreateTracker() const
93 {
94 // create a TPC tracker
95
96   AliTPCParam* param = GetTPCParam();
97   if (!param) {
98     AliWarning("Loading default TPC parameters !");
99     param = new AliTPCParamSR;
100   }
101   param->ReadGeoMatrices();
102   return new AliTPCtrackerMI(param);
103 }
104
105 //_____________________________________________________________________________
106 void AliTPCReconstructor::FillESD(TTree */*digitsTree*/, TTree */*clustersTree*/,
107                                   AliESDEvent* esd) const
108 {
109 // make PID
110
111   Double_t parTPC[] = {47., 0.07, 5.};
112   AliTPCpidESD tpcPID(parTPC);
113   tpcPID.MakePID(esd);
114 }
115
116
117 //_____________________________________________________________________________
118 AliTPCParam* AliTPCReconstructor::GetTPCParam() const
119 {
120 // get the TPC parameters
121
122   AliTPCParam* param = AliTPCcalibDB::Instance()->GetParameters();
123
124   return param;
125 }