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