]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSReconstructor.cxx
Added two missing includes to allow macro compilation (thanks to Laurent for remarkin...
[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 "AliITSVertexerFixed.h"
37 #include "AliITSVertexer3D.h"
38 #include "AliITSVertexerZ.h"
39 #include "AliITSVertexerCosmics.h"
40 #include "AliESDEvent.h"
41 #include "AliITSpidESD.h"
42 #include "AliITSpidESD1.h"
43 #include "AliITSpidESD2.h"
44 #include "AliITSInitGeometry.h"
45 #include "AliITSTrackleterSPDEff.h"
46
47
48 ClassImp(AliITSReconstructor)
49
50 //___________________________________________________________________________
51 AliITSReconstructor::AliITSReconstructor() : AliReconstructor(),
52 fItsPID(0),
53 fDetTypeRec(0)
54 {
55   // Default constructor
56 }
57  //___________________________________________________________________________
58 AliITSReconstructor::~AliITSReconstructor(){
59 // destructor
60   delete fItsPID;
61   if(fDetTypeRec) delete fDetTypeRec;
62
63
64 //______________________________________________________________________
65 void AliITSReconstructor::Init() {
66     // Initalize this constructor bet getting/creating the objects
67     // nesseary for a proper ITS reconstruction.
68     // Inputs:
69     //   none.
70     // Output:
71     //   none.
72     // Return:
73     //   none.
74
75     AliITSInitGeometry initgeom;
76     AliITSgeom *geom = initgeom.CreateAliITSgeom();
77     AliInfo(Form("Geometry name: %s",(initgeom.GetGeometryName()).Data()));
78
79     fDetTypeRec = new AliITSDetTypeRec();
80     fDetTypeRec->SetITSgeom(geom);
81     fDetTypeRec->SetDefaults();
82
83     return;
84 }
85
86 //_____________________________________________________________________________
87 void AliITSReconstructor::Reconstruct(TTree *digitsTree, TTree *clustersTree) const
88 {
89 // reconstruct clusters
90
91   Int_t cluFindOpt = GetRecoParam()->GetClusterFinder();
92
93   fDetTypeRec->SetTreeAddressD(digitsTree);
94   fDetTypeRec->MakeBranch(clustersTree,"R");
95   fDetTypeRec->SetTreeAddressR(clustersTree);
96   fDetTypeRec->DigitsToRecPoints(digitsTree,clustersTree,0,"All",cluFindOpt);    
97 }
98
99 //_________________________________________________________________
100 void AliITSReconstructor::Reconstruct(AliRawReader* rawReader, TTree *clustersTree) const
101 {
102   // reconstruct clusters from raw data
103  
104   fDetTypeRec->SetDefaultClusterFindersV2(kTRUE);
105   fDetTypeRec->DigitsToRecPoints(rawReader,clustersTree);
106 }
107 //_____________________________________________________________________________
108 AliTracker* AliITSReconstructor::CreateTrackleter() const
109 {
110 // create the SPD trackeleter (for SPD PlaneEfficiency evaluation)
111   if(!GetRecoParam()->GetComputePlaneEff() || !GetRecoParam()->GetUseTrackletsPlaneEff()) return NULL;
112   //Int_t trackerOpt = GetRecoParam()->GetTracker();
113   AliTracker* trackleter;
114   trackleter = new AliITSTrackleterSPDEff();
115   AliITSTrackleterSPDEff *spdtrackleter=(AliITSTrackleterSPDEff*)trackleter;
116   // here set cuts (from RecoParam)
117   if(GetRecoParam()->GetBkgTrackletsPlaneEff()) spdtrackleter->SetReflectClusterAroundZAxisForLayer(1,kTRUE);
118   if(GetRecoParam()->GetMCTrackletsPlaneEff()) spdtrackleter->SetMC();
119   spdtrackleter->SetHistOn();
120   spdtrackleter->SetPhiWindowL2(GetRecoParam()->GetTrackleterPhiWindowL2());
121   spdtrackleter->SetZetaWindowL2(GetRecoParam()->GetTrackleterZetaWindowL2());
122   spdtrackleter->SetPhiWindowL1(GetRecoParam()->GetTrackleterPhiWindowL1());
123   spdtrackleter->SetZetaWindowL1(GetRecoParam()->GetTrackleterZetaWindowL1());
124   if(GetRecoParam()->GetUpdateOncePerEventPlaneEff()) spdtrackleter->SetUpdateOncePerEventPlaneEff();
125   //spdtrackleter->(GetRecoParam()->GetMinContVtxPlaneEff()); // to be implemented
126   return trackleter;
127 }
128
129 //_____________________________________________________________________________
130 AliTracker* AliITSReconstructor::CreateTracker() const
131 {
132 // create a ITS tracker
133
134   Int_t trackerOpt = GetRecoParam()->GetTracker();
135   AliTracker* tracker;    
136   if (trackerOpt==1) {
137     tracker = new AliITStrackerMI(0);
138     AliITStrackerMI *mit=(AliITStrackerMI*)tracker;
139     mit->SetDetTypeRec(fDetTypeRec);
140   }  
141   else if (trackerOpt==2) {
142     tracker = new AliITStrackerV2(0);
143   }
144   else {
145     tracker =  new AliITStrackerSA(0);  // inherits from AliITStrackerMI
146     AliITStrackerSA *sat=(AliITStrackerSA*)tracker;
147     sat->SetDetTypeRec(fDetTypeRec);
148     if(GetRecoParam()->GetTrackerSAOnly()) sat->SetSAFlag(kTRUE);
149     if(sat->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
150         if(GetRecoParam()->GetInwardFindingSA()){
151        sat->SetInwardFinding();
152        sat->SetInnerStartLayer(GetRecoParam()->GetInnerStartLayerSA());
153         }else{
154       sat->SetOutwardFinding();
155       sat->SetOuterStartLayer(GetRecoParam()->GetOuterStartLayerSA());
156         }
157     sat->SetMinNPoints(GetRecoParam()->GetMinNPointsSA());
158   }
159
160   Int_t pidOpt = GetRecoParam()->GetPID();
161
162   AliITSReconstructor* nc = const_cast<AliITSReconstructor*>(this);
163   if(pidOpt==1){
164     Info("FillESD","ITS LandauFitPID option has been selected\n");
165     nc->fItsPID = new AliITSpidESD2();
166   }
167   else{
168     Info("FillESD","ITS default PID\n");
169     Double_t parITS[] = {79.,0.13, 5.}; //IB: this is  "pp tuning"
170     nc->fItsPID = new AliITSpidESD1(parITS);
171   }
172  
173   return tracker;
174   
175 }
176
177 //_____________________________________________________________________________
178 AliVertexer* AliITSReconstructor::CreateVertexer() const
179 {
180 // create a ITS vertexer
181
182   AliITSVertexer *vptr;
183   Int_t vtxOpt = GetRecoParam()->GetVertexer();
184   if(vtxOpt==3){
185     AliInfo("AliITSVertexerIons has been selected");
186     vptr =  new AliITSVertexerIons();
187   }
188   else if(vtxOpt==4){
189     Double_t smear[3]={GetRecoParam()->GetVertexerFastSmearX(),
190                        GetRecoParam()->GetVertexerFastSmearY(),
191                        GetRecoParam()->GetVertexerFastSmearZ()};
192     AliInfo("AliITSVertexerFast has been selected"); 
193     vptr = new AliITSVertexerFast(smear);
194   }
195   else if(vtxOpt==1){
196     AliInfo("AliITSVertexerZ has been selected");
197     vptr =  new AliITSVertexerZ();
198   }
199   else if(vtxOpt==2){
200     AliInfo("AliITSVertexerCosmics has been selected");
201     vptr = new AliITSVertexerCosmics();
202   }
203   else if(vtxOpt==5){ 
204     AliInfo("Vertex is fixed in the position of the TDI\n");
205     vptr = new AliITSVertexerFixed("TDI");
206   }
207   else if(vtxOpt==6){ 
208     AliInfo("Vertex is fixed in the position of the TED\n");
209     vptr = new AliITSVertexerFixed("TED");
210   }
211   else {
212   // by default an AliITSVertexer3D object is instatiated
213     AliITSVertexer3D*  vtxr = new AliITSVertexer3D();
214     Float_t dzw=GetRecoParam()->GetVertexer3DWideFiducialRegionZ();
215     Float_t drw=GetRecoParam()->GetVertexer3DWideFiducialRegionR();
216     vtxr->SetWideFiducialRegion(dzw,drw);
217     Float_t dzn=GetRecoParam()->GetVertexer3DNarrowFiducialRegionZ();
218     Float_t drn=GetRecoParam()->GetVertexer3DNarrowFiducialRegionR();
219     vtxr->SetNarrowFiducialRegion(dzn,drn);
220     Float_t dphil=GetRecoParam()->GetVertexer3DLooseDeltaPhiCut();
221     Float_t dphit=GetRecoParam()->GetVertexer3DTightDeltaPhiCut();
222     vtxr->SetDeltaPhiCuts(dphil,dphit);
223     Float_t dcacut=GetRecoParam()->GetVertexer3DDCACut();
224     vtxr->SetDCACut(dcacut);
225     Int_t pileupAlgo=GetRecoParam()->GetSPDVertexerPileupAlgo();
226     vtxr->SetPileupAlgo(pileupAlgo);
227     AliInfo(Form("AliITSVertexer3D with pileup algo %d has been selected",pileupAlgo));
228     vptr = vtxr;
229   }
230   vptr->SetDetTypeRec(fDetTypeRec);
231   return vptr;
232 }
233
234 //_____________________________________________________________________________
235 void AliITSReconstructor::FillESD(TTree * /*digitsTree*/, TTree * /*clustersTree*/, 
236                                   AliESDEvent* esd) const
237 {
238 // make PID, find V0s and cascade
239   if(fItsPID!=0) fItsPID->MakePID(esd);
240   else AliError("!! cannot do the PID !!");
241 }