]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ITS/AliITSreconstruction.cxx
Move histogram setting ranges from analysis modules to base class (to be moved to...
[u/mrichter/AliRoot.git] / ITS / AliITSreconstruction.cxx
... / ...
CommitLineData
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// Class for ITS RecPoint reconstruction //
20// //
21////////////////////////////////////////////////////////////////////////
22
23#include <TString.h>
24#include "AliRun.h"
25#include "AliRunLoader.h"
26#include "AliITSDetTypeRec.h"
27#include "AliITSLoader.h"
28#include "AliITSreconstruction.h"
29#include "AliITSgeom.h"
30
31
32ClassImp(AliITSreconstruction)
33
34//______________________________________________________________________
35AliITSreconstruction::AliITSreconstruction():
36 fInit(kFALSE),
37 fEnt(0),
38 fEnt0(0),
39 fDetTypeRec(0x0),
40 fDfArp(kFALSE),
41 fITSgeom(0x0),
42 fLoader(0x0),
43 fRunLoader(0x0)
44{
45 // Default constructor.
46 // Inputs:
47 // none.
48 // Outputs:
49 // none.
50 // Return:
51 // A zero-ed constructed AliITSreconstruction class.
52 fDet[0] = fDet[1] = fDet[2] = kTRUE;
53}
54//______________________________________________________________________
55
56AliITSreconstruction::AliITSreconstruction(AliRunLoader *rl):
57 fInit(kFALSE),
58 fEnt(0),
59 fEnt0(0),
60 fDetTypeRec(0x0),
61 fDfArp(kFALSE),
62 fITSgeom(0x0),
63 fLoader(0x0),
64 fRunLoader(rl)
65{
66 fDet[0] = fDet[1] = fDet[2] = kTRUE;
67}
68//______________________________________________________________________
69AliITSreconstruction::AliITSreconstruction(const char* filename):
70 fInit(kFALSE),
71 fEnt(0),
72 fEnt0(0),
73 fDetTypeRec(0x0),
74 fDfArp(kFALSE),
75 fITSgeom(0x0),
76 fLoader(0x0),
77 fRunLoader(0x0)
78{
79 // Standard constructor.
80 // Inputs:
81 // const char* filename filename containing the digits to be
82 // reconstructed. If filename = 0 (nil)
83 // then no file is opened but a file is
84 // assumed to already be opened. This
85 // already opened file will be used.
86 // Outputs:
87 // none.
88 // Return:
89 // A standardly constructed AliITSreconstruction class.
90
91 fDet[0] = fDet[1] = fDet[2] = kTRUE;
92
93 fRunLoader = AliRunLoader::Open(filename);
94 if (fRunLoader == 0x0)
95 {
96 Error("AliITSreconstruction","Can not load the session %s \n",filename);
97 return;
98 }
99
100}
101
102
103//______________________________________________________________________
104AliITSreconstruction::~AliITSreconstruction(){
105 // A destroyed AliITSreconstruction class.
106
107 //fITS = 0;
108 delete fRunLoader;
109
110}
111//______________________________________________________________________
112Bool_t AliITSreconstruction::Init(){
113 // Class Initilizer.
114 // Inputs:
115 // none.
116 // Outputs:
117 // none.
118 // Return:
119 // kTRUE if no errors initilizing this class occurse else kFALSE
120 Info("Init"," Init ITS reconstruction");
121 if (fRunLoader == 0x0)
122 {
123 Error("Init","Run Loader is NULL");
124 return kFALSE;
125 }
126 // fRunLoader->LoadgAlice();
127 // fRunLoader->LoadHeader();
128
129 fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
130 if(!fLoader) {
131 Error("Init","ITS loader not found");
132 fInit = kFALSE;
133 }
134
135 // Now ready to init.
136
137 //fRunLoader->CdGAFile();
138 fITSgeom = fLoader->GetITSgeom();
139
140 fDetTypeRec = new AliITSDetTypeRec();
141 fDetTypeRec->SetITSgeom(fITSgeom);
142 fDetTypeRec->SetDefaults();
143 fDet[0] = fDet[1] = fDet[2] = kTRUE;
144 fEnt0 = 0;
145
146 fEnt = Int_t(fRunLoader->GetNumberOfEvents());
147
148 fLoader->LoadDigits("read");
149 fLoader->LoadRecPoints("recreate");
150 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
151
152 fDetTypeRec->SetTreeAddressD(fLoader->TreeD());
153 fDetTypeRec->MakeBranchR(fLoader->TreeR());
154 fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
155
156 fInit = InitRec();
157
158 Info("Init"," Done\n\n\n");
159
160 return fInit;
161}
162//______________________________________________________________________
163Bool_t AliITSreconstruction::InitRec(){
164 // Sets up Reconstruction part of AliITSDetType..
165 // Inputs:
166 // none.
167 // Outputs:
168 // none.
169 // Return:
170 // none.
171
172
173 fDetTypeRec->SetDefaultClusterFindersV2();
174 Info("InitRec"," Done\n");
175 return kTRUE;
176}
177//______________________________________________________________________
178void AliITSreconstruction::Exec(const Option_t *opt){
179 // Main reconstruction function.
180 // Inputs:
181 // Option_t * opt list of subdetector to digitize. =0 all.
182 // Outputs:
183 // none.
184 // Return:
185 // none.
186 Option_t *lopt;
187 Int_t evnt;
188 Bool_t condition =kFALSE;
189 if(opt){
190 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS"))condition =kTRUE;
191 }
192 else{
193 condition = kTRUE;
194 }
195 if(condition){
196 fDet[0] = fDet[1] = fDet[2] = kTRUE;
197 lopt = "All";
198 }else{
199 fDet[0] = fDet[1] = fDet[2] = kFALSE;
200 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
201 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
202 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
203 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
204 else lopt = opt;
205 } // end if strstr(opt,...)
206
207 if(!fInit){
208 cout << "Initilization Failed, Can't run Exec." << endl;
209 return;
210 } // end if !fInit
211 for(evnt=0;evnt<fEnt;evnt++)
212 {
213 // Info("Exec","");
214 Info("Exec","Processing Event %d",evnt);
215 // Info("Exec","");
216
217 fRunLoader->GetEvent(evnt);
218 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
219 fDetTypeRec->MakeBranchR(0);
220 fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
221 fDetTypeRec->SetTreeAddressD(fLoader->TreeD());
222 fDetTypeRec->DigitsToRecPoints(fLoader->TreeD(),fLoader->TreeR(),0,lopt);
223 } // end for evnt
224}
225//______________________________________________________________________
226void AliITSreconstruction::SetOutputFile(TString filename){
227 // Set a new file name for recpoints.
228 // It must be called before Init()
229 if(!fLoader)fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
230 if(fLoader){
231 Info("SetOutputFile","name for rec points is %s",filename.Data());
232 fLoader->SetRecPointsFileName(filename);
233 }
234 else {
235 Error("SetOutputFile",
236 "ITS loader not available. Not possible to set name: %s",filename.Data());
237 }
238}