Update for Ds
[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"
113c12f1 27#include "AliRawReader.h"
7ef60110 28#include "AliESDEvent.h"
29#include "AliESDpid.h"
6cae184e 30#include "AliITSgeom.h"
7d62fb64 31#include "AliITSLoader.h"
e43c066c 32#include "AliITStrackerMI.h"
c0342e67 33#include "AliITStrackerV2.h"
121a60bd 34#include "AliITStrackerSA.h"
121a60bd 35#include "AliITSVertexerFast.h"
c8735dd3 36#include "AliITSVertexerFixed.h"
3acc14d5 37#include "AliITSVertexer3D.h"
121a60bd 38#include "AliITSVertexerZ.h"
3acc14d5 39#include "AliITSVertexerCosmics.h"
023ae34b 40#include "AliITSInitGeometry.h"
58e8dc31 41#include "AliITSTrackleterSPDEff.h"
1f9831ab 42#include "AliITSMultReconstructor.h"
44347160 43
121a60bd 44ClassImp(AliITSReconstructor)
44347160 45
e62c1aea 46//___________________________________________________________________________
94631b2f 47AliITSReconstructor::AliITSReconstructor() : AliReconstructor(),
6cae184e 48fDetTypeRec(0)
94631b2f 49{
e62c1aea 50 // Default constructor
e62c1aea 51}
52 //___________________________________________________________________________
53AliITSReconstructor::~AliITSReconstructor(){
54// destructor
6cae184e 55 if(fDetTypeRec) delete fDetTypeRec;
e62c1aea 56}
7ef60110 57//____________________________________________________________________________
58void AliITSReconstructor::GetPidSettings(AliESDpid *ESDpid) {
59 //
60 // pass PID settings from AliITSRecoParam to AliESDpid
61 //
62 Int_t pidOpt = GetRecoParam()->GetPID();
6cae184e 63
7ef60110 64 if(pidOpt==1){
3b1d8321 65 AliDebug(1,"ITS LandauFitPID option has been selected\n");
7ef60110 66 ESDpid->SetITSPIDmethod(AliESDpid::kITSLikelihood);
67 }
68 else{
3b1d8321 69 AliDebug(1,"ITS default PID\n");
7ef60110 70 ESDpid->SetITSPIDmethod(AliESDpid::kITSTruncMean);
71 }
72}
023ae34b 73//______________________________________________________________________
d76c31f4 74void AliITSReconstructor::Init() {
023ae34b 75 // Initalize this constructor bet getting/creating the objects
76 // nesseary for a proper ITS reconstruction.
77 // Inputs:
d76c31f4 78 // none.
023ae34b 79 // Output:
80 // none.
81 // Return:
82 // none.
00a7cc50 83
108bd0fe 84 AliITSInitGeometry initgeom;
85 AliITSgeom *geom = initgeom.CreateAliITSgeom();
86 AliInfo(Form("Geometry name: %s",(initgeom.GetGeometryName()).Data()));
6cae184e 87
88 fDetTypeRec = new AliITSDetTypeRec();
89 fDetTypeRec->SetITSgeom(geom);
90 fDetTypeRec->SetDefaults();
ed446fa3 91
023ae34b 92 return;
93}
6cae184e 94
121a60bd 95//_____________________________________________________________________________
6cae184e 96void AliITSReconstructor::Reconstruct(TTree *digitsTree, TTree *clustersTree) const
121a60bd 97{
98// reconstruct clusters
99
9f9cae94 100 Int_t cluFindOpt = GetRecoParam()->GetClusterFinder();
121a60bd 101
6cae184e 102 fDetTypeRec->SetTreeAddressD(digitsTree);
103 fDetTypeRec->MakeBranch(clustersTree,"R");
104 fDetTypeRec->SetTreeAddressR(clustersTree);
5d2c2f86 105 fDetTypeRec->DigitsToRecPoints(digitsTree,clustersTree,0,"All",cluFindOpt);
121a60bd 106}
107
00a7cc50 108//_________________________________________________________________
6cae184e 109void AliITSReconstructor::Reconstruct(AliRawReader* rawReader, TTree *clustersTree) const
113c12f1 110{
6cae184e 111 // reconstruct clusters from raw data
00a7cc50 112
6cae184e 113 fDetTypeRec->SetDefaultClusterFindersV2(kTRUE);
114 fDetTypeRec->DigitsToRecPoints(rawReader,clustersTree);
113c12f1 115}
1f9831ab 116
117//_____________________________________________________________________________
118AliTrackleter* AliITSReconstructor::CreateMultFinder() const
119{
120 // create the SPD trackeleter for mult. reconstruction
121 AliITSMultReconstructor* multReco = new AliITSMultReconstructor();
122 multReco->SetHistOn(kFALSE);
123 multReco->SetDetTypeRec(fDetTypeRec);
124 return multReco;
125}
126
58e8dc31 127//_____________________________________________________________________________
128AliTracker* AliITSReconstructor::CreateTrackleter() const
129{
130// create the SPD trackeleter (for SPD PlaneEfficiency evaluation)
1a64bda6 131 if(!GetRecoParam()->GetComputePlaneEff() || !GetRecoParam()->GetUseTrackletsPlaneEff()) return NULL;
58e8dc31 132 //Int_t trackerOpt = GetRecoParam()->GetTracker();
133 AliTracker* trackleter;
134 trackleter = new AliITSTrackleterSPDEff();
135 AliITSTrackleterSPDEff *spdtrackleter=(AliITSTrackleterSPDEff*)trackleter;
136 // here set cuts (from RecoParam)
137 if(GetRecoParam()->GetBkgTrackletsPlaneEff()) spdtrackleter->SetReflectClusterAroundZAxisForLayer(1,kTRUE);
138 if(GetRecoParam()->GetMCTrackletsPlaneEff()) spdtrackleter->SetMC();
139 spdtrackleter->SetHistOn();
7284b2b2 140 spdtrackleter->SetPhiWindowL2(GetRecoParam()->GetTrackleterPhiWindowL2());
141 spdtrackleter->SetZetaWindowL2(GetRecoParam()->GetTrackleterZetaWindowL2());
58e8dc31 142 spdtrackleter->SetPhiWindowL1(GetRecoParam()->GetTrackleterPhiWindowL1());
143 spdtrackleter->SetZetaWindowL1(GetRecoParam()->GetTrackleterZetaWindowL1());
144 if(GetRecoParam()->GetUpdateOncePerEventPlaneEff()) spdtrackleter->SetUpdateOncePerEventPlaneEff();
0ea92079 145 spdtrackleter->SetMinContVtx(GetRecoParam()->GetMinContVtxPlaneEff());
58e8dc31 146 return trackleter;
147}
113c12f1 148
149//_____________________________________________________________________________
d76c31f4 150AliTracker* AliITSReconstructor::CreateTracker() const
121a60bd 151{
152// create a ITS tracker
153
9f9cae94 154 Int_t trackerOpt = GetRecoParam()->GetTracker();
e62c1aea 155 AliTracker* tracker;
9f9cae94 156 if (trackerOpt==1) {
e341247d 157 tracker = new AliITStrackerMI(0);
23197852 158 AliITStrackerMI *mit=(AliITStrackerMI*)tracker;
159 mit->SetDetTypeRec(fDetTypeRec);
c0342e67 160 }
9f9cae94 161 else if (trackerOpt==2) {
c0342e67 162 tracker = new AliITStrackerV2(0);
e62c1aea 163 }
164 else {
cc088660 165 tracker = new AliITStrackerSA(0); // inherits from AliITStrackerMI
1966f03c 166 AliITStrackerSA *sat=(AliITStrackerSA*)tracker;
23197852 167 sat->SetDetTypeRec(fDetTypeRec);
9f9cae94 168 if(GetRecoParam()->GetTrackerSAOnly()) sat->SetSAFlag(kTRUE);
1966f03c 169 if(sat->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
58e8dc31 170 if(GetRecoParam()->GetInwardFindingSA()){
171 sat->SetInwardFinding();
172 sat->SetInnerStartLayer(GetRecoParam()->GetInnerStartLayerSA());
173 }else{
12b1afb7 174 sat->SetOutwardFinding();
175 sat->SetOuterStartLayer(GetRecoParam()->GetOuterStartLayerSA());
58e8dc31 176 }
12b1afb7 177 sat->SetMinNPoints(GetRecoParam()->GetMinNPointsSA());
e62c1aea 178 }
7d62fb64 179
e62c1aea 180 return tracker;
7d62fb64 181
121a60bd 182}
183
184//_____________________________________________________________________________
d76c31f4 185AliVertexer* AliITSReconstructor::CreateVertexer() const
121a60bd 186{
187// create a ITS vertexer
188
b7bd9ab6 189 AliITSVertexer *vptr = NULL;
9f9cae94 190 Int_t vtxOpt = GetRecoParam()->GetVertexer();
191 if(vtxOpt==3){
0c1383c1 192 AliFatal("Option AliITSVertexerIons is no longer supported");
b7bd9ab6 193 return vptr;
121a60bd 194 }
ff44c37c 195 else if(vtxOpt==4){
9364069b 196 Double_t smear[3]={GetRecoParam()->GetVertexerFastSmearX(),
197 GetRecoParam()->GetVertexerFastSmearY(),
198 GetRecoParam()->GetVertexerFastSmearZ()};
3b1d8321 199 AliDebug(1,"AliITSVertexerFast has been selected");
ff44c37c 200 vptr = new AliITSVertexerFast(smear);
121a60bd 201 }
ff44c37c 202 else if(vtxOpt==1){
3b1d8321 203 AliDebug(1,"AliITSVertexerZ has been selected");
ff44c37c 204 vptr = new AliITSVertexerZ();
3acc14d5 205 }
ff44c37c 206 else if(vtxOpt==2){
3b1d8321 207 AliDebug(1,"AliITSVertexerCosmics has been selected");
ff44c37c 208 vptr = new AliITSVertexerCosmics();
121a60bd 209 }
ff44c37c 210 else if(vtxOpt==5){
3b1d8321 211 AliDebug(1,"Vertex is fixed in the position of the TDI\n");
ff44c37c 212 vptr = new AliITSVertexerFixed("TDI");
c8735dd3 213 }
ff44c37c 214 else if(vtxOpt==6){
3b1d8321 215 AliDebug(1,"Vertex is fixed in the position of the TED\n");
ff44c37c 216 vptr = new AliITSVertexerFixed("TED");
c8735dd3 217 }
ff44c37c 218 else {
99f38bf6 219 // by default an AliITSVertexer3D object is instatiated
ff44c37c 220 AliITSVertexer3D* vtxr = new AliITSVertexer3D();
221 Float_t dzw=GetRecoParam()->GetVertexer3DWideFiducialRegionZ();
222 Float_t drw=GetRecoParam()->GetVertexer3DWideFiducialRegionR();
223 vtxr->SetWideFiducialRegion(dzw,drw);
224 Float_t dzn=GetRecoParam()->GetVertexer3DNarrowFiducialRegionZ();
225 Float_t drn=GetRecoParam()->GetVertexer3DNarrowFiducialRegionR();
226 vtxr->SetNarrowFiducialRegion(dzn,drn);
227 Float_t dphil=GetRecoParam()->GetVertexer3DLooseDeltaPhiCut();
228 Float_t dphit=GetRecoParam()->GetVertexer3DTightDeltaPhiCut();
229 vtxr->SetDeltaPhiCuts(dphil,dphit);
230 Float_t dcacut=GetRecoParam()->GetVertexer3DDCACut();
231 vtxr->SetDCACut(dcacut);
8b78365f 232 Int_t pileupAlgo=GetRecoParam()->GetSPDVertexerPileupAlgo();
233 vtxr->SetPileupAlgo(pileupAlgo);
3b1d8321 234 AliDebug(1,Form("AliITSVertexer3D with pileup algo %d has been selected",pileupAlgo));
ff44c37c 235 vptr = vtxr;
236 }
237 vptr->SetDetTypeRec(fDetTypeRec);
238 return vptr;
121a60bd 239}
240
241//_____________________________________________________________________________
1919a678 242void AliITSReconstructor::FillESD(TTree * /*digitsTree*/, TTree * /*clustersTree*/,
7ef60110 243 AliESDEvent* /* esd */) const
121a60bd 244{
e62c1aea 245// make PID, find V0s and cascade
10d100d4 246/* Now done in AliESDpid
1919a678 247 if(fItsPID!=0) fItsPID->MakePID(esd);
248 else AliError("!! cannot do the PID !!");
10d100d4 249*/
6922a70f 250}