]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSReconstructor.cxx
Simple example macro to make some analyzis for the ESD tracks - see comments (Not...
[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"
121a60bd 41#include "AliV0vertexer.h"
42#include "AliCascadeVertexer.h"
121a60bd 43
44ClassImp(AliITSReconstructor)
45
e62c1aea 46//___________________________________________________________________________
47AliITSReconstructor::AliITSReconstructor() : AliReconstructor(){
48 // Default constructor
49 fItsPID=0;
50}
51 //___________________________________________________________________________
52AliITSReconstructor::~AliITSReconstructor(){
53// destructor
54 delete fItsPID;
55}
56//______________________________________________________________________
57AliITSReconstructor::AliITSReconstructor(const AliITSReconstructor &ob) :AliReconstructor(ob) {
58 // Copy constructor
59 // Copies are not allowed. The method is protected to avoid misuse.
60 Error("AliITSpidESD2","Copy constructor not allowed\n");
61}
62
63//______________________________________________________________________
64AliITSReconstructor& AliITSReconstructor::operator=(const AliITSReconstructor& /* ob */){
65 // Assignment operator
66 // Assignment is not allowed. The method is protected to avoid misuse.
67 Error("= operator","Assignment operator not allowed\n");
68 return *this;
69}
00a7cc50 70
121a60bd 71//_____________________________________________________________________________
72void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader) const
73{
74// reconstruct clusters
75
7d62fb64 76
8e50d897 77 AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
121a60bd 78 if (!loader) {
79 Error("Reconstruct", "ITS loader not found");
80 return;
81 }
8e50d897 82 AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
00a7cc50 83 rec->SetDefaults();
84
121a60bd 85 loader->LoadRecPoints("recreate");
86 loader->LoadDigits("read");
87 runLoader->LoadKinematics();
00a7cc50 88 TString option = GetOption();
89 Bool_t clusfinder=kTRUE; // Default: V2 cluster finder
90 if(option.Contains("OrigCF"))clusfinder=kFALSE;
121a60bd 91
121a60bd 92 Int_t nEvents = runLoader->GetNumberOfEvents();
93
94 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
95 runLoader->GetEvent(iEvent);
00a7cc50 96 if(loader->TreeR()==0x0) loader->MakeTree("R");
97 rec->MakeBranch("R");
98 rec->SetTreeAddress();
99 rec->DigitsToRecPoints(iEvent,0,"All",clusfinder);
121a60bd 100 }
101
102 loader->UnloadRecPoints();
103 loader->UnloadDigits();
104 runLoader->UnloadKinematics();
105}
106
00a7cc50 107//_________________________________________________________________
108void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader,
109 AliRawReader* rawReader) const
113c12f1 110{
00a7cc50 111// reconstruct clusters
113c12f1 112
00a7cc50 113
8e50d897 114 AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
113c12f1 115 if (!loader) {
116 Error("Reconstruct", "ITS loader not found");
117 return;
118 }
00a7cc50 119
8e50d897 120 AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
00a7cc50 121 rec->SetDefaults();
122 rec->SetDefaultClusterFindersV2(kTRUE);
113c12f1 123
00a7cc50 124 loader->LoadRecPoints("recreate");
113c12f1 125
126 Int_t iEvent = 0;
113c12f1 127
00a7cc50 128 while(rawReader->NextEvent()) {
129 runLoader->GetEvent(iEvent++);
130 if(loader->TreeR()==0x0) loader->MakeTree("R");
131 rec->DigitsToRecPoints(rawReader);
113c12f1 132 }
133
134 loader->UnloadRecPoints();
135}
136
121a60bd 137//_____________________________________________________________________________
e62c1aea 138AliTracker* AliITSReconstructor::CreateTracker(AliRunLoader* runLoader)const
121a60bd 139{
140// create a ITS tracker
141
7d62fb64 142
121a60bd 143 AliITSgeom* geom = GetITSgeom(runLoader);
e43c066c 144 TString selectedTracker = GetOption();
e62c1aea 145 AliTracker* tracker;
146 if (selectedTracker.Contains("MI")) {
147 tracker = new AliITStrackerMI(geom);
148 }
149 else {
150 tracker = new AliITStrackerSA(geom); // inherits from AliITStrackerMI
151 }
7d62fb64 152
e62c1aea 153 TString selectedPIDmethod = GetOption();
154 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
155 if (!loader) {
156 Error("CreateTracker", "ITS loader not found");
157 }
158 if(selectedPIDmethod.Contains("LandauFitPID")){
159 loader->AdoptITSpid(new AliITSpidESD2((AliITStrackerMI*)tracker,loader));
160 }
161 else{
162 Double_t parITS[] = {34., 0.15, 10.};
163 loader->AdoptITSpid(new AliITSpidESD1(parITS));
164 }
165 return tracker;
7d62fb64 166
121a60bd 167}
168
169//_____________________________________________________________________________
170AliVertexer* AliITSReconstructor::CreateVertexer(AliRunLoader* /*runLoader*/) const
171{
172// create a ITS vertexer
173
f4d5a8d1 174 TString selectedVertexer = GetOption();
121a60bd 175 if(selectedVertexer.Contains("ions") || selectedVertexer.Contains("IONS")){
176 Info("CreateVertexer","a AliITSVertexerIons object has been selected\n");
177 return new AliITSVertexerIons("null");
178 }
179 if(selectedVertexer.Contains("smear") || selectedVertexer.Contains("SMEAR")){
180 Double_t smear[3]={0.005,0.005,0.01};
181 Info("CreateVertexer","a AliITSVertexerFast object has been selected\n");
182 return new AliITSVertexerFast(smear);
183 }
184 if(selectedVertexer.Contains("ppz") || selectedVertexer.Contains("PPZ")){
185 Info("CreateVertexer","a AliITSVertexerPPZ object has been selected\n");
186 return new AliITSVertexerPPZ("null");
187 }
188 // by default an AliITSVertexerZ object is instatiated
189 Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
190 return new AliITSVertexerZ("null");
191}
192
193//_____________________________________________________________________________
e62c1aea 194void AliITSReconstructor::FillESD(AliRunLoader* runLoader,
121a60bd 195 AliESD* esd) const
196{
e62c1aea 197// make PID, find V0s and cascade
198 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
199 AliITSpidESD *pidESD = 0;
200 TString selectedPIDmethod = GetOption();
201 if(selectedPIDmethod.Contains("LandauFitPID")){
149c4c59 202 Info("FillESD","ITS LandauFitPID option has been selected\n");
e62c1aea 203 pidESD=loader->GetITSpid();
204 }
205 else{
149c4c59 206 Info("FillESD","ITS default PID\n");
e62c1aea 207 pidESD=loader->GetITSpid();
208 }
209 if(pidESD!=0){
210 pidESD->MakePID(esd);
211 }
212 else {
213 Error("FillESD","!! cannot do the PID !!\n");
214 }
121a60bd 215 // V0 finding
216 Double_t cuts[]={33, // max. allowed chi2
217 0.16,// min. allowed negative daughter's impact parameter
218 0.05,// min. allowed positive daughter's impact parameter
219 0.08,// max. allowed DCA between the daughter tracks
220 0.99,// max. allowed cosine of V0's pointing angle
221 0.9, // min. radius of the fiducial volume
222 2.9 // max. radius of the fiducial volume
223 };
224 AliV0vertexer vtxer(cuts);
225 Double_t vtx[3], cvtx[6];
226 esd->GetVertex()->GetXYZ(vtx);
227 esd->GetVertex()->GetSigmaXYZ(cvtx);
228 vtxer.SetVertex(vtx);
229 vtxer.Tracks2V0vertices(esd);
230
231 // cascade finding
232 Double_t cts[]={33., // max. allowed chi2
233 0.05, // min. allowed V0 impact parameter
234 0.008, // window around the Lambda mass
235 0.035, // min. allowed bachelor's impact parameter
236 0.10, // max. allowed DCA between a V0 and a track
237 0.9985, //max. allowed cosine of the cascade pointing angle
238 0.9, // min. radius of the fiducial volume
239 2.9 // max. radius of the fiducial volume
240 };
241 AliCascadeVertexer cvtxer=AliCascadeVertexer(cts);
242 cvtxer.SetVertex(vtx);
243 cvtxer.V0sTracks2CascadeVertices(esd);
244}
245
246
247//_____________________________________________________________________________
248AliITSgeom* AliITSReconstructor::GetITSgeom(AliRunLoader* runLoader) const
249{
250// get the ITS geometry
251
252 if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
253 if (!runLoader->GetAliRun()) {
254 Error("GetITSgeom", "couldn't get AliRun object");
255 return NULL;
256 }
8e50d897 257 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
258 AliITSgeom* geom = (AliITSgeom*)loader->GetITSgeom();
7d62fb64 259 if(!geom){
260 Error("GetITSgeom","no ITS geometry available");
121a60bd 261 return NULL;
262 }
7d62fb64 263
264 return geom;
121a60bd 265}
7d62fb64 266