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