Implementation of reconstructors (T.Kuhr)
[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
24
25#include "AliITSReconstructor.h"
26#include "AliRunLoader.h"
27#include "AliITSclustererV2.h"
28#include "AliITStrackerSA.h"
29#include "AliITSVertexerIons.h"
30#include "AliITSVertexerFast.h"
31#include "AliITSVertexerPPZ.h"
32#include "AliITSVertexerZ.h"
33#include "AliESD.h"
34#include "AliITSpidESD.h"
35#include "AliV0vertexer.h"
36#include "AliCascadeVertexer.h"
37#include "AliRun.h"
38#include "AliITS.h"
39
40
41ClassImp(AliITSReconstructor)
42
43
44//_____________________________________________________________________________
45void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader) const
46{
47// reconstruct clusters
48
49 AliLoader* loader = runLoader->GetLoader("ITSLoader");
50 if (!loader) {
51 Error("Reconstruct", "ITS loader not found");
52 return;
53 }
54 loader->LoadRecPoints("recreate");
55 loader->LoadDigits("read");
56 runLoader->LoadKinematics();
57
58 AliITSgeom* geom = GetITSgeom(runLoader);
59 if (!geom) return;
60 AliITSclustererV2 clusterer(geom);
61 Int_t nEvents = runLoader->GetNumberOfEvents();
62
63 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
64 runLoader->GetEvent(iEvent);
65
66 TTree* treeClusters = loader->TreeR();
67 if (!treeClusters) {
68 loader->MakeTree("R");
69 treeClusters = loader->TreeR();
70 }
71 TTree* treeDigits = loader->TreeD();
72 if (!treeDigits) {
73 Error("Reconstruct", "Can't get digits tree !");
74 return;
75 }
76
77 clusterer.Digits2Clusters(treeDigits, treeClusters);
78
79 loader->WriteRecPoints("OVERWRITE");
80 }
81
82 loader->UnloadRecPoints();
83 loader->UnloadDigits();
84 runLoader->UnloadKinematics();
85}
86
87//_____________________________________________________________________________
88AliTracker* AliITSReconstructor::CreateTracker(AliRunLoader* runLoader) const
89{
90// create a ITS tracker
91
92 AliITSgeom* geom = GetITSgeom(runLoader);
93 if (!geom) return NULL;
94 return new AliITStrackerSA(geom);
95}
96
97//_____________________________________________________________________________
98AliVertexer* AliITSReconstructor::CreateVertexer(AliRunLoader* /*runLoader*/) const
99{
100// create a ITS vertexer
101
102 TString selectedVertexer(" ");
103 if(selectedVertexer.Contains("ions") || selectedVertexer.Contains("IONS")){
104 Info("CreateVertexer","a AliITSVertexerIons object has been selected\n");
105 return new AliITSVertexerIons("null");
106 }
107 if(selectedVertexer.Contains("smear") || selectedVertexer.Contains("SMEAR")){
108 Double_t smear[3]={0.005,0.005,0.01};
109 Info("CreateVertexer","a AliITSVertexerFast object has been selected\n");
110 return new AliITSVertexerFast(smear);
111 }
112 if(selectedVertexer.Contains("ppz") || selectedVertexer.Contains("PPZ")){
113 Info("CreateVertexer","a AliITSVertexerPPZ object has been selected\n");
114 return new AliITSVertexerPPZ("null");
115 }
116 // by default an AliITSVertexerZ object is instatiated
117 Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
118 return new AliITSVertexerZ("null");
119}
120
121//_____________________________________________________________________________
122void AliITSReconstructor::FillESD(AliRunLoader* /*runLoader*/,
123 AliESD* esd) const
124{
125// make PID, find V0s and cascades
126
127 Double_t parITS[] = {34., 0.15, 10.};
128 AliITSpidESD itsPID(parITS);
129 itsPID.MakePID(esd);
130
131 // V0 finding
132 Double_t cuts[]={33, // max. allowed chi2
133 0.16,// min. allowed negative daughter's impact parameter
134 0.05,// min. allowed positive daughter's impact parameter
135 0.08,// max. allowed DCA between the daughter tracks
136 0.99,// max. allowed cosine of V0's pointing angle
137 0.9, // min. radius of the fiducial volume
138 2.9 // max. radius of the fiducial volume
139 };
140 AliV0vertexer vtxer(cuts);
141 Double_t vtx[3], cvtx[6];
142 esd->GetVertex()->GetXYZ(vtx);
143 esd->GetVertex()->GetSigmaXYZ(cvtx);
144 vtxer.SetVertex(vtx);
145 vtxer.Tracks2V0vertices(esd);
146
147 // cascade finding
148 Double_t cts[]={33., // max. allowed chi2
149 0.05, // min. allowed V0 impact parameter
150 0.008, // window around the Lambda mass
151 0.035, // min. allowed bachelor's impact parameter
152 0.10, // max. allowed DCA between a V0 and a track
153 0.9985, //max. allowed cosine of the cascade pointing angle
154 0.9, // min. radius of the fiducial volume
155 2.9 // max. radius of the fiducial volume
156 };
157 AliCascadeVertexer cvtxer=AliCascadeVertexer(cts);
158 cvtxer.SetVertex(vtx);
159 cvtxer.V0sTracks2CascadeVertices(esd);
160}
161
162
163//_____________________________________________________________________________
164AliITSgeom* AliITSReconstructor::GetITSgeom(AliRunLoader* runLoader) const
165{
166// get the ITS geometry
167
168 if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
169 if (!runLoader->GetAliRun()) {
170 Error("GetITSgeom", "couldn't get AliRun object");
171 return NULL;
172 }
173 AliITS* its = (AliITS*) runLoader->GetAliRun()->GetDetector("ITS");
174 if (!its) {
175 Error("GetITSgeom", "couldn't get ITS detector");
176 return NULL;
177 }
178 if (!its->GetITSgeom()) {
179 Error("GetITSgeom", "no ITS geometry available");
180 return NULL;
181 }
182 return its->GetITSgeom();
183}