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