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.5 2002/05/13 14:27:57 hristov
19 TreeC created once per event (M.Masera)
21 Revision 1.4 2002/05/10 22:31:30 nilsen
22 Changes by Massimo Masera to allow Recpoints and Clusters to be written
25 Revision 1.3 2002/02/06 13:52:27 barbera
26 gAlice deletion corrected (from M. Masera)
28 Revision 1.2 2002/01/31 18:52:09 nilsen
29 Minor change to allow the use of files that are already open. grun.C macro
30 that also does ITS digitizationa and Reconstruction all in one go.
32 Revision 1.1 2002/01/30 22:20:22 nilsen
33 New TTask based method to do Digits To clusters. Works with files of multiple
34 events in the file. Macro added to show how to use. Also the changes made
35 in the nessesary complilation files.
40 #include <TSeqCollection.h>
42 #include <TClonesArray.h>
47 #include "AliITSDetType.h"
48 #include "AliITSreconstruction.h"
49 #include "AliITSsegmentationSPD.h"
50 #include "AliITSsegmentationSDD.h"
51 #include "AliITSsegmentationSSD.h"
52 #include "AliITSClusterFinderSPD.h"
53 #include "AliITSClusterFinderSDD.h"
54 #include "AliITSClusterFinderSSD.h"
55 #include "AliITSresponseSDD.h"
56 #include "AliITSgeom.h"
58 ClassImp(AliITSreconstruction)
60 //______________________________________________________________________
61 AliITSreconstruction::AliITSreconstruction(){
62 // Default constructor.
68 // A zero-ed constructed AliITSreconstruction class.
74 fDet[0] = fDet[1] = fDet[2] = kTRUE;
79 //______________________________________________________________________
80 AliITSreconstruction::AliITSreconstruction(AliRun *ar){
81 // Standard constructor.
83 // AliRun *ar Pointer to an existing AliRun object. Assumed that
84 // this AliRun object will not be deleted by this distructor.
88 // A standardly constructed AliITSreconstruction class.
94 fDet[0] = fDet[1] = fDet[2] = kTRUE;
99 //______________________________________________________________________
100 AliITSreconstruction::AliITSreconstruction(const char* filename){
101 // Standard constructor.
103 // const char* filename filename containing the digits to be
104 // reconstructed. If filename = 0 (nil)
105 // then no file is opened but a file is
106 // assumed to already be opened. This
107 // already opened file will be used.
111 // A standardly constructed AliITSreconstruction class.
113 fFilename = filename;
119 fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data());
120 if(fFile) fFile->Close();
121 fFile = new TFile(fFilename.Data(),"UPDATE");
126 fArp = (AliRun*)fFile->Get("gAlice");
128 cout << "gAlice not found on file. Aborting." << endl;
132 } // end if !filename.
134 //______________________________________________________________________
135 AliITSreconstruction::~AliITSreconstruction(){
136 // Default constructor.
142 // A destroyed AliITSreconstruction class.
144 if(fFile) fFile->Close();
148 if(fArp) delete fArp;
151 //______________________________________________________________________
152 Bool_t AliITSreconstruction::Init(){
159 // kTRUE if no errors initilizing this class occurse else kFALSE
161 fITS = (AliITS*) fArp->GetDetector("ITS");
163 cout << "ITS not found aborting. fITS=" << fITS << endl;
167 if(!(fITS->GetITSgeom())){
168 cout << "ITSgeom not found aborting."<< endl;
171 } // end if !GetITSgeom()
172 // Now ready to init.
174 fDet[0] = fDet[1] = fDet[2] = kTRUE;
176 fEnt = fArp->GetEventsPerRun();
178 nparticles = fArp->GetEvent(fEnt0);
184 //______________________________________________________________________
185 Bool_t AliITSreconstruction::InitRec(){
186 // Sets up Reconstruction part of AliITSDetType..
197 idt = fITS->DetType(kSPD);
198 AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)
199 idt->GetSegmentationModel();
200 TClonesArray *digSPD = fITS->DigitsAddress(kSPD);
201 TClonesArray *recpSPD = fITS->ClustersAddress(kSPD);
202 AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD,
205 fITS->SetReconstructionModel(kSPD,recSPD);
206 } // end if fDet[kSPD].
209 idt = fITS->DetType(kSDD);
210 AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*)
211 idt->GetSegmentationModel();
212 AliITSresponseSDD *resSDD = (AliITSresponseSDD*)
213 idt->GetResponseModel();
214 TClonesArray *digSDD = fITS->DigitsAddress(kSDD);
215 TClonesArray *recpSDD = fITS->ClustersAddress(kSDD);
216 AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD,
219 fITS->SetReconstructionModel(kSDD,recSDD);
220 } // end if fDet[kSDD]
223 idt = fITS->DetType(kSSD);
224 AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*)
225 idt->GetSegmentationModel();
226 TClonesArray *digSSD = fITS->DigitsAddress(kSSD);
227 AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD,
229 fITS->SetReconstructionModel(kSSD,recSSD);
230 } // end if fDet[kSSD]
234 //______________________________________________________________________
235 void AliITSreconstruction::Exec(const Option_t *opt){
236 // Main reconstruction function.
238 // Option_t * opt list of subdetector to digitize. =0 all.
244 Int_t nparticles,evnt;
246 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
247 fDet[0] = fDet[1] = fDet[2] = kTRUE;
250 fDet[0] = fDet[1] = fDet[2] = kFALSE;
251 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
252 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
253 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
254 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
256 } // end if strstr(opt,...)
259 cout << "Initilization Failed, Can't run Exec." << endl;
262 TDirectory *curr = gDirectory;
263 if(fFile2)fFile2->cd();
264 for(evnt=0;evnt<fEnt;evnt++){
265 nparticles = fArp->GetEvent(evnt);
266 fArp->SetEvent(evnt);
269 fArp->MakeTree("R",fFile2);
275 fITS->MakeBranch("R");
277 fITS->DigitsToRecPoints(evnt,0,lopt);
281 //______________________________________________________________________
282 void AliITSreconstruction::SetOutputFile(TString filename){
283 // Set a file name for recpoints. Used only if this file is not the file
284 // containing digits. This obj is deleted by AliRun.
285 fFile2 = fArp->InitTreeFile("R",filename);