]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSreconstruction.cxx
Removing obsolete macros
[u/mrichter/AliRoot.git] / ITS / AliITSreconstruction.cxx
CommitLineData
e69020a0 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/*
17$Log$
b9d0a01d 18Revision 1.3.6.2 2002/10/14 13:14:08 hristov
19Updating VirtualMC to v3-09-02
20
21Revision 1.6 2002/09/09 17:30:02 nilsen
22Added new creator which passes a pointer to type AliRun. Can now use either
23gAlice or a local instance of AliRun.
24
4d24e763 25Revision 1.5 2002/05/13 14:27:57 hristov
26TreeC created once per event (M.Masera)
27
def15085 28Revision 1.4 2002/05/10 22:31:30 nilsen
29Changes by Massimo Masera to allow Recpoints and Clusters to be written
30to separate files.
31
f243fbe6 32Revision 1.3 2002/02/06 13:52:27 barbera
33gAlice deletion corrected (from M. Masera)
34
8f9d0004 35Revision 1.2 2002/01/31 18:52:09 nilsen
36Minor change to allow the use of files that are already open. grun.C macro
37that also does ITS digitizationa and Reconstruction all in one go.
38
3e9ba728 39Revision 1.1 2002/01/30 22:20:22 nilsen
40New TTask based method to do Digits To clusters. Works with files of multiple
41events in the file. Macro added to show how to use. Also the changes made
42in the nessesary complilation files.
43
e69020a0 44*/
45#include <TROOT.h>
46#include <TFile.h>
47#include <TSeqCollection.h>
48#include <TString.h>
49#include <TClonesArray.h>
50
51#include "AliRun.h"
52
53#include "AliITS.h"
54#include "AliITSDetType.h"
55#include "AliITSreconstruction.h"
56#include "AliITSsegmentationSPD.h"
57#include "AliITSsegmentationSDD.h"
58#include "AliITSsegmentationSSD.h"
59#include "AliITSClusterFinderSPD.h"
60#include "AliITSClusterFinderSDD.h"
61#include "AliITSClusterFinderSSD.h"
62#include "AliITSresponseSDD.h"
63#include "AliITSgeom.h"
64
65ClassImp(AliITSreconstruction)
66
67//______________________________________________________________________
68AliITSreconstruction::AliITSreconstruction(){
69 // Default constructor.
70 // Inputs:
71 // none.
72 // Outputs:
73 // none.
74 // Return:
75 // A zero-ed constructed AliITSreconstruction class.
76
77 fFilename = "";
78 fFile = 0;
f243fbe6 79 fFile2 = 0;
e69020a0 80 fITS = 0;
81 fDet[0] = fDet[1] = fDet[2] = kTRUE;
82 fInit = kFALSE;
4d24e763 83 fArp = 0;
84 fDfArp = kFALSE;
85}
86//______________________________________________________________________
87AliITSreconstruction::AliITSreconstruction(AliRun *ar){
88 // Standard constructor.
89 // Inputs:
90 // AliRun *ar Pointer to an existing AliRun object. Assumed that
91 // this AliRun object will not be deleted by this distructor.
92 // Outputs:
93 // none.
94 // Return:
95 // A standardly constructed AliITSreconstruction class.
96
97 fFilename = "";
98 fFile = 0;
99 fFile2 = 0;
100 fITS = 0;
101 fDet[0] = fDet[1] = fDet[2] = kTRUE;
102 fInit = kFALSE;
103 fDfArp = kFALSE;
104 fArp = ar;
e69020a0 105}
106//______________________________________________________________________
107AliITSreconstruction::AliITSreconstruction(const char* filename){
108 // Standard constructor.
109 // Inputs:
110 // const char* filename filename containing the digits to be
3e9ba728 111 // reconstructed. If filename = 0 (nil)
112 // then no file is opened but a file is
113 // assumed to already be opened. This
114 // already opened file will be used.
e69020a0 115 // Outputs:
116 // none.
117 // Return:
118 // A standardly constructed AliITSreconstruction class.
119
120 fFilename = filename;
f243fbe6 121 fFile2 = 0;
122 fFile = 0;
4d24e763 123 fArp = 0;
124 fDfArp = kTRUE;
3e9ba728 125 if(filename){
126 fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data());
127 if(fFile) fFile->Close();
128 fFile = new TFile(fFilename.Data(),"UPDATE");
4d24e763 129 if(fArp) {
130 delete fArp;
131 fArp = 0;
f243fbe6 132 }
4d24e763 133 fArp = (AliRun*)fFile->Get("gAlice");
134 if(!fArp) {
3e9ba728 135 cout << "gAlice not found on file. Aborting." << endl;
136 fInit = kFALSE;
137 return;
4d24e763 138 } // end if !fArp
3e9ba728 139 } // end if !filename.
e69020a0 140}
141//______________________________________________________________________
142AliITSreconstruction::~AliITSreconstruction(){
143 // Default constructor.
144 // Inputs:
145 // none.
146 // Outputs:
147 // none.
148 // Return:
149 // A destroyed AliITSreconstruction class.
150
151 if(fFile) fFile->Close();
152 fFile = 0;
153 fITS = 0;
4d24e763 154 if(fDfArp){
155 if(fArp) delete fArp;
156 } // end if
e69020a0 157}
158//______________________________________________________________________
159Bool_t AliITSreconstruction::Init(){
160 // Class Initilizer.
161 // Inputs:
162 // none.
163 // Outputs:
164 // none.
165 // Return:
166 // kTRUE if no errors initilizing this class occurse else kFALSE
167 Int_t nparticles;
4d24e763 168 fITS = (AliITS*) fArp->GetDetector("ITS");
e69020a0 169 if(!fITS){
170 cout << "ITS not found aborting. fITS=" << fITS << endl;
171 fInit = kFALSE;
172 return fInit;
173 } // end if !fITS
174 if(!(fITS->GetITSgeom())){
175 cout << "ITSgeom not found aborting."<< endl;
176 fInit = kFALSE;
177 return fInit;
178 } // end if !GetITSgeom()
179 // Now ready to init.
180
181 fDet[0] = fDet[1] = fDet[2] = kTRUE;
182 fEnt0 = 0;
4d24e763 183 fEnt = fArp->GetEventsPerRun();
e69020a0 184 fITS->MakeTreeC();
4d24e763 185 nparticles = fArp->GetEvent(fEnt0);
e69020a0 186
187 // finished init.
188 fInit = InitRec();
189 return fInit;
190}
191//______________________________________________________________________
192Bool_t AliITSreconstruction::InitRec(){
193 // Sets up Reconstruction part of AliITSDetType..
194 // Inputs:
195 // none.
196 // Outputs:
197 // none.
198 // Return:
199 // none.
200 AliITSDetType *idt;
201
202 // SPD
203 if(fDet[kSPD]){
204 idt = fITS->DetType(kSPD);
205 AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)
206 idt->GetSegmentationModel();
207 TClonesArray *digSPD = fITS->DigitsAddress(kSPD);
208 TClonesArray *recpSPD = fITS->ClustersAddress(kSPD);
209 AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD,
210 digSPD,
211 recpSPD);
212 fITS->SetReconstructionModel(kSPD,recSPD);
213 } // end if fDet[kSPD].
214 // SDD
215 if(fDet[kSDD]){
216 idt = fITS->DetType(kSDD);
217 AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*)
218 idt->GetSegmentationModel();
219 AliITSresponseSDD *resSDD = (AliITSresponseSDD*)
220 idt->GetResponseModel();
221 TClonesArray *digSDD = fITS->DigitsAddress(kSDD);
222 TClonesArray *recpSDD = fITS->ClustersAddress(kSDD);
223 AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD,
224 resSDD,
225 digSDD,recpSDD);
226 fITS->SetReconstructionModel(kSDD,recSDD);
227 } // end if fDet[kSDD]
228 // SSD
229 if(fDet[kSSD]){
230 idt = fITS->DetType(kSSD);
231 AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*)
232 idt->GetSegmentationModel();
233 TClonesArray *digSSD = fITS->DigitsAddress(kSSD);
234 AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD,
235 digSSD);
236 fITS->SetReconstructionModel(kSSD,recSSD);
237 } // end if fDet[kSSD]
238
239 return kTRUE;
240}
241//______________________________________________________________________
242void AliITSreconstruction::Exec(const Option_t *opt){
243 // Main reconstruction function.
244 // Inputs:
245 // Option_t * opt list of subdetector to digitize. =0 all.
246 // Outputs:
247 // none.
248 // Return:
249 // none.
250 Option_t *lopt;
251 Int_t nparticles,evnt;
252
253 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
254 fDet[0] = fDet[1] = fDet[2] = kTRUE;
255 lopt = "All";
256 }else{
257 fDet[0] = fDet[1] = fDet[2] = kFALSE;
258 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
259 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
260 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
261 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
262 else lopt = opt;
263 } // end if strstr(opt,...)
264
265 if(!fInit){
266 cout << "Initilization Failed, Can't run Exec." << endl;
267 return;
268 } // end if !fInit
f243fbe6 269 TDirectory *curr = gDirectory;
270 if(fFile2)fFile2->cd();
e69020a0 271 for(evnt=0;evnt<fEnt;evnt++){
4d24e763 272 nparticles = fArp->GetEvent(evnt);
273 fArp->SetEvent(evnt);
274 if(!fArp->TreeR()){
def15085 275 if(fFile2){
4d24e763 276 fArp->MakeTree("R",fFile2);
def15085 277 }
278 else {
4d24e763 279 fArp->MakeTree("R");
def15085 280 }
f243fbe6 281 }
def15085 282 fITS->MakeBranch("R");
283 fITS->MakeTreeC();
284 fITS->DigitsToRecPoints(evnt,0,lopt);
e69020a0 285 } // end for evnt
f243fbe6 286 curr->cd();
287}
288//______________________________________________________________________
289void AliITSreconstruction::SetOutputFile(TString filename){
290 // Set a file name for recpoints. Used only if this file is not the file
291 // containing digits. This obj is deleted by AliRun.
4d24e763 292 fFile2 = fArp->InitTreeFile("R",filename);
e69020a0 293}
f243fbe6 294
295
296
297
298