]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ITS/AliITSReconstructor.cxx
added new files
[u/mrichter/AliRoot.git] / ITS / AliITSReconstructor.cxx
... / ...
CommitLineData
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 ITS reconstruction //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
24#include "Riostream.h"
25#include "AliITSReconstructor.h"
26#include "AliRun.h"
27#include "AliRunLoader.h"
28#include "AliRawReader.h"
29#include "AliITSDetTypeRec.h"
30#include "AliITSLoader.h"
31#include "AliITStrackerMI.h"
32#include "AliITStrackerSA.h"
33#include "AliITSVertexerIons.h"
34#include "AliITSVertexerFast.h"
35#include "AliITSVertexerPPZ.h"
36#include "AliITSVertexerZ.h"
37#include "AliESD.h"
38#include "AliITSpidESD.h"
39#include "AliITSpidESD1.h"
40#include "AliITSpidESD2.h"
41#include "AliITSInitGeometry.h"
42
43ClassImp(AliITSReconstructor)
44
45//___________________________________________________________________________
46AliITSReconstructor::AliITSReconstructor() : AliReconstructor(),
47fItsPID(0)
48{
49 // Default constructor
50}
51 //___________________________________________________________________________
52AliITSReconstructor::~AliITSReconstructor(){
53// destructor
54 delete fItsPID;
55}
56//______________________________________________________________________
57AliITSReconstructor::AliITSReconstructor(const AliITSReconstructor &ob) :AliReconstructor(ob),
58fItsPID(ob.fItsPID)
59{
60 // Copy constructor
61}
62
63//______________________________________________________________________
64AliITSReconstructor& AliITSReconstructor::operator=(const AliITSReconstructor& ob ){
65 // Assignment operator
66 this->~AliITSReconstructor();
67 new(this) AliITSReconstructor(ob);
68 return *this;
69}
70//______________________________________________________________________
71void AliITSReconstructor::Init(AliRunLoader *runLoader) const{
72 // Initalize this constructor bet getting/creating the objects
73 // nesseary for a proper ITS reconstruction.
74 // Inputs:
75 // AliRunLoader *runLoader Pointer to the run loader to allow
76 // the getting of files/folders data
77 // needed to do reconstruction
78 // Output:
79 // none.
80 // Return:
81 // none.
82
83 AliITSInitGeometry *initgeom = new AliITSInitGeometry("AliITSvPPRasymmFMD",
84 2);
85 AliITSgeom *geom = initgeom->CreateAliITSgeom();
86 delete initgeom; // once created, do not need initgeom any more.
87 AliITSLoader* loader = static_cast<AliITSLoader*>
88 (runLoader->GetLoader("ITSLoader"));
89 if (!loader) {
90 Error("Init", "ITS loader not found");
91 return;
92 }
93 loader->SetITSgeom(geom);
94 return;
95}
96//_____________________________________________________________________________
97void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader) const
98{
99// reconstruct clusters
100
101
102 AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
103 if (!loader) {
104 Error("Reconstruct", "ITS loader not found");
105 return;
106 }
107 AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
108 rec->SetDefaults();
109
110 loader->LoadRecPoints("recreate");
111 loader->LoadDigits("read");
112 runLoader->LoadKinematics();
113 TString option = GetOption();
114 Bool_t clusfinder=kTRUE; // Default: V2 cluster finder
115 if(option.Contains("OrigCF"))clusfinder=kFALSE;
116
117 Int_t nEvents = runLoader->GetNumberOfEvents();
118
119 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
120 runLoader->GetEvent(iEvent);
121 if(loader->TreeR()==0x0) loader->MakeTree("R");
122 rec->MakeBranch("R");
123 rec->SetTreeAddress();
124 rec->DigitsToRecPoints(iEvent,0,"All",clusfinder);
125 }
126
127 loader->UnloadRecPoints();
128 loader->UnloadDigits();
129 runLoader->UnloadKinematics();
130}
131
132//_________________________________________________________________
133void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader,
134 AliRawReader* rawReader) const
135{
136// reconstruct clusters
137
138
139 AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
140 if (!loader) {
141 Error("Reconstruct", "ITS loader not found");
142 return;
143 }
144
145 AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
146 rec->SetDefaults();
147 rec->SetDefaultClusterFindersV2(kTRUE);
148
149 loader->LoadRecPoints("recreate");
150
151 Int_t iEvent = 0;
152
153 while(rawReader->NextEvent()) {
154 runLoader->GetEvent(iEvent++);
155 if(loader->TreeR()==0x0) loader->MakeTree("R");
156 rec->DigitsToRecPoints(rawReader);
157 }
158
159 loader->UnloadRecPoints();
160}
161
162//_____________________________________________________________________________
163AliTracker* AliITSReconstructor::CreateTracker(AliRunLoader* runLoader)const
164{
165// create a ITS tracker
166
167
168 AliITSgeom* geom = GetITSgeom(runLoader);
169 TString selectedTracker = GetOption();
170 AliTracker* tracker;
171 if (selectedTracker.Contains("MI")) {
172 tracker = new AliITStrackerMI(geom);
173 }
174 else {
175 tracker = new AliITStrackerSA(geom); // inherits from AliITStrackerMI
176 }
177
178 TString selectedPIDmethod = GetOption();
179 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
180 if (!loader) {
181 Error("CreateTracker", "ITS loader not found");
182 }
183 if(selectedPIDmethod.Contains("LandauFitPID")){
184 loader->AdoptITSpid(new AliITSpidESD2((AliITStrackerMI*)tracker,loader));
185 }
186 else{
187 Double_t parITS[] = {34., 0.15, 10.};
188 loader->AdoptITSpid(new AliITSpidESD1(parITS));
189 }
190 return tracker;
191
192}
193
194//_____________________________________________________________________________
195AliVertexer* AliITSReconstructor::CreateVertexer(AliRunLoader* /*runLoader*/) const
196{
197// create a ITS vertexer
198
199 TString selectedVertexer = GetOption();
200 if(selectedVertexer.Contains("ions") || selectedVertexer.Contains("IONS")){
201 Info("CreateVertexer","a AliITSVertexerIons object has been selected\n");
202 return new AliITSVertexerIons("null");
203 }
204 if(selectedVertexer.Contains("smear") || selectedVertexer.Contains("SMEAR")){
205 Double_t smear[3]={0.005,0.005,0.01};
206 Info("CreateVertexer","a AliITSVertexerFast object has been selected\n");
207 return new AliITSVertexerFast(smear);
208 }
209 if(selectedVertexer.Contains("ppz") || selectedVertexer.Contains("PPZ")){
210 Info("CreateVertexer","a AliITSVertexerPPZ object has been selected\n");
211 return new AliITSVertexerPPZ("null");
212 }
213 // by default an AliITSVertexerZ object is instatiated
214 Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
215 return new AliITSVertexerZ("null");
216}
217
218//_____________________________________________________________________________
219void AliITSReconstructor::FillESD(AliRunLoader* runLoader,
220 AliESD* esd) const
221{
222// make PID, find V0s and cascade
223 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
224 AliITSpidESD *pidESD = 0;
225 TString selectedPIDmethod = GetOption();
226 if(selectedPIDmethod.Contains("LandauFitPID")){
227 Info("FillESD","ITS LandauFitPID option has been selected\n");
228 pidESD=loader->GetITSpid();
229 }
230 else{
231 Info("FillESD","ITS default PID\n");
232 pidESD=loader->GetITSpid();
233 }
234 if(pidESD!=0){
235 pidESD->MakePID(esd);
236 }
237 else {
238 Error("FillESD","!! cannot do the PID !!\n");
239 }
240}
241
242
243//_____________________________________________________________________________
244AliITSgeom* AliITSReconstructor::GetITSgeom(AliRunLoader* runLoader) const
245{
246// get the ITS geometry
247
248 if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
249 if (!runLoader->GetAliRun()) {
250 Error("GetITSgeom", "couldn't get AliRun object");
251 return NULL;
252 }
253 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
254 AliITSgeom* geom = (AliITSgeom*)loader->GetITSgeom();
255 if(!geom){
256 Error("GetITSgeom","no ITS geometry available");
257 return NULL;
258 }
259
260 return geom;
261}