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