]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCReconstructor.cxx
4df397b01b76b9567f7518e67cccfa231499366a
[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 "AliTPCclustererMI.h"
29 #include "AliTPCtrackerMI.h"
30 #include "AliTPCpidESD.h"
31
32
33 ClassImp(AliTPCReconstructor)
34
35
36 //_____________________________________________________________________________
37 void AliTPCReconstructor::Reconstruct(AliRunLoader* runLoader) const
38 {
39 // reconstruct clusters
40
41   AliLoader* loader = runLoader->GetLoader("TPCLoader");
42   if (!loader) {
43     Error("Reconstruct", "TPC loader not found");
44     return;
45   }
46   loader->LoadRecPoints("recreate");
47   loader->LoadDigits("read");
48
49   AliTPCParam* param = GetTPCParam(runLoader);
50   if (!param) return;
51   AliTPCclustererMI clusterer(param);
52   Int_t nEvents = runLoader->GetNumberOfEvents();
53
54   for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
55     runLoader->GetEvent(iEvent);
56
57     TTree* treeClusters = loader->TreeR();
58     if (!treeClusters) {
59       loader->MakeTree("R");
60       treeClusters = loader->TreeR();
61     }
62     TTree* treeDigits = loader->TreeD();
63     if (!treeDigits) {
64       Error("Reconstruct", "Can't get digits tree !");
65       return;
66     }
67
68     clusterer.SetInput(treeDigits);
69     clusterer.SetOutput(treeClusters);
70     clusterer.Digits2Clusters();
71          
72     loader->WriteRecPoints("OVERWRITE");
73   }
74
75   loader->UnloadRecPoints();
76   loader->UnloadDigits();
77 }
78
79 //_____________________________________________________________________________
80 AliTracker* AliTPCReconstructor::CreateTracker(AliRunLoader* runLoader) const
81 {
82 // create a TPC tracker
83
84   AliTPCParam* param = GetTPCParam(runLoader);
85   if (!param) return NULL;
86   return new AliTPCtrackerMI(param);
87 }
88
89 //_____________________________________________________________________________
90 void AliTPCReconstructor::FillESD(AliRunLoader* /*runLoader*/, 
91                                   AliESD* esd) const
92 {
93 // make PID
94
95   Double_t parTPC[] = {47., 0.10, 10.};
96   AliTPCpidESD tpcPID(parTPC);
97   tpcPID.MakePID(esd);
98 }
99
100
101 //_____________________________________________________________________________
102 AliTPCParam* AliTPCReconstructor::GetTPCParam(AliRunLoader* runLoader) const
103 {
104 // get the TPC parameters
105
106   TDirectory* saveDir = gDirectory;
107   runLoader->CdGAFile();
108
109   AliTPCParam* param = (AliTPCParam*) gDirectory->Get("75x40_100x60_150x60");
110   if (!param) Error("GetTPCParam", "no TPC parameters found");
111
112   saveDir->cd();
113   return param;
114 }