]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSReconstructor.cxx
changes for Vertex and Tracks classes
[u/mrichter/AliRoot.git] / ITS / AliITSReconstructor.cxx
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 #include "Riostream.h"
25 #include "AliITSReconstructor.h"
26 #include "AliRun.h"
27 #include "AliRawReader.h"
28 #include "AliESDEvent.h"
29 #include "AliESDpid.h"
30 #include "AliITSgeom.h"
31 #include "AliITSLoader.h"
32 #include "AliITStrackerMI.h"
33 #include "AliITStrackerV2.h"
34 #include "AliITStrackerSA.h"
35 #include "AliITSVertexerFast.h"
36 #include "AliITSVertexerFixed.h"
37 #include "AliITSVertexer3D.h"
38 #include "AliITSVertexerZ.h"
39 #include "AliITSVertexerZD.h"
40 #include "AliITSVertexerCosmics.h"
41 #include "AliITSInitGeometry.h"
42 #include "AliITSTrackleterSPDEff.h"
43 #include "AliITSMultReconstructor.h"
44
45 ClassImp(AliITSReconstructor)
46
47 //___________________________________________________________________________
48 AliITSReconstructor::AliITSReconstructor() : AliReconstructor(),
49 fDetTypeRec(0)
50 {
51   // Default constructor
52 }
53  //___________________________________________________________________________
54 AliITSReconstructor::~AliITSReconstructor(){
55 // destructor
56   if(fDetTypeRec) delete fDetTypeRec;
57
58 //____________________________________________________________________________
59 void AliITSReconstructor::GetPidSettings(AliESDpid *ESDpid) {
60   //
61   // pass PID settings from AliITSRecoParam to AliESDpid
62   //
63   Int_t pidOpt = GetRecoParam()->GetPID();
64
65   if(pidOpt==1){
66     AliDebug(1,"ITS LandauFitPID option has been selected\n");
67     ESDpid->SetITSPIDmethod(AliESDpid::kITSLikelihood);
68   }
69   else{
70     AliDebug(1,"ITS default PID\n");
71     ESDpid->SetITSPIDmethod(AliESDpid::kITSTruncMean);
72   }
73 }
74 //______________________________________________________________________
75 void AliITSReconstructor::Init() {
76     // Initalize this constructor bet getting/creating the objects
77     // nesseary for a proper ITS reconstruction.
78     // Inputs:
79     //   none.
80     // Output:
81     //   none.
82     // Return:
83     //   none.
84
85     AliITSInitGeometry initgeom;
86     AliITSgeom *geom = initgeom.CreateAliITSgeom();
87     AliInfo(Form("Geometry name: %s",(initgeom.GetGeometryName()).Data()));
88
89     fDetTypeRec = new AliITSDetTypeRec();
90     fDetTypeRec->SetITSgeom(geom);
91     fDetTypeRec->SetDefaults();
92
93     return;
94 }
95
96 //_____________________________________________________________________________
97 void AliITSReconstructor::Reconstruct(TTree *digitsTree, TTree *clustersTree) const
98 {
99 // reconstruct clusters
100
101   TString recopt = GetRecoParam()->GetOptReco();
102   fDetTypeRec->SetTreeAddressD(digitsTree);
103   fDetTypeRec->MakeBranch(clustersTree,"R");
104   fDetTypeRec->SetTreeAddressR(clustersTree);
105   fDetTypeRec->DigitsToRecPoints(digitsTree,clustersTree,0,recopt.Data(),1);    
106 }
107
108 //_________________________________________________________________
109 void AliITSReconstructor::Reconstruct(AliRawReader* rawReader, TTree *clustersTree) const
110 {
111   // reconstruct clusters from raw data
112   TString recopt = GetRecoParam()->GetOptReco();
113   fDetTypeRec->SetDefaultClusterFindersV2(kTRUE,kTRUE);
114   fDetTypeRec->DigitsToRecPoints(rawReader,clustersTree,recopt.Data());
115 }
116
117 //_____________________________________________________________________________
118 AliTrackleter* 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
127 //_____________________________________________________________________________
128 AliTracker* AliITSReconstructor::CreateTrackleter() const
129 {
130 // create the SPD trackeleter (for SPD PlaneEfficiency evaluation)
131   if(!GetRecoParam()->GetComputePlaneEff() || !GetRecoParam()->GetUseTrackletsPlaneEff()) return NULL;
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();
140   spdtrackleter->SetPhiWindowL2(GetRecoParam()->GetTrackleterPhiWindowL2());
141   spdtrackleter->SetZetaWindowL2(GetRecoParam()->GetTrackleterZetaWindowL2());
142   spdtrackleter->SetPhiWindowL1(GetRecoParam()->GetTrackleterPhiWindowL1());
143   spdtrackleter->SetZetaWindowL1(GetRecoParam()->GetTrackleterZetaWindowL1());
144   if(GetRecoParam()->GetUpdateOncePerEventPlaneEff()) spdtrackleter->SetUpdateOncePerEventPlaneEff();
145   spdtrackleter->SetMinContVtx(GetRecoParam()->GetMinContVtxPlaneEff());
146   return trackleter;
147 }
148
149 //_____________________________________________________________________________
150 AliTracker* AliITSReconstructor::CreateTracker() const
151 {
152 // create a ITS tracker
153
154   Int_t trackerOpt = GetRecoParam()->GetTracker();
155   AliTracker* tracker;    
156   if (trackerOpt==1) {
157     tracker = new AliITStrackerMI(0);
158     AliITStrackerMI *mit=(AliITStrackerMI*)tracker;
159     mit->SetDetTypeRec(fDetTypeRec);
160   }  
161   else if (trackerOpt==2) {
162     tracker = new AliITStrackerV2(0);
163   }
164   else {
165     tracker =  new AliITStrackerSA(0);  // inherits from AliITStrackerMI
166     AliITStrackerSA *sat=(AliITStrackerSA*)tracker;
167     sat->SetDetTypeRec(fDetTypeRec);
168     if(GetRecoParam()->GetTrackerSAOnly()) sat->SetSAFlag(kTRUE);
169     if(sat->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
170         if(GetRecoParam()->GetInwardFindingSA()){
171        sat->SetInwardFinding();
172        sat->SetInnerStartLayer(GetRecoParam()->GetInnerStartLayerSA());
173         }else{
174       sat->SetOutwardFinding();
175       sat->SetOuterStartLayer(GetRecoParam()->GetOuterStartLayerSA());
176         }
177     sat->SetMinNPoints(GetRecoParam()->GetMinNPointsSA());
178   }
179
180   return tracker;
181   
182 }
183
184 //_____________________________________________________________________________
185 AliVertexer* AliITSReconstructor::CreateVertexer() const
186 {
187 // create a ITS vertexer
188
189   AliITSVertexer *vptr = NULL;
190   Int_t vtxOpt = GetRecoParam()->GetVertexer();
191   if(vtxOpt==3){
192     AliFatal("Option AliITSVertexerIons is no longer supported");
193     return vptr;
194   }
195   else if(vtxOpt==4){
196     Double_t smear[3]={GetRecoParam()->GetVertexerFastSmearX(),
197                        GetRecoParam()->GetVertexerFastSmearY(),
198                        GetRecoParam()->GetVertexerFastSmearZ()};
199     AliDebug(1,"AliITSVertexerFast has been selected"); 
200     vptr = new AliITSVertexerFast(smear);
201   }
202   else if(vtxOpt==1){
203     AliDebug(1,"AliITSVertexerZ has been selected");
204     AliITSVertexerZ* vtxrz =  new AliITSVertexerZ();
205     Int_t pileupAlgo=GetRecoParam()->GetSPDVertexerPileupAlgo();
206     if(pileupAlgo==3) vtxrz->SetSearchForPileup(kFALSE);
207     vptr = vtxrz;
208   }
209   else if(vtxOpt==2){
210     AliDebug(1,"AliITSVertexerCosmics has been selected");
211     vptr = new AliITSVertexerCosmics();
212   }
213   else if(vtxOpt==5){ 
214     AliDebug(1,"Vertex is fixed in the position of the TDI\n");
215     vptr = new AliITSVertexerFixed("TDI");
216   }
217   else if(vtxOpt==6){ 
218     AliDebug(1,"Vertex is fixed in the position of the TED\n");
219     vptr = new AliITSVertexerFixed("TED");
220   }
221   else if(vtxOpt==7){
222     AliDebug(1,"VertexerZD:  reconstruction of the Z coordinate with SDD \n");
223     AliITSVertexerZD*vtxrz = new AliITSVertexerZD();
224     vtxrz->SetSearchForPileup(kFALSE);
225     vptr = vtxrz;
226   }
227   else {
228   // by default an AliITSVertexer3D object is instatiated
229     AliITSVertexer3D*  vtxr = 
230        new AliITSVertexer3D(GetRecoParam()->GetVertexer3DWideFiducialRegionZ());
231     Float_t dzw=GetRecoParam()->GetVertexer3DWideFiducialRegionZ();
232     Float_t drw=GetRecoParam()->GetVertexer3DWideFiducialRegionR();
233     vtxr->SetWideFiducialRegion(dzw,drw);
234     Float_t dzn=GetRecoParam()->GetVertexer3DNarrowFiducialRegionZ();
235     Float_t drn=GetRecoParam()->GetVertexer3DNarrowFiducialRegionR();
236     vtxr->SetNarrowFiducialRegion(dzn,drn);
237     Float_t dphil=GetRecoParam()->GetVertexer3DLooseDeltaPhiCut();
238     Float_t dphit=GetRecoParam()->GetVertexer3DTightDeltaPhiCut();
239     vtxr->SetDeltaPhiCuts(dphil,dphit);
240     Float_t dcacut=GetRecoParam()->GetVertexer3DDCACut();
241     vtxr->SetDCACut(dcacut);
242     Int_t pileupAlgo=GetRecoParam()->GetSPDVertexerPileupAlgo();
243     vtxr->SetPileupAlgo(pileupAlgo);
244     UChar_t highmultAlgo=GetRecoParam()->GetSPDVertexerHighMultAlgo();
245     vtxr->SetHighMultAlgo(highmultAlgo);
246     AliDebug(1,Form("AliITSVertexer3D with pileup algo %d has been selected",pileupAlgo));
247     vptr = vtxr;
248   }
249   vptr->SetDetTypeRec(fDetTypeRec);
250   return vptr;
251 }
252
253 //_____________________________________________________________________________
254 void AliITSReconstructor::FillESD(TTree * /*digitsTree*/, TTree * /*clustersTree*/, 
255                                   AliESDEvent* /* esd */) const
256 {
257 // make PID, find V0s and cascade
258 /* Now done in AliESDpid
259   if(fItsPID!=0) fItsPID->MakePID(esd);
260   else AliError("!! cannot do the PID !!");
261 */
262 }