]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSReconstructor.cxx
Options for ITS reconstruction moved to AliITSRecoParam (Dainese, Prino)
[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 "AliITSDetTypeRec.h"
29 #include "AliITSgeom.h"
30 #include "AliITSLoader.h"
31 #include "AliITStrackerMI.h"
32 #include "AliITStrackerV2.h"
33 #include "AliITStrackerSA.h"
34 #include "AliITSVertexerIons.h"
35 #include "AliITSVertexerFast.h"
36 #include "AliITSVertexer3D.h"
37 #include "AliITSVertexerZ.h"
38 #include "AliITSVertexerCosmics.h"
39 #include "AliESDEvent.h"
40 #include "AliITSpidESD.h"
41 #include "AliITSpidESD1.h"
42 #include "AliITSpidESD2.h"
43 #include "AliITSInitGeometry.h"
44
45
46 ClassImp(AliITSReconstructor)
47
48 //___________________________________________________________________________
49 AliITSReconstructor::AliITSReconstructor() : AliReconstructor(),
50 fItsPID(0),
51 fDetTypeRec(0)
52 {
53   // Default constructor
54 }
55  //___________________________________________________________________________
56 AliITSReconstructor::~AliITSReconstructor(){
57 // destructor
58   delete fItsPID;
59   if(fDetTypeRec) delete fDetTypeRec;
60
61 //______________________________________________________________________
62 AliITSReconstructor::AliITSReconstructor(const AliITSReconstructor &ob) :AliReconstructor(ob),
63 fItsPID(ob.fItsPID),
64 fDetTypeRec(ob.fDetTypeRec)
65
66 {
67   // Copy constructor
68 }
69
70 //______________________________________________________________________
71 AliITSReconstructor& AliITSReconstructor::operator=(const AliITSReconstructor&  ob ){
72   // Assignment operator
73   this->~AliITSReconstructor();
74   new(this) AliITSReconstructor(ob);
75   return *this;
76 }
77
78 //______________________________________________________________________
79 void AliITSReconstructor::Init() {
80     // Initalize this constructor bet getting/creating the objects
81     // nesseary for a proper ITS reconstruction.
82     // Inputs:
83     //   none.
84     // Output:
85     //   none.
86     // Return:
87     //   none.
88
89     AliITSInitGeometry initgeom;
90     AliITSgeom *geom = initgeom.CreateAliITSgeom();
91     AliInfo(Form("Geometry name: %s",(initgeom.GetGeometryName()).Data()));
92
93     fDetTypeRec = new AliITSDetTypeRec();
94     fDetTypeRec->SetITSgeom(geom);
95     fDetTypeRec->SetDefaults();
96
97     return;
98 }
99
100 //_____________________________________________________________________________
101 void AliITSReconstructor::Reconstruct(TTree *digitsTree, TTree *clustersTree) const
102 {
103 // reconstruct clusters
104
105   Int_t cluFindOpt = GetRecoParam()->GetClusterFinder();
106   Bool_t useV2=kTRUE;   // Default: V2 cluster finder
107   if(cluFindOpt==1) useV2=kFALSE;
108
109   fDetTypeRec->SetTreeAddressD(digitsTree);
110   fDetTypeRec->MakeBranch(clustersTree,"R");
111   fDetTypeRec->SetTreeAddressR(clustersTree);
112   fDetTypeRec->DigitsToRecPoints(digitsTree,clustersTree,0,"All",useV2);    
113 }
114
115 //_________________________________________________________________
116 void AliITSReconstructor::Reconstruct(AliRawReader* rawReader, TTree *clustersTree) const
117 {
118   // reconstruct clusters from raw data
119  
120   fDetTypeRec->SetDefaultClusterFindersV2(kTRUE);
121   fDetTypeRec->DigitsToRecPoints(rawReader,clustersTree);
122 }
123
124 //_____________________________________________________________________________
125 AliTracker* AliITSReconstructor::CreateTracker() const
126 {
127 // create a ITS tracker
128
129   Int_t trackerOpt = GetRecoParam()->GetTracker();
130   AliTracker* tracker;    
131   if (trackerOpt==1) {
132     tracker = new AliITStrackerMI(0);
133     AliITStrackerMI *mit=(AliITStrackerMI*)tracker;
134     mit->SetDetTypeRec(fDetTypeRec);
135   }  
136   else if (trackerOpt==2) {
137     tracker = new AliITStrackerV2(0);
138   }
139   else {
140     tracker =  new AliITStrackerSA(0);  // inherits from AliITStrackerMI
141     AliITStrackerSA *sat=(AliITStrackerSA*)tracker;
142     sat->SetDetTypeRec(fDetTypeRec);
143     if(GetRecoParam()->GetTrackerSAOnly()) sat->SetSAFlag(kTRUE);
144     if(sat->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
145     sat->SetOuterStartLayer(GetRecoParam()->GetOuterStartLayerSA());
146   }
147
148   Int_t pidOpt = GetRecoParam()->GetPID();
149
150   AliITSReconstructor* nc = const_cast<AliITSReconstructor*>(this);
151   if(pidOpt==1){
152     Info("FillESD","ITS LandauFitPID option has been selected\n");
153     nc->fItsPID = new AliITSpidESD2((AliITStrackerMI*)tracker);
154   }
155   else{
156     Info("FillESD","ITS default PID\n");
157     Double_t parITS[] = {79.,0.13, 5.}; //IB: this is  "pp tuning"
158     nc->fItsPID = new AliITSpidESD1(parITS);
159   }
160  
161   return tracker;
162   
163 }
164
165 //_____________________________________________________________________________
166 AliVertexer* AliITSReconstructor::CreateVertexer() const
167 {
168 // create a ITS vertexer
169
170   Int_t vtxOpt = GetRecoParam()->GetVertexer();
171   if(vtxOpt==3){
172     Info("CreateVertexer","a AliITSVertexerIons object has been selected\n");
173     return new AliITSVertexerIons();
174   }
175   if(vtxOpt==4){
176     Double_t smear[3]={0.005,0.005,0.01};
177     Info("CreateVertexer","a AliITSVertexerFast object has been selected\n"); 
178     return new AliITSVertexerFast(smear);
179   }
180   if(vtxOpt==1){
181     Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
182     return new AliITSVertexerZ();
183   }
184   if(vtxOpt==2){
185     Info("CreateVertexer","a AliITSVertexerCosmics object has been selected\n");
186     return new AliITSVertexerCosmics();
187   }
188   // by default an AliITSVertexer3D object is instatiated
189   Info("CreateVertexer","a AliITSVertexer3D object has been selected\n");
190   return new AliITSVertexer3D();
191 }
192
193 //_____________________________________________________________________________
194 void AliITSReconstructor::FillESD(TTree * /*digitsTree*/, TTree *clustersTree, 
195                                   AliESDEvent* esd) const
196 {
197 // make PID, find V0s and cascade
198   if(fItsPID!=0) {
199     Int_t pidOpt = GetRecoParam()->GetPID();
200     if(pidOpt==1){
201       fItsPID->MakePID(clustersTree,esd);
202     }else{
203       fItsPID->MakePID(esd);
204     }
205   }
206   else {
207     Error("FillESD","!! cannot do the PID !!\n");
208   }
209 }