1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 #include <TSeqCollection.h>
22 #include <TClonesArray.h>
25 #include "AliRunLoader.h"
28 #include "AliITSDetType.h"
29 #include "AliITSLoader.h"
30 #include "AliITSreconstruction.h"
31 #include "AliITSsegmentationSPD.h"
32 #include "AliITSsegmentationSDD.h"
33 #include "AliITSsegmentationSSD.h"
34 #include "AliITSClusterFinderSPD.h"
35 #include "AliITSClusterFinderSDD.h"
36 #include "AliITSClusterFinderSSD.h"
37 #include "AliITSresponseSDD.h"
38 #include "AliITSgeom.h"
40 ClassImp(AliITSreconstruction)
42 //______________________________________________________________________
43 AliITSreconstruction::AliITSreconstruction():
52 // Default constructor.
58 // A zero-ed constructed AliITSreconstruction class.
59 fDet[0] = fDet[1] = fDet[2] = kTRUE;
61 //______________________________________________________________________
63 AliITSreconstruction::AliITSreconstruction(AliRunLoader *rl):
72 fDet[0] = fDet[1] = fDet[2] = kTRUE;
74 //______________________________________________________________________
75 AliITSreconstruction::AliITSreconstruction(const char* filename):
84 // Standard constructor.
86 // const char* filename filename containing the digits to be
87 // reconstructed. If filename = 0 (nil)
88 // then no file is opened but a file is
89 // assumed to already be opened. This
90 // already opened file will be used.
94 // A standardly constructed AliITSreconstruction class.
96 fDet[0] = fDet[1] = fDet[2] = kTRUE;
98 fRunLoader = AliRunLoader::Open(filename);
99 if (fRunLoader == 0x0)
101 Error("AliITSreconstruction","Can not load the session",filename);
104 fRunLoader->LoadgAlice();
105 gAlice = fRunLoader->GetAliRun();
108 Error("AliITSreconstruction","gAlice not found on file. Aborting.");
114 //______________________________________________________________________
115 AliITSreconstruction::~AliITSreconstruction(){
116 // A destroyed AliITSreconstruction class.
120 //______________________________________________________________________
121 Bool_t AliITSreconstruction::Init(){
128 // kTRUE if no errors initilizing this class occurse else kFALSE
130 if (fRunLoader == 0x0)
132 Error("Init","Run Loader is NULL");
135 fRunLoader->LoadgAlice();
136 fRunLoader->LoadHeader();
138 fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
140 Error("Init","ITS loader not found");
145 fITS = (AliITS*) gAlice->GetDetector("ITS");
147 cout << "ITS not found aborting. fITS=" << fITS << endl;
151 if(!(fITS->GetITSgeom())){
152 cout << "ITSgeom not found aborting."<< endl;
155 } // end if !GetITSgeom()
156 // Now ready to init.
158 fDet[0] = fDet[1] = fDet[2] = kTRUE;
161 fEnt = gAlice->GetEventsPerRun();
163 fLoader->LoadDigits("read");
164 fLoader->LoadRecPoints("recreate");
165 fLoader->LoadRawClusters("recreate");
166 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
167 fITS->MakeBranch("R");
169 fITS->SetTreeAddress();
172 Info("Init"," Done\n\n\n");
176 //______________________________________________________________________
177 Bool_t AliITSreconstruction::InitRec(){
178 // Sets up Reconstruction part of AliITSDetType..
189 Info("InitRec","SPD");
190 idt = fITS->DetType(kSPD);
191 AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)idt->GetSegmentationModel();
192 TClonesArray *digSPD = fITS->DigitsAddress(kSPD);
193 TClonesArray *recpSPD = fITS->ClustersAddress(kSPD);
194 Info("InitRec","idt = %#x; digSPD = %#x; recpSPD = %#x",idt,digSPD,recpSPD);
195 AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD,digSPD,recpSPD);
196 fITS->SetReconstructionModel(kSPD,recSPD);
197 } // end if fDet[kSPD].
200 Info("InitRec","SDD");
201 idt = fITS->DetType(kSDD);
202 AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*)
203 idt->GetSegmentationModel();
204 AliITSresponseSDD *resSDD = (AliITSresponseSDD*)
205 idt->GetResponseModel();
206 TClonesArray *digSDD = fITS->DigitsAddress(kSDD);
207 TClonesArray *recpSDD = fITS->ClustersAddress(kSDD);
208 AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD,
211 fITS->SetReconstructionModel(kSDD,recSDD);
212 } // end if fDet[kSDD]
215 Info("InitRec","SSD");
216 idt = fITS->DetType(kSSD);
217 AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*)
218 idt->GetSegmentationModel();
219 TClonesArray *digSSD = fITS->DigitsAddress(kSSD);
220 AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD,
222 fITS->SetReconstructionModel(kSSD,recSSD);
223 } // end if fDet[kSSD]
224 Info("InitRec"," Done\n");
227 //______________________________________________________________________
228 void AliITSreconstruction::Exec(const Option_t *opt){
229 // Main reconstruction function.
231 // Option_t * opt list of subdetector to digitize. =0 all.
239 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
240 fDet[0] = fDet[1] = fDet[2] = kTRUE;
243 fDet[0] = fDet[1] = fDet[2] = kFALSE;
244 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
245 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
246 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
247 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
249 } // end if strstr(opt,...)
252 cout << "Initilization Failed, Can't run Exec." << endl;
256 for(evnt=0;evnt<fEnt;evnt++)
259 Info("Exec","Processing Event %d",evnt);
262 fRunLoader->GetEvent(evnt);
263 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
264 fITS->MakeBranch("R");
265 if (fLoader->TreeC() == 0x0) fITS->MakeTreeC();
266 fITS->SetTreeAddress();
267 fITS->DigitsToRecPoints(evnt,0,lopt);
270 //______________________________________________________________________
271 void AliITSreconstruction::SetOutputFile(TString filename){
272 // Set a file name for recpoints. Used only if this file is not the file
273 // containing digits. This obj is deleted by AliRun.
274 Error("SetOutputFile",
275 "Use AliLoader::SetRecPointsFileName(TString&)instead filename=%s",