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