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 **************************************************************************/
18 Revision 1.1 2002/01/30 22:20:22 nilsen
19 New TTask based method to do Digits To clusters. Works with files of multiple
20 events in the file. Macro added to show how to use. Also the changes made
21 in the nessesary complilation files.
26 #include <TSeqCollection.h>
28 #include <TClonesArray.h>
33 #include "AliITSDetType.h"
34 #include "AliITSreconstruction.h"
35 #include "AliITSsegmentationSPD.h"
36 #include "AliITSsegmentationSDD.h"
37 #include "AliITSsegmentationSSD.h"
38 #include "AliITSClusterFinderSPD.h"
39 #include "AliITSClusterFinderSDD.h"
40 #include "AliITSClusterFinderSSD.h"
41 #include "AliITSresponseSDD.h"
42 #include "AliITSgeom.h"
44 ClassImp(AliITSreconstruction)
46 //______________________________________________________________________
47 AliITSreconstruction::AliITSreconstruction(){
48 // Default constructor.
54 // A zero-ed constructed AliITSreconstruction class.
59 fDet[0] = fDet[1] = fDet[2] = kTRUE;
62 //______________________________________________________________________
63 AliITSreconstruction::AliITSreconstruction(const char* filename){
64 // Standard constructor.
66 // const char* filename filename containing the digits to be
67 // reconstructed. If filename = 0 (nil)
68 // then no file is opened but a file is
69 // assumed to already be opened. This
70 // already opened file will be used.
74 // A standardly constructed AliITSreconstruction class.
79 fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data());
80 if(fFile) fFile->Close();
81 fFile = new TFile(fFilename.Data(),"UPDATE");
83 if(gAlice) delete gAlice;
84 gAlice = (AliRun*)fFile->Get("gAlice");
86 cout << "gAlice not found on file. Aborting." << endl;
90 } // end if !filename.
94 //______________________________________________________________________
95 AliITSreconstruction::~AliITSreconstruction(){
96 // Default constructor.
102 // A destroyed AliITSreconstruction class.
104 if(fFile) fFile->Close();
109 //______________________________________________________________________
110 Bool_t AliITSreconstruction::Init(){
117 // kTRUE if no errors initilizing this class occurse else kFALSE
120 fITS = (AliITS*) gAlice->GetDetector("ITS");
122 cout << "ITS not found aborting. fITS=" << fITS << endl;
126 if(!(fITS->GetITSgeom())){
127 cout << "ITSgeom not found aborting."<< endl;
130 } // end if !GetITSgeom()
131 // Now ready to init.
133 fDet[0] = fDet[1] = fDet[2] = kTRUE;
135 fEnt = gAlice->GetEventsPerRun();
137 nparticles = gAlice->GetEvent(fEnt0);
143 //______________________________________________________________________
144 Bool_t AliITSreconstruction::InitRec(){
145 // Sets up Reconstruction part of AliITSDetType..
156 idt = fITS->DetType(kSPD);
157 AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)
158 idt->GetSegmentationModel();
159 TClonesArray *digSPD = fITS->DigitsAddress(kSPD);
160 TClonesArray *recpSPD = fITS->ClustersAddress(kSPD);
161 AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD,
164 fITS->SetReconstructionModel(kSPD,recSPD);
165 } // end if fDet[kSPD].
168 idt = fITS->DetType(kSDD);
169 AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*)
170 idt->GetSegmentationModel();
171 AliITSresponseSDD *resSDD = (AliITSresponseSDD*)
172 idt->GetResponseModel();
173 TClonesArray *digSDD = fITS->DigitsAddress(kSDD);
174 TClonesArray *recpSDD = fITS->ClustersAddress(kSDD);
175 AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD,
178 fITS->SetReconstructionModel(kSDD,recSDD);
179 } // end if fDet[kSDD]
182 idt = fITS->DetType(kSSD);
183 AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*)
184 idt->GetSegmentationModel();
185 TClonesArray *digSSD = fITS->DigitsAddress(kSSD);
186 AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD,
188 fITS->SetReconstructionModel(kSSD,recSSD);
189 } // end if fDet[kSSD]
193 //______________________________________________________________________
194 void AliITSreconstruction::Exec(const Option_t *opt){
195 // Main reconstruction function.
197 // Option_t * opt list of subdetector to digitize. =0 all.
203 Int_t nparticles,evnt;
205 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
206 fDet[0] = fDet[1] = fDet[2] = kTRUE;
209 fDet[0] = fDet[1] = fDet[2] = kFALSE;
210 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
211 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
212 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
213 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
215 } // end if strstr(opt,...)
218 cout << "Initilization Failed, Can't run Exec." << endl;
221 for(evnt=0;evnt<fEnt;evnt++){
222 nparticles = gAlice->GetEvent(evnt);
223 gAlice->SetEvent(evnt);
224 if(!gAlice->TreeR()) gAlice->MakeTree("R");
225 fITS->MakeBranch("R");
226 fITS->DigitsToRecPoints(evnt,0,lopt);