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