]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSReconstructor.cxx
Major commit related to steering of the reco parameters: AliDAQ and trigger 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 "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   TString option = GetOption();
106   Bool_t clusfinder=kTRUE;   // Default: V2 cluster finder
107   if(option.Contains("OrigCF"))clusfinder=kFALSE;
108
109   fDetTypeRec->SetTreeAddressD(digitsTree);
110   fDetTypeRec->MakeBranch(clustersTree,"R");
111   fDetTypeRec->SetTreeAddressR(clustersTree);
112   fDetTypeRec->DigitsToRecPoints(digitsTree,clustersTree,0,"All",clusfinder);    
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   
130   TString selectedTracker = GetOption();
131   AliTracker* tracker;    
132   if (selectedTracker.Contains("MI")) {
133     tracker = new AliITStrackerMI(0);
134     AliITStrackerMI *mit=(AliITStrackerMI*)tracker;
135     mit->SetDetTypeRec(fDetTypeRec);
136   }  
137   else if (selectedTracker.Contains("V2")) {
138     tracker = new AliITStrackerV2(0);
139   }
140   else {
141     tracker =  new AliITStrackerSA(0);  // inherits from AliITStrackerMI
142     AliITStrackerSA *sat=(AliITStrackerSA*)tracker;
143     sat->SetDetTypeRec(fDetTypeRec);
144     if(selectedTracker.Contains("onlyITS"))sat->SetSAFlag(kTRUE);
145     if(sat->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
146     if(selectedTracker.Contains("cosmics")||selectedTracker.Contains("COSMICS"))
147       sat->SetOuterStartLayer(AliITSgeomTGeo::GetNLayers()-2);
148   }
149
150   TString selectedPIDmethod = GetOption();
151   AliITSReconstructor* nc = const_cast<AliITSReconstructor*>(this);
152   if(selectedPIDmethod.Contains("LandauFitPID")){
153     Info("FillESD","ITS LandauFitPID option has been selected\n");
154     nc->fItsPID = new AliITSpidESD2((AliITStrackerMI*)tracker);
155   }
156   else{
157     Info("FillESD","ITS default PID\n");
158     Double_t parITS[] = {79.,0.13, 5.}; //IB: this is  "pp tuning"
159     nc->fItsPID = new AliITSpidESD1(parITS);
160   }
161  
162   return tracker;
163   
164 }
165
166 //_____________________________________________________________________________
167 AliVertexer* AliITSReconstructor::CreateVertexer() const
168 {
169 // create a ITS vertexer
170
171   TString selectedVertexer = GetOption();
172   if(selectedVertexer.Contains("ions") || selectedVertexer.Contains("IONS")){
173     Info("CreateVertexer","a AliITSVertexerIons object has been selected\n");
174     return new AliITSVertexerIons();
175   }
176   if(selectedVertexer.Contains("smear") || selectedVertexer.Contains("SMEAR")){
177     Double_t smear[3]={0.005,0.005,0.01};
178     Info("CreateVertexer","a AliITSVertexerFast object has been selected\n"); 
179     return new AliITSVertexerFast(smear);
180   }
181   if(selectedVertexer.Contains("vertexerz") || selectedVertexer.Contains("VERTEXERZ")){
182     Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
183     return new AliITSVertexerZ();
184   }
185   if(selectedVertexer.Contains("cosmics") || selectedVertexer.Contains("COSMICS")){
186     Info("CreateVertexer","a AliITSVertexerCosmics object has been selected\n");
187     return new AliITSVertexerCosmics();
188   }
189   // by default an AliITSVertexer3D object is instatiated
190   Info("CreateVertexer","a AliITSVertexer3D object has been selected\n");
191   return new AliITSVertexer3D();
192 }
193
194 //_____________________________________________________________________________
195 void AliITSReconstructor::FillESD(TTree * /*digitsTree*/, TTree *clustersTree, 
196                                   AliESDEvent* esd) const
197 {
198 // make PID, find V0s and cascade
199   if(fItsPID!=0) {
200     TString selectedPIDmethod = GetOption();
201     if(selectedPIDmethod.Contains("LandauFitPID")){
202       fItsPID->MakePID(clustersTree,esd);
203     }
204     else{
205       fItsPID->MakePID(esd);
206     }
207   }
208   else {
209     Error("FillESD","!! cannot do the PID !!\n");
210   }
211 }