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 **************************************************************************/
17 /////////////////////////////////////////////////////////////////////////
21 ////////////////////////////////////////////////////////////////////////
25 #include <TSeqCollection.h>
27 #include <TClonesArray.h>
30 #include "AliRunLoader.h"
33 #include "AliITSDetType.h"
34 #include "AliITSLoader.h"
35 #include "AliITSreconstruction.h"
36 #include "AliITSsegmentationSPD.h"
37 #include "AliITSsegmentationSDD.h"
38 #include "AliITSsegmentationSSD.h"
39 #include "AliITSClusterFinderSPD.h"
40 #include "AliITSClusterFinderSDD.h"
41 #include "AliITSClusterFinderSSD.h"
42 #include "AliITSresponseSDD.h"
43 #include "AliITSgeom.h"
45 ClassImp(AliITSreconstruction)
47 //______________________________________________________________________
48 AliITSreconstruction::AliITSreconstruction():
57 // Default constructor.
63 // A zero-ed constructed AliITSreconstruction class.
64 fDet[0] = fDet[1] = fDet[2] = kTRUE;
66 //______________________________________________________________________
68 AliITSreconstruction::AliITSreconstruction(AliRunLoader *rl):
77 fDet[0] = fDet[1] = fDet[2] = kTRUE;
79 //______________________________________________________________________
80 AliITSreconstruction::AliITSreconstruction(const char* filename):
89 // Standard constructor.
91 // const char* filename filename containing the digits to be
92 // reconstructed. If filename = 0 (nil)
93 // then no file is opened but a file is
94 // assumed to already be opened. This
95 // already opened file will be used.
99 // A standardly constructed AliITSreconstruction class.
101 fDet[0] = fDet[1] = fDet[2] = kTRUE;
103 fRunLoader = AliRunLoader::Open(filename);
104 if (fRunLoader == 0x0)
106 Error("AliITSreconstruction","Can not load the session",filename);
109 fRunLoader->LoadgAlice();
110 gAlice = fRunLoader->GetAliRun();
113 Error("AliITSreconstruction","gAlice not found on file. Aborting.");
119 //______________________________________________________________________
120 AliITSreconstruction::~AliITSreconstruction(){
121 // A destroyed AliITSreconstruction class.
125 //______________________________________________________________________
126 Bool_t AliITSreconstruction::Init(){
133 // kTRUE if no errors initilizing this class occurse else kFALSE
135 if (fRunLoader == 0x0)
137 Error("Init","Run Loader is NULL");
140 fRunLoader->LoadgAlice();
141 fRunLoader->LoadHeader();
143 fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
145 Error("Init","ITS loader not found");
150 fITS = (AliITS*) gAlice->GetDetector("ITS");
152 cout << "ITS not found aborting. fITS=" << fITS << endl;
156 if(!(fITS->GetITSgeom())){
157 cout << "ITSgeom not found aborting."<< endl;
160 } // end if !GetITSgeom()
161 // Now ready to init.
163 fDet[0] = fDet[1] = fDet[2] = kTRUE;
166 //fEnt = gAlice->GetEventsPerRun();
167 fEnt = Int_t(fRunLoader->TreeE()->GetEntries());
169 fLoader->LoadDigits("read");
170 fLoader->LoadRecPoints("recreate");
171 fLoader->LoadRawClusters("recreate");
172 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
173 fITS->MakeBranch("R");
175 fITS->SetTreeAddress();
178 Info("Init"," Done\n\n\n");
182 //______________________________________________________________________
183 Bool_t AliITSreconstruction::InitRec(){
184 // Sets up Reconstruction part of AliITSDetType..
195 Info("InitRec","SPD");
196 idt = fITS->DetType(kSPD);
197 AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)idt->GetSegmentationModel();
198 TClonesArray *digSPD = fITS->DigitsAddress(kSPD);
199 TClonesArray *recpSPD = fITS->ClustersAddress(kSPD);
200 Info("InitRec","idt = %#x; digSPD = %#x; recpSPD = %#x",idt,digSPD,recpSPD);
201 AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD,digSPD,recpSPD);
202 fITS->SetReconstructionModel(kSPD,recSPD);
203 } // end if fDet[kSPD].
206 Info("InitRec","SDD");
207 idt = fITS->DetType(kSDD);
208 AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*)
209 idt->GetSegmentationModel();
210 AliITSresponseSDD *resSDD = (AliITSresponseSDD*)
211 idt->GetResponseModel();
212 TClonesArray *digSDD = fITS->DigitsAddress(kSDD);
213 TClonesArray *recpSDD = fITS->ClustersAddress(kSDD);
214 AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD,
217 fITS->SetReconstructionModel(kSDD,recSDD);
218 } // end if fDet[kSDD]
221 Info("InitRec","SSD");
222 idt = fITS->DetType(kSSD);
223 AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*)
224 idt->GetSegmentationModel();
225 TClonesArray *digSSD = fITS->DigitsAddress(kSSD);
226 AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD,
228 fITS->SetReconstructionModel(kSSD,recSSD);
229 } // end if fDet[kSSD]
230 Info("InitRec"," Done\n");
233 //______________________________________________________________________
234 void AliITSreconstruction::Exec(const Option_t *opt){
235 // Main reconstruction function.
237 // Option_t * opt list of subdetector to digitize. =0 all.
245 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
246 fDet[0] = fDet[1] = fDet[2] = kTRUE;
249 fDet[0] = fDet[1] = fDet[2] = kFALSE;
250 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
251 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
252 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
253 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
255 } // end if strstr(opt,...)
258 cout << "Initilization Failed, Can't run Exec." << endl;
262 for(evnt=0;evnt<fEnt;evnt++)
265 Info("Exec","Processing Event %d",evnt);
268 fRunLoader->GetEvent(evnt);
269 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
270 fITS->MakeBranch("R");
271 if (fLoader->TreeC() == 0x0) fITS->MakeTreeC();
272 fITS->SetTreeAddress();
273 fITS->DigitsToRecPoints(evnt,0,lopt);
276 //______________________________________________________________________
277 void AliITSreconstruction::SetOutputFile(TString filename){
278 // Set a new file name for recpoints.
279 // It must be called before Init()
280 if(!fLoader)fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
282 Info("SetOutputFile","name for rec points is %s",filename.Data());
283 fLoader->SetRecPointsFileName(filename);
286 Error("SetOutputFile",
287 "ITS loader not available. Not possible to set name: %s",filename.Data());